Changeset 12154 in josm


Ignore:
Timestamp:
2017-05-15T13:29:59+02:00 (2 months ago)
Author:
michael2402
Message:

Fix #12926: Don't draw direction arrows on short selection segments.

Location:
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/ArrowPaintHelper.java

    r10875 r12154  
    4949        }
    5050    }
     51
     52    /**
     53     * Gets the length of the arrow along the line segment.
     54     * @return the length along the line
     55     * @since 12154
     56     */
     57    public double getOnLineLength() {
     58        return length * cos;
     59    }
    5160}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r12131 r12154  
    12221222        Iterator<MapViewPoint> it = new OffsetIterator(mapState, wayNodes, offset);
    12231223        boolean initialMoveToNeeded = true;
     1224        ArrowPaintHelper drawArrowHelper = null;
     1225        if (showOrientation) {
     1226            drawArrowHelper = new ArrowPaintHelper(PHI, 10 + line.getLineWidth());
     1227        }
    12241228        while (it.hasNext()) {
    12251229            MapViewPoint p = it.next();
     
    12351239
    12361240                /* draw arrow */
    1237                 if (showHeadArrowOnly ? !it.hasNext() : showOrientation) {
    1238                     //TODO: Cache
    1239                     ArrowPaintHelper drawHelper = new ArrowPaintHelper(PHI, 10 + line.getLineWidth());
    1240                     drawHelper.paintArrowAt(orientationArrows, p2, p1);
     1241                if (drawArrowHelper != null) {
     1242                    boolean drawArrow;
     1243                    if (showHeadArrowOnly) {
     1244                        // always draw last arrow - no matter how short the segment is
     1245                        drawArrow = !it.hasNext();
     1246                    } else {
     1247                        // draw arrows in between only if there is enough space
     1248                        drawArrow = p1.distanceToInView(p2) > drawArrowHelper.getOnLineLength() * 1.3;
     1249                    }
     1250                    if (drawArrow) {
     1251                        drawArrowHelper.paintArrowAt(orientationArrows, p2, p1);
     1252                    }
    12411253                }
    12421254            }
Note: See TracChangeset for help on using the changeset viewer.