Changeset 33011 in osm for applications/editors/josm
- Timestamp:
- 2016-09-24T14:18:41+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/surveyor
- Files:
-
- 1 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/.project
r32286 r33011 16 16 </arguments> 17 17 </buildCommand> 18 <buildCommand> 19 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 18 23 </buildSpec> 19 24 <natures> 20 25 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 21 27 </natures> 22 28 </projectDescription> -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ActionConstants.java
r13497 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 42 39 public void actionPerformed(ActionEvent e) { 43 40 if (e.getSource() instanceof AbstractButton) { 44 autoSave = ((AbstractButton)e.getSource()).isSelected(); 41 autoSave = ((AbstractButton) e.getSource()).isSelected(); 45 42 } 46 43 47 if(autoSave) { 48 if(gpsDataTimer == null) { 44 if (autoSave) { 45 if (gpsDataTimer == null) { 49 46 gpsDataTimer = new Timer(); 50 47 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java
r32464 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 44 41 File tmpFile = new File(file.getAbsoluteFile()+".tmp"); 45 42 System.out.println("AutoSaving osm data to file " + file.getAbsolutePath()); 46 synchronized(SurveyorLock.class) { 43 synchronized (SurveyorLock.class) { 47 44 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(new FileOutputStream(tmpFile)), false, dataset.getVersion()); 48 45 w.header(); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java
r30738 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 58 55 try { 59 56 GpxLayer gpsLayer = LayerUtil.findGpsLayer(gpsLayerName, GpxLayer.class); 60 if(gpsLayer == null) { 57 if (gpsLayer == null) { 61 58 return; 62 59 } … … 69 66 PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(tmpFile))); 70 67 try (GpxWriter gpxWriter = new GpxWriter(out)) { 71 68 gpxWriter.write(gpsLayer.data); 72 69 } 73 70 tmpFile.renameTo(file); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonDescription.java
r30737 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 49 46 super(); 50 47 } 51 /**52 * @param hotkey48 49 /** 53 50 * @param actions a list of actions to be performed. 54 51 * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. … … 59 56 60 57 /** 61 * @param hotkey62 58 * @param actions a list of actions to be performed. 63 59 * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. … … 79 75 80 76 /** 81 * @param hotkey82 77 * @param actions a list of actions to be performed. 83 78 * @param type if <code>null</code> {@link ButtonType#SINGLE} is used. … … 88 83 this.hotkey = hotkey; 89 84 this.iconName = iconName; 90 if(type == null) { 85 if (type == null) { 91 86 this.type = ButtonType.SINGLE; 92 87 } else { … … 102 97 return this.actions; 103 98 } 99 104 100 /** 105 101 * @param actions the actions to set … … 108 104 this.actions = actions; 109 105 } 106 110 107 /** 111 108 * @return the hotkey … … 114 111 return this.hotkey; 115 112 } 113 116 114 /** 117 115 * @param hotkey the hotkey to set … … 120 118 this.hotkey = hotkey; 121 119 } 120 122 121 /** 123 122 * @return the label … … 153 152 } 154 153 } 154 155 155 /** 156 156 * @param type the type to set … … 162 162 /** 163 163 * Sets the name of the icon. 164 * @param icon165 164 */ 166 165 public void setIcon(String icon) { … … 176 175 String actionName = tr(getLabel()) + " (" + hotkey + ")"; 177 176 178 Icon icon = ImageProvider.getIfAvailable(null,iconName); 177 Icon icon = ImageProvider.getIfAvailable(null, iconName); 179 178 if (icon == null) 180 icon = ImageProvider.getIfAvailable("markers",iconName); 179 icon = ImageProvider.getIfAvailable("markers", iconName); 181 180 if (icon == null) 182 icon = ImageProvider.getIfAvailable("symbols",iconName); 181 icon = ImageProvider.getIfAvailable("symbols", iconName); 183 182 if (icon == null) 184 icon = ImageProvider.getIfAvailable("nodes",iconName); 183 icon = ImageProvider.getIfAvailable("nodes", iconName); 185 184 186 185 MetaAction action = new MetaAction(actionName, icon); … … 189 188 190 189 AbstractButton button; 191 if(type == ButtonType.TOGGLE) { 190 if (type == ButtonType.TOGGLE) { 192 191 button = new JToggleButton(action); 193 192 connectActionAndButton(action, button); … … 223 222 private Action action; 224 223 private AbstractButton button; 225 public SelectionStateAdapter(Action theAction, AbstractButton theButton) { 224 225 SelectionStateAdapter(Action theAction, AbstractButton theButton) { 226 226 action = theAction; 227 227 button = theButton; 228 228 } 229 229 230 protected void configure() { 230 231 action.addPropertyChangeListener(this); 231 232 button.addItemListener(this); 232 233 } 234 233 235 public void itemStateChanged(ItemEvent e) { 234 236 boolean value = e.getStateChange() == ItemEvent.SELECTED; … … 238 240 239 241 public void propertyChange(PropertyChangeEvent evt) { 240 if(evt.getPropertyName().equals(ActionConstants.SELECTED_KEY)) { 241 Boolean newSelectedState = (Boolean)evt.getNewValue(); 242 if (evt.getPropertyName().equals(ActionConstants.SELECTED_KEY)) { 243 Boolean newSelectedState = (Boolean) evt.getNewValue(); 242 244 button.setSelected(newSelectedState.booleanValue()); 243 245 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/ButtonType.java
r13497 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsActionEvent.java
r13497 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 17 14 private LatLon coordinates; 18 15 19 20 /**21 * @param e22 * @param latitude23 * @param longitude24 */25 16 public GpsActionEvent(ActionEvent e, double latitude, double longitude) { 26 17 super(e.getSource(), e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()); 27 18 coordinates = new LatLon(latitude, longitude); 28 19 } 29 30 20 31 21 /** … … 35 25 return this.coordinates; 36 26 } 37 38 39 40 27 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/GpsDataSource.java
r13497 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 16 13 * @return gps data. 17 14 */ 18 public LiveGpsData getGpsData(); 19 15 LiveGpsData getGpsData(); 20 16 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/MetaAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 35 32 } 36 33 37 /**38 * @param name39 */40 34 public MetaAction(String name) { 41 35 super(name); 42 36 } 43 37 44 /**45 * @param name46 * @param icon47 */48 38 public MetaAction(String name, Icon icon) { 49 39 super(name, icon); 50 // TODO Auto-generated constructor stub51 40 } 52 41 … … 96 85 System.out.println("Surveyor: no gps data available!"); 97 86 // TEST for offline test only: 98 if(Main.pref.getBoolean("surveyor.debug")) { 87 if (Main.pref.getBoolean("surveyor.debug")) { 99 88 for (SurveyorActionDescription action : actions) { 100 89 action.actionPerformed(new GpsActionEvent(e, 0, 0)); … … 103 92 } 104 93 JFrame frame = SurveyorPlugin.getSurveyorFrame(); 105 if(frame != null && frame.isVisible()) { 94 if (frame != null && frame.isVisible()) { 106 95 frame.toFront(); 107 96 } 108 97 } 109 98 110 /**111 * @param gpsDataSource112 */113 99 public void setGpsDataSource(GpsDataSource gpsDataSource) { 114 100 this.gpsDataSource = gpsDataSource; -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorAction.java
r13497 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 17 14 * @param event the event. 18 15 */ 19 publicvoid actionPerformed(GpsActionEvent event);16 void actionPerformed(GpsActionEvent event); 20 17 21 18 /** … … 23 20 * @param parameters the parameters. 24 21 */ 25 publicvoid setParameters(List<String> parameters);22 void setParameters(List<String> parameters); 26 23 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionDescription.java
r30737 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 10 7 11 8 import org.dinopolis.util.io.Tokenizer; 9 import org.openstreetmap.josm.Main; 12 10 13 11 /** … … 20 18 private SurveyorAction action; 21 19 22 23 20 /** 24 21 * Default Constructor … … 27 24 super(); 28 25 } 29 /** 30 * @param actionClass 31 * @param params 32 */ 26 33 27 public SurveyorActionDescription(String actionClass) { 34 28 super(); 35 29 this.actionClass = actionClass; 36 30 } 37 /** 38 * @param actionClass 39 * @param params 40 */ 31 41 32 public SurveyorActionDescription(String actionClass, List<String> params) { 42 33 super(); … … 44 35 this.params = params; 45 36 } 46 /** 47 * @param actionClass 48 * @param params 49 */ 37 50 38 public SurveyorActionDescription(String actionClass, String[] params) { 51 39 super(); … … 56 44 } 57 45 } 46 58 47 /** 59 48 * @return the actionClass … … 62 51 return this.actionClass; 63 52 } 53 64 54 /** 65 55 * @param actionClass the actionClass to set … … 68 58 this.actionClass = actionClass; 69 59 } 60 70 61 /** 71 62 * @return the params … … 74 65 return this.params; 75 66 } 67 76 68 /** 77 69 * @param params the params to set … … 82 74 83 75 public void actionPerformed(GpsActionEvent e) { 84 if(action == null) { 76 if (action == null) { 85 77 action = SurveyorActionFactory.getInstance(actionClass); 86 78 action.setParameters(getParameterList()); … … 106 98 params = tokenizer.nextLine(); 107 99 } catch (IOException ignore) { 100 Main.debug(ignore); 108 101 } 109 102 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorActionFactory.java
r30737 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 17 14 * 18 15 */ 19 public class SurveyorActionFactory { 20 private static Map<String, SurveyorAction>actionCache = new HashMap<>(); 16 public final class SurveyorActionFactory { 17 private static Map<String, SurveyorAction> actionCache = new HashMap<>(); 21 18 public static final String DEFAULT_PACKAGE = SurveyorActionFactory.class.getPackage().getName() + ".action"; 22 19 23 /**24 * @param actionClass25 * @return26 */20 private SurveyorActionFactory() { 21 // Hide default contructir for utilities classes 22 } 23 27 24 public static SurveyorAction getInstance(String actionClass) { 28 25 try { 29 26 SurveyorAction action = actionCache.get(actionClass); 30 if(action == null) { 27 if (action == null) { 31 28 try { 32 action = (SurveyorAction)Class.forName(actionClass).newInstance(); 29 action = (SurveyorAction) Class.forName(actionClass).newInstance(); 33 30 } catch (ClassNotFoundException e) { 34 31 actionClass = DEFAULT_PACKAGE + "." + actionClass; 35 action = (SurveyorAction)Class.forName(actionClass).newInstance(); 32 action = (SurveyorAction) Class.forName(actionClass).newInstance(); 36 33 } 37 34 actionCache.put(actionClass, action); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorComponent.java
r30737 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 44 41 private JLabel streetLabel; 45 42 private JPanel buttonPanel; 46 private Set<String>hotKeys; 43 private Set<String> hotKeys; 47 44 48 45 public SurveyorComponent() { … … 84 81 public void setWidth(String widthString) { 85 82 width = Integer.parseInt(widthString); 86 if(width > 0 && height > 0) { 83 if (width > 0 && height > 0) { 87 84 super.setPreferredSize(new Dimension(width, height)); 88 85 } … … 95 92 public void setHeight(String heightString) { 96 93 height = Integer.parseInt(heightString); 97 if(width > 0 && height > 0) { 94 if (width > 0 && height > 0) { 98 95 super.setPreferredSize(new Dimension(width, height)); 99 96 } … … 105 102 106 103 public void addButton(ButtonDescription description) { 107 if(description.getHotkey() != "" && hotKeys.contains(description.getHotkey())) { 108 JOptionPane.showMessageDialog(Main.parent, tr("Duplicate hotkey for button ''{0}'' - button will be ignored!",description.getLabel())); 104 if (description.getHotkey() != "" && hotKeys.contains(description.getHotkey())) { 105 JOptionPane.showMessageDialog(Main.parent, 106 tr("Duplicate hotkey for button ''{0}'' - button will be ignored!", description.getLabel())); 109 107 } else { 110 if(rows == 0 && columns == 0) { 108 if (rows == 0 && columns == 0) { 111 109 setColumns("4"); 112 110 } … … 129 127 try { 130 128 parser.start(in); 131 } catch(SAXException e) { 129 } catch (SAXException e) { 132 130 e.printStackTrace(); 133 131 } 134 132 List<SurveyorActionDescription> actions = new ArrayList<>(); 135 while(parser.hasNext()) { 133 while (parser.hasNext()) { 136 134 Object object = parser.next(); 137 135 if (object instanceof SurveyorComponent) { … … 140 138 } else if (object instanceof ButtonDescription) { 141 139 System.out.println("ButtonDescription " + object); 142 ((ButtonDescription)object).setActions(actions); 143 surveyorComponent.addButton(((ButtonDescription)object)); 140 ((ButtonDescription) object).setActions(actions); 141 surveyorComponent.addButton(((ButtonDescription) object)); 144 142 actions.clear(); 145 143 } else if (object instanceof SurveyorActionDescription) { 146 144 System.out.println("SurveyorActionDescription " + object); 147 actions.add((SurveyorActionDescription)object); 145 actions.add((SurveyorActionDescription) object); 148 146 } else { 149 147 System.err.println("unknown " + object); … … 160 158 @Override 161 159 public void propertyChange(PropertyChangeEvent evt) { 162 if("gpsdata".equals(evt.getPropertyName())) { 160 if ("gpsdata".equals(evt.getPropertyName())) { 163 161 gpsData = (LiveGpsData) evt.getNewValue(); 164 162 streetLabel.setText(tr("Way: ") + gpsData.getWayInfo()); 165 163 } 166 167 164 } 168 165 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorLock.java
r19681 r33011 1 // License: GPL. For details, see LICENSE file. 1 2 package at.dallermassl.josm.plugin.surveyor; 2 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java
r19479 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 17 14 import org.openstreetmap.josm.plugins.PluginInformation; 18 15 16 // CHECKSTYLE.OFF: HideUtilityClassConstructorCheck 17 19 18 /** 20 19 * Plugin that uses live gps data and a button panel to add nodes/waypoints etc at the current … … 26 25 * 27 26 */ 28 public class SurveyorPlugin { 27 public final class SurveyorPlugin { 29 28 30 29 private static JFrame surveyorFrame; 31 30 public static final String PREF_KEY_STREET_NAME_FONT_SIZE = "surveyor.way.fontsize"; 32 31 33 32 /** 34 * 33 * Constructs a new {@code SurveyorPlugin}. 34 * @param info plugin information 35 35 */ 36 36 public SurveyorPlugin(PluginInformation info) { 37 37 38 38 LiveGpsPlugin gpsPlugin = (LiveGpsPlugin) PluginHandler.getPlugin("livegps"); 39 if(gpsPlugin == null) 39 if (gpsPlugin == null) 40 40 throw new IllegalStateException(tr("SurveyorPlugin needs LiveGpsPlugin, but could not find it!")); 41 41 … … 64 64 } 65 65 66 // CHECKSTYLE.ON: HideUtilityClassConstructorCheck 66 67 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java
r30738 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor; 6 3 … … 51 48 52 49 @Override 53 54 if(surveyorFrame == null) { 50 public void actionPerformed(ActionEvent e) { 51 if (surveyorFrame == null) { 55 52 surveyorFrame = new JFrame(); 56 53 … … 66 63 actionMap.put("zoomout", new AbstractAction() { 67 64 @Override 68 69 if(Main.map != null && Main.map.mapView != null) { 65 public void actionPerformed(ActionEvent e) { 66 if (Main.map != null && Main.map.mapView != null) { 70 67 Main.map.mapView.zoomToFactor(2); 71 68 } … … 76 73 actionMap.put("zoomin", new AbstractAction() { 77 74 @Override 78 79 if(Main.map != null && Main.map.mapView != null) { 75 public void actionPerformed(ActionEvent e) { 76 if (Main.map != null && Main.map.mapView != null) { 80 77 Main.map.mapView.zoomToFactor(1/2); 81 78 } … … 86 83 actionMap.put("autocenter", new AbstractAction() { 87 84 @Override 88 85 public void actionPerformed(ActionEvent e) { 89 86 // toggle autocenter 90 87 gpsPlugin.setAutoCenter(!gpsPlugin.isAutoCenter()); … … 110 107 public SurveyorComponent createComponent() { 111 108 String source = Main.pref.get("surveyor.source"); 112 if(source == null || source.length() == 0) { 109 if (source == null || source.length() == 0) { 113 110 source = DEFAULT_SOURCE; 114 111 Main.pref.put("surveyor.source", DEFAULT_SOURCE); … … 121 118 } catch (IOException e) { 122 119 Main.error(e); 123 JOptionPane.showMessageDialog(Main.parent, tr("Could not read surveyor definition: {0}",source)); 120 JOptionPane.showMessageDialog(Main.parent, tr("Could not read surveyor definition: {0}", source)); 124 121 } catch (SAXException e) { 125 122 Main.error(e); … … 144 141 parser.start(new BufferedReader(new InputStreamReader(in))); 145 142 List<SurveyorActionDescription> actions = new ArrayList<>(); 146 while(parser.hasNext()) { 143 while (parser.hasNext()) { 147 144 Object object = parser.next(); 148 145 if (object instanceof SurveyorComponent) { … … 151 148 } else if (object instanceof ButtonDescription) { 152 149 //System.out.println("ButtonDescription " + object); 153 ((ButtonDescription)object).setActions(actions); 154 surveyorComponent.addButton(((ButtonDescription)object)); 150 ((ButtonDescription) object).setActions(actions); 151 surveyorComponent.addButton(((ButtonDescription) object)); 155 152 actions = new ArrayList<>(); 156 153 } else if (object instanceof SurveyorActionDescription) { 157 154 //System.out.println("SurveyorActionDescription " + object); 158 actions.add((SurveyorActionDescription)object); 155 actions.add((SurveyorActionDescription) object); 159 156 } else { 160 157 Main.error("surveyor: unknown xml element: " + object); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/AbstractSurveyorAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/BeepAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 25 22 Main.worker.execute(new Runnable() { 26 23 public void run() { 27 for(int index = 0; index < beepNumber; ++index) { 24 for (int index = 0; index < beepNumber; ++index) { 28 25 Toolkit.getDefaultToolkit().beep(); 29 26 try { 30 27 Thread.sleep(200); 31 28 } catch (InterruptedException ignore) { 29 Main.debug(ignore); 32 30 } 33 31 } … … 40 38 try { 41 39 beepNumber = Integer.parseInt(parameters.get(0)); 42 } catch(NumberFormatException e) { 40 } catch (NumberFormatException e) { 43 41 // print but recover 44 e.printStackTrace();42 Main.warn(e); 45 43 } 46 44 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/ConsolePrinterAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/PlayAudioAction.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 38 35 public void run() { 39 36 try { 40 if(audioSource == null) { 37 if (audioSource == null) { 41 38 audioSource = getParameters().get(0); 42 39 } … … 61 58 // Create the clip 62 59 DataLine.Info info = new DataLine.Info( 63 Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize())); 60 Clip.class, stream.getFormat(), ((int) stream.getFrameLength()*format.getFrameSize())); 64 61 Clip clip = (Clip) AudioSystem.getLine(info); 65 62 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetNodeAction.java
r32464 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 44 41 for (String keyValuePair : parameters) { 45 42 pos = keyValuePair.indexOf('='); 46 if(pos > 0) { 43 if (pos > 0) { 47 44 key = keyValuePair.substring(0, pos); 48 45 value = keyValuePair.substring(pos + 1); … … 59 56 //System.out.println(getClass().getSimpleName() + " KOORD: " + coordinates.lat() + ", " + coordinates.lon() + " params: " + keyValues); 60 57 Node node = new Node(coordinates); 61 for(Pair<String, String> entry : keyValues) { 58 for (Pair<String, String> entry : keyValues) { 62 59 node.put(entry.a, entry.b); 63 60 } 64 synchronized(SurveyorLock.class) { 61 synchronized (SurveyorLock.class) { 65 62 DataSet ds = Main.getLayerManager().getEditDataSet(); 66 if(ds != null) 67 { 63 if (ds != null) { 68 64 ds.addPrimitive(node); 69 65 ds.setSelected(node); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SetWaypointAction.java
r32464 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 51 48 String markerTitle = getParameters().get(0); 52 49 Object source = event.getSource(); 53 if(source instanceof JToggleButton) { 54 if(((JToggleButton)source).isSelected()) { 50 if (source instanceof JToggleButton) { 51 if (((JToggleButton) source).isSelected()) { 55 52 markerTitle = tr("{0} start", markerTitle); 56 53 } else { … … 78 75 79 76 String inputText = dialog.openDialog(SurveyorPlugin.getSurveyorFrame(), tr("Waypoint Description"), timeout*1000); 80 if(inputText != null && inputText.length() > 0) { 77 if (inputText != null && inputText.length() > 0) { 81 78 inputText = inputText.replaceAll("<", "_"); // otherwise the gpx file is ruined 82 79 markerText = markerText + " " + inputText; … … 90 87 WayPoint waypoint = new WayPoint(event.getCoordinates()); 91 88 waypoint.attr.put("name", markerText); 92 if(iconName != null && !iconName.isEmpty()) 89 if (iconName != null && !iconName.isEmpty()) 93 90 waypoint.attr.put("sym", iconName); 94 synchronized(SurveyorLock.class) { 91 synchronized (SurveyorLock.class) { 95 92 layer.data.add(new Marker(event.getCoordinates(), markerText, iconName, null, -1.0, 0.0)); 96 if(gpsLayer != null) { 93 if (gpsLayer != null) { 97 94 gpsLayer.data.waypoints.add(waypoint); 98 95 } … … 107 104 */ 108 105 public MarkerLayer getMarkerLayer() { 109 if(markerLayer == null) { 106 if (markerLayer == null) { 110 107 markerLayer = LayerUtil.findGpsLayer(MARKER_LAYER_NAME, MarkerLayer.class); 111 108 112 if(markerLayer == null) { 109 if (markerLayer == null) { 113 110 // not found, add a new one 114 111 markerLayer = new MarkerLayer(new GpxData(), MARKER_LAYER_NAME, null, null); … … 124 121 */ 125 122 public GpxLayer getGpxLayer() { 126 if(liveGpsLayer == null) { 123 if (liveGpsLayer == null) { 127 124 Collection<Layer> layers = Main.getLayerManager().getLayers(); 128 125 for (Layer layer : layers) { 129 if(layer instanceof LiveGpsLayer) { 126 if (layer instanceof LiveGpsLayer) { 130 127 liveGpsLayer = (LiveGpsLayer) layer; 131 128 break; -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/SystemExecuteAction.java
r30722 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 38 35 39 36 while ((line = br.readLine()) != null) { 40 Main.info(getClass().getSimpleName() + ": " + 37 Main.info(getClass().getSimpleName() + ": " + line); 41 38 } 42 39 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/TaggingPresetAction.java
r31615 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action; 6 3 … … 26 23 @Override 27 24 public void actionPerformed(GpsActionEvent event) { 28 if(preset == null) { 25 if (preset == null) { 29 26 return; 30 27 } … … 47 44 @Override 48 45 public void setParameters(List<String> parameters) { 49 if(parameters.size() == 0) { 46 if (parameters.size() == 0) { 50 47 throw new IllegalArgumentException("No annotation preset name given!"); 51 48 } -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/DialogClosingThread.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action.gui; 6 3 … … 29 26 /** 30 27 * Using the given dialog and the default timeout. 31 * @param dialog32 28 */ 33 29 public DialogClosingThread(JDialog dialog) { … … 35 31 } 36 32 37 /**38 * @param dialog39 * @param timeout40 */41 33 public DialogClosingThread(JDialog dialog, long timeout) { 42 34 super(); … … 49 41 public void run() { 50 42 String title = dialog.getTitle(); 51 while(loopCount > 0) { 43 while (loopCount > 0) { 52 44 dialog.setTitle(title + " (" + loopCount + "sec)"); 53 45 --loopCount; 54 46 try { 55 47 sleep(1000); 56 } catch(InterruptedException ignore) {} 48 } catch (InterruptedException ignore) { 49 Main.debug(ignore); 50 } 57 51 } 58 52 … … 83 77 } 84 78 85 /**86 * @param optionPane87 */88 79 public void observe(Container container) { 89 for(Component component : container.getComponents()) { 90 if(component instanceof JTextField) { 91 observe((JTextField)component); 80 for (Component component : container.getComponents()) { 81 if (component instanceof JTextField) { 82 observe((JTextField) component); 92 83 } else { 93 84 observe(component); -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/action/gui/WaypointDialog.java
r30646 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.action.gui; 6 3 -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/LayerUtil.java
r32329 r33011 1 /** 2 * 3 */ 1 // License: GPL. For details, see LICENSE file. 4 2 package at.dallermassl.josm.plugin.surveyor.util; 5 3 … … 11 9 * 12 10 */ 13 public class LayerUtil { 11 public final class LayerUtil { 14 12 13 private LayerUtil() { 14 // Hide default contructir for utilities classes 15 } 16 15 17 /** 16 18 * Returns the layer with the given name and type from the map view or <code>null</code>. … … 23 25 public static <LayerType extends Layer> LayerType findGpsLayer(String layerName, Class<LayerType> layerType) { 24 26 Layer result = null; 25 if(Main.map != null && Main.map.mapView != null) { 26 for(Layer layer : Main.getLayerManager().getLayers()) { 27 if(layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) { 27 if (Main.map != null && Main.map.mapView != null) { 28 for (Layer layer : Main.getLayerManager().getLayers()) { 29 if (layerName.equals(layer.getName()) && layerType.isAssignableFrom(layer.getClass())) { 28 30 result = layer; 29 31 break; -
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/util/ResourceLoader.java
r30738 r33011 1 /** 2 * Copyright by Christof Dallermassl 3 * This program is free software and licensed under GPL. 4 */ 1 // License: GPL. For details, see LICENSE file. 5 2 package at.dallermassl.josm.plugin.surveyor.util; 6 3 … … 14 11 * 15 12 */ 16 public class ResourceLoader { 13 public final class ResourceLoader { 17 14 18 15 private ResourceLoader() { … … 29 26 */ 30 27 @SuppressWarnings("resource") 31 28 public static InputStream getInputStream(String source) throws IOException { 32 29 InputStream in = null; 33 30 if (source.startsWith("http://") || source.startsWith("https://") || source.startsWith("ftp://") || source.startsWith("file:")) {
Note:
See TracChangeset
for help on using the changeset viewer.