1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.osm.visitor.paint;
|
---|
3 |
|
---|
4 | import java.awt.Color;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.Main;
|
---|
7 | import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent;
|
---|
8 | import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
|
---|
9 |
|
---|
10 | public 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 taggedNodeSize;
|
---|
25 | private int unselectedNodeSize;
|
---|
26 | private boolean fillSelectedNode;
|
---|
27 | private boolean fillUnselectedNode;
|
---|
28 |
|
---|
29 | private Color selectedColor;
|
---|
30 | private Color highlightColor;
|
---|
31 | private Color inactiveColor;
|
---|
32 | private Color nodeColor;
|
---|
33 |
|
---|
34 | private MapPaintSettings() {
|
---|
35 | load();
|
---|
36 | Main.pref.addPreferenceChangeListener(this);
|
---|
37 | }
|
---|
38 |
|
---|
39 | private void load() {
|
---|
40 | showDirectionArrow = Main.pref.getBoolean("draw.segment.direction", true);
|
---|
41 | showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only", true);
|
---|
42 | useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth", false);
|
---|
43 | defaultSegmentWidth = Main.pref.getInteger("mappaint.segment.default-width", 2);
|
---|
44 |
|
---|
45 | selectedColor = PaintColors.SELECTED.get();
|
---|
46 | highlightColor = PaintColors.HIGHLIGHT.get();
|
---|
47 | inactiveColor = PaintColors.INACTIVE.get();
|
---|
48 | nodeColor = PaintColors.NODE.get();
|
---|
49 |
|
---|
50 | showOrderNumber = Main.pref.getBoolean("draw.segment.order_number", false);
|
---|
51 | showHeadArrowOnly = Main.pref.getBoolean("draw.segment.head_only", false);
|
---|
52 |
|
---|
53 | showNamesDistance = Main.pref.getInteger("mappaint.shownames", 10000000);
|
---|
54 | useStrokesDistance = Main.pref.getInteger("mappaint.strokes", 10000000);
|
---|
55 | showIconsDistance = Main.pref.getInteger("mappaint.showicons", 10000000);
|
---|
56 |
|
---|
57 | selectedNodeSize = Main.pref.getInteger("mappaint.node.selected-size", 5);
|
---|
58 | unselectedNodeSize = Main.pref.getInteger("mappaint.node.unselected-size", 3);
|
---|
59 | taggedNodeSize = Main.pref.getInteger("mappaint.node.tagged-size", 5);
|
---|
60 | fillSelectedNode = Main.pref.getBoolean("mappaint.node.fill-selected", true);
|
---|
61 | fillUnselectedNode = Main.pref.getBoolean("mappaint.node.fill-unselected", false);
|
---|
62 | }
|
---|
63 |
|
---|
64 | public void preferenceChanged(PreferenceChangeEvent e) {
|
---|
65 | load();
|
---|
66 | }
|
---|
67 |
|
---|
68 | public boolean isUseRealWidth() {
|
---|
69 | return useRealWidth;
|
---|
70 | }
|
---|
71 |
|
---|
72 | public boolean isShowDirectionArrow() {
|
---|
73 | return showDirectionArrow;
|
---|
74 | }
|
---|
75 |
|
---|
76 | public boolean isShowRelevantDirectionsOnly() {
|
---|
77 | return showRelevantDirectionsOnly;
|
---|
78 | }
|
---|
79 |
|
---|
80 | public int getDefaultSegmentWidth() {
|
---|
81 | return defaultSegmentWidth;
|
---|
82 | }
|
---|
83 |
|
---|
84 | public Color getSelectedColor() {
|
---|
85 | return selectedColor;
|
---|
86 | }
|
---|
87 |
|
---|
88 | public Color getHighlightColor() {
|
---|
89 | return highlightColor;
|
---|
90 | }
|
---|
91 |
|
---|
92 | public Color getInactiveColor() {
|
---|
93 | return inactiveColor;
|
---|
94 | }
|
---|
95 |
|
---|
96 | public boolean isShowOrderNumber() {
|
---|
97 | return showOrderNumber;
|
---|
98 | }
|
---|
99 |
|
---|
100 | public void setShowHeadArrowOnly(boolean showHeadArrowOnly) {
|
---|
101 | this.showHeadArrowOnly = showHeadArrowOnly;
|
---|
102 | }
|
---|
103 |
|
---|
104 | public boolean isShowHeadArrowOnly() {
|
---|
105 | return showHeadArrowOnly;
|
---|
106 | }
|
---|
107 |
|
---|
108 | public int getShowNamesDistance() {
|
---|
109 | return showNamesDistance;
|
---|
110 | }
|
---|
111 |
|
---|
112 | public int getUseStrokesDistance() {
|
---|
113 | return useStrokesDistance;
|
---|
114 | }
|
---|
115 |
|
---|
116 | public Color getNodeColor() {
|
---|
117 | return nodeColor;
|
---|
118 | }
|
---|
119 |
|
---|
120 | public int getShowIconsDistance() {
|
---|
121 | return showIconsDistance;
|
---|
122 | }
|
---|
123 |
|
---|
124 | public int getSelectedNodeSize() {
|
---|
125 | return selectedNodeSize;
|
---|
126 | }
|
---|
127 |
|
---|
128 | public int getTaggedNodeSize() {
|
---|
129 | return taggedNodeSize;
|
---|
130 | }
|
---|
131 |
|
---|
132 | public int getUnselectedNodeSize() {
|
---|
133 | return unselectedNodeSize;
|
---|
134 | }
|
---|
135 |
|
---|
136 | public boolean isFillSelectedNode() {
|
---|
137 | return fillSelectedNode;
|
---|
138 | }
|
---|
139 |
|
---|
140 | public boolean isFillUnselectedNode() {
|
---|
141 | return fillUnselectedNode;
|
---|
142 | }
|
---|
143 | }
|
---|