Changeset 34591 in osm for applications
- Timestamp:
- 2018-08-19T22:35:16+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/surveyor
- Files:
-
- 5 added
- 1 deleted
- 6 edited
- 26 copied
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/build.xml
r34558 r34591 14 14 --> 15 15 <property name="plugin.author" value="Christof Dallermassl"/> 16 <property name="plugin.class" value=" at.dallermassl.josm.plugin.surveyor.SurveyorPlugin"/>16 <property name="plugin.class" value="org.openstreetmap.josm.plugins.surveyor.SurveyorPlugin"/> 17 17 <property name="plugin.description" value="Allow adding markers/nodes on current gps positions."/> 18 18 <property name="plugin.icon" value="images/surveyormenu.png"/> 19 <property name="plugin.link" value="https://wiki.openstreetmap.org/ index.php/JOSM/Plugins/Surveyor"/>19 <property name="plugin.link" value="https://wiki.openstreetmap.org/wiki/JOSM/Plugins/Surveyor"/> 20 20 <property name="plugin.requires" value="livegps"/> 21 21 <property name="plugin.stage" value="60"/> -
applications/editors/josm/plugins/surveyor/src/org/dinopolis/util/io/Tokenizer.java
r30737 r34591 23 23 24 24 import java.io.IOException; 25 import java.io.InputStream;26 import java.io.InputStreamReader;27 25 import java.io.PushbackReader; 28 26 import java.io.Reader; … … 228 226 //---------------------------------------------------------------------- 229 227 /** 230 * Creates a tokenizer that reads from the given string. It uses the231 * comma as delimiter, does not respect escape characters but respects232 * quoted words.233 *234 * @param inStream the stream to read from.235 */236 public Tokenizer(InputStream inStream)237 {238 this(new InputStreamReader(inStream));239 }240 241 //----------------------------------------------------------------------242 /**243 228 * Creates a tokenizer that reads from the given reader. It uses the 244 229 * comma as delimiter, does not respect escape characters but respects -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/ActionConstants.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import javax.swing.Action; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/AutoSaveAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/AutoSaveEditLayerTimerTask.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.BufferedWriter; 6 7 import java.io.File; 7 8 import java.io.FileOutputStream; 8 9 import java.io.IOException; 10 import java.io.OutputStreamWriter; 9 11 import java.io.PrintWriter; 12 import java.nio.charset.StandardCharsets; 10 13 import java.util.TimerTask; 11 14 … … 41 44 // write to temporary file, on success, rename tmp file to target file: 42 45 File tmpFile = new File(file.getAbsoluteFile()+".tmp"); 43 System.out.println("AutoSaving osm data to file " + file.getAbsolutePath());46 Logging.info("AutoSaving osm data to file " + file.getAbsolutePath()); 44 47 synchronized (SurveyorLock.class) { 45 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new FileOutputStream(tmpFile)), false, dataset.getVersion()); 48 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new OutputStreamWriter( 49 new FileOutputStream(tmpFile), StandardCharsets.UTF_8)), false, dataset.getVersion()); 46 50 w.header(); 47 51 w.writeDataSources(dataset); … … 50 54 } 51 55 tmpFile.renameTo(file); 52 System.out.println("AutoSaving finished");53 56 } catch (IOException ex) { 54 57 Logging.error(ex); -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/AutoSaveGpsLayerTimerTask.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 9 9 import java.io.IOException; 10 10 import java.io.PrintWriter; 11 import java.nio.charset.StandardCharsets; 12 import java.nio.file.Files; 11 13 import java.util.TimerTask; 12 14 … … 16 18 import org.openstreetmap.josm.gui.layer.GpxLayer; 17 19 import org.openstreetmap.josm.io.GpxWriter; 18 19 import at.dallermassl.josm.plugin.surveyor.util.LayerUtil; 20 import org.openstreetmap.josm.plugins.surveyor.util.LayerUtil; 20 21 21 22 /** … … 64 65 // quite a hack, but no other object to sync available :-( 65 66 // @see LiveGpsLayer 66 PrintWriter out = new PrintWriter( new BufferedWriter(new FileWriter(tmpFile)));67 PrintWriter out = new PrintWriter(Files.newBufferedWriter(tmpFile.toPath(), StandardCharsets.UTF_8)); 67 68 try (GpxWriter gpxWriter = new GpxWriter(out)) { 68 69 gpxWriter.write(gpsLayer.data); -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/ButtonDescription.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/ButtonType.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/GpsActionEvent.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import java.awt.event.ActionEvent; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/GpsDataSource.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import livegps.LiveGpsData; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/MetaAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import java.awt.event.ActionEvent; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import java.util.List; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorActionDescription.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import java.io.IOException; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorActionFactory.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import java.util.HashMap; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorComponent.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 9 9 import java.beans.PropertyChangeEvent; 10 10 import java.beans.PropertyChangeListener; 11 import java.io.InputStreamReader;12 import java.io.Reader;13 import java.util.ArrayList;14 11 import java.util.HashSet; 15 import java.util.List;16 12 import java.util.Set; 17 13 18 14 import javax.swing.JComponent; 19 import javax.swing.JFrame;20 15 import javax.swing.JLabel; 21 16 import javax.swing.JOptionPane; … … 24 19 import org.openstreetmap.josm.gui.MainApplication; 25 20 import org.openstreetmap.josm.spi.preferences.Config; 26 import org.openstreetmap.josm.tools.Logging;27 import org.openstreetmap.josm.tools.XmlObjectParser;28 import org.xml.sax.SAXException;29 21 30 22 import livegps.LiveGpsData; … … 117 109 } 118 110 119 public static void main(String[] args) {120 121 // parse xml file and create component from it:122 Reader in = new InputStreamReader(SurveyorComponent.class.getClassLoader().getResourceAsStream("resources/surveyor.xml"));123 XmlObjectParser parser = new XmlObjectParser();124 parser.mapOnStart("surveyor", SurveyorComponent.class);125 parser.map("button", ButtonDescription.class);126 parser.map("action", SurveyorActionDescription.class);127 128 SurveyorComponent surveyorComponent = null;129 try {130 parser.start(in);131 } catch (SAXException e) {132 Logging.error(e);133 }134 List<SurveyorActionDescription> actions = new ArrayList<>();135 while (parser.hasNext()) {136 Object object = parser.next();137 if (object instanceof SurveyorComponent) {138 System.out.println("SurveyorComponent " + object);139 surveyorComponent = (SurveyorComponent) object;140 } else if (object instanceof ButtonDescription) {141 System.out.println("ButtonDescription " + object);142 ((ButtonDescription) object).setActions(actions);143 surveyorComponent.addButton(((ButtonDescription) object));144 actions.clear();145 } else if (object instanceof SurveyorActionDescription) {146 System.out.println("SurveyorActionDescription " + object);147 actions.add((SurveyorActionDescription) object);148 } else {149 System.err.println("unknown " + object);150 }151 }152 153 JFrame frame = new JFrame();154 frame.add(surveyorComponent);155 frame.pack();156 frame.setVisible(true);157 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);158 }159 160 111 @Override 161 112 public void propertyChange(PropertyChangeEvent evt) { -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorLock.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 public class SurveyorLock { -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorPlugin.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorShowAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor;2 package org.openstreetmap.josm.plugins.surveyor; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 10 10 import java.io.InputStream; 11 11 import java.io.InputStreamReader; 12 import java.nio.charset.StandardCharsets; 12 13 import java.util.ArrayList; 13 14 import java.util.List; … … 22 23 import org.openstreetmap.josm.actions.JosmAction; 23 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm.plugins.surveyor.util.ResourceLoader; 24 26 import org.openstreetmap.josm.spi.preferences.Config; 25 27 import org.openstreetmap.josm.tools.Logging; … … 28 30 import org.xml.sax.SAXException; 29 31 30 import at.dallermassl.josm.plugin.surveyor.util.ResourceLoader;31 32 import livegps.LiveGpsPlugin; 32 33 … … 140 141 141 142 SurveyorComponent surveyorComponent = null; 142 parser.start(new BufferedReader(new InputStreamReader(in )));143 parser.start(new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))); 143 144 List<SurveyorActionDescription> actions = new ArrayList<>(); 144 145 while (parser.hasNext()) { -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/AbstractSurveyorAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.util.List; 5 5 6 import at.dallermassl.josm.plugin.surveyor.SurveyorAction;6 import org.openstreetmap.josm.plugins.surveyor.SurveyorAction; 7 7 8 8 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/BeepAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.awt.Toolkit; … … 6 6 7 7 import org.openstreetmap.josm.gui.MainApplication; 8 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 9 import org.openstreetmap.josm.plugins.surveyor.SurveyorAction; 8 10 import org.openstreetmap.josm.tools.Logging; 9 10 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;11 import at.dallermassl.josm.plugin.surveyor.SurveyorAction;12 11 13 12 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/ConsolePrinterAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import org.openstreetmap.josm.data.coor.LatLon; 5 6 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; 5 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 7 6 8 7 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/PlayAudioAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.io.BufferedInputStream; … … 15 15 16 16 import org.openstreetmap.josm.gui.MainApplication; 17 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 18 import org.openstreetmap.josm.plugins.surveyor.util.ResourceLoader; 17 19 import org.openstreetmap.josm.tools.Logging; 18 19 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;20 import at.dallermassl.josm.plugin.surveyor.util.ResourceLoader;21 20 22 21 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/SetNodeAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.util.ArrayList; … … 10 10 import org.openstreetmap.josm.data.osm.Node; 11 11 import org.openstreetmap.josm.gui.MainApplication; 12 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 13 import org.openstreetmap.josm.plugins.surveyor.SurveyorAction; 14 import org.openstreetmap.josm.plugins.surveyor.SurveyorLock; 12 15 import org.openstreetmap.josm.tools.Pair; 13 14 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;15 import at.dallermassl.josm.plugin.surveyor.SurveyorAction;16 import at.dallermassl.josm.plugin.surveyor.SurveyorLock;17 16 18 17 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/SetWaypointAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; … … 15 15 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; 16 16 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 17 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 18 import org.openstreetmap.josm.plugins.surveyor.SurveyorLock; 19 import org.openstreetmap.josm.plugins.surveyor.SurveyorPlugin; 20 import org.openstreetmap.josm.plugins.surveyor.action.gui.DialogClosingThread; 21 import org.openstreetmap.josm.plugins.surveyor.action.gui.WaypointDialog; 22 import org.openstreetmap.josm.plugins.surveyor.util.LayerUtil; 17 23 import org.openstreetmap.josm.tools.Logging; 18 24 19 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;20 import at.dallermassl.josm.plugin.surveyor.SurveyorLock;21 import at.dallermassl.josm.plugin.surveyor.SurveyorPlugin;22 import at.dallermassl.josm.plugin.surveyor.action.gui.DialogClosingThread;23 import at.dallermassl.josm.plugin.surveyor.action.gui.WaypointDialog;24 import at.dallermassl.josm.plugin.surveyor.util.LayerUtil;25 25 import livegps.LiveGpsLayer; 26 26 -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/SystemExecuteAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.io.BufferedReader; … … 6 6 import java.io.InputStream; 7 7 import java.io.InputStreamReader; 8 import java.nio.charset.StandardCharsets; 8 9 10 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 9 11 import org.openstreetmap.josm.tools.Logging; 10 11 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent;12 12 13 13 /** … … 30 30 final Process process = builder.start(); 31 31 InputStream is = process.getInputStream(); 32 InputStreamReader isr = new InputStreamReader(is );32 InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); 33 33 BufferedReader br = new BufferedReader(isr); 34 34 String line; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/TaggingPresetAction.java
r34576 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action;2 package org.openstreetmap.josm.plugins.surveyor.action; 3 3 4 4 import java.util.List; … … 9 9 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 10 10 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 11 12 import at.dallermassl.josm.plugin.surveyor.GpsActionEvent; 13 import at.dallermassl.josm.plugin.surveyor.SurveyorAction; 11 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 12 import org.openstreetmap.josm.plugins.surveyor.SurveyorAction; 14 13 15 14 /** -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/gui/DialogClosingThread.java
r33824 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action.gui;2 package org.openstreetmap.josm.plugins.surveyor.action.gui; 3 3 4 4 import java.awt.Component; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/gui/WaypointDialog.java
r33011 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.action.gui; 3 4 import java.beans.PropertyChangeEvent; 5 import java.beans.PropertyChangeListener; 2 package org.openstreetmap.josm.plugins.surveyor.action.gui; 6 3 7 4 import javax.swing.JDialog; … … 38 35 closer.observe(textField); 39 36 dialog.setContentPane(optionPane); 40 optionPane.addPropertyChangeListener(new PropertyChangeListener() { 41 public void propertyChange(PropertyChangeEvent e) { 42 String prop = e.getPropertyName(); 37 optionPane.addPropertyChangeListener(e -> { 38 String prop = e.getPropertyName(); 43 39 44 if (dialog.isVisible() && (e.getSource() == optionPane) 45 && (prop.equals(JOptionPane.VALUE_PROPERTY))) { 46 // If you were going to check something 47 // before closing the window, you'd do it here. 48 dialog.setVisible(false); 49 } 40 if (dialog.isVisible() && (e.getSource() == optionPane) 41 && (prop.equals(JOptionPane.VALUE_PROPERTY))) { 42 // If you were going to check something 43 // before closing the window, you'd do it here. 44 dialog.setVisible(false); 50 45 } 51 46 }); -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/util/LayerUtil.java
r33824 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.util;2 package org.openstreetmap.josm.plugins.surveyor.util; 3 3 4 4 import org.openstreetmap.josm.gui.MainApplication; -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/util/ResourceLoader.java
r33011 r34591 1 1 // License: GPL. For details, see LICENSE file. 2 package at.dallermassl.josm.plugin.surveyor.util;2 package org.openstreetmap.josm.plugins.surveyor.util; 3 3 4 4 import java.io.FileInputStream;
Note:
See TracChangeset
for help on using the changeset viewer.