Changeset 9082 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2015-12-04T01:53:17+01:00 (9 years ago)
Author:
bastiK
Message:

mapcss partial fill: remove [9061] code & turn it on again (see #12104)

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/MapPaintSettings.java

    r9076 r9082  
    4949    /** Preference: should only the data area outline be drawn */
    5050    private boolean outlineOnly;
    51     /** Preference: if unclosed areas should be drawn differently for partial fill */
    52     private boolean unclosedAreaHighlight;
    53     /** Preference: width of unclosed area highlight */
    54     private double unclosedAreaHighlightWidth;
    5551    /** Preference: parameter to avoid partial fill on small area objects:
    5652     * If more than a certain percentage of the total area would be filled by
     
    115111
    116112        outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false);
    117         unclosedAreaHighlight = Main.pref.getBoolean("draw.unclosed_area_partial_fill_highlight", false);
    118         unclosedAreaHighlightWidth = Main.pref.getDouble("draw.unclosed_area_partial_fill_highlight.width", 80);
    119113        partialFillThreshold = Main.pref.getDouble("draw.area.partial_fill_threshold", 70);
    120114    }
     
    357351    public boolean isOutlineOnly() {
    358352        return outlineOnly;
    359     }
    360 
    361     /**
    362      * Determines if unclosed areas should be drawn differently for partial fill.
    363      *
    364      * @return {@code true} if unclosed areas should be drawn differently for partial fill
    365      */
    366     public boolean isUnclosedAreaHighlight() {
    367         return unclosedAreaHighlight;
    368     }
    369 
    370     /**
    371      * Returns the width of unclosed area highlight.
    372      * @return the width of unclosed area highlight
    373      */
    374     public double getUnclosedAreaHighlightWidth() {
    375         return unclosedAreaHighlightWidth;
    376353    }
    377354
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r9079 r9082  
    336336    private boolean showIcons;
    337337    private boolean isOutlineOnly;
    338     private boolean isUnclosedAreaHighlight;
    339     private double unclosedAreaHighlightWidth;
    340338    private double partialFillThreshold;
    341339
     
    470468     * if null, area will be filled completely
    471469     * @param pfClip clipping area for partial fill
    472      * @param unclosedHighlight true, if the fact that the way / multipolygon is not
    473      * properly closed should be highlighted; this parameter is only used
    474      * for partial fill ({@code extent != null}), otherwise it is ignored
    475470     * @param disabled If this should be drawn with a special disabled style.
    476471     * @param text The text to write on the area.
    477472     */
    478     protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, MapImage fillImage, Float extent, Path2D.Double pfClip,
    479             boolean unclosedHighlight, boolean disabled, TextElement text) {
     473    protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color,
     474            MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, TextElement text) {
    480475
    481476        Shape area = path.createTransformedShape(nc.getAffineTransform());
     
    491486                    g.fill(area);
    492487                } else {
    493                     if (unclosedHighlight) {
    494                         g.setStroke(new BasicStroke((int) (unclosedAreaHighlightWidth / 100 * extent),
    495                                 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    496                         g.draw(area);
    497                     } else {
    498                         Shape oldClip = g.getClip();
    499                         Shape clip = area;
    500                         if (pfClip != null) {
    501                             clip = pfClip.createTransformedShape(nc.getAffineTransform());
    502                         }
    503                         g.clip(clip);
    504                         g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    505                         g.draw(area);
    506                         g.setClip(oldClip);
     488                    Shape oldClip = g.getClip();
     489                    Shape clip = area;
     490                    if (pfClip != null) {
     491                        clip = pfClip.createTransformedShape(nc.getAffineTransform());
    507492                    }
     493                    g.clip(clip);
     494                    g.setStroke(new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
     495                    g.draw(area);
     496                    g.setClip(oldClip);
    508497                }
    509498            } else {
     
    518507                    g.fill(area);
    519508                } else {
    520                     if (unclosedHighlight) {
    521                         g.setStroke(new BasicStroke((int) (unclosedAreaHighlightWidth / 100 * extent),
    522                                 BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    523                         g.draw(area);
    524                     } else {
    525                         Shape oldClip = g.getClip();
    526                         BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
    527                         g.clip(stroke.createStrokedShape(area));
    528                         Shape fill = area;
    529                         if (pfClip != null) {
    530                             fill = pfClip.createTransformedShape(nc.getAffineTransform());
    531                         }
    532                         g.fill(fill);
    533                         g.setClip(oldClip);
     509                    Shape oldClip = g.getClip();
     510                    BasicStroke stroke = new BasicStroke(2 * extent, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
     511                    g.clip(stroke.createStrokedShape(area));
     512                    Shape fill = area;
     513                    if (pfClip != null) {
     514                        fill = pfClip.createTransformedShape(nc.getAffineTransform());
    534515                    }
     516                    g.fill(fill);
     517                    g.setClip(oldClip);
    535518                }
    536519                g.setPaintMode();
     
    636619                    continue;
    637620                }
    638                 boolean unclosedHighlight = false;
    639621                if (extent != null) {
    640622                    if (pd.isClosed()) {
     
    646628                        }
    647629                    } else {
    648                         unclosedHighlight = isUnclosedAreaHighlight;
    649630                        pfClip = getPFClip(pd, extent * scale);
    650631                    }
     
    652633                drawArea(r, p,
    653634                        pd.selected ? paintSettings.getRelationSelectedColor(color.getAlpha()) : color,
    654                         fillImage, extent, pfClip, unclosedHighlight, disabled, text);
     635                        fillImage, extent, pfClip, disabled, text);
    655636            }
    656637        }
     
    682663            }
    683664        }
    684         drawArea(w, getPath(w), color, fillImage, extent, pfClip, isUnclosedAreaHighlight && !w.isClosed(), disabled, text);
     665        drawArea(w, getPath(w), color, fillImage, extent, pfClip, disabled, text);
    685666    }
    686667
     
    15381519        showIcons = paintSettings.getShowIconsDistance() > circum;
    15391520        isOutlineOnly = paintSettings.isOutlineOnly();
    1540         isUnclosedAreaHighlight = paintSettings.isUnclosedAreaHighlight();
    1541         unclosedAreaHighlightWidth = paintSettings.getUnclosedAreaHighlightWidth();
    15421521        partialFillThreshold = paintSettings.getPartialFillThreshold();
    15431522        orderFont = new Font(Main.pref.get("mappaint.font", "Droid Sans"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8));
Note: See TracChangeset for help on using the changeset viewer.