Changeset 2471 in josm
- Timestamp:
- 2009-11-18T18:50:38+01:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r2444 r2471 10 10 import java.util.Collection; 11 11 import java.util.Collections; 12 import java.util.logging.Logger; 12 13 13 14 import javax.swing.JOptionPane; … … 138 139 */ 139 140 static class UpdatePrimitivesTask extends PleaseWaitRunnable { 141 static private final Logger logger = Logger.getLogger(UpdatePrimitivesTask.class.getName()); 142 140 143 private DataSet ds; 141 144 private boolean canceled; … … 144 147 private MultiFetchServerObjectReader reader; 145 148 149 /** 150 * 151 * @param toUpdate a collection of primitives to update from the server 152 */ 146 153 public UpdatePrimitivesTask(Collection<? extends OsmPrimitive> toUpdate) { 147 154 super(tr("Update objects"), false /* don't ignore exception*/); … … 166 173 return; 167 174 } 168 if (ds != null) { 169 Main.ma p.mapView.getEditLayer().mergeFrom(ds);170 Main.ma p.mapView.getEditLayer().onPostDownloadFromServer();175 if (ds != null && Main.main.getEditLayer() != null) { 176 Main.main.getEditLayer().mergeFrom(ds); 177 Main.main.getEditLayer().onPostDownloadFromServer(); 171 178 } 172 179 } … … 202 209 } 203 210 } 211 204 212 205 213 @Override -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r2444 r2471 83 83 if (mergeById(source)) 84 84 return; 85 if (!source.isVisible()) 86 87 return; 85 //if (!source.isVisible()) 86 // ignore it 87 // return; 88 88 } else { 89 89 // try to merge onto a primitive which has no id assigned … … 236 236 * Tries to merge a primitive <code>source</code> into an existing primitive with the same id. 237 237 * 238 * @param source the otherprimitive which is to be mergedonto aprimitivein my primitives238 * @param source the source primitive which is to be merged into a target primitive 239 239 * @return true, if this method was able to merge <code>source</code> into a target object; false, otherwise 240 240 */ -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r2455 r2471 7 7 import java.util.HashMap; 8 8 import java.util.List; 9 import java.util.concurrent.atomic.AtomicLong; 9 10 10 11 /** … … 18 19 */ 19 20 public class User { 20 static private long uidCounter = 0; 21 22 static private AtomicLong uidCounter = new AtomicLong(); 23 21 24 /** 22 25 * the map of known users … … 27 30 private static long getNextLocalUid() { 28 31 synchronized(User.class) { 29 uidCounter--; 30 return uidCounter; 32 return uidCounter.decrementAndGet(); 31 33 } 32 34 } … … 60 62 } 61 63 64 /** 65 * clears the static map of user ids to user objects 66 * 67 */ 68 public static void clearUserMap() { 69 userMap.clear(); 70 } 62 71 63 72 /** -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r2443 r2471 17 17 import java.util.logging.Logger; 18 18 19 import org.junit.Before; 19 20 import org.junit.BeforeClass; 20 21 import org.junit.Test; … … 62 63 } 63 64 65 @Before 66 public void setUp() { 67 User.clearUserMap(); 68 } 69 64 70 /** 65 71 * two identical nodes, even in id and version. No confict expected. … … 348 354 /** 349 355 * their node is not visible and doesn't exist in my data set 350 * => ignore their node 356 * => we can't ignore it because we'd run into troubles in case of multi fetch 357 * which can return invisible objects 351 358 * 352 359 */ … … 373 380 Node n2 = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE); 374 381 assertEquals(0,visitor.getConflicts().size()); 375 assertEquals( 1, my.getNodes().size());382 assertEquals(2, my.getNodes().size()); 376 383 assertEquals(n,n2); 377 384 } … … 775 782 theirWay.addNode(n3); 776 783 theirWay.addNode(n4); 777 theirWay.setUser(User.createOsmUser(1111, "their")); 784 User user = User.createOsmUser(1111, "their"); 785 theirWay.setUser(user); 778 786 theirWay.setTimestamp(new Date()); 779 787 their.addPrimitive(theirWay); … … 895 903 theirWay.addNode(n4); 896 904 theirWay.addNode(n5); 897 theirWay.setUser(User.createOsmUser(1111, "their")); 905 User user = User.getById(1111); 906 if (user == null) { 907 User.createOsmUser(1111, "their"); 908 } 909 theirWay.setUser(user); 898 910 theirWay.setTimestamp(new Date()); 899 911 their.addPrimitive(theirWay); … … 1081 1093 assertTrue(!w.getNode(1).incomplete); 1082 1094 } 1095 1083 1096 }
Note:
See TracChangeset
for help on using the changeset viewer.