source: josm/trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java@ 12987

Last change on this file since 12987 was 12987, checked in by bastiK, 7 years ago

see #15410 - change preferences scheme for named colors - makes runtime color name registry obsolete

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm.visitor.paint;
3
4import static org.openstreetmap.josm.tools.I18n.marktr;
5
6import java.awt.Color;
7
8import org.openstreetmap.josm.data.preferences.CachingProperty;
9import org.openstreetmap.josm.data.preferences.NamedColorProperty;
10import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
11
12/**
13 * The colors used to paint the map, especially with the wireframe renderer
14 * <p>
15 * This enum stores the colors to be set in the preferences
16 */
17public enum PaintColors {
18
19 /**
20 * Inactive objects
21 */
22 INACTIVE(marktr("inactive"), Color.darkGray),
23 /**
24 * Currently selected objects
25 */
26 SELECTED(marktr("selected"), Color.red),
27 /**
28 * Objects that are part of a selected relation
29 */
30 RELATIONSELECTED(marktr("Relation: selected"), Color.magenta),
31 /**
32 * Normal nodes
33 */
34 NODE(marktr("Node: standard"), Color.yellow),
35 /**
36 * Connected nodes
37 */
38 CONNECTION(marktr("Node: connection"), Color.yellow),
39 /**
40 * A tagged node
41 */
42 TAGGED(marktr("Node: tagged"), new Color(204, 255, 255)), // light cyan
43 /**
44 * Default way color
45 */
46 DEFAULT_WAY(marktr("way"), new Color(0, 0, 128)), // dark blue
47 /**
48 * Relation color
49 */
50 RELATION(marktr("relation"), new Color(0, 128, 128)), // teal
51 /**
52 * Color for untagged way
53 */
54 UNTAGGED_WAY(marktr("untagged way"), new Color(0, 128, 0)), // dark green
55 /**
56 * Background of the map
57 */
58 BACKGROUND(marktr("background"), Color.BLACK),
59 /**
60 * Highlight around a selected node/way, MapCSS renderer
61 */
62 HIGHLIGHT(marktr("highlight"), SELECTED.get()),
63 /**
64 * Highlight around a selected node/way, Wireframe renderer
65 */
66 HIGHLIGHT_WIREFRAME(marktr("highlight wireframe"), Color.orange),
67
68 /**
69 * Untagged way
70 */
71 UNTAGGED(marktr("untagged"), Color.GRAY),
72 /**
73 * Default text color
74 */
75 TEXT(marktr("text"), Color.WHITE),
76 /**
77 * Default text color for areas
78 */
79 AREA_TEXT(marktr("areatext"), Color.LIGHT_GRAY);
80
81 /**
82 * The name of the color
83 */
84 private final String name;
85 private final Color defaultColor;
86 private final NamedColorProperty baseProperty;
87 private final CachingProperty<Color> property;
88
89 PaintColors(String name, Color defaultColor) {
90 baseProperty = new NamedColorProperty(name, defaultColor);
91 property = baseProperty.cached();
92 this.name = name;
93 this.defaultColor = defaultColor;
94 }
95
96 /**
97 * Gets the default value for this color.
98 * @return The default value
99 */
100 public Color getDefaultValue() {
101 return property.getDefaultValue();
102 }
103
104 /**
105 * Get the given color
106 * @return The color
107 */
108 public Color get() {
109 return property.get();
110 }
111
112 /**
113 * Returns the background color.
114 * @return the background color
115 */
116 public static Color getBackgroundColor() {
117 return MapPaintStyles.getStyles().getBackgroundColor();
118 }
119
120 /**
121 * Get the color property
122 * @return The property that is used to access the color.
123 * @since 10874
124 */
125 public NamedColorProperty getProperty() {
126 return baseProperty;
127 }
128}
Note: See TracBrowser for help on using the repository browser.