Changeset 1273 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-01-17T11:38:59+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1272 r1273 29 29 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor; 30 30 import org.openstreetmap.josm.data.coor.LatLon; 31 import org.openstreetmap.josm.data.coor.EastNorth; 31 32 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle; 32 33 import org.openstreetmap.josm.gui.mappaint.ElemStyle; … … 59 60 private static int paintid = 0; 60 61 private static int viewid = 0; 62 private EastNorth minEN; 63 private EastNorth maxEN; 61 64 62 65 protected int profilerVisibleNodes; … … 114 117 public void visit(Node n) { 115 118 // check, if the node is visible at all 116 Point p = nc.getPoint(n.eastNorth); 117 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) 119 if((n.eastNorth.east() > maxEN.east() ) || 120 (n.eastNorth.north() > maxEN.north()) || 121 (n.eastNorth.east() < minEN.east() ) || 122 (n.eastNorth.north() < minEN.north())) 118 123 { 119 124 n.mappaintVisibleCode = viewid; … … 149 154 150 155 // check, if the way is visible at all 151 Polygon polygon = getPolygon(w); 152 if(!isPolygonVisible(polygon)) 156 double minx = 10000; 157 double maxx = -10000; 158 double miny = 10000; 159 double maxy = -10000; 160 161 for (Node n : w.nodes) 162 { 163 if(n.eastNorth.east() > maxx) maxx = n.eastNorth.east(); 164 if(n.eastNorth.north() > maxy) maxy = n.eastNorth.north(); 165 if(n.eastNorth.east() < minx) minx = n.eastNorth.east(); 166 if(n.eastNorth.north() < miny) miny = n.eastNorth.north(); 167 } 168 169 if ((minx > maxEN.east()) || 170 (miny > maxEN.north()) || 171 (maxx < minEN.east()) || 172 (maxy < minEN.north())) 153 173 { 154 174 w.mappaintVisibleCode = viewid; … … 190 210 { 191 211 profilerVisibleAreas++; 192 drawArea( polygon, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color);212 drawArea(w, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color); 193 213 if(!w.isClosed()) 194 214 w.putError(tr("Area style way is not closed."), true); … … 409 429 drawWay((Way)osm, ((AreaElemStyle)style).line, selectedColor, true); 410 430 if(area) 411 drawArea( getPolygon((Way)osm), areaselected ? selectedColor431 drawArea((Way)osm, areaselected ? selectedColor 412 432 : ((AreaElemStyle)style).color); 413 433 } … … 650 670 if(isPolygonVisible(pd.get())) 651 671 { 652 drawArea(pd. get(), (pd.way.selected || r.selected) ? selectedColor672 drawArea(pd.way, (pd.way.selected || r.selected) ? selectedColor 653 673 : ((AreaElemStyle)wayStyle).color); 654 674 visible = true; … … 741 761 } 742 762 743 protected void drawArea( Polygon polygon, Color color)763 protected void drawArea(Way w, Color color) 744 764 { 765 Polygon polygon = getPolygon(w); 766 745 767 // set the opacity (alpha) level of the filled polygon 746 768 g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); … … 872 894 } 873 895 874 /*public void getColors()896 public void getColors() 875 897 { 876 898 super.getColors(); 877 899 untaggedColor = Main.pref.getColor(marktr("untagged"),Color.GRAY); 878 900 textColor = Main.pref.getColor (marktr("text"), Color.WHITE); 879 } */901 } 880 902 881 903 // Shows areas before non-areas … … 910 932 String currentLocale = Locale.getDefault().getLanguage(); 911 933 regionalNameOrder = Main.pref.get("mappaint.nameOrder", "name:"+currentLocale+";name;int_name;ref;operator;brand").split(";"); 934 minEN = nc.getEastNorth(0,nc.getHeight()-1); 935 maxEN = nc.getEastNorth(nc.getWidth()-1,0); 936 912 937 913 938 selectedCall = false;
Note:
See TracChangeset
for help on using the changeset viewer.