Changeset 187 in josm


Ignore:
Timestamp:
2007-01-04T23:30:59+01:00 (18 years ago)
Author:
imi
Message:
  • fixed bug when merging unchanged segments over new ones
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/osm/Segment.java

    r100 r187  
    8484                if (incomplete)
    8585                        return ((Segment)osm).incomplete;
    86                 return from.equals(((Segment)osm).from) && to.equals(((Segment)osm).to);
     86                return super.realEqual(osm) && from.equals(((Segment)osm).from) && to.equals(((Segment)osm).to);
    8787        }
    8888
  • test/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java

    r159 r187  
    2828                n = DataSetTestCaseHelper.createNode(null);
    2929        }
     30
     31
     32        private Segment createSegment(DataSet ds, boolean incomplete, boolean deleted, int id) {
     33        Node n1 = DataSetTestCaseHelper.createNode(ds);
     34        Node n2 = DataSetTestCaseHelper.createNode(ds);
     35        Segment s = DataSetTestCaseHelper.createSegment(ds, n1, n2);
     36        s.incomplete = incomplete;
     37        s.id = id;
     38        s.deleted = deleted;
     39        s.timestamp = new Date();
     40        return s;
     41    }
     42
     43
     44        /**
     45     * Create that amount of nodes and add them to the dataset. The id will be 1,2,3,4...
     46     * @param amount Number of nodes to create.
     47     * @return The created nodes.
     48     */
     49    private Node[] createNodes(DataSet ds, int amount) {
     50        Node[] nodes = new Node[amount];
     51        for (int i = 0; i < amount; ++i) {
     52                nodes[i] = DataSetTestCaseHelper.createNode(ds);
     53                nodes[i].id = i+1;
     54        }
     55        return nodes;
     56    }
    3057
    3158
     
    279306                assertEquals(1, v.conflicts.size());
    280307        }
    281 
    282 
    283         private Segment createSegment(DataSet ds, boolean incomplete, boolean deleted, int id) {
    284                 Node n1 = DataSetTestCaseHelper.createNode(ds);
    285                 Node n2 = DataSetTestCaseHelper.createNode(ds);
    286                 Segment s = DataSetTestCaseHelper.createSegment(ds, n1, n2);
    287                 s.incomplete = incomplete;
    288                 s.id = id;
    289                 s.deleted = deleted;
    290                 s.timestamp = new Date();
    291                 return s;
    292         }
    293308       
    294         /**
    295          * Create that amount of nodes and add them to the dataset. The id will be 1,2,3,4...
    296          * @param amount Number of nodes to create.
    297          * @return The created nodes.
    298          */
    299         private Node[] createNodes(DataSet ds, int amount) {
    300                 Node[] nodes = new Node[amount];
    301                 for (int i = 0; i < amount; ++i) {
    302                         nodes[i] = DataSetTestCaseHelper.createNode(ds);
    303                         nodes[i].id = i+1;
    304                 }
    305                 return nodes;
    306         }
    307309}
Note: See TracChangeset for help on using the changeset viewer.