Changeset 10884 in josm
- Timestamp:
- 2016-08-24T00:11:00+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r10875 r10884 29 29 import org.openstreetmap.josm.data.osm.visitor.Visitor; 30 30 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 31 import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle; 31 32 import org.openstreetmap.josm.gui.NavigatableComponent; 32 33 import org.openstreetmap.josm.gui.draw.MapPath2D; … … 92 93 private final Stroke relatedWayStroke = new BasicStroke( 93 94 4, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL); 95 private MapViewRectangle viewClip; 94 96 95 97 /** … … 146 148 } 147 149 148 /**149 * Renders the dataset for display.150 *151 * @param data <code>DataSet</code> to display152 * @param virtual <code>true</code> if virtual nodes are used153 * @param bounds display boundaries154 */155 150 @Override 156 151 public void render(DataSet data, boolean virtual, Bounds bounds) { 157 152 BBox bbox = bounds.toBBox(); 158 153 this.ds = data; 154 Rectangle clip = g.getClipBounds(); 155 clip.grow(50, 50); 156 viewClip = mapState.getViewArea(clip); 159 157 getSettings(virtual); 160 158 … … 316 314 if (it.hasNext()) { 317 315 MapViewPoint lastP = mapState.getPointFor(it.next()); 316 int lastPOutside = lastP.getOutsideRectangleFlags(viewClip); 318 317 for (int orderNumber = 1; it.hasNext(); orderNumber++) { 319 318 MapViewPoint p = mapState.getPointFor(it.next()); 320 drawSegment(lastP, p, wayColor, 321 showOnlyHeadArrowOnly ? !it.hasNext() : showThisDirectionArrow); 322 if (showOrderNumber && !isInactiveMode) { 323 drawOrderNumber(lastP, p, orderNumber, g.getColor()); 319 int pOutside = p.getOutsideRectangleFlags(viewClip); 320 if ((pOutside & lastPOutside) == 0) { 321 drawSegment(lastP, p, wayColor, 322 showOnlyHeadArrowOnly ? !it.hasNext() : showThisDirectionArrow); 323 if (showOrderNumber && !isInactiveMode) { 324 drawOrderNumber(lastP, p, orderNumber, g.getColor()); 325 } 324 326 } 325 327 lastP = p; 328 lastPOutside = pOutside; 326 329 } 327 330 } … … 414 417 */ 415 418 protected void drawSegment(MapPath2D path, MapViewPoint mv1, MapViewPoint mv2, boolean showDirection) { 416 Rectangle bounds = g.getClipBounds(); 417 bounds.grow(100, 100); // avoid arrow heads at the border 418 if (mv1.rectTo(mv2).isInView()) { 419 path.moveTo(mv1); 420 path.lineTo(mv2); 421 if (showDirection) { 422 ARROW_PAINT_HELPER.paintArrowAt(path, mv2, mv1); 423 } 419 path.moveTo(mv1); 420 path.lineTo(mv2); 421 if (showDirection) { 422 ARROW_PAINT_HELPER.paintArrowAt(path, mv2, mv1); 424 423 } 425 424 }
Note:
See TracChangeset
for help on using the changeset viewer.