-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLDMIOEmpty.java
More file actions
144 lines (123 loc) · 3.07 KB
/
LDMIOEmpty.java
File metadata and controls
144 lines (123 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* Copyright (C) 2014,2015 Maximilian Diedrich
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package de.hu_berlin.informatik.spws2014.ImagePositionLocator;
import java.util.ArrayList;
/**
* Empty LDMIO. Does not provide any saving or Loading capabilities.
* Mostly used for debugging purposes.
*/
public class LDMIOEmpty implements ILDMIOHandler {
ArrayList<GpsPoint> gpspath = new ArrayList<GpsPoint>();
ArrayList<Marker> markers = new ArrayList<Marker>();
long time;
@Override
public ArrayList<Marker> getAllMarkers() {
return markers;
}
/**
* Returns one currently known Marker with this imgpoint or null
*/
@Override
public Marker getMarker(Point2D imgpoint) {
for (Marker m : markers) {
if (m.imgpoint.equals(imgpoint))
return m;
}
return null;
}
/**
* Returns one currently known Marker with this realpoint or null
*/
@Override
public Marker getMarker(GpsPoint realpoint) {
for (Marker m : markers) {
if (m.realpoint.equals(realpoint))
return m;
}
return null;
}
/**
* Returns the last added Marker
*/
@Override
public Marker getLastMarker() {
return markers.get(markers.size()-1);
}
/**
* Removes one currently known Marker with this imgpoint or returns false
*/
@Override
public boolean removeMarker(Point2D imgpoint) {
Marker m = getMarker(imgpoint);
if (m == null)
return false;
markers.remove(m);
return true;
}
/**
* Removes one currently known Marker with this realpoint or returns false
*/
@Override
public boolean removeMarker(GpsPoint realpoint) {
Marker m = getMarker(realpoint);
if (m == null)
return false;
markers.remove(m);
return true;
}
@Override
public ArrayList<GpsPoint> getAllGpsPoints() {
return gpspath;
}
@Override
public GpsPoint getLastGpsPoint() {
return gpspath.get(gpspath.size()-1);
}
@Override
public boolean removeMarker(Marker m) {
return markers.remove(m);
}
@Override
public void removeAllMarkers() {
markers = new ArrayList<Marker>();
}
@Override
public boolean removeGpsPoint(GpsPoint p) {
return gpspath.remove(p);
}
@Override
public void removeAllGpsPoints() {
gpspath = new ArrayList<GpsPoint>();
}
@Override
public void addMarker(Marker m) {
markers.add(m);
}
@Override
public void addGpsPoint(GpsPoint p) {
gpspath.add(p);
}
@Override
public void setLastGpsPointTime(long unixTime) {
time = unixTime;
}
@Override
public long getLastGpsPointTime() {
return this.time;
}
@Override
public void save() { }
}