Changeset 16945 in osm for applications/editors
- Timestamp:
- 2009-08-09T22:42:58+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/livegps
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/build.xml
r16294 r16945 26 26 <attribute name="Plugin-Description" value="Support live GPS input (moving dot) through a connection to gpsd server."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/LiveGPS"/> 28 <attribute name="Plugin-Mainversion" value="1 725"/>28 <attribute name="Plugin-Mainversion" value="1890"/> 29 29 <attribute name="Plugin-Stage" value="50"/> 30 30 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
r16933 r16945 36 36 if(!propertyChangeListener.contains(listener)) { 37 37 propertyChangeListener.add(listener); 38 } 39 } 40 41 /** 42 * Remove a property change listener from the acquirer. 43 * @param listener the new listener 44 */ 45 public void removePropertyChangeListener(PropertyChangeListener listener) { 46 if(propertyChangeListener.contains(listener)) { 47 propertyChangeListener.remove(listener); 38 48 } 39 49 } -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsData.java
r16933 r16945 163 163 */ 164 164 public Way getWay() { 165 if(way == null ) {165 if(way == null && Main.map != null && Main.map.mapView != null) { 166 166 Point xy = Main.map.mapView.getPoint(getLatLon()); 167 167 way = Main.map.mapView.getNearestWay(xy); -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java
r16294 r16945 138 138 */ 139 139 public void propertyChange(PropertyChangeEvent evt) { 140 if(! visible) {140 if(!isVisible()) { 141 141 return; 142 142 } … … 154 154 } 155 155 } 156 157 156 } 158 159 157 } -
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsPlugin.java
r16933 r16945 19 19 import org.openstreetmap.josm.gui.MainMenu; 20 20 import org.openstreetmap.josm.gui.MapFrame; 21 import org.openstreetmap.josm.gui.layer.Layer; 22 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 21 23 import org.openstreetmap.josm.plugins.Plugin; 22 24 import org.openstreetmap.josm.tools.Shortcut; 23 25 24 public class LiveGpsPlugin extends Plugin 26 public class LiveGpsPlugin extends Plugin implements LayerChangeListener 25 27 { 26 28 private LiveGpsAcquirer acquirer = null; … … 34 36 35 37 private GpxData data = new GpxData(); 36 private LiveGpsLayer lgpslayer; 37 38 private LiveGpsLayer lgpslayer = null; 38 39 39 40 public class CaptureAction extends JosmAction { … … 74 75 setAutoCenter(lgpsautocenter.isSelected()); 75 76 } 77 } 78 } 79 80 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 81 } 82 83 public void layerAdded(Layer newLayer) { 84 } 85 86 public void layerRemoved(Layer oldLayer) { 87 if(oldLayer == lgpslayer) 88 { 89 enableTracking(false); 90 lgpscapture.setSelected(false); 91 removePropertyChangeListener(lgpslayer); 92 Layer.listeners.remove(this); 93 lgpslayer = null; 76 94 } 77 95 } … … 135 153 lgpslayer = new LiveGpsLayer(data); 136 154 Main.main.addLayer(lgpslayer); 155 Layer.listeners.add(this); 137 156 lgpslayer.setAutoCenter(isAutoCenter()); 138 157 } … … 170 189 } 171 190 191 /** 192 * Remove a listener for gps events. 193 * @param listener the listener. 194 */ 195 public void removePropertyChangeListener(PropertyChangeListener listener) { 196 if(acquirer != null) 197 acquirer.removePropertyChangeListener(listener); 198 else if(listenerQueue != null && listenerQueue.contains(listener)) 199 listenerQueue.remove(listener); 200 } 172 201 173 202 /* (non-Javadoc) … … 184 213 } 185 214 186 187 215 /** 188 216 * @return the lgpsmenu … … 191 219 return this.lgpsmenu; 192 220 } 193 194 221 } 195
Note:
See TracChangeset
for help on using the changeset viewer.