source: josm/trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java@ 3862

Last change on this file since 3862 was 3862, checked in by bastiK, 13 years ago

mapcss: fill-image

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain
File size: 6.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm.visitor.paint;
3
4import java.awt.Color;
5
6import org.openstreetmap.josm.Main;
7import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
8import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
9
10public class MapPaintSettings implements PreferenceChangedListener {
11
12 public static final MapPaintSettings INSTANCE = new MapPaintSettings();
13
14 private boolean useRealWidth;
15 private boolean showDirectionArrow;
16 private boolean showRelevantDirectionsOnly;
17 private int defaultSegmentWidth;
18 private boolean showOrderNumber;
19 private boolean showHeadArrowOnly;
20 private int showNamesDistance;
21 private int useStrokesDistance;
22 private int showIconsDistance;
23 private int selectedNodeSize;
24 private int connectionNodeSize;
25 private int unselectedNodeSize;
26 private int taggedNodeSize;
27 private boolean fillSelectedNode;
28 private boolean fillUnselectedNode;
29 private boolean fillTaggedNode;
30 private boolean fillConnectionNode;
31 private boolean outlineOnly;
32 private Color selectedColor;
33 private Color relationSelectedColor;
34 private Color highlightColor;
35 private Color inactiveColor;
36 private Color nodeColor;
37 private Color taggedColor;
38 private Color connectionColor;
39 private Color taggedConnectionColor;
40
41 private MapPaintSettings() {
42 load();
43 Main.pref.addPreferenceChangeListener(this);
44 }
45
46 private void load() {
47 showDirectionArrow = Main.pref.getBoolean("draw.segment.direction", true);
48 showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only", true);
49 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false);
50 defaultSegmentWidth = Main.pref.getInteger("mappaint.segment.default-width", 2);
51
52 selectedColor = PaintColors.SELECTED.get();
53 relationSelectedColor = PaintColors.RELATIONSELECTED.get();
54 highlightColor = PaintColors.HIGHLIGHT.get();
55 inactiveColor = PaintColors.INACTIVE.get();
56 nodeColor = PaintColors.NODE.get();
57 taggedColor = PaintColors.TAGGED.get();
58 connectionColor = PaintColors.CONNECTION.get();
59 if (taggedColor != nodeColor) {
60 taggedConnectionColor = taggedColor;
61 } else {
62 taggedConnectionColor = connectionColor;
63 }
64
65
66 showOrderNumber = Main.pref.getBoolean("draw.segment.order_number", false);
67 showHeadArrowOnly = Main.pref.getBoolean("draw.segment.head_only", false);
68
69 showNamesDistance = Main.pref.getInteger("mappaint.shownames", 10000000);
70 useStrokesDistance = Main.pref.getInteger("mappaint.strokes", 10000000);
71 showIconsDistance = Main.pref.getInteger("mappaint.showicons", 10000000);
72
73 selectedNodeSize = Main.pref.getInteger("mappaint.node.selected-size", 5);
74 unselectedNodeSize = Main.pref.getInteger("mappaint.node.unselected-size", 3);
75 connectionNodeSize = Main.pref.getInteger("mappaint.node.connection-size", 5);
76 taggedNodeSize = Main.pref.getInteger("mappaint.node.tagged-size", 3);
77 fillSelectedNode = Main.pref.getBoolean("mappaint.node.fill-selected", true);
78 fillUnselectedNode = Main.pref.getBoolean("mappaint.node.fill-unselected", false);
79 fillTaggedNode = Main.pref.getBoolean("mappaint.node.fill-tagged", true);
80 fillConnectionNode = Main.pref.getBoolean("mappaint.node.fill-connection", false);
81
82 outlineOnly = Main.pref.getBoolean("draw.data.area_outline_only", false);
83
84 }
85
86 public void preferenceChanged(PreferenceChangeEvent e) {
87 load();
88 }
89
90 public boolean isUseRealWidth() {
91 return useRealWidth;
92 }
93
94 public boolean isShowDirectionArrow() {
95 return showDirectionArrow;
96 }
97
98 public boolean isShowRelevantDirectionsOnly() {
99 return showRelevantDirectionsOnly;
100 }
101
102 public int getDefaultSegmentWidth() {
103 return defaultSegmentWidth;
104 }
105
106 public Color getSelectedColor() {
107 return selectedColor;
108 }
109
110 public Color getSelectedColor(int alpha) {
111 return new Color(selectedColor.getRGB() & 0x00ffffff | (alpha << 24), true);
112 }
113
114 public Color getRelationSelectedColor() {
115 return relationSelectedColor;
116 }
117
118 public Color getRelationSelectedColor(int alpha) {
119 return new Color(relationSelectedColor.getRGB() & 0x00ffffff | (alpha << 24), true);
120 }
121
122 public Color getHighlightColor() {
123 return highlightColor;
124 }
125
126 public Color getInactiveColor() {
127 return inactiveColor;
128 }
129
130 public Color getNodeColor() {
131 return nodeColor;
132 }
133
134 public Color getTaggedColor() {
135 return taggedColor;
136 }
137
138 public Color getConnectionColor() {
139 return connectionColor;
140 }
141
142 public Color getTaggedConnectionColor() {
143 return taggedConnectionColor;
144 }
145
146 public boolean isShowOrderNumber() {
147 return showOrderNumber;
148 }
149
150 public void setShowHeadArrowOnly(boolean showHeadArrowOnly) {
151 this.showHeadArrowOnly = showHeadArrowOnly;
152 }
153
154 public boolean isShowHeadArrowOnly() {
155 return showHeadArrowOnly;
156 }
157
158 public int getShowNamesDistance() {
159 return showNamesDistance;
160 }
161
162 public int getUseStrokesDistance() {
163 return useStrokesDistance;
164 }
165
166 public int getShowIconsDistance() {
167 return showIconsDistance;
168 }
169
170 public int getSelectedNodeSize() {
171 return selectedNodeSize;
172 }
173
174 public int getConnectionNodeSize() {
175 return connectionNodeSize;
176 }
177
178 public int getUnselectedNodeSize() {
179 return unselectedNodeSize;
180 }
181
182 public int getTaggedNodeSize() {
183 return taggedNodeSize;
184 }
185
186 public boolean isFillSelectedNode() {
187 return fillSelectedNode;
188 }
189
190 public boolean isFillUnselectedNode() {
191 return fillUnselectedNode;
192 }
193
194 public boolean isFillConnectionNode() {
195 return fillConnectionNode;
196 }
197
198 public boolean isFillTaggedNode() {
199 return fillTaggedNode;
200 }
201
202 public boolean isOutlineOnly() {
203 return outlineOnly;
204 }
205}
Note: See TracBrowser for help on using the repository browser.