Changeset 2363 in josm
- Timestamp:
- 2009-10-31T19:56:25+01:00 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.settings/org.eclipse.jdt.ui.prefs
r1682 r2363 1 # Mon Jun 08 20:01:40 CEST 20091 #Sat Oct 31 19:47:16 CET 2009 2 2 cleanup_settings_version=2 3 3 eclipse.preferences.version=1 … … 31 31 sp_cleanup.never_use_parentheses_in_expressions=true 32 32 sp_cleanup.on_save_use_additional_actions=true 33 sp_cleanup.organize_imports= false33 sp_cleanup.organize_imports=true 34 34 sp_cleanup.qualify_static_field_accesses_with_declaring_class=false 35 35 sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r2284 r2363 112 112 113 113 @Override public String toString() { 114 if (coor == null) return "{Node id="+getId()+"}";115 return "{Node id=" +getId()+",version="+getVersion()+",lat="+coor.lat()+",lon="+coor.lon()+"}";114 String coorDesc = coor == null?"":"lat="+coor.lat()+",lon="+coor.lon(); 115 return "{Node id=" + getUniqueId() + " version=" + getVersion() + " " + getFlagsAsString() + " " + coorDesc+"}"; 116 116 } 117 117 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2341 r2363 490 490 */ 491 491 @Override public boolean equals(Object obj) { 492 if (isNew()) return obj == this;493 492 if (obj instanceof OsmPrimitive) 494 493 return ((OsmPrimitive)obj).id == id && obj.getClass() == getClass(); … … 502 501 */ 503 502 @Override public final int hashCode() { 504 if (id == 0)505 return super.hashCode();506 503 final int[] ret = new int[1]; 507 504 Visitor v = new Visitor(){ … … 512 509 }; 513 510 visit(v); 514 return id == 0 ? super.hashCode() :(int)(id<<2)+ret[0];511 return (int)(id<<2)+ret[0]; 515 512 } 516 513 … … 832 829 } 833 830 831 protected String getFlagsAsString() { 832 833 StringBuilder builder = new StringBuilder(); 834 835 if (isModified()) { 836 builder.append("M"); 837 } 838 if (isVisible()) { 839 builder.append("V"); 840 } 841 if (isDeleted()) { 842 builder.append("D"); 843 } 844 if (isFiltered()) { 845 builder.append("f"); 846 } 847 848 if (isDeleted()) { 849 builder.append("d"); 850 } 851 852 return builder.toString(); 853 } 854 834 855 } 835 856 -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r2308 r2363 171 171 for (RelationMemberData member:relationData.getMembers()) { 172 172 switch (member.getMemberType()) { 173 174 175 176 177 178 179 180 181 173 case NODE: 174 nodes.put(member.getMemberId(), nodeMarker); 175 break; 176 case WAY: 177 ways.put(member.getMemberId(), wayMarker); 178 break; 179 case RELATION: 180 relations.put(member.getMemberId(), relationMarker); 181 break; 182 182 } 183 183 } … … 203 203 OsmPrimitive foundMember = null; 204 204 switch (member.getMemberType()) { 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 205 case NODE: 206 foundMember = nodes.get(member.getMemberId()); 207 if (foundMember == nodeMarker) 208 throw new AssertionError("Data consistency problem - relation with missing member detected"); 209 break; 210 case WAY: 211 foundMember = ways.get(member.getMemberId()); 212 if (foundMember == wayMarker) 213 throw new AssertionError("Data consistency problem - relation with missing member detected"); 214 break; 215 case RELATION: 216 foundMember = relations.get(member.getMemberId()); 217 if (foundMember == relationMarker) 218 throw new AssertionError("Data consistency problem - relation with missing member detected"); 219 break; 220 220 } 221 221 newMembers.add(new RelationMember(member.getRole(), foundMember)); … … 234 234 235 235 @Override public String toString() { 236 // return "{Relation id="+id+" version="+version+" members="+Arrays.toString(members.toArray())+"}"; 237 // adding members in string increases memory usage a lot and overflows for looped relations 238 return "{Relation id="+getId()+" version="+getVersion()+"}"; 236 StringBuilder result = new StringBuilder(); 237 result.append("{Relation id="); 238 result.append(getUniqueId()); 239 result.append(" version="); 240 result.append(getVersion()); 241 result.append(" ["); 242 for (RelationMember rm:getMembers()) { 243 result.append(OsmPrimitiveType.from(rm.getMember())); 244 result.append(" "); 245 result.append(rm.getMember().getUniqueId()); 246 result.append(", "); 247 } 248 result.delete(result.length()-2, result.length()); 249 result.append("]"); 250 result.append("}"); 251 return result.toString(); 239 252 } 240 253 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r2305 r2363 173 173 * @param dataSet Dataset this way is part of. This parameter will be removed in future 174 174 */ 175 @Override 175 176 public void load(PrimitiveData data, DataSet dataSet) { 176 177 super.load(data, dataSet); … … 195 196 if (node != marker) { 196 197 newNodes.add(foundNodes.get(nodeId)); 197 } else {198 } else 198 199 throw new AssertionError("Data consistency problem - way with missing node detected"); 199 }200 200 } 201 201 setNodes(newNodes); … … 219 219 220 220 @Override public String toString() { 221 if (incomplete) return "{Way id="+getId()+" version="+getVersion()+" (incomplete)}";222 return "{Way id=" +getId()+" version="+getVersion()+" nodes="+Arrays.toString(nodes)+"}";221 String nodesDesc = incomplete?"(incomplete)":"nodes=" + Arrays.toString(nodes); 222 return "{Way id=" + getUniqueId() + " version=" + getVersion()+ " " + getFlagsAsString() + " " + nodesDesc + "}"; 223 223 } 224 224
Note:
See TracChangeset
for help on using the changeset viewer.