Changeset 2388 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
- Timestamp:
- 2009-11-02T21:04:32+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
r2381 r2388 98 98 */ 99 99 protected <P extends OsmPrimitive> void mergePrimitive(P other, 100 Collection<P> myPrimitives, Collection<P> otherPrimitives, 101 HashMap<Long, P> primitivesWithDefinedIds) { 100 DataSet myDataset, Collection<P> myPrimitives, HashMap<Long, P> primitivesWithDefinedIds) { 102 101 103 102 if (!other.isNew() ) { … … 105 104 // defined id 106 105 // 107 if (mergeById( myPrimitives,primitivesWithDefinedIds, other))106 if (mergeById(primitivesWithDefinedIds, other)) 108 107 return; 109 108 } else { … … 136 135 // my dataset. Just add other to my dataset. 137 136 // 138 my Primitives.add(other);137 myDataset.addPrimitive(other); 139 138 } 140 139 141 140 public void visit(Node other) { 142 mergePrimitive(other, myDataSet .nodes, theirDataSet.nodes, nodeshash);141 mergePrimitive(other, myDataSet, myDataSet.getNodes(), nodeshash); 143 142 } 144 143 145 144 public void visit(Way other) { 146 145 fixWay(other); 147 mergePrimitive(other, myDataSet .ways, theirDataSet.ways, wayshash);146 mergePrimitive(other, myDataSet, myDataSet.getWays(), wayshash); 148 147 } 149 148 150 149 public void visit(Relation other) { 151 150 fixRelation(other); 152 mergePrimitive(other, myDataSet .relations, theirDataSet.relations, relshash);151 mergePrimitive(other, myDataSet, myDataSet.getRelations(), relshash); 153 152 } 154 153 … … 230 229 * Tries to merge a primitive <code>other</code> into an existing primitive with the same id. 231 230 * 232 * @param myPrimitives the complete set of my primitives (potential merge targets)233 231 * @param myPrimitivesWithDefinedIds the map of primitives (potential merge targets) with an id <> 0, for faster lookup 234 232 * by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a … … 237 235 * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise 238 236 */ 239 private <P extends OsmPrimitive> boolean mergeById( 240 Collection<P> myPrimitives, HashMap<Long, P> myPrimitivesWithDefinedIds, P other) { 237 private <P extends OsmPrimitive> boolean mergeById(HashMap<Long, P> myPrimitivesWithDefinedIds, P other) { 241 238 242 239 // merge other into an existing primitive with the same id, if possible
Note:
See TracChangeset
for help on using the changeset viewer.