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 / MapContextManager.java @ 43574
History | View | Annotate | Download (14.8 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} {Create Manager to register MapContextDrawer implementation}
|
27 |
*/
|
28 |
package org.gvsig.fmap.mapcontext; |
29 |
|
30 |
import java.awt.Color; |
31 |
import java.awt.Font; |
32 |
import java.io.File; |
33 |
import java.util.List; |
34 |
|
35 |
import org.cresques.cts.IProjection; |
36 |
|
37 |
import org.gvsig.fmap.dal.DataStore; |
38 |
import org.gvsig.fmap.dal.DataStoreParameters; |
39 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
40 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
41 |
import org.gvsig.fmap.mapcontext.layers.LayerInformationBuilder; |
42 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
43 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
44 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
45 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
46 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
47 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy; |
48 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol; |
49 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
50 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
51 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
52 |
import org.gvsig.tools.observer.Observable; |
53 |
|
54 |
/**
|
55 |
* Manager of the MapContext library.
|
56 |
*
|
57 |
* Holds the default implementation of the {@link MapContextDrawer}.
|
58 |
*
|
59 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
|
60 |
* @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a>
|
61 |
*/
|
62 |
public interface MapContextManager extends Observable { |
63 |
|
64 |
public static final String GET_DEFAULT_CRS = "MAPCONTEXTMANAGER_GET_DEFAULT_CRS"; |
65 |
public static final String CREATE_LEGEND = "MAPCONTEXTMANAGER_CREATE_LEGEND"; |
66 |
public static final String CREATE_MAPCONTEXT_DRAWER = "MAPCONTEXTMANAGER_CREATE_MAPCONTEXT_DRAWER"; |
67 |
public static final String SET_MAPCONTEXT_DRAWER = "MAPCONTEXTMANAGER_SET_MAPCONTEXT_DRAWER"; |
68 |
public static final String CREATE_GRAPHICS_LAYER = "MAPCONTEXTMANAGER_CREATE_GRAPHICS_LAYER"; |
69 |
public static final String REGISTER_LEGEND = "MAPCONTEXTMANAGER_REGISTER_LEGEND"; |
70 |
public static final String REGISTER_LEGEND_READER = "MAPCONTEXTMANAGER_REGISTER_LEGEND_READER"; |
71 |
public static final String CREATE_LEGEND_READER = "MAPCONTEXTMANAGER_CREATE_LEGEND_READER"; |
72 |
public static final String REGISTER_LEGEND_WRITER = "MAPCONTEXTMANAGER_REGISTER_LEGEND_WRITER"; |
73 |
public static final String CREATE_SYMBOL = "MAPCONTEXTMANAGER_CREATE_SYMBOL"; |
74 |
public static final String LOAD_SYMBOLS = "MAPCONTEXTMANAGER_LOAD_SYMBOLS"; |
75 |
public static final String REGISTER_MULTILAYER_SYMBOL = "MAPCONTEXTMANAGER_REGISTER_MULTILAYER_SYMBOL"; |
76 |
public static final String REGISTER_SYMBOL = "MAPCONTEXTMANAGER_REGISTER_SYMBOL"; |
77 |
public static final String CREATE_LAYER = "MAPCONTEXTMANAGER_CREATE_LAYER"; |
78 |
public static final String LOAD_LAYER = "MAPCONTEXTMANAGER_LOAD_LAYER"; |
79 |
public static final String REGISTER_ICON_LAYER = "MAPCONTEXTMANAGER_REGISTER_ICON_LAYER"; |
80 |
public static final String CREATE_MAPCONTEXT = "MAPCONTEXTMANAGER_CREATE_MAPCONTEXT"; |
81 |
public static final String LOAD_MAPCONTEXT = "MAPCONTEXTMANAGER_LOAD_MAPCONTEXT"; |
82 |
|
83 |
|
84 |
public MapContext createMapContext();
|
85 |
|
86 |
/**
|
87 |
* Create a new layer from the data parameters passed as parameter.
|
88 |
*
|
89 |
* @param layerName name used in for the new layer.
|
90 |
* @param parameters used for create the {@link DataStore} of the new layer
|
91 |
*
|
92 |
* @return the new FLayer
|
93 |
*
|
94 |
* @throws LoadLayerException
|
95 |
*/
|
96 |
public FLayer createLayer(String layerName, |
97 |
DataStoreParameters parameters) throws LoadLayerException;
|
98 |
|
99 |
/**
|
100 |
* Create a layer from a {@link DataStore}.
|
101 |
*
|
102 |
* @param layerName name used in for the new layer.
|
103 |
* @param store used for the new layer
|
104 |
*
|
105 |
* @return the new FLayer
|
106 |
*
|
107 |
* @throws LoadLayerException
|
108 |
*/
|
109 |
public FLayer createLayer(String layerName, DataStore store) |
110 |
throws LoadLayerException;
|
111 |
|
112 |
/**
|
113 |
* Create a layer to be used as the {@link GraphicLayer}.
|
114 |
*
|
115 |
* @param projection used in the layer.
|
116 |
*
|
117 |
* @return the new {@link GraphicLayer}.
|
118 |
*/
|
119 |
public GraphicLayer createGraphicsLayer(IProjection projection);
|
120 |
|
121 |
/**
|
122 |
* Returns the current {@link SymbolManager}.
|
123 |
*
|
124 |
* @return the {@link SymbolManager}
|
125 |
*/
|
126 |
SymbolManager getSymbolManager(); |
127 |
|
128 |
/**
|
129 |
* Sets the class to use as the default implementation for the
|
130 |
* {@link MapContextDrawer}.
|
131 |
*
|
132 |
* @param drawerClazz
|
133 |
* the {@link MapContextDrawer} class to use
|
134 |
* @throws MapContextException
|
135 |
* if there is any error setting the class
|
136 |
*/
|
137 |
public void setDefaultMapContextDrawer(Class drawerClazz) |
138 |
throws MapContextException;
|
139 |
|
140 |
public void validateMapContextDrawer(Class drawerClazz) throws MapContextException; |
141 |
|
142 |
/**
|
143 |
* Creates a new instance of the default {@link MapContextDrawer}
|
144 |
* implementation.
|
145 |
*
|
146 |
* @return the new {@link MapContextDrawer} instance
|
147 |
* @throws MapContextException
|
148 |
* if there is an error creating the new object instance
|
149 |
*/
|
150 |
public MapContextDrawer createDefaultMapContextDrawerInstance()
|
151 |
throws MapContextException;
|
152 |
|
153 |
/**
|
154 |
* Creates a new instance of the provided {@link MapContextDrawer}
|
155 |
* implementation.
|
156 |
*
|
157 |
* @param drawerClazz
|
158 |
* the {@link MapContextDrawer} implementation class
|
159 |
* @return the new {@link MapContextDrawer} instance
|
160 |
* @throws MapContextException
|
161 |
* if there is an error creating the new object instance
|
162 |
*/
|
163 |
public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz) |
164 |
throws MapContextException;
|
165 |
|
166 |
|
167 |
|
168 |
void registerLegend(String legendName, Class legendClass) |
169 |
throws MapContextRuntimeException;
|
170 |
|
171 |
ILegend createLegend(String legendName) throws MapContextRuntimeException; |
172 |
|
173 |
void setDefaultVectorLegend(String legendName); |
174 |
|
175 |
IVectorLegend createDefaultVectorLegend(int shapeType)
|
176 |
throws MapContextRuntimeException;
|
177 |
|
178 |
// ================================================================
|
179 |
// = Legend reading/writing (GVSLEG, SLD, etc)
|
180 |
|
181 |
/**
|
182 |
* Registers legend writer.
|
183 |
* Format is a MIME type string. Examples:
|
184 |
*
|
185 |
* "application/zip; subtype=gvsleg",
|
186 |
* "text/xml; subtype=sld/1.0.0",
|
187 |
* "text/xml; subtype=sld/1.1.0",
|
188 |
*
|
189 |
* @param legendClass Legend class
|
190 |
* @param format File type in mime format.
|
191 |
* @param writerClass Class object of the writer
|
192 |
* @throws MapContextRuntimeException
|
193 |
*/
|
194 |
void registerLegendWriter(Class legendClass, String format, |
195 |
Class writerClass) throws MapContextRuntimeException; |
196 |
|
197 |
/**
|
198 |
*
|
199 |
* Registers legend reader.
|
200 |
* Format is a MIME type string. Examples:
|
201 |
*
|
202 |
* "application/zip; subtype=gvsleg",
|
203 |
* "text/xml; subtype=sld/1.0.0",
|
204 |
* "text/xml; subtype=sld/1.1.0",
|
205 |
*
|
206 |
* @param format
|
207 |
* @param readerClass
|
208 |
* @throws MapContextRuntimeException
|
209 |
*/
|
210 |
void registerLegendReader(String format, Class readerClass) |
211 |
throws MapContextRuntimeException;
|
212 |
|
213 |
/**
|
214 |
* Creates a legend writer for the specified legend class
|
215 |
*
|
216 |
*/
|
217 |
ILegendWriter createLegendWriter(Class legendClass, String format) |
218 |
throws MapContextException;
|
219 |
|
220 |
/**
|
221 |
* Creates a legend reader for the given format
|
222 |
* ("sld", "gvsleg", etc are extracted from the MIME long string)
|
223 |
*/
|
224 |
ILegendReader createLegendReader(String format)
|
225 |
throws MapContextRuntimeException;
|
226 |
|
227 |
/**
|
228 |
*
|
229 |
* Format is a MIME type string. Examples:
|
230 |
*
|
231 |
* "application/zip; subtype=gvsleg",
|
232 |
* "text/xml; subtype=sld/1.0.0",
|
233 |
* "text/xml; subtype=sld/1.1.0",
|
234 |
*
|
235 |
* @return A list of Strings with the available formats for reading
|
236 |
* legends
|
237 |
*/
|
238 |
List getLegendReadingFormats();
|
239 |
|
240 |
/**
|
241 |
*
|
242 |
* Format is a MIME type string. Examples:
|
243 |
*
|
244 |
* "application/zip; subtype=gvsleg",
|
245 |
* "text/xml; subtype=sld/1.0.0",
|
246 |
* "text/xml; subtype=sld/1.1.0",
|
247 |
*
|
248 |
* @return A list of Strings with the available formats for writing
|
249 |
* legends
|
250 |
*/
|
251 |
List getLegendWritingFormats();
|
252 |
|
253 |
|
254 |
// ================================================================
|
255 |
|
256 |
/**
|
257 |
* @deprecated to be removed in gvSIG 2.0
|
258 |
* @see {@link SymbolPreferences}.
|
259 |
*/
|
260 |
int getDefaultCartographicSupportMeasureUnit();
|
261 |
|
262 |
/**
|
263 |
* @deprecated to be removed in gvSIG 2.0
|
264 |
* @see {@link SymbolPreferences}.
|
265 |
*/
|
266 |
void setDefaultCartographicSupportMeasureUnit(
|
267 |
int defaultCartographicSupportMeasureUnit);
|
268 |
|
269 |
/**
|
270 |
* @deprecated to be removed in gvSIG 2.0
|
271 |
* @see {@link SymbolPreferences}.
|
272 |
*/
|
273 |
int getDefaultCartographicSupportReferenceSystem();
|
274 |
|
275 |
/**
|
276 |
* @deprecated to be removed in gvSIG 2.0
|
277 |
* @see {@link SymbolPreferences}.
|
278 |
*/
|
279 |
void setDefaultCartographicSupportReferenceSystem(
|
280 |
int defaultCartographicSupportReferenceSystem);
|
281 |
|
282 |
/**
|
283 |
* @deprecated to be removed in gvSIG 2.0
|
284 |
* @see {@link SymbolPreferences}.
|
285 |
*/
|
286 |
Color getDefaultSymbolColor();
|
287 |
|
288 |
/**
|
289 |
* @deprecated to be removed in gvSIG 2.0
|
290 |
* @see {@link SymbolPreferences}.
|
291 |
*/
|
292 |
void setDefaultSymbolColor(Color defaultSymbolColor); |
293 |
|
294 |
/**
|
295 |
* @deprecated to be removed in gvSIG 2.0
|
296 |
* @see {@link SymbolPreferences}.
|
297 |
*/
|
298 |
void resetDefaultSymbolColor();
|
299 |
|
300 |
/**
|
301 |
* @deprecated to be removed in gvSIG 2.0
|
302 |
* @see {@link SymbolPreferences}.
|
303 |
*/
|
304 |
Color getDefaultSymbolFillColor();
|
305 |
|
306 |
/**
|
307 |
* @deprecated to be removed in gvSIG 2.0
|
308 |
* @see {@link SymbolPreferences}.
|
309 |
*/
|
310 |
void setDefaultSymbolFillColor(Color defaultSymbolFillColor); |
311 |
|
312 |
/**
|
313 |
* @deprecated to be removed in gvSIG 2.0
|
314 |
* @see {@link SymbolPreferences}.
|
315 |
*/
|
316 |
void resetDefaultSymbolFillColor();
|
317 |
|
318 |
/**
|
319 |
* @deprecated to be removed in gvSIG 2.0
|
320 |
* @see {@link SymbolPreferences}.
|
321 |
*/
|
322 |
boolean isDefaultSymbolFillColorAleatory();
|
323 |
|
324 |
/**
|
325 |
* @deprecated to be removed in gvSIG 2.0
|
326 |
* @see {@link SymbolPreferences}.
|
327 |
*/
|
328 |
void setDefaultSymbolFillColorAleatory(
|
329 |
boolean defaultSymbolFillColorAleatory);
|
330 |
|
331 |
/**
|
332 |
* @deprecated to be removed in gvSIG 2.0
|
333 |
* @see {@link SymbolPreferences}.
|
334 |
*/
|
335 |
void resetDefaultSymbolFillColorAleatory();
|
336 |
|
337 |
/**
|
338 |
* @deprecated to be removed in gvSIG 2.0
|
339 |
* @see {@link SymbolPreferences}.
|
340 |
*/
|
341 |
Font getDefaultSymbolFont();
|
342 |
|
343 |
/**
|
344 |
* @deprecated to be removed in gvSIG 2.0
|
345 |
* @see {@link SymbolPreferences}.
|
346 |
*/
|
347 |
void setDefaultSymbolFont(Font defaultSymbolFont); |
348 |
|
349 |
/**
|
350 |
* @deprecated to be removed in gvSIG 2.0
|
351 |
* @see {@link SymbolPreferences}.
|
352 |
*/
|
353 |
void resetDefaultSymbolFont();
|
354 |
|
355 |
/**
|
356 |
* @deprecated to be removed in gvSIG 2.0
|
357 |
* @see {@link SymbolPreferences}.
|
358 |
*/
|
359 |
String getSymbolLibraryPath();
|
360 |
|
361 |
/**
|
362 |
* @deprecated to be removed in gvSIG 2.0
|
363 |
* @see {@link SymbolPreferences}.
|
364 |
*/
|
365 |
void setSymbolLibraryPath(String symbolLibraryPath); |
366 |
|
367 |
/**
|
368 |
* @deprecated to be removed in gvSIG 2.0
|
369 |
* @see {@link SymbolPreferences}.
|
370 |
*/
|
371 |
void resetSymbolLibraryPath();
|
372 |
|
373 |
|
374 |
/**
|
375 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
376 |
*/
|
377 |
ISymbol createSymbol(String symbolName) throws MapContextRuntimeException; |
378 |
|
379 |
/**
|
380 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
381 |
*/
|
382 |
ISymbol createSymbol(int shapeType) throws MapContextRuntimeException; |
383 |
|
384 |
/**
|
385 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
386 |
*/
|
387 |
ISymbol createSymbol(String symbolName, Color color) |
388 |
throws MapContextRuntimeException;
|
389 |
|
390 |
/**
|
391 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
392 |
*/
|
393 |
ISymbol createSymbol(int shapeType, Color color) |
394 |
throws MapContextRuntimeException;
|
395 |
|
396 |
/**
|
397 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
398 |
*/
|
399 |
IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
|
400 |
throws MapContextRuntimeException;
|
401 |
|
402 |
/**
|
403 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
404 |
*/
|
405 |
IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
|
406 |
throws MapContextRuntimeException;
|
407 |
|
408 |
/**
|
409 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
410 |
*/
|
411 |
void registerSymbol(String symbolName, Class symbolClass) |
412 |
throws MapContextRuntimeException;
|
413 |
|
414 |
/**
|
415 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
416 |
*/
|
417 |
void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass) |
418 |
throws MapContextException;
|
419 |
|
420 |
/**
|
421 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
422 |
*/
|
423 |
void registerMultiLayerSymbol(String symbolName, Class symbolClass) |
424 |
throws MapContextRuntimeException;
|
425 |
|
426 |
/**
|
427 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
428 |
*/
|
429 |
void registerMultiLayerSymbol(String symbolName, int[] shapeTypes, |
430 |
Class symbolClass) throws MapContextRuntimeException; |
431 |
|
432 |
/**
|
433 |
* @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
434 |
*/
|
435 |
IWarningSymbol getWarningSymbol(String message, String symbolDesc, |
436 |
int symbolDrawExceptionType) throws MapContextRuntimeException; |
437 |
|
438 |
/**
|
439 |
* It returns the legend associated with a {@link DataStore}.
|
440 |
* If the legend doesn't exist it returns <code>null</code>.
|
441 |
* @param dataStore
|
442 |
* the store that could have a legend.
|
443 |
* @return
|
444 |
* the legend or <code>null</code>.
|
445 |
*/
|
446 |
ILegend getLegend(DataStore dataStore); |
447 |
|
448 |
/**
|
449 |
* It returns the labeling strategy associated with a {@link DataStore}.
|
450 |
* If the labeling strategy doesn't exist it returns <code>null</code>.
|
451 |
* @param dataStore
|
452 |
* the store that could have a labeling strategy.
|
453 |
* @return
|
454 |
* the labeling strategy or <code>null</code>.
|
455 |
*/
|
456 |
ILabelingStrategy getLabelingStrategy(DataStore dataStore); |
457 |
|
458 |
|
459 |
void registerIconLayer(String store, String iconName); |
460 |
|
461 |
String getIconLayer(DataStore store);
|
462 |
String getIconLayer(String providerName); |
463 |
|
464 |
// TODO:
|
465 |
// DynObjectModel getFeatureTypeUIModel(DataStore store,
|
466 |
// FeatureType featureType);
|
467 |
|
468 |
/**
|
469 |
* Returns the default CRS.
|
470 |
* This is NOT taken from the app
|
471 |
* preferences because this is a library. It is a
|
472 |
* "hard-coded" default CRS, used as a last resort.
|
473 |
* @return the default CRS
|
474 |
*/
|
475 |
IProjection getDefaultCRS(); |
476 |
|
477 |
public File getColorTableLibraryFolder(); |
478 |
|
479 |
public void setColorTableLibraryFolder(File colorTableLibraryFolder); |
480 |
|
481 |
public LayerInformationBuilder createLayerInformationBuilder();
|
482 |
|
483 |
} |