svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / rendering / symbols / impl / DefaultSymbolPreferences.java @ 40559
History | View | Annotate | Download (5.58 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | /* gvSIG. Geographic Information System of the Valencian Government
|
25 | *
|
||
26 | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
||
27 | * of the Valencian Government (CIT)
|
||
28 | *
|
||
29 | * This program is free software; you can redistribute it and/or
|
||
30 | * modify it under the terms of the GNU General Public License
|
||
31 | * as published by the Free Software Foundation; either version 2
|
||
32 | * of the License, or (at your option) any later version.
|
||
33 | *
|
||
34 | * This program is distributed in the hope that it will be useful,
|
||
35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
37 | * GNU General Public License for more details.
|
||
38 | *
|
||
39 | * You should have received a copy of the GNU General Public License
|
||
40 | * along with this program; if not, write to the Free Software
|
||
41 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
42 | * MA 02110-1301, USA.
|
||
43 | *
|
||
44 | */
|
||
45 | |||
46 | /*
|
||
47 | * AUTHORS (In addition to CIT):
|
||
48 | * 2009 {} {{Task}}
|
||
49 | */
|
||
50 | package org.gvsig.fmap.mapcontext.rendering.symbols.impl; |
||
51 | |||
52 | import java.awt.Color; |
||
53 | import java.awt.Font; |
||
54 | import java.io.File; |
||
55 | |||
56 | import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
||
57 | import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences; |
||
58 | |||
59 | /**
|
||
60 | * Default {@link SymbolPreferences} implementation based on object attributes.
|
||
61 | *
|
||
62 | * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
|
||
63 | */
|
||
64 | public class DefaultSymbolPreferences implements SymbolPreferences { |
||
65 | |||
66 | private String symbolFileExtension = ".gvssym"; |
||
67 | |||
68 | private Color defaultSymbolColor; |
||
69 | |||
70 | private Color defaultSymbolFillColor; |
||
71 | |||
72 | private boolean defaultSymbolFillColorAleatory; |
||
73 | |||
74 | private Font defaultSymbolFont; |
||
75 | |||
76 | private String symbolLibraryPath; |
||
77 | |||
78 | /**
|
||
79 | * The unit that will be used when creating new symbols with Cartographic
|
||
80 | * support.
|
||
81 | */
|
||
82 | private int defaultCartographicSupportMeasureUnit = -1; |
||
83 | |||
84 | /**
|
||
85 | * The reference system that will be used when creating new symbols with
|
||
86 | * Cartographic support.
|
||
87 | */
|
||
88 | private int defaultCartographicSupportReferenceSystem = |
||
89 | CartographicSupport.WORLD; |
||
90 | |||
91 | public DefaultSymbolPreferences() {
|
||
92 | resetDefaultSymbolColor(); |
||
93 | resetDefaultSymbolFillColor(); |
||
94 | resetDefaultSymbolFillColorAleatory(); |
||
95 | resetSymbolLibraryPath(); |
||
96 | resetDefaultSymbolFont(); |
||
97 | } |
||
98 | |||
99 | public String getSymbolFileExtension() { |
||
100 | return symbolFileExtension;
|
||
101 | } |
||
102 | |||
103 | public void setSymbolFileExtension(String symbolFileExtension) { |
||
104 | this.symbolFileExtension = symbolFileExtension;
|
||
105 | } |
||
106 | public String getSymbolLibraryPath() { |
||
107 | return symbolLibraryPath;
|
||
108 | } |
||
109 | |||
110 | public void setSymbolLibraryPath(String symbolLibraryPath) { |
||
111 | this.symbolLibraryPath = symbolLibraryPath;
|
||
112 | } |
||
113 | |||
114 | public void resetSymbolLibraryPath() { |
||
115 | |||
116 | symbolLibraryPath = |
||
117 | System.getProperty("user.home") + File.separator + "gvSIG" |
||
118 | + File.separator + "plugins" + File.separator + |
||
119 | 40489 | jldominguez | "org.gvsig.app.mainplugin" + File.separator + "Symbols"; |
120 | 40435 | jjdelcerro | } |
121 | |||
122 | public Color getDefaultSymbolColor() { |
||
123 | return defaultSymbolColor;
|
||
124 | } |
||
125 | |||
126 | public void setDefaultSymbolColor(Color defaultSymbolColor) { |
||
127 | this.defaultSymbolColor = defaultSymbolColor;
|
||
128 | } |
||
129 | |||
130 | public void resetDefaultSymbolColor() { |
||
131 | defaultSymbolColor = Color.GRAY;
|
||
132 | } |
||
133 | |||
134 | public Color getDefaultSymbolFillColor() { |
||
135 | return defaultSymbolFillColor;
|
||
136 | } |
||
137 | |||
138 | public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) { |
||
139 | this.defaultSymbolFillColor = defaultSymbolFillColor;
|
||
140 | } |
||
141 | |||
142 | public void resetDefaultSymbolFillColor() { |
||
143 | defaultSymbolFillColor = new Color(60, 235, 235); |
||
144 | } |
||
145 | |||
146 | public boolean isDefaultSymbolFillColorAleatory() { |
||
147 | return defaultSymbolFillColorAleatory;
|
||
148 | } |
||
149 | |||
150 | public void setDefaultSymbolFillColorAleatory( |
||
151 | boolean defaultSymbolFillColorAleatory) {
|
||
152 | this.defaultSymbolFillColorAleatory = defaultSymbolFillColorAleatory;
|
||
153 | } |
||
154 | |||
155 | public void resetDefaultSymbolFillColorAleatory() { |
||
156 | defaultSymbolFillColorAleatory = false;
|
||
157 | } |
||
158 | |||
159 | public Font getDefaultSymbolFont() { |
||
160 | return defaultSymbolFont;
|
||
161 | } |
||
162 | |||
163 | public void setDefaultSymbolFont(Font defaultSymbolFont) { |
||
164 | this.defaultSymbolFont = defaultSymbolFont;
|
||
165 | } |
||
166 | |||
167 | public void resetDefaultSymbolFont() { |
||
168 | defaultSymbolFont = new Font("Serif", Font.PLAIN, 8); |
||
169 | } |
||
170 | |||
171 | public int getDefaultCartographicSupportMeasureUnit() { |
||
172 | return defaultCartographicSupportMeasureUnit;
|
||
173 | } |
||
174 | |||
175 | public void setDefaultCartographicSupportMeasureUnit( |
||
176 | int defaultCartographicSupportMeasureUnit) {
|
||
177 | this.defaultCartographicSupportMeasureUnit =
|
||
178 | defaultCartographicSupportMeasureUnit; |
||
179 | } |
||
180 | |||
181 | public int getDefaultCartographicSupportReferenceSystem() { |
||
182 | return defaultCartographicSupportReferenceSystem;
|
||
183 | } |
||
184 | |||
185 | public void setDefaultCartographicSupportReferenceSystem( |
||
186 | int defaultCartographicSupportReferenceSystem) {
|
||
187 | this.defaultCartographicSupportReferenceSystem =
|
||
188 | defaultCartographicSupportReferenceSystem; |
||
189 | } |
||
190 | } |