Changeset 2249 in josm
- Timestamp:
- 2009-10-05T21:36:56+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2216 r2249 41 41 private static final int FLAG_FILTERED = 1 << 4; 42 42 private static final int FLAG_SELECTED = 1 << 5; 43 private static final int FLAG_HAS_DIRECTIONS = 1 << 6; 44 private static final int FLAG_TAGGED = 1 << 7; 43 45 44 46 /** … … 527 529 this.keys = new HashMap<String, String>(keys); 528 530 } 531 keysChangedImpl(); 529 532 } 530 533 … … 550 553 } 551 554 mappaintStyle = null; 555 keysChangedImpl(); 552 556 } 553 557 /** … … 564 568 } 565 569 mappaintStyle = null; 570 keysChangedImpl(); 566 571 } 567 572 … … 574 579 keys = null; 575 580 mappaintStyle = null; 581 keysChangedImpl(); 576 582 } 577 583 … … 610 616 public final boolean hasKeys() { 611 617 return keys != null && !keys.isEmpty(); 618 } 619 620 private void keysChangedImpl() { 621 updateHasDirectionKeys(); 622 updateTagged(); 612 623 } 613 624 … … 675 686 } 676 687 688 private void updateTagged() { 689 getUninterestingKeys(); 690 if (keys != null) { 691 for (Entry<String,String> e : keys.entrySet()) { 692 if (!uninteresting.contains(e.getKey())) { 693 flags |= FLAG_TAGGED; 694 return; 695 } 696 } 697 } 698 flags &= ~FLAG_TAGGED; 699 } 700 677 701 /** 678 702 * true if this object is considered "tagged". To be "tagged", an object … … 682 706 */ 683 707 public boolean isTagged() { 684 // TODO Cache value after keys are made private 685 getUninterestingKeys(); 686 if (keys != null) { 687 for (Entry<String,String> e : keys.entrySet()) { 688 if (!uninteresting.contains(e.getKey())) 689 return true; 690 } 691 } 692 return false; 693 } 694 /** 695 * true if this object has direction dependent tags (e.g. oneway) 696 */ 697 public boolean hasDirectionKeys() { 698 // TODO Cache value after keys are made private 708 return (flags & FLAG_TAGGED) != 0; 709 } 710 711 private void updateHasDirectionKeys() { 699 712 getDirectionKeys(); 700 713 if (keys != null) { 701 714 for (Entry<String,String> e : keys.entrySet()) { 702 if (directionKeys.contains(e.getKey())) 703 return true; 715 if (directionKeys.contains(e.getKey())) { 716 flags |= FLAG_HAS_DIRECTIONS; 717 return; 718 } 704 719 } 705 720 } 706 return false; 721 flags &= ~FLAG_HAS_DIRECTIONS; 722 } 723 /** 724 * true if this object has direction dependent tags (e.g. oneway) 725 */ 726 public boolean hasDirectionKeys() { 727 return (flags & FLAG_HAS_DIRECTIONS) != 0; 707 728 } 708 729
Note:
See TracChangeset
for help on using the changeset viewer.