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