- Timestamp:
- 2009-01-11T00:01:00+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1235 r1236 79 79 Point p = nc.getPoint(n.eastNorth); 80 80 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 81 81 82 82 IconElemStyle nodeStyle = (IconElemStyle)styles.get(n); 83 83 if (nodeStyle != null && isZoomOk(nodeStyle)) … … 100 100 101 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 } 102 Polygon polygon = getPolygon(w); 108 103 if(!isPolygonVisible(polygon)) 109 104 return; 110 105 111 106 ElemStyle wayStyle = styles.get(w); 112 107 … … 125 120 l = ((AreaElemStyle)wayStyle).line; 126 121 if (fillAreas) 127 draw WayAsArea(w,areacolor);122 drawArea(polygon, w.selected ? selectedColor : areacolor); 128 123 } 129 124 } … … 342 337 drawWay((Way)osm, ((AreaElemStyle)style).line, selectedColor, true); 343 338 if(area) 344 draw WayAsArea((Way)osm, areaselected ? selectedColor339 drawArea(getPolygon((Way)osm), areaselected ? selectedColor 345 340 : ((AreaElemStyle)style).color); 346 341 } … … 580 575 for (PolyData pd : poly) 581 576 { 582 Color color = (pd.way.selected || r.selected) ? selectedColor 583 : ((AreaElemStyle)wayStyle).color; 584 g.setColor(new Color( color.getRed(), color.getGreen(), 585 color.getBlue(), fillAlpha)); 586 587 g.fillPolygon(pd.get()); 577 drawArea(pd.get(), (pd.way.selected || r.selected) ? selectedColor 578 : ((AreaElemStyle)wayStyle).color); 588 579 } 589 580 } … … 653 644 } 654 645 655 protected void drawWayAsArea(Way w, Color color)646 protected Polygon getPolygon(Way w) 656 647 { 657 648 Polygon polygon = new Polygon(); … … 662 653 polygon.addPoint(p.x,p.y); 663 654 } 664 665 Color mycolor = w.selected ? selectedColor : color; 655 return polygon; 656 } 657 658 protected void drawArea(Polygon polygon, Color color) 659 { 666 660 // set the opacity (alpha) level of the filled polygon 667 g.setColor(new Color( mycolor.getRed(), mycolor.getGreen(), mycolor.getBlue(), fillAlpha)); 668 661 g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); 669 662 g.fillPolygon(polygon); 670 663 } … … 814 807 alreadyDrawnAreas = new LinkedList<Way>(); 815 808 selectedCall = false; 816 809 817 810 // update the style name, just in case the user changed it in the meantime 818 811 styles.updateStyleName(); 819 820 if(profiler) 812 813 if(profiler) 821 814 { 822 815 System.out.format("Prepare : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast)); … … 838 831 } 839 832 840 if(profiler) 833 if(profiler) 841 834 { 842 835 System.out.format("Relations: %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1235 r1236 360 360 protected boolean isPolygonVisible(Polygon polygon) { 361 361 Rectangle bounds = polygon.getBounds(); 362 363 364 else if (bounds.x + polygon.getBounds().width < 0) return false;365 else if (bounds.y + polygon.getBounds().height < 0) return false;366 362 if (bounds.x > nc.getWidth()) return false; 363 else if (bounds.y > nc.getHeight()) return false; 364 else if (bounds.x + bounds.width < 0) return false; 365 else if (bounds.y + bounds.height < 0) return false; 366 367 367 return true; 368 368 } 369 369 370 370 public void setGraphics(Graphics g) { 371 371 this.g = g;
Note:
See TracChangeset
for help on using the changeset viewer.