- Timestamp:
- 2009-09-13T22:23:19+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r2101 r2120 286 286 public void build(DataSet ds) { 287 287 for (Relation r: ds.relations) { 288 if ( r.isDeleted() || r.incomplete) {288 if (!r.isUsable()) { 289 289 continue; 290 290 } -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r2025 r2120 102 102 for (Node n : selectedNodes) { 103 103 for (Way w : getCurrentDataSet().ways) { 104 if ( w.isDeleted() || w.incomplete) {104 if (!w.isUsable()) { 105 105 continue; 106 106 } … … 293 293 294 294 for (Relation r : getCurrentDataSet().relations) { 295 if ( r.isDeleted() || r.incomplete) {295 if (!r.isUsable()) { 296 296 continue; 297 297 } -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r2070 r2120 66 66 int count = 0; 67 67 for (Way w : getCurrentDataSet().ways) { 68 if ( w.isDeleted() || w.incomplete|| w.getNodesCount() < 1) {68 if (!w.isUsable() || w.getNodesCount() < 1) { 69 69 continue; 70 70 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r2110 r2120 767 767 Way way = null; 768 768 for (Way w : getCurrentDataSet().ways) { 769 if ( w.isDeleted() || w.incomplete|| w.getNodesCount() < 1) {769 if (!w.isUsable() || w.getNodesCount() < 1) { 770 770 continue; 771 771 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2115 r2120 184 184 } 185 185 186 public void setFiltered(Collection<? extends OsmPrimitive> selection) { 187 clearFiltered(nodes); 188 clearFiltered(ways); 189 clearFiltered(relations); 190 for (OsmPrimitive osm : selection) { 191 osm.setFiltered(true); 192 } 193 } 194 195 public void setFiltered(OsmPrimitive... osm) { 196 if (osm.length == 1 && osm[0] == null) { 197 setFiltered(); 198 return; 199 } 200 clearFiltered(nodes); 201 clearFiltered(ways); 202 clearFiltered(relations); 203 for (OsmPrimitive o : osm) 204 if (o != null) { 205 o.setFiltered(true); 206 } 207 } 208 209 public void setDisabled(Collection<? extends OsmPrimitive> selection) { 210 clearDisabled(nodes); 211 clearDisabled(ways); 212 clearDisabled(relations); 213 for (OsmPrimitive osm : selection) { 214 osm.setDisabled(true); 215 } 216 } 217 218 public void setDisabled(OsmPrimitive... osm) { 219 if (osm.length == 1 && osm[0] == null) { 220 setDisabled(); 221 return; 222 } 223 clearDisabled(nodes); 224 clearDisabled(ways); 225 clearDisabled(relations); 226 for (OsmPrimitive o : osm) 227 if (o != null) { 228 o.setDisabled(true); 229 } 230 } 231 186 232 public void setSelected(Collection<? extends OsmPrimitive> selection) { 187 233 clearSelection(nodes); … … 207 253 } 208 254 fireSelectionChanged(Arrays.asList(osm)); 255 } 256 257 /** 258 * Remove the filtered parameter from every value in the collection. 259 * @param list The collection to remove the filtered parameter from. 260 */ 261 private void clearFiltered(Collection<? extends OsmPrimitive> list) { 262 if (list == null) 263 return; 264 for (OsmPrimitive osm : list) { 265 osm.setFiltered(false); 266 } 267 } 268 /** 269 * Remove the disabled parameter from every value in the collection. 270 * @param list The collection to remove the disabled parameter from. 271 */ 272 private void clearDisabled(Collection<? extends OsmPrimitive> list) { 273 if (list == null) 274 return; 275 for (OsmPrimitive osm : list) { 276 osm.setDisabled(false); 277 } 209 278 } 210 279 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2115 r2120 96 96 * new to the server! To create a new object, call the default constructor of 97 97 * the respective class. 98 * 98 * 99 99 */ 100 100 private long id = 0; … … 105 105 * Deleted objects are deleted from the server. If the objects are added (id=0), 106 106 * the modified is ignored and the object is added to the server. 107 * 107 * 108 108 */ 109 109 private boolean modified = false; … … 111 111 /** 112 112 * <code>true</code>, if the object has been deleted. 113 * 113 * 114 114 */ 115 115 private boolean deleted = false; … … 119 119 * introduced with the 0.4 API to be able to communicate deleted objects 120 120 * (they will have visible=false). 121 * 121 * 122 122 */ 123 123 private boolean visible = true; 124 125 /** 126 * <code>true</code>, if the object has been set inactive 127 * 128 */ 129 private boolean disabled = false; 130 131 /** 132 * <code>true</code>, if the object has been filtered out 133 * 134 */ 135 private boolean filtered = false; 124 136 125 137 /** … … 131 143 /** 132 144 * If set to true, this object is currently selected. 133 * 145 * 134 146 */ 135 147 private volatile boolean selected = false; … … 149 161 /** 150 162 * Creates a new primitive with id 0. 151 * 163 * 152 164 */ 153 165 public OsmPrimitive() { … … 158 170 * Creates a new primitive for the given id. If the id > 0, the primitive is marked 159 171 * as incomplete. 160 * 172 * 161 173 * @param id the id. > 0 required 162 174 * @throws IllegalArgumentException thrown if id < 0 … … 173 185 /* accessors */ 174 186 /* ------------------------------------------------------------------------------------ */ 187 /** 188 * Sets whether this primitive is disabled or not. 189 * 190 * @param selected true, if this primitive is disabled; false, otherwise 191 */ 192 public void setDisabled(boolean disabled) { 193 this.disabled = disabled; 194 } 195 196 /** 197 * Replies true, if this primitive is disabled. 198 * 199 * @return true, if this primitive is disabled 200 */ 201 public boolean isDisabled() { 202 return disabled; 203 } 204 /** 205 * Sets whether this primitive is filtered out or not. 206 * 207 * @param selected true, if this primitive is filtered out; false, otherwise 208 */ 209 public void setFiltered(boolean filtered) { 210 this.filtered = filtered; 211 } 212 /** 213 * Replies true, if this primitive is filtered out. 214 * 215 * @return true, if this primitive is filtered out 216 */ 217 public boolean isFiltered() { 218 return filtered; 219 } 175 220 176 221 /** 177 222 * Sets whether this primitive is selected or not. 178 * 223 * 179 224 * @param selected true, if this primitive is selected; false, otherwise 180 225 * @since 1899 … … 185 230 /** 186 231 * Replies true, if this primitive is selected. 187 * 232 * 188 233 * @return true, if this primitive is selected 189 234 * @since 1899 … … 195 240 /** 196 241 * Marks this primitive as being modified. 197 * 242 * 198 243 * @param modified true, if this primitive is to be modified 199 244 */ … … 205 250 * Replies <code>true</code> if the object has been modified since it was loaded from 206 251 * the server. In this case, on next upload, this object will be updated. 207 * 252 * 208 253 * @return <code>true</code> if the object has been modified since it was loaded from 209 254 * the server … … 230 275 */ 231 276 public boolean isUsable() { 232 return !deleted && !incomplete ;277 return !deleted && !incomplete && !disabled; 233 278 } 234 279 … … 238 283 * Replies false, if this primitive is known on the server and has been deleted 239 284 * on the server. 240 * 285 * 241 286 * @see #setVisible(boolean) 242 287 */ … … 248 293 * Sets whether this primitive is visible, i.e. whether it is known on the server 249 294 * and not deleted on the server. 250 * 295 * 251 296 * @see #isVisible() 252 297 * @throws IllegalStateException thrown if visible is set to false on an primitive with … … 262 307 * Replies the version number as returned by the API. The version is 0 if the id is 0 or 263 308 * if this primitive is incomplete. 264 * 309 * 265 310 * @see #setVersion(int) 266 311 */ … … 271 316 /** 272 317 * Replies the id of this primitive. 273 * 318 * 274 319 * @return the id of this primitive. 275 320 */ … … 280 325 /** 281 326 * Sets the id and the version of this primitive if it is known to the OSM API. 282 * 327 * 283 328 * Since we know the id and its version it can't be incomplete anymore. incomplete 284 329 * is set to false. 285 * 330 * 286 331 * @param id the id. > 0 required 287 332 * @param version the version > 0 required … … 302 347 * Clears the id and version known to the OSM API. The id and the version is set to 0. 303 348 * incomplete is set to false. 304 * 349 * 305 350 * <strong>Caution</strong>: Do not use this method on primitives which are already added to a {@see DataSet}. 306 351 * Ways and relations might already refer to the primitive and clearing the OSM ID 307 352 * result in corrupt data. 308 * 353 * 309 354 * Here's an example use case: 310 355 * <pre> 311 356 * // create a clone of an already existing node 312 357 * Node copy = new Node(otherExistingNode); 313 * 358 * 314 359 * // reset the clones OSM id 315 360 * copy.clearOsmId(); 316 361 * </pre> 317 * 362 * 318 363 */ 319 364 public void clearOsmId() { … … 388 433 /** 389 434 * Sets whether this primitive is deleted or not. 390 * 435 * 391 436 * Also marks this primitive as modified if deleted is true and sets selected to false. 392 * 437 * 393 438 * @param deleted true, if this primitive is deleted; false, otherwise 394 439 */ … … 442 487 /** 443 488 * Replies the map of key/value pairs. Never replies null. The map can be empty, though. 444 * 489 * 445 490 * @return Keys of this primitive. Changes made in returned map are not mapped 446 491 * back to the primitive, use setKeys() to modify the keys … … 459 504 * Sets the keys of this primitives to the key/value pairs in <code>keys</code>. 460 505 * If <code>keys</code> is null removes all existing key/value pairs. 461 * 506 * 462 507 * @param keys the key/value pairs to set. If null, removes all existing key/value pairs. 463 508 * @since 1924 … … 474 519 * Set the given value to the given key. If key is null, does nothing. If value is null, 475 520 * removes the key and behaves like {@see #remove(String)}. 476 * 521 * 477 522 * @param key The key, for which the value is to be set. Can be null, does nothing in this case. 478 523 * @param value The value for the key. If null, removes the respective key/value pair. 479 * 524 * 480 525 * @see #remove(String) 481 526 */ … … 495 540 /** 496 541 * Remove the given key from the list 497 * 542 * 498 543 * @param key the key to be removed. Ignored, if key is null. 499 544 */ … … 510 555 /** 511 556 * Removes all keys from this primitive. 512 * 557 * 513 558 * @since 1843 514 559 */ … … 521 566 * Replies the value for key <code>key</code>. Replies null, if <code>key</code> is null. 522 567 * Replies null, if there is no value for the given key. 523 * 568 * 524 569 * @param key the key. Can be null, replies null in this case. 525 570 * @return the value for key <code>key</code>. … … 544 589 /** 545 590 * Replies true, if the map of key/value pairs of this primitive is not empty. 546 * 591 * 547 592 * @return true, if the map of key/value pairs of this primitive is not empty; false 548 593 * otherwise 549 * 594 * 550 595 * @since 1843 551 596 */ … … 656 701 * Replies the name of this primitive. The default implementation replies the value 657 702 * of the tag <tt>name</tt> or null, if this tag is not present. 658 * 703 * 659 704 * @return the name of this primitive 660 705 */ … … 673 718 * <li>name of the current locale</li> 674 719 * </ul> 675 * 720 * 676 721 * null, if no such tag exists 677 * 722 * 678 723 * @return the name of this primitive 679 724 */ … … 693 738 /** 694 739 * Replies the display name of a primitive formatted by <code>formatter</code> 695 * 740 * 696 741 * @return the display name 697 742 */ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r2087 r2120 159 159 } else if (n.isTagged()) { 160 160 drawNode(n, nodeColor, taggedNodeSize, taggedNodeRadius, fillUnselectedNode); 161 } else if (n.isDisabled()) { 162 drawNode(n, inactiveColor, unselectedNodeSize, unselectedNodeRadius, fillUnselectedNode); 161 163 } else { 162 164 drawNode(n, nodeColor, unselectedNodeSize, unselectedNodeRadius, fillUnselectedNode); … … 307 309 } else if(w.isSelected()) { 308 310 color = selectedColor; 311 } else if(w.isDisabled()) { 312 color = inactiveColor; 309 313 } 310 314 … … 530 534 for (RelationMember m : r.getMembers()) 531 535 { 532 if (m.isNode() && !m.getMember().incomplete && !m.getMember().isDeleted() )536 if (m.isNode() && !m.getMember().incomplete && !m.getMember().isDeleted() && !m.getMember().isFiltered()) 533 537 { 534 538 drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember()) : null, true, true); … … 1395 1399 for (final Relation osm : data.relations) 1396 1400 { 1397 if(!osm.isDeleted() && !osm.i ncomplete && osm.mappaintVisibleCode != viewid)1401 if(!osm.isDeleted() && !osm.isFiltered() && !osm.incomplete && osm.mappaintVisibleCode != viewid) 1398 1402 { 1399 1403 osm.visit(this); … … 1412 1416 for (final Way osm : data.ways) 1413 1417 { 1414 if (!osm.incomplete && !osm.isDeleted() 1418 if (!osm.incomplete && !osm.isDeleted() && !osm.isFiltered() 1415 1419 && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid) 1416 1420 { … … 1453 1457 // profilerN = 0; 1454 1458 for (final OsmPrimitive osm : data.ways) 1455 if (!osm.incomplete && !osm.isDeleted() && !osm.is Selected()1459 if (!osm.incomplete && !osm.isDeleted() && !osm.isFiltered() && !osm.isSelected() 1456 1460 && osm.mappaintVisibleCode != viewid ) 1457 1461 { … … 1492 1496 //profilerN = 0; 1493 1497 for (final OsmPrimitive osm : data.nodes) 1494 if (!osm.incomplete && !osm.isDeleted() 1498 if (!osm.incomplete && !osm.isDeleted() && (osm.isSelected() || !osm.isFiltered()) 1495 1499 && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid) 1496 1500 { … … 1512 1516 currentColor = nodeColor; 1513 1517 for (final OsmPrimitive osm : data.ways) 1514 if ( !osm.incomplete && !osm.isDeleted()1518 if (osm.isUsable() && !osm.isFiltered() 1515 1519 && osm.mappaintVisibleCode != viewid ) 1516 1520 { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r2025 r2120 149 149 //profilerN = 0; 150 150 for (final OsmPrimitive osm : data.relations) 151 if (!osm.isDeleted() && !osm.isSelected() )151 if (!osm.isDeleted() && !osm.isSelected() && !osm.isFiltered()) 152 152 { 153 153 osm.visit(this); … … 163 163 //profilerN = 0; 164 164 for (final OsmPrimitive osm : data.ways) 165 if (!osm.isDeleted() && !osm.isSelected() && osm.isTagged())165 if (!osm.isDeleted() && !osm.isSelected() && !osm.isFiltered() && osm.isTagged()) 166 166 { 167 167 osm.visit(this); … … 171 171 172 172 for (final OsmPrimitive osm : data.ways) 173 if (!osm.isDeleted() && !osm.isSelected() && !osm.is Tagged())173 if (!osm.isDeleted() && !osm.isSelected() && !osm.isFiltered() && !osm.isTagged()) 174 174 { 175 175 osm.visit(this); … … 202 202 //profilerN = 0; 203 203 for (final OsmPrimitive osm : data.nodes) 204 if (!osm.isDeleted() && !osm.isSelected() )204 if (!osm.isDeleted() && !osm.isSelected() && !osm.isFiltered()) 205 205 { 206 206 osm.visit(this); … … 220 220 currentColor = nodeColor; 221 221 for (final OsmPrimitive osm : data.ways) 222 if (!osm.isDeleted() )222 if (!osm.isDeleted() && !osm.isDisabled() && !osm.isFiltered()) 223 223 { 224 224 visitVirtual((Way)osm); … … 249 249 if (n.incomplete) return; 250 250 251 if (inactive ) {251 if (inactive || n.isDisabled()) { 252 252 drawNode(n, inactiveColor, unselectedNodeSize, unselectedNodeRadius, fillUnselectedNode); 253 253 } else if (n.highlighted) { … … 312 312 Color wayColor; 313 313 314 if (inactive ) {314 if (inactive || w.isDisabled()) { 315 315 wayColor = inactiveColor; 316 316 } else if(w.highlighted) { … … 345 345 346 346 Color col; 347 if (inactive ) {347 if (inactive || r.isDisabled()) { 348 348 col = inactiveColor; 349 349 } else if (r.isSelected()) { -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r1879 r2120 64 64 motd = "<html>" + styles + "<body><h1>" + "JOSM - " + tr("Java OpenStreetMap Editor") 65 65 + "</h1>\n<h2 align=\"center\">(" + tr("Message of the day not available") + ")</h2></html>"; 66 } else {67 motd = motd.replace("<!-- VERSION -->", tr("- running version is {0}", AboutAction.getVersionString()));68 66 } 69 67 // Save this to prefs in case JOSM is updated so MOTD can be refreshed -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r2114 r2120 307 307 return null; 308 308 for (Node n : ds.nodes) { 309 if ( n.isDeleted() || n.incomplete) {309 if (!n.isUsable()) { 310 310 continue; 311 311 } … … 338 338 return null; 339 339 for (Way w : ds.ways) { 340 if ( w.isDeleted() || w.incomplete) {340 if (!w.isUsable()) { 341 341 continue; 342 342 } … … 462 462 return null; 463 463 for (Way w : ds.ways) { 464 if ( w.isDeleted() || w.incomplete) {464 if (!w.isUsable()) { 465 465 continue; 466 466 } 467 467 Node lastN = null; 468 468 for (Node n : w.getNodes()) { 469 if ( n.isDeleted() || n.incomplete) {469 if (!n.isUsable()) { 470 470 continue; 471 471 } … … 488 488 } 489 489 for (Node n : ds.nodes) { 490 if ( !n.isDeleted() && !n.incomplete490 if (n.isUsable() 491 491 && getPoint(n).distanceSq(p) < snapDistance) { 492 492 nearest.add(n); … … 510 510 return null; 511 511 for (Node n : ds.nodes) { 512 if ( !n.isDeleted() && !n.incomplete512 if (n.isUsable() 513 513 && getPoint(n).distanceSq(p) < snapDistance) { 514 514 nearest.add(n); -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r2025 r2120 286 286 // nodes 287 287 for (Node n : nc.getCurrentDataSet().nodes) { 288 if ( !n.isDeleted() && !n.incomplete&& r.contains(nc.getPoint(n))) {288 if (n.isUsable() && r.contains(nc.getPoint(n))) { 289 289 selection.add(n); 290 290 } … … 293 293 // ways 294 294 for (Way w : nc.getCurrentDataSet().ways) { 295 if ( w.isDeleted() || w.getNodesCount() == 0 || w.incomplete){295 if (!w.isUsable() || w.getNodesCount() == 0){ 296 296 continue; 297 297 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r2032 r2120 750 750 if (Main.main.getCurrentDataSet() != null) { 751 751 for (Relation r : Main.main.getCurrentDataSet().relations) { 752 if (!r.is Deleted() && !r.incomplete) {752 if (!r.isFiltered() && r.isUsable()) { 753 753 for (RelationMember m : r.getMembers()) { 754 754 if (newSelection.contains(m.getMember())) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r2070 r2120 135 135 int i = 0; 136 136 for (OsmPrimitive e : DataSet.sort(Main.main.getCurrentDataSet().relations)) { 137 if ( !e.isDeleted() && !e.incomplete){137 if (e.isUsable()){ 138 138 list.setElementAt(e, i++); 139 139 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r2025 r2120 318 318 @Override public void visitBoundingBox(final BoundingXYVisitor v) { 319 319 for (final Node n : data.nodes) 320 if ( !n.isDeleted() && !n.incomplete) {320 if (n.isUsable()) { 321 321 v.visit(n); 322 322 } … … 441 441 HashSet<Node> doneNodes = new HashSet<Node>(); 442 442 for (Way w : data.ways) { 443 if ( w.incomplete || w.isDeleted()) {443 if (!w.isUsable()) { 444 444 continue; 445 445 } … … 453 453 ArrayList<WayPoint> trkseg = null; 454 454 for (Node n : w.getNodes()) { 455 if ( n.incomplete || n.isDeleted()) {455 if (!n.isUsable()) { 456 456 trkseg = null; 457 457 continue;
Note:
See TracChangeset
for help on using the changeset viewer.