Changeset 7621 in josm
- Timestamp:
- 2014-10-14T21:11:26+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r7330 r7621 590 590 } 591 591 592 /** 593 * Determines if this primitive is a member of a selected relation. 594 * @return {@code true} if this primitive is a member of a selected relation, {@code false} otherwise 595 */ 592 596 public boolean isMemberOfSelected() { 593 597 if (referrers == null) … … 598 602 if (ref instanceof Relation && ref.isSelected()) 599 603 return true; 604 } 605 return false; 606 } 607 608 /** 609 * Determines if this primitive is an outer member of a selected multipolygon relation. 610 * @return {@code true} if this primitive is an outer member of a selected multipolygon relation, {@code false} otherwise 611 * @since 7621 612 */ 613 public boolean isOuterMemberOfSelected() { 614 if (referrers == null) 615 return false; 616 if (referrers instanceof OsmPrimitive) { 617 return isOuterMemberOfMultipolygon((OsmPrimitive) referrers); 618 } 619 for (OsmPrimitive ref : (OsmPrimitive[]) referrers) { 620 if (isOuterMemberOfMultipolygon(ref)) 621 return true; 622 } 623 return false; 624 } 625 626 private boolean isOuterMemberOfMultipolygon(OsmPrimitive ref) { 627 if (ref instanceof Relation && ref.isSelected() && ((Relation)ref).isMultipolygon()) { 628 for (RelationMember rm : ((Relation)ref).getMembersFor(Collections.singleton(this))) { 629 if ("outer".equals(rm.getRole())) { 630 return true; 631 } 632 } 600 633 } 601 634 return false; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r7555 r7621 291 291 private static final int FLAG_MEMBER_OF_SELECTED = 2; 292 292 private static final int FLAG_SELECTED = 4; 293 private static final int FLAG_OUTERMEMBER_OF_SELECTED = 8; 293 294 294 295 private static final double PHI = Math.toRadians(20); … … 1514 1515 } else if (w.isSelected()) { 1515 1516 add(w, FLAG_SELECTED); 1517 } else if (w.isOuterMemberOfSelected()) { 1518 add(w, FLAG_OUTERMEMBER_OF_SELECTED); 1516 1519 } else if (w.isMemberOfSelected()) { 1517 1520 add(w, FLAG_MEMBER_OF_SELECTED); … … 1527 1530 } else if (r.isSelected()) { 1528 1531 add(r, FLAG_SELECTED); 1532 } else if (r.isOuterMemberOfSelected()) { 1533 add(r, FLAG_OUTERMEMBER_OF_SELECTED); 1529 1534 } else if (r.isMemberOfSelected()) { 1530 1535 add(r, FLAG_MEMBER_OF_SELECTED); … … 1654 1659 StyledMapRenderer.this, 1655 1660 (r.flags & FLAG_SELECTED) != 0, 1661 (r.flags & FLAG_OUTERMEMBER_OF_SELECTED) != 0, 1656 1662 (r.flags & FLAG_MEMBER_OF_SELECTED) != 0 1657 1663 ); -
trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
r7555 r7621 86 86 87 87 @Override 88 public void paintPrimitive(OsmPrimitive osm, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean member) { 88 public void paintPrimitive(OsmPrimitive osm, MapPaintSettings paintSettings, StyledMapRenderer painter, 89 boolean selected, boolean outermember, boolean member) { 89 90 Color myColor = color; 90 91 if (osm instanceof Way) { … … 92 93 if (selected) { 93 94 myColor = paintSettings.getSelectedColor(color.getAlpha()); 94 } else if ( member) {95 } else if (outermember) { 95 96 myColor = paintSettings.getRelationSelectedColor(color.getAlpha()); 96 97 } … … 98 99 painter.drawArea((Way) osm, myColor, fillImage, text); 99 100 } else if (osm instanceof Relation) { 100 if (color != null && (selected || (member && ((Relation) osm).isMultipolygon()))) {101 if (color != null && (selected || outermember)) { 101 102 myColor = paintSettings.getRelationSelectedColor(color.getAlpha()); 102 103 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java
r7383 r7621 179 179 180 180 @Override 181 public void paintPrimitive(OsmPrimitive osm, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean member) { 181 public void paintPrimitive(OsmPrimitive osm, MapPaintSettings settings, StyledMapRenderer painter, 182 boolean selected, boolean outermember, boolean member) { 182 183 if (osm instanceof Node) { 183 184 painter.drawBoxText((Node) osm, this); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
r7383 r7621 43 43 * @param painter 44 44 * @param selected true, if primitive is selected 45 * @param outermember true, if primitive is not selected and outer member of a selected multipolygon relation 45 46 * @param member true, if primitive is not selected and member of a selected relation 46 47 */ 47 public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean member); 48 public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, 49 boolean selected, boolean outermember, boolean member); 48 50 49 51 public boolean isProperLineStyle() { -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r7136 r7621 264 264 265 265 @Override 266 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean member) { 266 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, 267 boolean selected, boolean outermember, boolean member) { 267 268 Way w = (Way)primitive; 268 269 /* show direction arrows, if draw.segment.relevant_directions_only is not set, … … 297 298 if (selected) { 298 299 myColor = paintSettings.getSelectedColor(color.getAlpha()); 299 } else if (member ) {300 } else if (member || outermember) { 300 301 myColor = paintSettings.getRelationSelectedColor(color.getAlpha()); 301 302 } else if(w.isDisabled()) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineTextElemStyle.java
r7383 r7621 32 32 33 33 @Override 34 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean member) { 34 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, 35 boolean selected, boolean outermember, boolean member) { 35 36 Way w = (Way)primitive; 36 37 painter.drawTextOnPath(w, text); -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r7136 r7621 241 241 242 242 @Override 243 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean member) { 243 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, StyledMapRenderer painter, 244 boolean selected, boolean outermember, boolean member) { 244 245 if (primitive instanceof Node) { 245 246 Node n = (Node) primitive; -
trunk/src/org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java
r7083 r7621 50 50 51 51 @Override 52 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean member) { 52 public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, 53 boolean selected, boolean outermember, boolean member) { 53 54 Way w = (Way) primitive; 54 55 painter.drawRepeatImage(w, pattern.getImage(), offset, spacing, phase, align);
Note:
See TracChangeset
for help on using the changeset viewer.