Changeset 3129 in josm for trunk/src/org
- Timestamp:
- 2010-03-13T15:34:25+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r3116 r3129 55 55 private static final int FLAG_TAGGED = 1 << 6; 56 56 private static final int FLAG_DIRECTION_REVERSED = 1 << 7; 57 private static final int FLAG_HIGHLIGHTED = 1 << 8; 58 private static final int FLAG_INCOMPLETE = 1 << 9; 57 59 58 60 /** … … 119 121 /* mappaint data */ 120 122 public ElemStyle mappaintStyle = null; 121 public IntegermappaintDrawnCode = 0;123 public int mappaintDrawnCode = 0; 122 124 123 125 /* This should not be called from outside. Fixing the UI to add relevant … … 168 170 } 169 171 170 private volatile byteflags = FLAG_VISIBLE; // visible per default172 private volatile short flags = FLAG_VISIBLE; // visible per default 171 173 172 174 /** … … 175 177 */ 176 178 private User user = null; 177 178 /**179 * If set to true, this object is incomplete, which means only the id180 * and type is known (type is the objects instance class)181 */182 private boolean incomplete = false;183 179 184 180 /** … … 333 329 */ 334 330 public boolean isUsable() { 335 return !isDeleted() && !isIncomplete() && !isDisabled(); 336 } 337 338 public boolean isDrawable() 339 { 340 return !isDeleted() && !isIncomplete() && !isFiltered(); 331 return (flags & (FLAG_DELETED + FLAG_INCOMPLETE + FLAG_DISABLED)) == 0; 332 } 333 334 public boolean isDrawable() { 335 return (flags & (FLAG_DELETED + FLAG_INCOMPLETE + FLAG_FILTERED)) == 0; 341 336 } 342 337 … … 470 465 return timestamp == 0; 471 466 } 472 473 /**474 * If set to true, this object is highlighted. Currently this is only used to475 * show which ways/nodes will connect476 */477 private volatile boolean highlighted = false;478 467 479 468 private int timestamp; … … 1270 1259 } 1271 1260 1261 /** 1262 * If set to true, this object is incomplete, which means only the id 1263 * and type is known (type is the objects instance class) 1264 */ 1272 1265 private void setIncomplete(boolean incomplete) { 1273 if (dataSet != null && incomplete != this.i ncomplete) {1266 if (dataSet != null && incomplete != this.isIncomplete()) { 1274 1267 if (incomplete) { 1275 1268 dataSet.firePrimitivesRemoved(Collections.singletonList(this), true); … … 1278 1271 } 1279 1272 } 1280 this.incomplete = incomplete; 1273 if (incomplete) { 1274 flags |= FLAG_INCOMPLETE; 1275 } else { 1276 flags &= ~FLAG_INCOMPLETE; 1277 } 1281 1278 } 1282 1279 1283 1280 public boolean isIncomplete() { 1284 return incomplete;1281 return (flags & FLAG_INCOMPLETE) != 0; 1285 1282 } 1286 1283 … … 1290 1287 1291 1288 public void setHighlighted(boolean highlighted) { 1292 if (this.highlighted != highlighted) { 1293 this.highlighted = highlighted; 1289 if (isHighlighted() != highlighted) { 1290 if (highlighted) { 1291 flags |= FLAG_HIGHLIGHTED; 1292 } else { 1293 flags &= ~FLAG_HIGHLIGHTED; 1294 } 1294 1295 if (dataSet != null) { 1295 1296 dataSet.fireHighlightingChanged(this); … … 1299 1300 1300 1301 public boolean isHighlighted() { 1301 return highlighted;1302 return (flags & FLAG_HIGHLIGHTED) != 0; 1302 1303 } 1303 1304 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r2971 r3129 32 32 import org.openstreetmap.josm.data.osm.RelationMember; 33 33 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 34 import org.openstreetmap.josm.data.osm.Storage; 34 35 import org.openstreetmap.josm.data.osm.User; 35 36 import org.openstreetmap.josm.data.osm.Way; … … 119 120 private long currentExternalId; 120 121 private String generator; 122 private Storage<String> internedStrings = new Storage<String>(); 123 124 // Memory optimization - see #2312 125 private String intern(String s) { 126 String result = internedStrings.get(s); 127 if (result == null) { 128 internedStrings.put(s); 129 return s; 130 } else 131 return result; 132 } 121 133 122 134 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 135 123 136 if (qName.equals("osm")) { 124 137 if (atts == null) { … … 258 271 String key = atts.getValue("k"); 259 272 String value = atts.getValue("v"); 260 currentPrimitive.put(key, value); 273 currentPrimitive.put(intern(key), intern(value)); 274 261 275 } else { 262 276 System.out.println(tr("Undefined element ''{0}'' found in input stream. Skipping.", qName));
Note:
See TracChangeset
for help on using the changeset viewer.