Changeset 30737 in osm for applications/editors/josm/plugins/measurement/src/org
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
r30641 r30737 32 32 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 33 33 import org.openstreetmap.josm.gui.NavigatableComponent; 34 import org.openstreetmap.josm.gui.NavigatableComponent.SoMChangeListener; 34 35 import org.openstreetmap.josm.gui.SideButton; 35 import org.openstreetmap.josm.gui.NavigatableComponent.SoMChangeListener;36 36 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 37 37 import org.openstreetmap.josm.gui.help.HelpUtil; … … 73 73 */ 74 74 protected JLabel segAngleLabel; 75 75 76 76 private DataSet ds; 77 77 78 78 private Collection<Way> ways; 79 79 private Collection<Node> nodes; 80 80 81 81 /** 82 82 * Constructor … … 131 131 resetButton 132 132 })); 133 133 134 134 DataSet.addSelectionListener(this); 135 135 NavigatableComponent.addSoMChangeListener(this); … … 162 162 Node lastNode = null; 163 163 // Don't mix up way and nodes computation (fix #6872). Priority given to ways 164 ways = new SubclassFilteredCollection< OsmPrimitive, Way>(newSelection, OsmPrimitive.wayPredicate);164 ways = new SubclassFilteredCollection<>(newSelection, OsmPrimitive.wayPredicate); 165 165 if (ways.isEmpty()) { 166 nodes = new SubclassFilteredCollection< OsmPrimitive, Node>(newSelection, OsmPrimitive.nodePredicate);166 nodes = new SubclassFilteredCollection<>(newSelection, OsmPrimitive.nodePredicate); 167 167 for (Node n : nodes) { 168 168 if (n.getCoor() != null) { … … 198 198 } 199 199 } 200 200 201 201 final String lengthLabel = getDistText(length); 202 202 final String angleLabel = getAngleText(segAngle); 203 203 final String areaLabel = getAreaText(area); 204 204 205 205 GuiHelper.runInEDT(new Runnable() { 206 206 @Override … … 211 211 } 212 212 }); 213 213 214 214 DataSet currentDs = Main.main.getCurrentDataSet(); 215 215 216 216 if (ds != currentDs) { 217 217 if (ds != null) { … … 246 246 return false; 247 247 } 248 248 249 249 @Override public void nodeMoved(NodeMovedEvent event) { 250 250 Node n = event.getNode(); -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
r30641 r30737 52 52 53 53 private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(MeasurementPlugin.class.getResource("/images/measurement.png"))); 54 private Collection<WayPoint> points = new ArrayList< WayPoint>(32);54 private Collection<WayPoint> points = new ArrayList<>(32); 55 55 56 56 @Override … … 146 146 last = p; 147 147 } 148 if (MeasurementPlugin.measurementDialog != null) { 148 if (MeasurementPlugin.measurementDialog != null) { 149 149 MeasurementPlugin.measurementDialog.pathLengthLabel.setText(NavigatableComponent.getDistText(pathLength)); 150 150 } … … 153 153 } 154 154 } 155 155 156 156 /* 157 157 * Use an equal area sinusoidal projection to improve accuracy and so we can still use normal polygon area calculation … … 222 222 */ 223 223 private DefaultListModel<GpxLayer> model = new DefaultListModel<>(); 224 224 225 225 /** 226 226 * @param layer the targeting measurement layer … … 229 229 super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image 230 230 } 231 231 232 232 @Override 233 233 public void actionPerformed(ActionEvent e) { … … 237 237 Layer lastLayer = null; 238 238 int layerCnt = 0; 239 239 240 240 for (Layer l : data) { 241 241 if (l instanceof GpxLayer) { … … 261 261 } 262 262 }); 263 263 264 264 JCheckBox dropFirst = new JCheckBox(tr("Drop existing path")); 265 265 266 266 panel.add(layerList); 267 267 panel.add(dropFirst); 268 268 269 269 final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ 270 270 @Override … … 275 275 final JDialog dlg = optionPane.createDialog(Main.parent, tr("Import path from GPX layer")); 276 276 dlg.setVisible(true); 277 277 278 278 Object answer = optionPane.getValue(); 279 279 if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || … … 281 281 return; 282 282 } 283 284 GpxLayer gpx = (GpxLayer)layerList.getSelectedValue();283 284 GpxLayer gpx = layerList.getSelectedValue(); 285 285 if (dropFirst.isSelected()) { 286 points = new ArrayList< WayPoint>(32);286 points = new ArrayList<>(32); 287 287 } 288 288
Note:
See TracChangeset
for help on using the changeset viewer.