Changeset 33824 in osm for applications/editors/josm/plugins/surveyor/src
- Timestamp:
- 2017-11-17T21:07:03+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java
r33011 r33824 13 13 import javax.swing.AbstractButton; 14 14 15 import livegps.LiveGpsLayer;16 17 15 import org.openstreetmap.josm.actions.JosmAction; 18 16 import org.openstreetmap.josm.tools.Shortcut; 17 18 import livegps.LiveGpsLayer; 19 19 20 20 /** -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java
r33011 r33824 14 14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.data.osm.DataSet; 16 import org.openstreetmap.josm.gui.MainApplication; 16 17 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 18 import org.openstreetmap.josm.io.OsmWriter; 18 19 import org.openstreetmap.josm.io.OsmWriterFactory; 20 import org.openstreetmap.josm.tools.Logging; 19 21 20 22 /** … … 31 33 @Override 32 34 public void run() { 33 OsmDataLayer layer = Main .getLayerManager().getEditLayer();35 OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer(); 34 36 if (layer == null) { 35 37 return; … … 50 52 tmpFile.renameTo(file); 51 53 System.out.println("AutoSaving finished"); 52 } catch (IOException x) {53 x.printStackTrace();54 } catch (IOException ex) { 55 Logging.error(ex); 54 56 JOptionPane.showMessageDialog(Main.parent, 55 tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), x.getMessage()),57 tr("Error while exporting {0}: {1}", file.getAbsoluteFile(), ex.getMessage()), 56 58 tr("Error"), 57 59 JOptionPane.ERROR_MESSAGE); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java
r33011 r33824 7 7 8 8 import org.dinopolis.util.io.Tokenizer; 9 import org.openstreetmap.josm. Main;9 import org.openstreetmap.josm.tools.Logging; 10 10 11 11 /** … … 98 98 params = tokenizer.nextLine(); 99 99 } catch (IOException ignore) { 100 Main.debug(ignore);100 Logging.debug(ignore); 101 101 } 102 102 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java
r33011 r33824 22 22 import javax.swing.JPanel; 23 23 24 import livegps.LiveGpsData;25 26 24 import org.openstreetmap.josm.Main; 27 25 import org.openstreetmap.josm.tools.XmlObjectParser; 28 26 import org.xml.sax.SAXException; 27 28 import livegps.LiveGpsData; 29 29 30 30 /** -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java
r33011 r33824 8 8 import javax.swing.JMenu; 9 9 10 import livegps.LiveGpsPlugin;11 12 10 import org.openstreetmap.josm.gui.MainMenu; 13 11 import org.openstreetmap.josm.plugins.PluginHandler; 14 12 import org.openstreetmap.josm.plugins.PluginInformation; 13 14 import livegps.LiveGpsPlugin; 15 15 16 16 // CHECKSTYLE.OFF: HideUtilityClassConstructorCheck -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java
r33011 r33824 20 20 import javax.swing.KeyStroke; 21 21 22 import livegps.LiveGpsPlugin;23 24 22 import org.openstreetmap.josm.Main; 25 23 import org.openstreetmap.josm.actions.JosmAction; 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm.tools.Logging; 26 26 import org.openstreetmap.josm.tools.Shortcut; 27 27 import org.openstreetmap.josm.tools.XmlObjectParser; … … 29 29 30 30 import at.dallermassl.josm.plugin.surveyor.util.ResourceLoader; 31 import livegps.LiveGpsPlugin; 31 32 32 33 /** … … 64 65 @Override 65 66 public void actionPerformed(ActionEvent e) { 66 if (Main .map != null && Main.map.mapView != null) {67 Main .map.mapView.zoomToFactor(2);67 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 68 MainApplication.getMap().mapView.zoomToFactor(2); 68 69 } 69 70 } … … 74 75 @Override 75 76 public void actionPerformed(ActionEvent e) { 76 if (Main .map != null && Main.map.mapView != null) {77 Main .map.mapView.zoomToFactor(1/2);77 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 78 MainApplication.getMap().mapView.zoomToFactor(1/2); 78 79 } 79 80 } … … 117 118 return createComponent(in); 118 119 } catch (IOException e) { 119 Main.error(e);120 Logging.error(e); 120 121 JOptionPane.showMessageDialog(Main.parent, tr("Could not read surveyor definition: {0}", source)); 121 122 } catch (SAXException e) { 122 Main.error(e);123 Logging.error(e); 123 124 JOptionPane.showMessageDialog(Main.parent, tr("Error parsing {0}: {1}", source, e.getMessage())); 124 125 } … … 155 156 actions.add((SurveyorActionDescription) object); 156 157 } else { 157 Main.error("surveyor: unknown xml element: " + object);158 Logging.error("surveyor: unknown xml element: " + object); 158 159 } 159 160 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/BeepAction.java
r33011 r33824 5 5 import java.util.List; 6 6 7 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.gui.MainApplication; 8 import org.openstreetmap.josm.tools.Logging; 8 9 9 10 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; … … 20 21 public void actionPerformed(GpsActionEvent event) { 21 22 // run as a separate thread 22 Main .worker.execute(new Runnable() {23 MainApplication.worker.execute(new Runnable() { 23 24 public void run() { 24 25 for (int index = 0; index < beepNumber; ++index) { … … 27 28 Thread.sleep(200); 28 29 } catch (InterruptedException ignore) { 29 Main.debug(ignore);30 Logging.debug(ignore); 30 31 } 31 32 } … … 40 41 } catch (NumberFormatException e) { 41 42 // print but recover 42 Main.warn(e);43 Logging.warn(e); 43 44 } 44 45 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java
r33011 r33824 15 15 import javax.sound.sampled.UnsupportedAudioFileException; 16 16 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.gui.MainApplication; 18 18 19 19 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; … … 32 32 public void actionPerformed(GpsActionEvent event) { 33 33 // run as a separate thread 34 Main .worker.execute(new Runnable() {34 MainApplication.worker.execute(new Runnable() { 35 35 public void run() { 36 36 try { -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java
r33011 r33824 6 6 import java.util.List; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.coor.LatLon; 10 9 import org.openstreetmap.josm.data.osm.DataSet; 11 10 import org.openstreetmap.josm.data.osm.Node; 11 import org.openstreetmap.josm.gui.MainApplication; 12 12 import org.openstreetmap.josm.tools.Pair; 13 13 … … 60 60 } 61 61 synchronized (SurveyorLock.class) { 62 DataSet ds = Main .getLayerManager().getEditDataSet();62 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 63 63 if (ds != null) { 64 64 ds.addPrimitive(node); … … 66 66 } 67 67 } 68 Main .map.repaint();68 MainApplication.getMap().repaint(); 69 69 } 70 70 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java
r33011 r33824 8 8 import javax.swing.JToggleButton; 9 9 10 import livegps.LiveGpsLayer;11 12 import org.openstreetmap.josm.Main;13 10 import org.openstreetmap.josm.data.gpx.GpxData; 14 11 import org.openstreetmap.josm.data.gpx.WayPoint; 12 import org.openstreetmap.josm.gui.MainApplication; 15 13 import org.openstreetmap.josm.gui.layer.GpxLayer; 16 14 import org.openstreetmap.josm.gui.layer.Layer; 17 15 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; 18 16 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 17 import org.openstreetmap.josm.tools.Logging; 19 18 20 19 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; … … 24 23 import at.dallermassl.josm.plugin.surveyor.action.gui.WaypointDialog; 25 24 import at.dallermassl.josm.plugin.surveyor.util.LayerUtil; 25 import livegps.LiveGpsLayer; 26 26 27 27 /** … … 63 63 timeout = Integer.parseInt(getParameters().get(2)); 64 64 } catch (NumberFormatException e) { 65 Main.error(e.getMessage());65 Logging.error(e.getMessage()); 66 66 } 67 67 } … … 96 96 } 97 97 98 Main .map.repaint();98 MainApplication.getMap().repaint(); 99 99 } 100 100 … … 110 110 // not found, add a new one 111 111 markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null, null); 112 Main .getLayerManager().addLayer(markerLayer);112 MainApplication.getLayerManager().addLayer(markerLayer); 113 113 } 114 114 } … … 122 122 public GpxLayer getGpxLayer() { 123 123 if (liveGpsLayer == null) { 124 Collection<Layer> layers = Main .getLayerManager().getLayers();124 Collection<Layer> layers = MainApplication.getLayerManager().getLayers(); 125 125 for (Layer layer : layers) { 126 126 if (layer instanceof LiveGpsLayer) { -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SystemExecuteAction.java
r33011 r33824 7 7 import java.io.InputStreamReader; 8 8 9 import org.openstreetmap.josm. Main;9 import org.openstreetmap.josm.tools.Logging; 10 10 11 11 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; … … 22 22 builder.directory(new File(System.getProperty("user.home"))); 23 23 24 Main.debug("Directory : " + builder.directory());24 Logging.debug("Directory : " + builder.directory()); 25 25 Thread executionThread = new Thread() { 26 26 … … 35 35 36 36 while ((line = br.readLine()) != null) { 37 Main.info(getClass().getSimpleName() + ": " + line);37 Logging.info(getClass().getSimpleName() + ": " + line); 38 38 } 39 39 40 Main.info(getClass().getSimpleName() + "Program terminated!");40 Logging.info(getClass().getSimpleName() + "Program terminated!"); 41 41 } catch (Exception t) { 42 Main.error(t);42 Logging.error(t); 43 43 } 44 44 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java
r33011 r33824 12 12 import javax.swing.event.DocumentListener; 13 13 14 import org.openstreetmap.josm. Main;14 import org.openstreetmap.josm.tools.Logging; 15 15 16 16 /** … … 47 47 sleep(1000); 48 48 } catch (InterruptedException ignore) { 49 Main.debug(ignore);49 Logging.debug(ignore); 50 50 } 51 51 } … … 62 62 public void keyPressed(KeyEvent e) { 63 63 reset(); 64 Main.debug("keypressed: " + e.getKeyCode());64 Logging.debug("keypressed: " + e.getKeyCode()); 65 65 } 66 66 … … 68 68 public void keyReleased(KeyEvent e) { 69 69 reset(); 70 Main.debug("keyreleased: " + e.getKeyCode());70 Logging.debug("keyreleased: " + e.getKeyCode()); 71 71 } 72 72 … … 74 74 public void keyTyped(KeyEvent e) { 75 75 reset(); 76 Main.debug("keytyped: " + e.getKeyCode());76 Logging.debug("keytyped: " + e.getKeyCode()); 77 77 } 78 78 … … 98 98 public void changedUpdate(DocumentEvent e) { 99 99 reset(); 100 Main.debug("changedUpdate: " + e);100 Logging.debug("changedUpdate: " + e); 101 101 } 102 102 … … 104 104 public void insertUpdate(DocumentEvent e) { 105 105 reset(); 106 Main.debug("insertUpdate: " + e);106 Logging.debug("insertUpdate: " + e); 107 107 } 108 108 … … 110 110 public void removeUpdate(DocumentEvent e) { 111 111 reset(); 112 Main.debug("removeUpdate: " + e);112 Logging.debug("removeUpdate: " + e); 113 113 } 114 114 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java
r33011 r33824 2 2 package at.dallermassl.josm.plugin.surveyor.util; 3 3 4 import org.openstreetmap.josm. Main;4 import org.openstreetmap.josm.gui.MainApplication; 5 5 import org.openstreetmap.josm.gui.layer.Layer; 6 6 … … 25 25 public static <LayerType extends Layer> LayerType findGpsLayer(String layerName, Class<LayerType> layerType) { 26 26 Layer result = null; 27 if (Main .map != null && Main.map.mapView != null) {28 for (Layer layer : Main .getLayerManager().getLayers()) {27 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 28 for (Layer layer : MainApplication.getLayerManager().getLayers()) { 29 29 if (layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) { 30 30 result = layer;
Note:
See TracChangeset
for help on using the changeset viewer.