Ticket #11714: 0001-Added-StyledMapRenderer-documentation.patch

File 0001-Added-StyledMapRenderer-documentation.patch, 7.3 KB (added by michael2402, 10 years ago)
  • src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java

    From f76c55c2b52444b2f80c0dbcb235ee6a4b77bf38 Mon Sep 17 00:00:00 2001
    From: Michael Zangl <michael.zangl@student.kit.edu>
    Date: Fri, 24 Jul 2015 10:28:20 +0200
    Subject: [PATCH] Added StyledMapRenderer documentation.
    
    ---
     .../osm/visitor/paint/AbstractMapRenderer.java     |  1 +
     .../data/osm/visitor/paint/StyledMapRenderer.java  | 60 +++++++++++++++++++++-
     2 files changed, 59 insertions(+), 2 deletions(-)
    
    diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
    index 97a6006..205323e 100644
    a b public abstract class AbstractMapRenderer implements Rendering {  
    8787     * @param p1 First point of the way segment.
    8888     * @param p2 Second point of the way segment.
    8989     * @param orderNumber The number of the segment in the way.
     90     * @param clr The color to use for drawing the text.
    9091     */
    9192    protected void drawOrderNumber(Point p1, Point p2, int orderNumber, Color clr) {
    9293        if (isSegmentVisible(p1, p2) && isLargeSegment(p1, p2, segmentNumberSpace)) {
  • src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
    index ba06c2a..381bcb5 100644
    a b public class StyledMapRenderer extends AbstractMapRenderer {  
    257257     * this case, but the method has been changed to simply return false by default.
    258258     * (This can be changed with a setting in the advanced preferences.)
    259259     *
     260     * @param font The font to check.
    260261     * @return false by default, but depends on the value of the advanced
    261262     * preference glyph-bug=false|true|auto, where auto is the automatic detection
    262263     * method which apparently no longer gives a useful result for Java 7.
    public class StyledMapRenderer extends AbstractMapRenderer {  
    290291
    291292    private Color highlightColorTransparent;
    292293
     294    /**
     295     * Flags used to store the primitive state along with the style. This is the normal style.
     296     * <p>
     297     * Not used in any public interfaces.
     298     */
    293299    private static final int FLAG_NORMAL = 0;
     300    /**
     301     * A primitive with {@link OsmPrimitive#isDisabled()}
     302     */
    294303    private static final int FLAG_DISABLED = 1;
     304    /**
     305     * A primitive with {@link OsmPrimitive#isMemberOfSelected()}
     306     */
    295307    private static final int FLAG_MEMBER_OF_SELECTED = 2;
     308    /**
     309     * A primitive with {@link OsmPrimitive#isSelected()}
     310     */
    296311    private static final int FLAG_SELECTED = 4;
     312    /**
     313     * A primitive with {@link OsmPrimitive#isOuterMemberOfSelected()}
     314     */
    297315    private static final int FLAG_OUTERMEMBER_OF_SELECTED = 8;
    298316
    299317    private static final double PHI = Math.toRadians(20);
    public class StyledMapRenderer extends AbstractMapRenderer {  
    536554        }
    537555    }
    538556
     557    /**
     558     * Draws a multipolygon area.
     559     * @param r The multipolygon relation
     560     * @param color The color to fill the area with.
     561     * @param fillImage The image to fill the area with. Overrides color.
     562     * @param disabled If this should be drawn with a special disabled style.
     563     * @param text The text to write on the area.
     564     */
    539565    public void drawArea(Relation r, Color color, MapImage fillImage, boolean disabled, TextElement text) {
    540566        Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r);
    541567        if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) {
    public class StyledMapRenderer extends AbstractMapRenderer {  
    551577        }
    552578    }
    553579
     580    /**
     581     * Draws an area defined by a way. They way does not need to be closed, but it should.
     582     * @param w The way.
     583     * @param color The color to fill the area with.
     584     * @param fillImage The image to fill the area with. Overrides color.
     585     * @param disabled If this should be drawn with a special disabled style.
     586     * @param text The text to write on the area.
     587     */
    554588    public void drawArea(Way w, Color color, MapImage fillImage, boolean disabled, TextElement text) {
    555589        drawArea(w, getPath(w), color, fillImage, disabled, text);
    556590    }
    public class StyledMapRenderer extends AbstractMapRenderer {  
    618652     *
    619653     * @param way the way
    620654     * @param pattern the image
     655     * @param disabled If this should be drawn with a special disabled style.
    621656     * @param offset offset from the way
    622657     * @param spacing spacing between two images
    623658     * @param phase initial spacing
    public class StyledMapRenderer extends AbstractMapRenderer {  
    846881    /**
    847882     * Draw a number of the order of the two consecutive nodes within the
    848883     * parents way
     884     *
     885     * @param n1 First node of the way segment.
     886     * @param n2 Second node of the way segment.
     887     * @param orderNumber The number of the segment in the way.
     888     * @param clr The color to use for drawing the text.
    849889     */
    850890    public void drawOrderNumber(Node n1, Node n2, int orderNumber, Color clr) {
    851891        Point p1 = nc.getPoint(n1);
    852892        Point p2 = nc.getPoint(n2);
    853         StyledMapRenderer.this.drawOrderNumber(p1, p2, orderNumber, clr);
     893        drawOrderNumber(p1, p2, orderNumber, clr);
    854894    }
    855895
    856896    /**
    public class StyledMapRenderer extends AbstractMapRenderer {  
    10671107                pVia, vx, vx2, vy, vy2, iconAngle, r.isSelected());
    10681108    }
    10691109
     1110    /**
     1111     * Draws a text along a given way.
     1112     * @param way The way to draw the text on.
     1113     * @param text The text definition (font/.../text content) to draw.
     1114     */
    10701115    public void drawTextOnPath(Way way, TextElement text) {
    10711116        if (way == null || text == null)
    10721117            return;
    public class StyledMapRenderer extends AbstractMapRenderer {  
    12361281    }
    12371282
    12381283    /**
    1239      * draw way
     1284     * draw way. This method allows for two draw styles (line using color, dashes using dashedColor) to be passed.
     1285     * @param way The way to draw
     1286     * @param color The base color to draw the way in
     1287     * @param line The line style to use. This is drawn using color.
     1288     * @param dashes The dash style to use. This is drawn using dashedColor. <code>null</code> if unused.
     1289     * @param dashedColor The color of the dashes.
     1290     * @param offset
    12401291     * @param showOrientation show arrows that indicate the technical orientation of
    12411292     *              the way (defined by order of nodes)
     1293     * @param showHeadArrowOnly True if only the arrow at the end of the line but not those on the segments should be displayed.
    12421294     * @param showOneway show symbols that indicate the direction of the feature,
    12431295     *              e.g. oneway street or waterway
    12441296     * @param onewayReversed for oneway=-1 and similar
    public class StyledMapRenderer extends AbstractMapRenderer {  
    13661418        displaySegments(path, orientationArrows, onewayArrows, onewayArrowsCasing, color, line, dashes, dashedColor);
    13671419    }
    13681420
     1421    /**
     1422     * Gets the "circum". This is the distance on the map in meters that 100 screen pixels represent.
     1423     * @return The "circum"
     1424     */
    13691425    public double getCircum() {
    13701426        return circum;
    13711427    }