Changeset 10884 in josm


Ignore:
Timestamp:
2016-08-24T00:11:00+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13427 - in wireframe mode, some line segments are invisible (patch by michael2402)

File:
1 edited

Legend:

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

    r10875 r10884  
    2929import org.openstreetmap.josm.data.osm.visitor.Visitor;
    3030import org.openstreetmap.josm.gui.MapViewState.MapViewPoint;
     31import org.openstreetmap.josm.gui.MapViewState.MapViewRectangle;
    3132import org.openstreetmap.josm.gui.NavigatableComponent;
    3233import org.openstreetmap.josm.gui.draw.MapPath2D;
     
    9293    private final Stroke relatedWayStroke = new BasicStroke(
    9394            4, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);
     95    private MapViewRectangle viewClip;
    9496
    9597    /**
     
    146148    }
    147149
    148     /**
    149      * Renders the dataset for display.
    150      *
    151      * @param data <code>DataSet</code> to display
    152      * @param virtual <code>true</code> if virtual nodes are used
    153      * @param bounds display boundaries
    154      */
    155150    @Override
    156151    public void render(DataSet data, boolean virtual, Bounds bounds) {
    157152        BBox bbox = bounds.toBBox();
    158153        this.ds = data;
     154        Rectangle clip = g.getClipBounds();
     155        clip.grow(50, 50);
     156        viewClip = mapState.getViewArea(clip);
    159157        getSettings(virtual);
    160158
     
    316314        if (it.hasNext()) {
    317315            MapViewPoint lastP = mapState.getPointFor(it.next());
     316            int lastPOutside = lastP.getOutsideRectangleFlags(viewClip);
    318317            for (int orderNumber = 1; it.hasNext(); orderNumber++) {
    319318                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                    }
    324326                }
    325327                lastP = p;
     328                lastPOutside = pOutside;
    326329            }
    327330        }
     
    414417     */
    415418    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);
    424423        }
    425424    }
Note: See TracChangeset for help on using the changeset viewer.