- Timestamp:
- 2010-06-04T09:08:56+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java
r3291 r3307 55 55 private double circum; 56 56 private double dist; 57 private boolean useStyleCache;58 57 private static int paintid = 0; 59 58 private EastNorth minEN; … … 74 73 } 75 74 76 public ElemStyle getPrimitiveStyle(OsmPrimitive osm) { 77 if(!useStyleCache) 78 return ((styles != null) ? styles.get(osm) : null); 79 80 if(osm.mappaintStyle == null && styles != null) { 81 osm.mappaintStyle = styles.get(osm); 82 if(osm instanceof Way) { 83 ((Way)osm).isMappaintArea = styles.isArea(osm); 84 } 85 } 86 87 if (osm.mappaintStyle == null && osm instanceof Node) { 88 osm.mappaintStyle = SimpleNodeElemStyle.INSTANCE; 89 } 90 91 if (osm.mappaintStyle == null && osm instanceof Way) { 92 osm.mappaintStyle = LineElemStyle.UNTAGGED_WAY; 93 } 94 75 public ElemStyle getPrimitiveStyle(OsmPrimitive osm, boolean nodefault) { 76 if(osm.mappaintStyle == null) 77 { 78 if(styles != null) { 79 osm.mappaintStyle = styles.get(osm); 80 if(osm instanceof Way) { 81 ((Way)osm).isMappaintArea = styles.isArea(osm); 82 } 83 } 84 if (osm.mappaintStyle == null) { 85 if(osm instanceof Node) 86 osm.mappaintStyle = SimpleNodeElemStyle.INSTANCE; 87 else if (osm instanceof Way) 88 osm.mappaintStyle = LineElemStyle.UNTAGGED_WAY; 89 } 90 } 91 if(nodefault && osm.mappaintStyle == LineElemStyle.UNTAGGED_WAY) 92 return null; 95 93 return osm.mappaintStyle; 96 94 } 97 95 98 96 public IconElemStyle getPrimitiveNodeStyle(OsmPrimitive osm) { 99 if(!useStyleCache) 100 return (styles != null) ? styles.getIcon(osm) : null; 101 102 if(osm.mappaintStyle == null && styles != null) { 103 osm.mappaintStyle = styles.getIcon(osm); 104 } 105 106 return (IconElemStyle)osm.mappaintStyle; 97 if(osm.mappaintStyle == null && styles != null) 98 osm.mappaintStyle = styles.getIcon(osm); 99 100 return (IconElemStyle)osm.mappaintStyle; 107 101 } 108 102 109 103 public boolean isPrimitiveArea(Way osm) { 110 if(!useStyleCache)111 return styles.isArea(osm);112 113 104 if(osm.mappaintStyle == null && styles != null) { 114 105 osm.mappaintStyle = styles.get(osm); … … 126 117 return; 127 118 128 ElemStyle nodeStyle = getPrimitiveStyle(n );119 ElemStyle nodeStyle = getPrimitiveStyle(n, false); 129 120 130 121 if (isZoomOk(nodeStyle)) { … … 169 160 return; 170 161 171 ElemStyle wayStyle = getPrimitiveStyle(w );162 ElemStyle wayStyle = getPrimitiveStyle(w, false); 172 163 173 164 if(!isZoomOk(wayStyle)) … … 237 228 if (m.isWay() && m.getMember().isDrawable()) 238 229 { 239 drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember() )230 drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember(), false) 240 231 : null, true, true); 241 232 } … … 470 461 multipolygon.load(r); 471 462 472 ElemStyle wayStyle = getPrimitiveStyle(r );463 ElemStyle wayStyle = getPrimitiveStyle(r, false); 473 464 474 465 // If area style was not found for relation then use style of ways … … 508 499 for (Way wInner : multipolygon.getInnerWays()) 509 500 { 510 ElemStyle innerStyle = getPrimitiveStyle(wInner );501 ElemStyle innerStyle = getPrimitiveStyle(wInner, true); 511 502 if(innerStyle == null) 512 503 { … … 539 530 for (Way wOuter : multipolygon.getOuterWays()) 540 531 { 541 ElemStyle outerStyle = getPrimitiveStyle(wOuter );532 ElemStyle outerStyle = getPrimitiveStyle(wOuter, true); 542 533 if(outerStyle == null) 543 534 { … … 648 639 ++paintid; 649 640 650 useStyleCache = Main.pref.getBoolean("mappaint.cache", true);651 641 int fillAreas = Main.pref.getInteger("mappaint.fillareas", 10000000); 652 642 LatLon ll1 = nc.getLatLon(0, 0); … … 734 724 for (RelationMember m : r.getMembers()) { 735 725 if (m.isNode() && m.getMember().isDrawable()) { 736 drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember() ) : null, true, true);726 drawSelectedMember(m.getMember(), styles != null ? getPrimitiveStyle(m.getMember(), false) : null, true, true); 737 727 } 738 728 }
Note:
See TracChangeset
for help on using the changeset viewer.