Changeset 12303 in josm for trunk/src/org
- Timestamp:
- 2017-06-02T21:39:27+02:00 (8 years ago)
- 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 25 25 * MapCSS text-anchor-horizontal 26 26 */ 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 } 28 40 29 41 /** 30 42 * MapCSS text-anchor-vertical 31 43 */ 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 } 33 65 34 66 /** … … 52 84 private final boolean temporary; 53 85 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 */ 54 91 public BoxProviderResult(Rectangle box, boolean temporary) { 55 92 this.box = box; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java
r12082 r12303 31 31 public static final LineElement UNTAGGED_WAY = createSimpleLineStyle(null, false); 32 32 33 /** 34 * The stroke used to paint the line 35 */ 33 36 private final BasicStroke line; 37 /** 38 * The color of the line. Should not be accessed directly 39 */ 34 40 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 */ 35 49 public Color dashesBackground; 50 /** 51 * The dash offset. Should not be accessed directly 52 */ 36 53 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 */ 38 61 public boolean wayDirectionArrows; 39 62 40 private final BasicStroke dashesLine; 41 63 /** 64 * The type of this line 65 */ 42 66 public enum LineType { 67 /** 68 * A normal line 69 */ 43 70 NORMAL("", 3f), 71 /** 72 * A casing (line behind normal line, extended to the right/left) 73 */ 44 74 CASING("casing-", 2f), 75 /** 76 * A casing, but only to the left 77 */ 45 78 LEFT_CASING("left-casing-", 2.1f), 79 /** 80 * A casing, but only to the right 81 */ 46 82 RIGHT_CASING("right-casing-", 2.1f); 47 83 84 /** 85 * The MapCSS line prefix used 86 */ 48 87 public final String prefix; 88 /** 89 * The major z index to use during painting 90 */ 49 91 public final float defaultMajorZIndex; 50 92 … … 138 180 } 139 181 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 */ 140 188 public String linejoinToString(int linejoin) { 141 189 switch (linejoin) { … … 147 195 } 148 196 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 */ 149 203 public String linecapToString(int linecap) { 150 204 switch (linecap) { … … 209 263 } 210 264 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 */ 211 270 public static LineElement createLine(Environment env) { 212 271 return createImpl(env, LineType.NORMAL); 213 272 } 214 273 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 */ 215 279 public static LineElement createLeftCasing(Environment env) { 216 280 LineElement leftCasing = createImpl(env, LineType.LEFT_CASING); … … 221 285 } 222 286 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 */ 223 292 public static LineElement createRightCasing(Environment env) { 224 293 LineElement rightCasing = createImpl(env, LineType.RIGHT_CASING); … … 229 298 } 230 299 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 */ 231 305 public static LineElement createCasing(Environment env) { 232 306 LineElement casing = createImpl(env, LineType.CASING); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r10748 r12303 33 33 private BufferedImage img; 34 34 35 /** 36 * The alpha (opacity) value of the image. It is multiplied to the image alpha channel. 37 * Range: 0...255 38 */ 35 39 public int alpha = 255; 40 /** 41 * The name of the image that should be displayed. It is given to the {@link ImageProvider} 42 */ 36 43 public String name; 44 /** 45 * The StyleSource that registered the image 46 */ 37 47 public StyleSource source; 48 /** 49 * A flag indicating that the image should automatically be scaled to the right size. 50 */ 38 51 public boolean autoRescale; 52 /** 53 * The width of the image, as set by MapCSS 54 */ 39 55 public int width = -1; 56 /** 57 * The height of the image, as set by MapCSS 58 */ 40 59 public int height = -1; 60 /** 61 * The x offset of the anchor of this image 62 */ 41 63 public int offsetX; 64 /** 65 * The y offset of the anchor of this image 66 */ 42 67 public int offsetY; 43 68 44 69 private boolean temporary; 70 71 /** 72 * A cache that holds a disabled (gray) version of this image 73 */ 45 74 private BufferedImage disabledImgCache; 46 75 76 /** 77 * Creates a new {@link MapImage} 78 * @param name The image name 79 * @param source The style source that requests this image 80 */ 47 81 public MapImage(String name, StyleSource source) { 48 82 this(name, source, true); 49 83 } 50 84 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 */ 51 91 public MapImage(String name, StyleSource source, boolean autoRescale) { 52 92 this.name = name; … … 125 165 } 126 166 167 /** 168 * Gets the image width 169 * @return The real image width 170 */ 127 171 public int getWidth() { 128 172 return getImage().getWidth(null); 129 173 } 130 174 175 /** 176 * Gets the image height 177 * @return The real image height 178 */ 131 179 public int getHeight() { 132 180 return getImage().getHeight(null); 133 181 } 134 182 183 /** 184 * Gets the alpha value the image should be multiplied with 185 * @return The value in range 0..1 186 */ 135 187 public float getAlphaFloat() { 136 188 return Utils.colorInt2float(alpha); … … 187 239 } 188 240 241 /** 242 * Gets a box provider that provides a box that covers the size of this image 243 * @return The box provider 244 */ 189 245 public BoxProvider getBoxProvider() { 190 246 return new MapImageBoxProvider(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r11932 r12303 48 48 private static final String[] ICON_KEYS = {ICON_IMAGE, ICON_WIDTH, ICON_HEIGHT, ICON_OPACITY, ICON_OFFSET_X, ICON_OFFSET_Y}; 49 49 50 /** 51 * The style used for simple nodes 52 */ 50 53 public static final NodeElement SIMPLE_NODE_ELEMSTYLE; 54 /** 55 * A box provider that provides the size of a simple node 56 */ 51 57 public static final BoxProvider SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER; 52 58 static { … … 58 64 } 59 65 66 /** 67 * The default styles that are used for nodes. 68 * @see #SIMPLE_NODE_ELEMSTYLE 69 */ 60 70 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 */ 61 74 public static final StyleElementList DEFAULT_NODE_STYLELIST_TEXT = new StyleElementList(NodeElement.SIMPLE_NODE_ELEMSTYLE, 62 75 BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java
r12259 r12303 22 22 */ 23 23 public enum LineImageAlignment { 24 /** 25 * Align it to the top side of the line 26 */ 24 27 TOP(.5), 28 /** 29 * Align it to the center of the line 30 */ 25 31 CENTER(0), 32 /** 33 * Align it to the bottom of the line 34 */ 26 35 BOTTOM(-.5); 27 36 … … 41 50 } 42 51 52 /** 53 * The image to draw on the line repeatedly 54 */ 43 55 public MapImage pattern; 56 /** 57 * The offset to the side of the way 58 */ 44 59 public float offset; 60 /** 61 * The space between the images 62 */ 45 63 public float spacing; 64 /** 65 * The offset of the first image along the way 66 */ 46 67 public float phase; 68 /** 69 * The alignment of the image 70 */ 47 71 public LineImageAlignment align; 48 72 … … 50 74 null, null}; 51 75 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 */ 52 85 public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) { 53 86 super(c, 2.9f); … … 61 94 } 62 95 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 */ 63 101 public static RepeatImageElement create(Environment env) { 64 102 MapImage pattern = NodeElement.createIcon(env, REPEAT_IMAGE_KEYS); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r12259 r12303 18 18 /** 19 19 * Class that defines how objects ({@link OsmPrimitive}) should be drawn on the map. 20 * 20 * 21 21 * Several subclasses of this abstract class implement different drawing features, 22 22 * like icons for a node or area fill. This class and all its subclasses are immutable … … 33 33 protected static final int ICON_OFFSET_Y_IDX = 5; 34 34 35 /** 36 * The major z index of this style element 37 */ 35 38 public float majorZIndex; 39 /** 40 * The z index as set by the user 41 */ 36 42 public float zIndex; 43 /** 44 * The object z index 45 */ 37 46 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 */ 40 55 public boolean defaultSelectedHandling; 41 56 … … 77 92 boolean selected, boolean outermember, boolean member); 78 93 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 */ 79 98 public boolean isProperLineStyle() { 80 99 return false; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r12285 r12303 24 24 */ 25 25 public class TextLabel implements StyleKeys { 26 /** 27 * The default strategy to use when determining the label of a element. 28 */ 26 29 public static final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy(); 27 30
Note:
See TracChangeset
for help on using the changeset viewer.