- Timestamp:
- 2009-01-10T20:51:48+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1221 r1235 76 76 */ 77 77 public void visit(Node n) { 78 // check, if the node is visible at all 79 Point p = nc.getPoint(n.eastNorth); 80 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 81 78 82 IconElemStyle nodeStyle = (IconElemStyle)styles.get(n); 79 83 if (nodeStyle != null && isZoomOk(nodeStyle)) … … 95 99 return; 96 100 101 // check, if the way is visible at all 102 Polygon polygon = new Polygon(); 103 for (Node n : w.nodes) 104 { 105 Point p = nc.getPoint(n.eastNorth); 106 polygon.addPoint(p.x,p.y); 107 } 108 if(!isPolygonVisible(polygon)) 109 return; 110 97 111 ElemStyle wayStyle = styles.get(w); 98 112 … … 104 118 if(wayStyle!=null) 105 119 { 106 boolean area = false;107 120 if(wayStyle instanceof LineElemStyle) 108 121 l = (LineElemStyle)wayStyle; … … 111 124 areacolor = ((AreaElemStyle)wayStyle).color; 112 125 l = ((AreaElemStyle)wayStyle).line; 113 area = true; 114 } 115 if (area && fillAreas) 116 drawWayAsArea(w, areacolor); 126 if (fillAreas) 127 drawWayAsArea(w, areacolor); 128 } 117 129 } 118 130 … … 129 141 int realWidth = 0; //the real width of the element in meters 130 142 boolean dashed = false; 143 Node lastN; 131 144 132 145 if(l != null) … … 147 160 color = selectedColor; 148 161 149 Node lastN;162 // draw overlays under the way 150 163 if(l != null && l.overlays != null) 151 164 { … … 168 181 } 169 182 183 // draw the way 170 184 lastN = null; 171 185 for(Node n : w.nodes) … … 176 190 } 177 191 192 // draw overlays above the way 178 193 if(l != null && l.overlays != null) 179 194 { … … 799 814 alreadyDrawnAreas = new LinkedList<Way>(); 800 815 selectedCall = false; 801 816 817 // update the style name, just in case the user changed it in the meantime 818 styles.updateStyleName(); 819 802 820 if(profiler) 803 821 { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1223 r1235 9 9 import java.awt.Graphics2D; 10 10 import java.awt.Point; 11 import java.awt.Polygon; 11 12 import java.awt.Rectangle; 12 13 import java.awt.RenderingHints; … … 357 358 } 358 359 360 protected boolean isPolygonVisible(Polygon polygon) { 361 Rectangle bounds = polygon.getBounds(); 362 if (bounds.x > nc.getWidth()) return false; 363 else if (bounds.y > nc.getHeight()) return false; 364 else if (bounds.x + polygon.getBounds().width < 0) return false; 365 else if (bounds.y + polygon.getBounds().height < 0) return false; 366 367 return true; 368 } 369 359 370 public void setGraphics(Graphics g) { 360 371 this.g = g; -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r1195 r1235 31 31 } 32 32 HashMap<String, StyleSet> styleSet; 33 String styleName; 33 34 34 35 public ElemStyles() 35 36 { 36 37 styleSet = new HashMap<String, StyleSet>(); 38 updateStyleName(); 39 } 40 41 public void updateStyleName() { 42 // Main.pref.get() is slow when done thousands of times, do it once here and cache it 43 styleName = Main.pref.get("mappaint.style", "standard"); 37 44 } 38 45 … … 78 85 { 79 86 if(name == null) 80 name = Main.pref.get("mappaint.style", "standard");87 name = styleName; 81 88 StyleSet s = styleSet.get(name); 82 89 if(create && s == null)
Note:
See TracChangeset
for help on using the changeset viewer.