Changeset 3591 in osm for applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java
- Timestamp:
- 2007-07-15T03:44:47+02:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mappaint/src/mappaint/MapPaintVisitor.java
r2853 r3591 30 30 public class MapPaintVisitor extends SimplePaintVisitor { 31 31 32 protected boolean isZoomOk(ElemStyle e) { 33 double circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter 34 35 /* show everything, if the user wishes so */ 36 if(!Main.pref.getBoolean("mappaint.zoomLevelDisplay",false)) { 37 return true; 38 } 39 40 if(e == null) { 41 /* the default for things that don't have a rule (show, if scale is smaller than 1500m) */ 42 if(circum < 1500) { 43 return true; 44 } else { 45 return false; 46 } 47 } 48 49 if(circum>=e.getMinZoom() / 70) { 50 return false; 51 } else { 52 return true; 53 } 54 } 55 32 56 /** 33 57 * Draw a small rectangle. … … 39 63 @Override public void visit(Node n) { 40 64 ElemStyle nodeStyle = MapPaintPlugin.elemStyles.getStyle(n); 41 if(nodeStyle!=null && Main.map.mapView.zoom()>=nodeStyle.getMinZoom()){65 if(nodeStyle!=null){ 42 66 if(nodeStyle instanceof IconElemStyle) { 43 drawNode(n, ((IconElemStyle)nodeStyle).getIcon()); 67 if(isZoomOk(nodeStyle)) { 68 drawNode(n, ((IconElemStyle)nodeStyle).getIcon()); 69 } 44 70 } else { 45 71 // throw some sort of exception … … 58 84 */ 59 85 @Override public void visit(Segment ls) { 86 ElemStyle segmentStyle = MapPaintPlugin.elemStyles.getStyle(ls); 87 if(isZoomOk(segmentStyle)) { 60 88 drawSegment(ls, getPreferencesColor("untagged",Color.GRAY),Main.pref.getBoolean("draw.segment.direction")); 89 } 61 90 } 62 91 … … 75 104 boolean area=false; 76 105 ElemStyle wayStyle = MapPaintPlugin.elemStyles.getStyle(w); 106 107 if(!isZoomOk(wayStyle)) { 108 return; 109 } 110 77 111 if(wayStyle!=null) 78 112 { … … 188 222 Point p1 = nc.getPoint(ls.from.eastNorth); 189 223 Point p2 = nc.getPoint(ls.to.eastNorth); 190 224 191 225 // checking if this segment is visible 192 226 if ((p1.x < 0) && (p2.x < 0)) return ; … … 223 257 */ 224 258 @Override public void drawNode(Node n, Color color) { 225 Point p = nc.getPoint(n.eastNorth); 226 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 227 g.setColor(color); 228 g.drawRect(p.x-1, p.y-1, 2, 2); 259 if(isZoomOk(null)) { 260 Point p = nc.getPoint(n.eastNorth); 261 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 262 g.setColor(color); 263 g.drawRect(p.x-1, p.y-1, 2, 2); 264 } 229 265 } 230 266
Note:
See TracChangeset
for help on using the changeset viewer.
