Changeset 12303 in josm for trunk/src/org


Ignore:
Timestamp:
2017-06-02T21:39:27+02:00 (8 years ago)
Author:
michael2402
Message:

Javadoc for package org.openstreetmap.josm.gui.mappaint.styleelement

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java

    r11797 r12303  
    2525     * MapCSS text-anchor-horizontal
    2626     */
    27     public enum HorizontalTextAlignment { LEFT, CENTER, RIGHT }
     27    public enum HorizontalTextAlignment {
     28        /**
     29         * Align to the left
     30         */
     31        LEFT,
     32        /**
     33         * Align in the center
     34         */
     35        CENTER,
     36        /**
     37         * Align to the right
     38         */
     39        RIGHT }
    2840
    2941    /**
    3042     * MapCSS text-anchor-vertical
    3143     */
    32     public enum VerticalTextAlignment { ABOVE, TOP, CENTER, BOTTOM, BELOW }
     44    public enum VerticalTextAlignment {
     45        /**
     46         * Render above the box
     47         */
     48        ABOVE,
     49        /**
     50         * Align to the top of the box
     51         */
     52        TOP,
     53        /**
     54         * Render at the center of the box
     55         */
     56        CENTER,
     57        /**
     58         * Align to the bottom of the box
     59         */
     60        BOTTOM,
     61        /**
     62         * Render below the box
     63         */
     64        BELOW }
    3365
    3466    /**
     
    5284        private final boolean temporary;
    5385
     86        /**
     87         * Create a new box provider result
     88         * @param box The box
     89         * @param temporary The temporary flag, will be returned by {@link #isTemporary()}
     90         */
    5491        public BoxProviderResult(Rectangle box, boolean temporary) {
    5592            this.box = box;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java

    r12082 r12303  
    3131    public static final LineElement UNTAGGED_WAY = createSimpleLineStyle(null, false);
    3232
     33    /**
     34     * The stroke used to paint the line
     35     */
    3336    private final BasicStroke line;
     37    /**
     38     * The color of the line. Should not be accessed directly
     39     */
    3440    public Color color;
     41
     42    /**
     43     * The stroke used to paint the gaps between the dashes
     44     */
     45    private final BasicStroke dashesLine;
     46    /**
     47     * The secondary color of the line that is used for the gaps in dashed lines. Should not be accessed directly
     48     */
    3549    public Color dashesBackground;
     50    /**
     51     * The dash offset. Should not be accessed directly
     52     */
    3653    public float offset;
    37     public float realWidth; // the real width of this line in meter
     54    /**
     55     * the real width of this line in meter. Should not be accessed directly
     56     */
     57    public float realWidth;
     58    /**
     59     * A flag indicating if the direction arrwos should be painted. Should not be accessed directly
     60     */
    3861    public boolean wayDirectionArrows;
    3962
    40     private final BasicStroke dashesLine;
    41 
     63    /**
     64     * The type of this line
     65     */
    4266    public enum LineType {
     67        /**
     68         * A normal line
     69         */
    4370        NORMAL("", 3f),
     71        /**
     72         * A casing (line behind normal line, extended to the right/left)
     73         */
    4474        CASING("casing-", 2f),
     75        /**
     76         * A casing, but only to the left
     77         */
    4578        LEFT_CASING("left-casing-", 2.1f),
     79        /**
     80         * A casing, but only to the right
     81         */
    4682        RIGHT_CASING("right-casing-", 2.1f);
    4783
     84        /**
     85         * The MapCSS line prefix used
     86         */
    4887        public final String prefix;
     88        /**
     89         * The major z index to use during painting
     90         */
    4991        public final float defaultMajorZIndex;
    5092
     
    138180    }
    139181
     182    /**
     183     * Converts a linejoin of a {@link BasicStroke} to a MapCSS string
     184     * @param linejoin The linejoin
     185     * @return The MapCSS string or <code>null</code> on error.
     186     * @see BasicStroke#getLineJoin()
     187     */
    140188    public String linejoinToString(int linejoin) {
    141189        switch (linejoin) {
     
    147195    }
    148196
     197    /**
     198     * Converts a linecap of a {@link BasicStroke} to a MapCSS string
     199     * @param linecap The linecap
     200     * @return The MapCSS string or <code>null</code> on error.
     201     * @see BasicStroke#getEndCap()
     202     */
    149203    public String linecapToString(int linecap) {
    150204        switch (linecap) {
     
    209263    }
    210264
     265    /**
     266     * Create a line element from the given MapCSS environment
     267     * @param env The environment
     268     * @return The line element describing the line that should be painted, or <code>null</code> if none should be painted.
     269     */
    211270    public static LineElement createLine(Environment env) {
    212271        return createImpl(env, LineType.NORMAL);
    213272    }
    214273
     274    /**
     275     * Create a line element for the left casing from the given MapCSS environment
     276     * @param env The environment
     277     * @return The line element describing the line that should be painted, or <code>null</code> if none should be painted.
     278     */
    215279    public static LineElement createLeftCasing(Environment env) {
    216280        LineElement leftCasing = createImpl(env, LineType.LEFT_CASING);
     
    221285    }
    222286
     287    /**
     288     * Create a line element for the right casing from the given MapCSS environment
     289     * @param env The environment
     290     * @return The line element describing the line that should be painted, or <code>null</code> if none should be painted.
     291     */
    223292    public static LineElement createRightCasing(Environment env) {
    224293        LineElement rightCasing = createImpl(env, LineType.RIGHT_CASING);
     
    229298    }
    230299
     300    /**
     301     * Create a line element for the casing from the given MapCSS environment
     302     * @param env The environment
     303     * @return The line element describing the line that should be painted, or <code>null</code> if none should be painted.
     304     */
    231305    public static LineElement createCasing(Environment env) {
    232306        LineElement casing = createImpl(env, LineType.CASING);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java

    r10748 r12303  
    3333    private BufferedImage img;
    3434
     35    /**
     36     * The alpha (opacity) value of the image. It is multiplied to the image alpha channel.
     37     * Range: 0...255
     38     */
    3539    public int alpha = 255;
     40    /**
     41     * The name of the image that should be displayed. It is given to the {@link ImageProvider}
     42     */
    3643    public String name;
     44    /**
     45     * The StyleSource that registered the image
     46     */
    3747    public StyleSource source;
     48    /**
     49     * A flag indicating that the image should automatically be scaled to the right size.
     50     */
    3851    public boolean autoRescale;
     52    /**
     53     * The width of the image, as set by MapCSS
     54     */
    3955    public int width = -1;
     56    /**
     57     * The height of the image, as set by MapCSS
     58     */
    4059    public int height = -1;
     60    /**
     61     * The x offset of the anchor of this image
     62     */
    4163    public int offsetX;
     64    /**
     65     * The y offset of the anchor of this image
     66     */
    4267    public int offsetY;
    4368
    4469    private boolean temporary;
     70
     71    /**
     72     * A cache that holds a disabled (gray) version of this image
     73     */
    4574    private BufferedImage disabledImgCache;
    4675
     76    /**
     77     * Creates a new {@link MapImage}
     78     * @param name The image name
     79     * @param source The style source that requests this image
     80     */
    4781    public MapImage(String name, StyleSource source) {
    4882        this(name, source, true);
    4983    }
    5084
     85    /**
     86     * Creates a new {@link MapImage}
     87     * @param name The image name
     88     * @param source The style source that requests this image
     89     * @param autoRescale A flag indicating to automatically adjust the width/height of the image
     90     */
    5191    public MapImage(String name, StyleSource source, boolean autoRescale) {
    5292        this.name = name;
     
    125165    }
    126166
     167    /**
     168     * Gets the image width
     169     * @return The real image width
     170     */
    127171    public int getWidth() {
    128172        return getImage().getWidth(null);
    129173    }
    130174
     175    /**
     176     * Gets the image height
     177     * @return The real image height
     178     */
    131179    public int getHeight() {
    132180        return getImage().getHeight(null);
    133181    }
    134182
     183    /**
     184     * Gets the alpha value the image should be multiplied with
     185     * @return The value in range 0..1
     186     */
    135187    public float getAlphaFloat() {
    136188        return Utils.colorInt2float(alpha);
     
    187239    }
    188240
     241    /**
     242     * Gets a box provider that provides a box that covers the size of this image
     243     * @return The box provider
     244     */
    189245    public BoxProvider getBoxProvider() {
    190246        return new MapImageBoxProvider();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java

    r11932 r12303  
    4848    private static final String[] ICON_KEYS = {ICON_IMAGE, ICON_WIDTH, ICON_HEIGHT, ICON_OPACITY, ICON_OFFSET_X, ICON_OFFSET_Y};
    4949
     50    /**
     51     * The style used for simple nodes
     52     */
    5053    public static final NodeElement SIMPLE_NODE_ELEMSTYLE;
     54    /**
     55     * A box provider that provides the size of a simple node
     56     */
    5157    public static final BoxProvider SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER;
    5258    static {
     
    5864    }
    5965
     66    /**
     67     * The default styles that are used for nodes.
     68     * @see #SIMPLE_NODE_ELEMSTYLE
     69     */
    6070    public static final StyleElementList DEFAULT_NODE_STYLELIST = new StyleElementList(NodeElement.SIMPLE_NODE_ELEMSTYLE);
     71    /**
     72     * The default styles that are used for nodes with text.
     73     */
    6174    public static final StyleElementList DEFAULT_NODE_STYLELIST_TEXT = new StyleElementList(NodeElement.SIMPLE_NODE_ELEMSTYLE,
    6275            BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java

    r12259 r12303  
    2222     */
    2323    public enum LineImageAlignment {
     24        /**
     25         * Align it to the top side of the line
     26         */
    2427        TOP(.5),
     28        /**
     29         * Align it to the center of the line
     30         */
    2531        CENTER(0),
     32        /**
     33         * Align it to the bottom of the line
     34         */
    2635        BOTTOM(-.5);
    2736
     
    4150    }
    4251
     52    /**
     53     * The image to draw on the line repeatedly
     54     */
    4355    public MapImage pattern;
     56    /**
     57     * The offset to the side of the way
     58     */
    4459    public float offset;
     60    /**
     61     * The space between the images
     62     */
    4563    public float spacing;
     64    /**
     65     * The offset of the first image along the way
     66     */
    4667    public float phase;
     68    /**
     69     * The alignment of the image
     70     */
    4771    public LineImageAlignment align;
    4872
     
    5074            null, null};
    5175
     76    /**
     77     * Create a new image element
     78     * @param c The cascade
     79     * @param pattern The image to draw on the line repeatedly
     80     * @param offset The offset to the side of the way
     81     * @param spacing The space between the images
     82     * @param phase The offset of the first image along the way
     83     * @param align The alignment of the image
     84     */
    5285    public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) {
    5386        super(c, 2.9f);
     
    6194    }
    6295
     96    /**
     97     * Create a RepeatImageElement from the given environment
     98     * @param env The environment
     99     * @return The image style element or <code>null</code> if none should be painted
     100     */
    63101    public static RepeatImageElement create(Environment env) {
    64102        MapImage pattern = NodeElement.createIcon(env, REPEAT_IMAGE_KEYS);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java

    r12259 r12303  
    1818/**
    1919 * Class that defines how objects ({@link OsmPrimitive}) should be drawn on the map.
    20  * 
     20 *
    2121 * Several subclasses of this abstract class implement different drawing features,
    2222 * like icons for a node or area fill. This class and all its subclasses are immutable
     
    3333    protected static final int ICON_OFFSET_Y_IDX = 5;
    3434
     35    /**
     36     * The major z index of this style element
     37     */
    3538    public float majorZIndex;
     39    /**
     40     * The z index as set by the user
     41     */
    3642    public float zIndex;
     43    /**
     44     * The object z index
     45     */
    3746    public float objectZIndex;
    38     public boolean isModifier;  // false, if style can serve as main style for the
    39     // primitive; true, if it is a highlight or modifier
     47    /**
     48     * false, if style can serve as main style for the primitive;
     49     * true, if it is a highlight or modifier
     50     */
     51    public boolean isModifier;
     52    /**
     53     * A flag indicating that the selection color handling should be done automatically
     54     */
    4055    public boolean defaultSelectedHandling;
    4156
     
    7792            boolean selected, boolean outermember, boolean member);
    7893
     94    /**
     95     * Check if this is a style that makes the line visible to the user
     96     * @return <code>true</code> for line styles
     97     */
    7998    public boolean isProperLineStyle() {
    8099        return false;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java

    r12285 r12303  
    2424 */
    2525public class TextLabel implements StyleKeys {
     26    /**
     27     * The default strategy to use when determining the label of a element.
     28     */
    2629    public static final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy();
    2730
Note: See TracChangeset for help on using the changeset viewer.