Changeset 25617 in osm for applications/editors/josm/plugins/contourmerge
- Timestamp:
- 2011-03-19T18:06:54+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/contourmerge
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/contourmerge/build.xml
r25381 r25617 27 27 <project name="contourmerge" default="dist" basedir="."> 28 28 29 <property name="commit.message" value=" Fixed: unexpected intersections after drag-and-drop" />29 <property name="commit.message" value="fixed broken test cases submitted by Lennard; fixed ant script again" /> 30 30 <property name="plugin.main.version" value="3835" /> 31 31 … … 72 72 <target name="dist" depends="compile,revision"> 73 73 <echo message="creating ${plugin.jar} for version ${version.entry.commit.revision} ... " /> 74 <copy todir="${plugin.build.dir} /images">74 <copy todir="${plugin.build.dir}"> 75 75 <fileset dir="images"> 76 76 <exclude name="*.svg" /> -
applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/ContourMergeModel.java
r25379 r25617 39 39 */ 40 40 public class ContourMergeModel implements DataSetListener{ 41 static private final Logger logger = Logger.getLogger(ContourMergeModel.class.getName());41 //static private final Logger logger = Logger.getLogger(ContourMergeModel.class.getName()); 42 42 43 43 private OsmDataLayer layer; … … 398 398 List<Node> targetNodes = dropTarget.getNodes(); 399 399 if (! areDirectionAligned(dragSource, dropTarget)) { 400 logger.info("not direction aligned !");401 400 Collections.reverse(targetNodes); 402 401 } … … 405 404 cmds.add(new ChangeCommand(dragSource.getWay(), dragSource.replaceNodes(targetNodes))); 406 405 407 // the command to delete nodes we don't need anymore406 // the commands to delete nodes we don't need anymore 408 407 for (Node n: dragSource.getNodes()) { 409 408 List<OsmPrimitive> parents = n.getReferrers(); … … 418 417 } 419 418 419 protected boolean haveSameStartAndEndNode(List<Node> n1, List<Node> n2) { 420 return n1.get(0) == n2.get(0) && n1.get(n1.size()-1) == n2.get(n2.size()-1); 421 } 422 423 protected boolean haveReversedStartAndEndeNode(List<Node> n1, List<Node> n2) { 424 return n1.get(0) == n2.get(n2.size()-1) && n1.get(n1.size()-1) == n2.get(0); 425 } 426 420 427 /** 421 428 * <p>Replies true, if the two polylines given by the node lists {@code n1} and … … 429 436 */ 430 437 protected boolean areDirectionAligned(List<Node> n1, List<Node> n2) { 438 /* 439 * Check whether n1 and n2 start and end at the same nodes 440 */ 441 if (haveSameStartAndEndNode(n1, n2)) return true; 442 if (haveReversedStartAndEndeNode(n1,n2)) return false; 443 /* 444 * n1 and n2 have different start or end nodes. Draw an imaginary line 445 * from the start of n1 to start of n2 and from the end of n1 to the end 446 * of n2 and check whether they intersect. 447 */ 431 448 EastNorth s1 = n1.get(0).getEastNorth(); 432 449 EastNorth s2 = n1.get(n1.size()-1).getEastNorth(); … … 438 455 Line2D l2 = new Line2D.Double(s2.getX(), s2.getY(), t2.getX(),t2.getY()); 439 456 return ! l1.intersectsLine(l2); 440 441 457 } 442 458 … … 452 468 if (dragSource == null) return false; 453 469 if (dropTarget == null) return false; 470 454 471 return areDirectionAligned(dragSource.getNodes(), dropTarget.getNodes()); 455 472 } -
applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/ContourMergeView.java
r25379 r25617 25 25 */ 26 26 public class ContourMergeView implements MapViewPaintable{ 27 static private final Logger logger = Logger.getLogger(ContourMergeView.class.getName());27 //static private final Logger logger = Logger.getLogger(ContourMergeView.class.getName()); 28 28 29 29 static private ContourMergeView instance; … … 48 48 Node n = ContourMergePlugin.getModelManager().getActiveModel().getFeedbackNode(); 49 49 if (n == null) return; 50 /* currently no decoration - mouse pointer is chan ing if mouse over a node */50 /* currently no decoration - mouse pointer is changing if mouse over a node */ 51 51 } 52 52 … … 322 322 ContourMergeModel model = ContourMergePlugin.getModelManager().getActiveModel(); 323 323 if (model == null) return; 324 if (!model.getLayer().isVisible()) return; 324 325 decorateSelectedNodes(g, mv, bbox); 325 326 decorateFeedbackNode(g, mv, bbox); -
applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/WaySlice.java
r24969 r25617 16 16 */ 17 17 public class WaySlice { 18 static private final Logger logger = Logger.getLogger(WaySlice.class.getName());18 //static private final Logger logger = Logger.getLogger(WaySlice.class.getName()); 19 19 20 20 private Way w; … … 288 288 nodes.addAll(w.getNodes().subList(start, end+1)); 289 289 } else { 290 for (int i=start; i>=0; i--) nodes.add(w.getNode(i));291 290 // do not add the last node which is the join node common to the node at index 0 292 for (int i=w.getNodesCount()-2; i>=end; i--) nodes.add(w.getNode(i)); 291 for (int i=end; i<=w.getNodesCount()-2;i++)nodes.add(w.getNode(i)); 292 for (int i=0; i <= start; i++) nodes.add(w.getNode(i)); 293 293 } 294 294 }
Note:
See TracChangeset
for help on using the changeset viewer.