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