Ignore:
Timestamp:
2011-03-19T18:06:54+01:00 (14 years ago)
Author:
guggis
Message:

'fixed broken test cases submitted by Lennard; fixed ant script again'

Location:
applications/editors/josm/plugins/contourmerge
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/contourmerge/build.xml

    r25381 r25617  
    2727<project name="contourmerge" default="dist" basedir=".">
    2828
    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" />
    3030        <property name="plugin.main.version" value="3835" />
    3131
     
    7272        <target name="dist" depends="compile,revision">
    7373                <echo message="creating ${plugin.jar} for version ${version.entry.commit.revision} ... " />
    74                 <copy todir="${plugin.build.dir}/images">
     74                <copy todir="${plugin.build.dir}">
    7575                        <fileset dir="images">
    7676                                <exclude name="*.svg" />
  • applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/ContourMergeModel.java

    r25379 r25617  
    3939 */
    4040public 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());
    4242       
    4343        private OsmDataLayer layer;     
     
    398398                List<Node> targetNodes = dropTarget.getNodes();
    399399                if (! areDirectionAligned(dragSource, dropTarget)) {
    400                         logger.info("not direction aligned !");
    401400                        Collections.reverse(targetNodes);
    402401                }
     
    405404                cmds.add(new ChangeCommand(dragSource.getWay(), dragSource.replaceNodes(targetNodes)));
    406405               
    407                 // the command to delete nodes we don't need anymore
     406                // the commands to delete nodes we don't need anymore
    408407                for (Node n: dragSource.getNodes()) {
    409408                        List<OsmPrimitive> parents = n.getReferrers();
     
    418417        }
    419418       
     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       
    420427        /**
    421428         * <p>Replies true, if the two polylines given by the node lists {@code n1} and
     
    429436         */
    430437        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                 */
    431448                EastNorth s1 = n1.get(0).getEastNorth();
    432449                EastNorth s2 = n1.get(n1.size()-1).getEastNorth();
     
    438455                Line2D l2 = new Line2D.Double(s2.getX(), s2.getY(), t2.getX(),t2.getY());
    439456                return ! l1.intersectsLine(l2);
    440 
    441457        }
    442458       
     
    452468                if (dragSource == null) return false;
    453469                if (dropTarget == null) return false;
     470               
    454471                return areDirectionAligned(dragSource.getNodes(), dropTarget.getNodes());
    455472        }
  • applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/ContourMergeView.java

    r25379 r25617  
    2525 */
    2626public 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());
    2828       
    2929        static private ContourMergeView instance;
     
    4848                Node n = ContourMergePlugin.getModelManager().getActiveModel().getFeedbackNode();
    4949                if (n == null) return;
    50                 /* currently no decoration - mouse pointer is chaning if mouse over a node */
     50                /* currently no decoration - mouse pointer is changing if mouse over a node */
    5151        }
    5252       
     
    322322                ContourMergeModel model = ContourMergePlugin.getModelManager().getActiveModel();
    323323                if (model == null) return;
     324                if (!model.getLayer().isVisible()) return;
    324325                decorateSelectedNodes(g, mv, bbox);
    325326                decorateFeedbackNode(g, mv, bbox);             
  • applications/editors/josm/plugins/contourmerge/src/org/openstreetmap/josm/plugins/contourmerge/WaySlice.java

    r24969 r25617  
    1616 */
    1717public class WaySlice {
    18         static private final Logger logger = Logger.getLogger(WaySlice.class.getName());
     18        //static private final Logger logger = Logger.getLogger(WaySlice.class.getName());
    1919
    2020        private Way w;
     
    288288                                nodes.addAll(w.getNodes().subList(start, end+1));
    289289                        } else {
    290                                 for (int i=start; i>=0; i--) nodes.add(w.getNode(i));
    291290                                // 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));
    293293                        }
    294294                }
Note: See TracChangeset for help on using the changeset viewer.