Changeset 34840 in osm for applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap
- Timestamp:
- 2019-01-17T15:57:36+01:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
r34817 r34840 91 91 } 92 92 // Fix #7341. Find the first way having all nodes in common to sort them in its nodes order 93 List<Node> consideredNodes = Arrays.asList(n ew Node[]{n1, n2, n3});93 List<Node> consideredNodes = Arrays.asList(n1, n2, n3); 94 94 for (Way w : selectedWays) { 95 95 final List<Node> nodes = w.getNodes(); … … 116 116 } 117 117 118 119 118 EastNorth p1 = n1.getEastNorth(); 120 119 EastNorth p2 = n2.getEastNorth(); 121 120 EastNorth p3 = n3.getEastNorth(); 122 // TODO: Check that the points are distinct 121 122 // make sure that points are different 123 if (p1.equals(p2) || p1.equals(p3) || p2.equals(p3)) { 124 return null; 125 } 123 126 124 127 // // Calculate the new points in the arc … … 249 252 double startAngle = realA1; 250 253 // Transform the angles to get a consistent starting point 251 //double a1 = 0;252 254 double a2 = normalizeAngle(realA2 - startAngle); 253 255 double a3 = normalizeAngle(realA3 - startAngle); … … 261 263 // make the angles consistent with the direction. 262 264 a2 = (Math.PI * 2 - a2); 263 a3 = (Math.PI * 2 - a3);264 265 } 265 266 int numberOfNodesInArc = Math.max((int) Math.ceil((radialLength / Math.PI) * 180 / angleSeparation)+1, -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java
r34454 r34840 11 11 import java.util.List; 12 12 13 import javax.swing.JOptionPane; 14 13 15 import org.openstreetmap.josm.actions.JosmAction; 14 16 import org.openstreetmap.josm.command.Command; … … 18 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.gui.Notification; 20 23 import org.openstreetmap.josm.spi.preferences.Config; 21 24 import org.openstreetmap.josm.tools.Shortcut; … … 61 64 62 65 Collection<Command> cmds = CircleArcMaker.doCircleArc(selectedNodes, selectedWays, angleSeparation); 63 if (cmds != null) 66 if (cmds == null || cmds.isEmpty()) { 67 new Notification(tr("Could not use selection to create a curve")).setIcon(JOptionPane.WARNING_MESSAGE).show(); 68 69 } else { 64 70 UndoRedoHandler.getInstance().add(new SequenceCommand("Create a curve", cmds)); 71 } 65 72 } 66 73
Note:
See TracChangeset
for help on using the changeset viewer.