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 / SymbolManager.java @ 40559
History | View | Annotate | Download (9.14 KB)
1 |
/**
|
---|---|
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 |
/*
|
25 |
* AUTHORS (In addition to CIT):
|
26 |
* 2009 {DiSiD Technologies} {{Task}}
|
27 |
*/
|
28 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
29 |
|
30 |
import java.awt.Color; |
31 |
import java.io.File; |
32 |
import java.io.FileFilter; |
33 |
|
34 |
import org.gvsig.fmap.geom.Geometry; |
35 |
import org.gvsig.fmap.mapcontext.MapContextException; |
36 |
import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
37 |
import org.gvsig.tools.persistence.PersistenceManager; |
38 |
|
39 |
/**
|
40 |
* Symbols management: creation, registration, etc.
|
41 |
*
|
42 |
* @author gvSIG team
|
43 |
*/
|
44 |
public interface SymbolManager { |
45 |
|
46 |
public static final String LEGEND_FILE_EXTENSION = ".gvsleg"; |
47 |
public static final String LABELINGSTRATEGY_FILE_EXTENSION = ".gvslab"; |
48 |
|
49 |
/**
|
50 |
* Loads the symbols persisted into a folder. It loads the symbols through
|
51 |
* the use of the current {@link PersistenceManager}, loading all files
|
52 |
* found into the folder.
|
53 |
*
|
54 |
* @param folder
|
55 |
* to load the persisted symbols from
|
56 |
* @return the list of loaded symbols
|
57 |
* @throws SymbolException
|
58 |
* if there is an error loading the symbols
|
59 |
*/
|
60 |
ISymbol[] loadSymbols(File folder) throws SymbolException; |
61 |
|
62 |
/**
|
63 |
* Loads the symbols persisted into a folder. It loads the symbols through
|
64 |
* the use of the current {@link PersistenceManager}, loading the files
|
65 |
* found into the folder which apply to the provided filter.
|
66 |
*
|
67 |
* @param folder
|
68 |
* to load the persisted symbols from
|
69 |
* @param filter
|
70 |
* to apply to know which files to load
|
71 |
* @return the list of loaded symbols
|
72 |
* @throws SymbolException
|
73 |
* if there is an error loading the symbols
|
74 |
*/
|
75 |
ISymbol[] loadSymbols(File folder, FileFilter filter) |
76 |
throws SymbolException;
|
77 |
|
78 |
/**
|
79 |
* Persists a {@link ISymbol} into the given folder, with the given file
|
80 |
* name.
|
81 |
*
|
82 |
* @param symbol
|
83 |
* to persist
|
84 |
* @param fileName
|
85 |
* of the file to create
|
86 |
* @param folder
|
87 |
* where to create the file
|
88 |
* @throws SymbolException
|
89 |
* if there is an error persisting the symbol, or the file to
|
90 |
* create already exists
|
91 |
*/
|
92 |
void saveSymbol(ISymbol symbol, String fileName, File folder) |
93 |
throws SymbolException;
|
94 |
|
95 |
/**
|
96 |
* Persists a {@link ISymbol} into the given folder, with the given file
|
97 |
* name.
|
98 |
*
|
99 |
* @param symbol
|
100 |
* to persist
|
101 |
* @param fileName
|
102 |
* of the file to create
|
103 |
* @param folder
|
104 |
* where to create the file
|
105 |
* @param overwrite
|
106 |
* what to do if the file to create already exists
|
107 |
* @throws SymbolException
|
108 |
* if there is an error persisting the symbol, or the file to
|
109 |
* create already exists and overwrite is false
|
110 |
*/
|
111 |
void saveSymbol(ISymbol symbol, String fileName, File folder, |
112 |
boolean overwrite) throws SymbolException; |
113 |
|
114 |
/**
|
115 |
* Returns the current {@link SymbolPreferences}.
|
116 |
*
|
117 |
* @return the current {@link SymbolPreferences}
|
118 |
*/
|
119 |
SymbolPreferences getSymbolPreferences(); |
120 |
|
121 |
/**
|
122 |
* Creates a new {@link ISymbol}.
|
123 |
*
|
124 |
* @param symbolName
|
125 |
* the name of the symbol to create
|
126 |
* @return a new {@link ISymbol}
|
127 |
* @throws MapContextRuntimeException
|
128 |
* if there is an error creating the symbol
|
129 |
*/
|
130 |
ISymbol createSymbol(String symbolName) throws MapContextRuntimeException; |
131 |
|
132 |
/**
|
133 |
* Creates a new {@link ISymbol} which can be used to render the given
|
134 |
* {@link Geometry} type.
|
135 |
*
|
136 |
* @param geomType
|
137 |
* the {@link Geometry} type to render
|
138 |
* @return a new {@link ISymbol}
|
139 |
* @throws MapContextRuntimeException
|
140 |
* if there is an error creating the symbol
|
141 |
*/
|
142 |
ISymbol createSymbol(int geomType) throws MapContextRuntimeException; |
143 |
|
144 |
/**
|
145 |
* Creates a new {@link ISymbol} with the given {@link Color}.
|
146 |
*
|
147 |
* @param symbolName
|
148 |
* the name of the symbol to create
|
149 |
* @param color
|
150 |
* the color for the symbol
|
151 |
* @return a new {@link ISymbol}
|
152 |
* @throws MapContextRuntimeException
|
153 |
* if there is an error creating the symbol
|
154 |
*/
|
155 |
ISymbol createSymbol(String symbolName, Color color) |
156 |
throws MapContextRuntimeException;
|
157 |
|
158 |
/**
|
159 |
* Creates a new {@link ISymbol} which can be used to render the given
|
160 |
* {@link Geometry} type, with the given {@link Color}.
|
161 |
*
|
162 |
* @param geomType
|
163 |
* the {@link Geometry} type to render
|
164 |
* @param color
|
165 |
* the color for the symbol
|
166 |
* @return a new {@link ISymbol}
|
167 |
* @throws MapContextRuntimeException
|
168 |
* if there is an error creating the symbol
|
169 |
*/
|
170 |
ISymbol createSymbol(int geomType, Color color) |
171 |
throws MapContextRuntimeException;
|
172 |
|
173 |
/**
|
174 |
* Creates a new {@link IMultiLayerSymbol}.
|
175 |
*
|
176 |
* @param symbolName
|
177 |
* the name of the symbol to create
|
178 |
* @return a new {@link IMultiLayerSymbol}
|
179 |
* @throws MapContextRuntimeException
|
180 |
* if there is an error creating the symbol
|
181 |
*/
|
182 |
IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
|
183 |
throws MapContextRuntimeException;
|
184 |
|
185 |
/**
|
186 |
* Creates a new {@link IMultiLayerSymbol} which can be used to render the
|
187 |
* given {@link Geometry} type.
|
188 |
*
|
189 |
* @param geomType
|
190 |
* the {@link Geometry} type to render
|
191 |
* @return a new {@link IMultiLayerSymbol}
|
192 |
* @throws MapContextRuntimeException
|
193 |
* if there is an error creating the symbol
|
194 |
*/
|
195 |
IMultiLayerSymbol createMultiLayerSymbol(int geomType)
|
196 |
throws MapContextRuntimeException;
|
197 |
|
198 |
/**
|
199 |
* Registers a {@link ISymbol} implementation class with a name. This way
|
200 |
* the symbol class is not related to any geometry type, so it can be
|
201 |
* created only through the {@link #createSymbol(String)} method.
|
202 |
*
|
203 |
* @param symbolName
|
204 |
* the symbol name
|
205 |
* @param symbolClass
|
206 |
* the symbol implementation class
|
207 |
* @throws MapContextRuntimeException
|
208 |
* if the provided class does not implement the ISymbol
|
209 |
* interface
|
210 |
*/
|
211 |
void registerSymbol(String symbolName, Class symbolClass) |
212 |
throws MapContextRuntimeException;
|
213 |
|
214 |
/**
|
215 |
* Registers a {@link ISymbol} implementation class with a name and a list
|
216 |
* of geometry types which the symbol is able to render.
|
217 |
*
|
218 |
* @param symbolName
|
219 |
* the symbol name
|
220 |
* @param geomTypes
|
221 |
* the list of geometry types the symbol is able to render
|
222 |
* @param symbolClass
|
223 |
* the symbol implementation class
|
224 |
* @throws MapContextRuntimeException
|
225 |
* if the provided class does not implement the ISymbol
|
226 |
* interface
|
227 |
*/
|
228 |
void registerSymbol(String symbolName, int[] geomTypes, Class symbolClass) |
229 |
throws MapContextException;
|
230 |
|
231 |
/**
|
232 |
* Registers a {@link IMultiLayerSymbol} implementation class with a name.
|
233 |
* This way the symbol class is not related to any geometry type, so it can
|
234 |
* be created only through the {@link #createMultiLayerSymbol(String)}
|
235 |
* method.
|
236 |
*
|
237 |
* @param symbolName
|
238 |
* the symbol name
|
239 |
* @param symbolClass
|
240 |
* the symbol implementation class
|
241 |
* @throws MapContextRuntimeException
|
242 |
* if the provided class does not implement the
|
243 |
* {@link IMultiLayerSymbol} interface
|
244 |
*/
|
245 |
void registerMultiLayerSymbol(String symbolName, Class symbolClass) |
246 |
throws MapContextRuntimeException;
|
247 |
|
248 |
/**
|
249 |
* Registers a {@link IMultiLayerSymbol} implementation class with a name
|
250 |
* and a list of geometry types which the symbol is able to render.
|
251 |
*
|
252 |
* @param symbolName
|
253 |
* the symbol name
|
254 |
* @param geomTypes
|
255 |
* the list of geometry types the symbol is able to render
|
256 |
* @param symbolClass
|
257 |
* the symbol implementation class
|
258 |
* @throws MapContextRuntimeException
|
259 |
* if the provided class does not implement the
|
260 |
* {@link IMultiLayerSymbol} interface
|
261 |
*/
|
262 |
void registerMultiLayerSymbol(String symbolName, int[] geomTypes, |
263 |
Class symbolClass) throws MapContextRuntimeException; |
264 |
|
265 |
/**
|
266 |
* Returns an instance of {@link IWarningSymbol}.
|
267 |
*
|
268 |
* TODO: revisar el uso de esto, a ver si es necesario o se puede ocultar
|
269 |
* dentro de la implementaci?n.
|
270 |
*
|
271 |
* @param message
|
272 |
* @param symbolDesc
|
273 |
* @param symbolDrawExceptionType
|
274 |
* @return the warning symbol
|
275 |
* @throws MapContextRuntimeException
|
276 |
*/
|
277 |
IWarningSymbol getWarningSymbol(String message, String symbolDesc, |
278 |
int symbolDrawExceptionType) throws MapContextRuntimeException; |
279 |
|
280 |
void setSymbolPreferences(SymbolPreferences symbolPreferences);
|
281 |
|
282 |
} |