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 @ 40559
History | View | Annotate | Download (11 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | *
|
||
6 | 40435 | jjdelcerro | * This program is free software; you can redistribute it and/or
|
7 | * modify it under the terms of the GNU General Public License
|
||
8 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * of the License, or (at your option) any later version.
|
10 | 40559 | jjdelcerro | *
|
11 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | *
|
16 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | 40435 | jjdelcerro | * MA 02110-1301, USA.
|
20 | 40559 | jjdelcerro | *
|
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 | 40435 | jjdelcerro | */
|
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 | |||
33 | import org.cresques.cts.IProjection; |
||
34 | |||
35 | import org.gvsig.fmap.dal.DataStore; |
||
36 | import org.gvsig.fmap.dal.DataStoreParameters; |
||
37 | import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
||
38 | import org.gvsig.fmap.mapcontext.layers.FLayer; |
||
39 | import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
||
40 | import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
||
41 | import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
||
42 | import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
||
43 | import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
||
44 | import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy; |
||
45 | import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol; |
||
46 | import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
||
47 | import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
||
48 | import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
||
49 | import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences; |
||
50 | |||
51 | /**
|
||
52 | * Manager of the MapContext library.
|
||
53 | *
|
||
54 | * Holds the default implementation of the {@link MapContextDrawer}.
|
||
55 | *
|
||
56 | * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
|
||
57 | * @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a>
|
||
58 | */
|
||
59 | public interface MapContextManager { |
||
60 | |||
61 | /**
|
||
62 | * Create a new layer from the data parameters passed as parameter.
|
||
63 | *
|
||
64 | * @param layerName name used in for the new layer.
|
||
65 | * @param parameters used for create the {@link DataStore} of the new layer
|
||
66 | *
|
||
67 | * @return the new FLayer
|
||
68 | *
|
||
69 | * @throws LoadLayerException
|
||
70 | */
|
||
71 | public FLayer createLayer(String layerName, |
||
72 | DataStoreParameters parameters) throws LoadLayerException;
|
||
73 | |||
74 | /**
|
||
75 | * Create a layer from a {@link DataStore}.
|
||
76 | *
|
||
77 | * @param layerName name used in for the new layer.
|
||
78 | * @param store used for the new layer
|
||
79 | *
|
||
80 | * @return the new FLayer
|
||
81 | *
|
||
82 | * @throws LoadLayerException
|
||
83 | */
|
||
84 | public FLayer createLayer(String layerName, DataStore store) |
||
85 | throws LoadLayerException;
|
||
86 | |||
87 | /**
|
||
88 | * Create a layer to be used as the {@link GraphicLayer}.
|
||
89 | *
|
||
90 | * @param projection used in the layer.
|
||
91 | *
|
||
92 | * @return the new {@link GraphicLayer}.
|
||
93 | */
|
||
94 | public GraphicLayer createGraphicsLayer(IProjection projection);
|
||
95 | |||
96 | /**
|
||
97 | * Returns the current {@link SymbolManager}.
|
||
98 | *
|
||
99 | * @return the {@link SymbolManager}
|
||
100 | */
|
||
101 | SymbolManager getSymbolManager(); |
||
102 | |||
103 | /**
|
||
104 | * Sets the class to use as the default implementation for the
|
||
105 | * {@link MapContextDrawer}.
|
||
106 | *
|
||
107 | * @param drawerClazz
|
||
108 | * the {@link MapContextDrawer} class to use
|
||
109 | * @throws MapContextException
|
||
110 | * if there is any error setting the class
|
||
111 | */
|
||
112 | public void setDefaultMapContextDrawer(Class drawerClazz) |
||
113 | throws MapContextException;
|
||
114 | |||
115 | public void validateMapContextDrawer(Class drawerClazz) throws MapContextException; |
||
116 | |||
117 | /**
|
||
118 | * Creates a new instance of the default {@link MapContextDrawer}
|
||
119 | * implementation.
|
||
120 | *
|
||
121 | * @return the new {@link MapContextDrawer} instance
|
||
122 | * @throws MapContextException
|
||
123 | * if there is an error creating the new object instance
|
||
124 | */
|
||
125 | public MapContextDrawer createDefaultMapContextDrawerInstance()
|
||
126 | throws MapContextException;
|
||
127 | |||
128 | /**
|
||
129 | * Creates a new instance of the provided {@link MapContextDrawer}
|
||
130 | * implementation.
|
||
131 | *
|
||
132 | * @param drawerClazz
|
||
133 | * the {@link MapContextDrawer} implementation class
|
||
134 | * @return the new {@link MapContextDrawer} instance
|
||
135 | * @throws MapContextException
|
||
136 | * if there is an error creating the new object instance
|
||
137 | */
|
||
138 | public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz) |
||
139 | throws MapContextException;
|
||
140 | |||
141 | |||
142 | |||
143 | void registerLegend(String legendName, Class legendClass) |
||
144 | throws MapContextRuntimeException;
|
||
145 | |||
146 | ILegend createLegend(String legendName) throws MapContextRuntimeException; |
||
147 | |||
148 | void setDefaultVectorLegend(String legendName); |
||
149 | |||
150 | IVectorLegend createDefaultVectorLegend(int shapeType)
|
||
151 | throws MapContextRuntimeException;
|
||
152 | |||
153 | void registerLegendWriter(String legendName, String format, |
||
154 | Class writerClass) throws MapContextRuntimeException; |
||
155 | |||
156 | void registerLegendReader(String format, Class readerClass) |
||
157 | throws MapContextRuntimeException;
|
||
158 | |||
159 | ILegendWriter createLegendWriter(String legendName, String format) |
||
160 | throws MapContextException;
|
||
161 | |||
162 | ILegendReader createLegendReader(String format)
|
||
163 | throws MapContextRuntimeException;
|
||
164 | |||
165 | /**
|
||
166 | * @deprecated to be removed in gvSIG 2.0
|
||
167 | * @see {@link SymbolPreferences}.
|
||
168 | */
|
||
169 | int getDefaultCartographicSupportMeasureUnit();
|
||
170 | |||
171 | /**
|
||
172 | * @deprecated to be removed in gvSIG 2.0
|
||
173 | * @see {@link SymbolPreferences}.
|
||
174 | */
|
||
175 | void setDefaultCartographicSupportMeasureUnit(
|
||
176 | int defaultCartographicSupportMeasureUnit);
|
||
177 | |||
178 | /**
|
||
179 | * @deprecated to be removed in gvSIG 2.0
|
||
180 | * @see {@link SymbolPreferences}.
|
||
181 | */
|
||
182 | int getDefaultCartographicSupportReferenceSystem();
|
||
183 | |||
184 | /**
|
||
185 | * @deprecated to be removed in gvSIG 2.0
|
||
186 | * @see {@link SymbolPreferences}.
|
||
187 | */
|
||
188 | void setDefaultCartographicSupportReferenceSystem(
|
||
189 | int defaultCartographicSupportReferenceSystem);
|
||
190 | |||
191 | /**
|
||
192 | * @deprecated to be removed in gvSIG 2.0
|
||
193 | * @see {@link SymbolPreferences}.
|
||
194 | */
|
||
195 | Color getDefaultSymbolColor();
|
||
196 | |||
197 | /**
|
||
198 | * @deprecated to be removed in gvSIG 2.0
|
||
199 | * @see {@link SymbolPreferences}.
|
||
200 | */
|
||
201 | void setDefaultSymbolColor(Color defaultSymbolColor); |
||
202 | |||
203 | /**
|
||
204 | * @deprecated to be removed in gvSIG 2.0
|
||
205 | * @see {@link SymbolPreferences}.
|
||
206 | */
|
||
207 | void resetDefaultSymbolColor();
|
||
208 | |||
209 | /**
|
||
210 | * @deprecated to be removed in gvSIG 2.0
|
||
211 | * @see {@link SymbolPreferences}.
|
||
212 | */
|
||
213 | Color getDefaultSymbolFillColor();
|
||
214 | |||
215 | /**
|
||
216 | * @deprecated to be removed in gvSIG 2.0
|
||
217 | * @see {@link SymbolPreferences}.
|
||
218 | */
|
||
219 | void setDefaultSymbolFillColor(Color defaultSymbolFillColor); |
||
220 | |||
221 | /**
|
||
222 | * @deprecated to be removed in gvSIG 2.0
|
||
223 | * @see {@link SymbolPreferences}.
|
||
224 | */
|
||
225 | void resetDefaultSymbolFillColor();
|
||
226 | |||
227 | /**
|
||
228 | * @deprecated to be removed in gvSIG 2.0
|
||
229 | * @see {@link SymbolPreferences}.
|
||
230 | */
|
||
231 | boolean isDefaultSymbolFillColorAleatory();
|
||
232 | |||
233 | /**
|
||
234 | * @deprecated to be removed in gvSIG 2.0
|
||
235 | * @see {@link SymbolPreferences}.
|
||
236 | */
|
||
237 | void setDefaultSymbolFillColorAleatory(
|
||
238 | boolean defaultSymbolFillColorAleatory);
|
||
239 | |||
240 | /**
|
||
241 | * @deprecated to be removed in gvSIG 2.0
|
||
242 | * @see {@link SymbolPreferences}.
|
||
243 | */
|
||
244 | void resetDefaultSymbolFillColorAleatory();
|
||
245 | |||
246 | /**
|
||
247 | * @deprecated to be removed in gvSIG 2.0
|
||
248 | * @see {@link SymbolPreferences}.
|
||
249 | */
|
||
250 | Font getDefaultSymbolFont();
|
||
251 | |||
252 | /**
|
||
253 | * @deprecated to be removed in gvSIG 2.0
|
||
254 | * @see {@link SymbolPreferences}.
|
||
255 | */
|
||
256 | void setDefaultSymbolFont(Font defaultSymbolFont); |
||
257 | |||
258 | /**
|
||
259 | * @deprecated to be removed in gvSIG 2.0
|
||
260 | * @see {@link SymbolPreferences}.
|
||
261 | */
|
||
262 | void resetDefaultSymbolFont();
|
||
263 | |||
264 | /**
|
||
265 | * @deprecated to be removed in gvSIG 2.0
|
||
266 | * @see {@link SymbolPreferences}.
|
||
267 | */
|
||
268 | String getSymbolLibraryPath();
|
||
269 | |||
270 | /**
|
||
271 | * @deprecated to be removed in gvSIG 2.0
|
||
272 | * @see {@link SymbolPreferences}.
|
||
273 | */
|
||
274 | void setSymbolLibraryPath(String symbolLibraryPath); |
||
275 | |||
276 | /**
|
||
277 | * @deprecated to be removed in gvSIG 2.0
|
||
278 | * @see {@link SymbolPreferences}.
|
||
279 | */
|
||
280 | void resetSymbolLibraryPath();
|
||
281 | |||
282 | |||
283 | /**
|
||
284 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
285 | */
|
||
286 | ISymbol createSymbol(String symbolName) throws MapContextRuntimeException; |
||
287 | |||
288 | /**
|
||
289 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
290 | */
|
||
291 | ISymbol createSymbol(int shapeType) throws MapContextRuntimeException; |
||
292 | |||
293 | /**
|
||
294 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
295 | */
|
||
296 | ISymbol createSymbol(String symbolName, Color color) |
||
297 | throws MapContextRuntimeException;
|
||
298 | |||
299 | /**
|
||
300 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
301 | */
|
||
302 | ISymbol createSymbol(int shapeType, Color color) |
||
303 | throws MapContextRuntimeException;
|
||
304 | |||
305 | /**
|
||
306 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
307 | */
|
||
308 | IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
|
||
309 | throws MapContextRuntimeException;
|
||
310 | |||
311 | /**
|
||
312 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
313 | */
|
||
314 | IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
|
||
315 | throws MapContextRuntimeException;
|
||
316 | |||
317 | /**
|
||
318 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
319 | */
|
||
320 | void registerSymbol(String symbolName, Class symbolClass) |
||
321 | throws MapContextRuntimeException;
|
||
322 | |||
323 | /**
|
||
324 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
325 | */
|
||
326 | void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass) |
||
327 | throws MapContextException;
|
||
328 | |||
329 | /**
|
||
330 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
331 | */
|
||
332 | void registerMultiLayerSymbol(String symbolName, Class symbolClass) |
||
333 | throws MapContextRuntimeException;
|
||
334 | |||
335 | /**
|
||
336 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
337 | */
|
||
338 | void registerMultiLayerSymbol(String symbolName, int[] shapeTypes, |
||
339 | Class symbolClass) throws MapContextRuntimeException; |
||
340 | |||
341 | /**
|
||
342 | * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
|
||
343 | */
|
||
344 | IWarningSymbol getWarningSymbol(String message, String symbolDesc, |
||
345 | int symbolDrawExceptionType) throws MapContextRuntimeException; |
||
346 | |||
347 | /**
|
||
348 | * It returns the legend associated with a {@link DataStore}.
|
||
349 | * If the legend doesn't exist it returns <code>null</code>.
|
||
350 | * @param dataStore
|
||
351 | * the store that could have a legend.
|
||
352 | * @return
|
||
353 | * the legend or <code>null</code>.
|
||
354 | */
|
||
355 | ILegend getLegend(DataStore dataStore); |
||
356 | |||
357 | /**
|
||
358 | * It returns the labeling strategy associated with a {@link DataStore}.
|
||
359 | * If the labeling strategy doesn't exist it returns <code>null</code>.
|
||
360 | * @param dataStore
|
||
361 | * the store that could have a labeling strategy.
|
||
362 | * @return
|
||
363 | * the labeling strategy or <code>null</code>.
|
||
364 | */
|
||
365 | ILabelingStrategy getLabelingStrategy(DataStore dataStore); |
||
366 | |||
367 | |||
368 | void registerIconLayer(String store, String iconName); |
||
369 | |||
370 | String getIconLayer(DataStore store);
|
||
371 | |||
372 | // TODO:
|
||
373 | // DynObjectModel getFeatureTypeUIModel(DataStore store,
|
||
374 | // FeatureType featureType);
|
||
375 | |||
376 | /**
|
||
377 | * Returns the default CRS.
|
||
378 | * This is NOT taken from the app
|
||
379 | * preferences because this is a library. It is a
|
||
380 | * "hard-coded" default CRS, used as a last resort.
|
||
381 | * @return the default CRS
|
||
382 | */
|
||
383 | IProjection getDefaultCRS(); |
||
384 | } |