root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / impl / DefaultMapContextManager.java @ 37298
History | View | Annotate | Download (18 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 {DiSiD Technologies} {Create Manager to register MapContextDrawer implementation}
|
26 |
*/
|
27 |
package org.gvsig.fmap.mapcontext.impl; |
28 |
|
29 |
import java.awt.Color; |
30 |
import java.awt.Font; |
31 |
import java.io.File; |
32 |
import java.io.FileFilter; |
33 |
import java.io.FileInputStream; |
34 |
import java.lang.reflect.Method; |
35 |
import java.util.Collections; |
36 |
import java.util.HashMap; |
37 |
import java.util.Map; |
38 |
|
39 |
import org.cresques.cts.IProjection; |
40 |
import org.slf4j.Logger; |
41 |
import org.slf4j.LoggerFactory; |
42 |
|
43 |
import org.gvsig.fmap.dal.DataServerExplorer; |
44 |
import org.gvsig.fmap.dal.DataStore; |
45 |
import org.gvsig.fmap.dal.DataStoreParameters; |
46 |
import org.gvsig.fmap.dal.exception.DataException; |
47 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
48 |
import org.gvsig.fmap.dal.feature.FeatureType; |
49 |
import org.gvsig.fmap.mapcontext.MapContextDrawer; |
50 |
import org.gvsig.fmap.mapcontext.MapContextException; |
51 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
52 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
53 |
import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
54 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
55 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
56 |
import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
57 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
58 |
import org.gvsig.fmap.mapcontext.layers.vectorial.impl.DefaultGraphicLayer; |
59 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
60 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
61 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend; |
62 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
63 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
64 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol; |
65 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
66 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
67 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException; |
68 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
69 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences; |
70 |
import org.gvsig.tools.ToolsLocator; |
71 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
72 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
73 |
import org.gvsig.tools.persistence.PersistenceManager; |
74 |
import org.gvsig.tools.persistence.PersistentState; |
75 |
|
76 |
/**
|
77 |
* Default implementation of the {@link MapContextManager}.
|
78 |
*
|
79 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
|
80 |
*/
|
81 |
public class DefaultMapContextManager implements MapContextManager { |
82 |
|
83 |
private static final Logger LOG = LoggerFactory |
84 |
.getLogger(DefaultMapContextManager.class); |
85 |
|
86 |
private Class drawerClazz = DefaultMapContextDrawer.class; |
87 |
|
88 |
private Map legends = Collections.synchronizedMap(new HashMap()); |
89 |
|
90 |
private Map legendReaders = Collections.synchronizedMap(new HashMap()); |
91 |
|
92 |
private Map legendWriters = Collections.synchronizedMap(new HashMap()); |
93 |
|
94 |
private String defaultVectorLegend; |
95 |
|
96 |
public SymbolManager getSymbolManager() {
|
97 |
return MapContextLocator.getSymbolManager();
|
98 |
} |
99 |
|
100 |
private SymbolPreferences getSymbolPreferences() {
|
101 |
return getSymbolManager().getSymbolPreferences();
|
102 |
} |
103 |
|
104 |
public String getSymbolLibraryPath() { |
105 |
return getSymbolPreferences().getSymbolLibraryPath();
|
106 |
} |
107 |
|
108 |
public void setSymbolLibraryPath(String symbolLibraryPath) { |
109 |
getSymbolPreferences().setSymbolLibraryPath(symbolLibraryPath); |
110 |
} |
111 |
|
112 |
public void resetSymbolLibraryPath() { |
113 |
getSymbolPreferences().resetSymbolLibraryPath(); |
114 |
} |
115 |
|
116 |
public Color getDefaultSymbolColor() { |
117 |
return getSymbolPreferences().getDefaultSymbolColor();
|
118 |
} |
119 |
|
120 |
public Color getDefaultSymbolFillColor() { |
121 |
return getSymbolPreferences().getDefaultSymbolFillColor();
|
122 |
} |
123 |
|
124 |
public Font getDefaultSymbolFont() { |
125 |
return getSymbolPreferences().getDefaultSymbolFont();
|
126 |
} |
127 |
|
128 |
public String getSymbolFileExtension() { |
129 |
return getSymbolPreferences().getSymbolFileExtension();
|
130 |
} |
131 |
|
132 |
public boolean isDefaultSymbolFillColorAleatory() { |
133 |
return getSymbolPreferences().isDefaultSymbolFillColorAleatory();
|
134 |
} |
135 |
|
136 |
public void resetDefaultSymbolColor() { |
137 |
getSymbolPreferences().resetDefaultSymbolColor(); |
138 |
} |
139 |
|
140 |
public void resetDefaultSymbolFillColor() { |
141 |
getSymbolPreferences().resetDefaultSymbolFillColor(); |
142 |
} |
143 |
|
144 |
public void resetDefaultSymbolFillColorAleatory() { |
145 |
getSymbolPreferences().resetDefaultSymbolFillColorAleatory(); |
146 |
} |
147 |
|
148 |
public void resetDefaultSymbolFont() { |
149 |
getSymbolPreferences().resetDefaultSymbolFont(); |
150 |
} |
151 |
|
152 |
public void setDefaultSymbolColor(Color defaultSymbolColor) { |
153 |
getSymbolPreferences().setDefaultSymbolColor(defaultSymbolColor); |
154 |
} |
155 |
|
156 |
public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) { |
157 |
getSymbolPreferences().setDefaultSymbolFillColor(defaultSymbolFillColor); |
158 |
} |
159 |
|
160 |
public void setDefaultSymbolFillColorAleatory( |
161 |
boolean defaultSymbolFillColorAleatory) {
|
162 |
getSymbolPreferences().setDefaultSymbolFillColorAleatory( |
163 |
defaultSymbolFillColorAleatory); |
164 |
} |
165 |
|
166 |
public void setDefaultSymbolFont(Font defaultSymbolFont) { |
167 |
getSymbolPreferences().setDefaultSymbolFont(defaultSymbolFont); |
168 |
} |
169 |
|
170 |
public void setSymbolFileExtension(String extension) { |
171 |
getSymbolPreferences().setSymbolFileExtension(extension); |
172 |
} |
173 |
|
174 |
public int getDefaultCartographicSupportMeasureUnit() { |
175 |
return getSymbolPreferences().getDefaultCartographicSupportMeasureUnit();
|
176 |
} |
177 |
|
178 |
public void setDefaultCartographicSupportMeasureUnit( |
179 |
int defaultCartographicSupportMeasureUnit) {
|
180 |
getSymbolPreferences().setDefaultCartographicSupportMeasureUnit( |
181 |
defaultCartographicSupportMeasureUnit); |
182 |
} |
183 |
|
184 |
public int getDefaultCartographicSupportReferenceSystem() { |
185 |
return getSymbolPreferences().getDefaultCartographicSupportReferenceSystem();
|
186 |
} |
187 |
|
188 |
public void setDefaultCartographicSupportReferenceSystem( |
189 |
int defaultCartographicSupportReferenceSystem) {
|
190 |
getSymbolPreferences().setDefaultCartographicSupportReferenceSystem( |
191 |
defaultCartographicSupportReferenceSystem); |
192 |
} |
193 |
|
194 |
public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz) |
195 |
throws MapContextException {
|
196 |
return createMapContextDrawerInstance(drawerClazz, "NONE"); |
197 |
} |
198 |
|
199 |
public MapContextDrawer createDefaultMapContextDrawerInstance()
|
200 |
throws MapContextException {
|
201 |
|
202 |
return createMapContextDrawerInstance(drawerClazz, "default"); |
203 |
} |
204 |
|
205 |
private MapContextDrawer createMapContextDrawerInstance(Class drawerClazz, |
206 |
String name) throws RegisteredClassInstantiationException { |
207 |
try {
|
208 |
return (MapContextDrawer) drawerClazz.newInstance();
|
209 |
} catch (Exception ex) { |
210 |
throw new RegisteredClassInstantiationException( |
211 |
MapContextDrawer.class, drawerClazz, name, ex); |
212 |
} |
213 |
} |
214 |
|
215 |
public void setDefaultMapContextDrawer(Class drawerClazz) |
216 |
throws MapContextException {
|
217 |
|
218 |
validateMapContextDrawer(drawerClazz); |
219 |
this.drawerClazz = drawerClazz;
|
220 |
} |
221 |
|
222 |
public void validateMapContextDrawer(Class drawerClazz) |
223 |
throws MapContextException {
|
224 |
if (!MapContextDrawer.class.isAssignableFrom(drawerClazz)) {
|
225 |
throw new InvalidRegisteredClassException(MapContextDrawer.class, |
226 |
drawerClazz, "UNKNOWN");
|
227 |
} |
228 |
} |
229 |
|
230 |
public GraphicLayer createGraphicsLayer(IProjection projection) {
|
231 |
DefaultGraphicLayer layer = new DefaultGraphicLayer();
|
232 |
try {
|
233 |
layer.initialize(projection); |
234 |
layer.setLegend((IVectorLegend)createLegend(IVectorialUniqueValueLegend.LEGEND_NAME)); |
235 |
} catch (Exception e) { |
236 |
LOG.error("Error initializing the graphics layer", e);
|
237 |
} |
238 |
return layer;
|
239 |
} |
240 |
|
241 |
public String getDefaultVectorLegend() { |
242 |
return defaultVectorLegend;
|
243 |
} |
244 |
|
245 |
public void setDefaultVectorLegend(String defaultVectorLegend) { |
246 |
this.defaultVectorLegend = defaultVectorLegend;
|
247 |
} |
248 |
|
249 |
public void registerLegend(String legendName, Class legendClass) |
250 |
throws MapContextRuntimeException {
|
251 |
|
252 |
if (legendClass == null || !ILegend.class.isAssignableFrom(legendClass)) { |
253 |
throw new InvalidRegisteredClassException(ILegend.class, |
254 |
legendClass, legendName); |
255 |
} |
256 |
|
257 |
legends.put(legendName, legendClass); |
258 |
} |
259 |
|
260 |
public ILegend createLegend(String legendName) |
261 |
throws MapContextRuntimeException {
|
262 |
Class legendClass = (Class) legends.get(legendName); |
263 |
|
264 |
if (legendClass != null) { |
265 |
try {
|
266 |
return (ILegend) legendClass.newInstance();
|
267 |
} catch (InstantiationException e) { |
268 |
throw new RegisteredClassInstantiationException(ILegend.class, |
269 |
legendClass, legendName, e); |
270 |
} catch (IllegalAccessException e) { |
271 |
throw new RegisteredClassInstantiationException(ILegend.class, |
272 |
legendClass, legendName, e); |
273 |
} |
274 |
} |
275 |
return null; |
276 |
} |
277 |
|
278 |
public IVectorLegend createDefaultVectorLegend(int shapeType) |
279 |
throws MapContextRuntimeException {
|
280 |
try {
|
281 |
// Create legend
|
282 |
IVectorLegend legend = |
283 |
(IVectorLegend) createLegend(getDefaultVectorLegend()); |
284 |
if (legend == null) { |
285 |
return null; |
286 |
} |
287 |
// Set legend values
|
288 |
legend.setShapeType(shapeType); |
289 |
legend.setDefaultSymbol(getSymbolManager().createSymbol(shapeType)); |
290 |
return legend;
|
291 |
} catch(Exception e) { |
292 |
throw new MapContextRuntimeException(e); |
293 |
} |
294 |
} |
295 |
|
296 |
public void registerLegendReader(String format, Class readerClass) |
297 |
throws MapContextRuntimeException {
|
298 |
if (readerClass == null |
299 |
|| !ILegendReader.class.isAssignableFrom(readerClass)) { |
300 |
throw new InvalidRegisteredClassException(ILegendReader.class, |
301 |
readerClass, format); |
302 |
} |
303 |
|
304 |
legendReaders.put(format, readerClass); |
305 |
} |
306 |
|
307 |
public ILegendReader createLegendReader(String format) |
308 |
throws MapContextRuntimeException {
|
309 |
Class legendReaderClazz = (Class) legendReaders.get(format); |
310 |
|
311 |
if (legendReaderClazz != null) { |
312 |
try {
|
313 |
return (ILegendReader) legendReaderClazz.newInstance();
|
314 |
} catch (InstantiationException e) { |
315 |
throw new RegisteredClassInstantiationException( |
316 |
ILegendReader.class, legendReaderClazz, format, e); |
317 |
} catch (IllegalAccessException e) { |
318 |
throw new RegisteredClassInstantiationException( |
319 |
ILegendReader.class, legendReaderClazz, format, e); |
320 |
} |
321 |
} |
322 |
return null; |
323 |
} |
324 |
|
325 |
public void registerLegendWriter(String legendName, String format, |
326 |
Class writerClass) throws MapContextRuntimeException { |
327 |
if (writerClass == null |
328 |
|| !ILegendWriter.class.isAssignableFrom(writerClass)) { |
329 |
throw new InvalidRegisteredClassException(ILegendWriter.class, |
330 |
writerClass, format.concat("-").concat(legendName));
|
331 |
} |
332 |
|
333 |
Map legendFormatWriters = (Map) legendWriters.get(format); |
334 |
|
335 |
synchronized (legendWriters) {
|
336 |
if (legendFormatWriters == null) { |
337 |
legendFormatWriters = Collections
|
338 |
.synchronizedMap(new HashMap()); |
339 |
legendWriters.put(format, legendFormatWriters); |
340 |
} |
341 |
} |
342 |
|
343 |
legendFormatWriters.put(legendName, writerClass); |
344 |
} |
345 |
|
346 |
public ILegendWriter createLegendWriter(String legendName, String format) |
347 |
throws MapContextRuntimeException {
|
348 |
Map legendFormatWriters = getLegendWritersForFormat(format);
|
349 |
|
350 |
if (legendFormatWriters != null) { |
351 |
Class legendWriterClazz = (Class) legendFormatWriters |
352 |
.get(legendName); |
353 |
|
354 |
if (legendWriterClazz != null) { |
355 |
try {
|
356 |
return (ILegendWriter) legendWriterClazz.newInstance();
|
357 |
} catch (InstantiationException e) { |
358 |
throw new RegisteredClassInstantiationException( |
359 |
ILegendWriter.class, legendWriterClazz, format |
360 |
.concat("-").concat(legendName), e);
|
361 |
} catch (IllegalAccessException e) { |
362 |
throw new RegisteredClassInstantiationException( |
363 |
ILegendWriter.class, legendWriterClazz, format |
364 |
.concat("-").concat(legendName), e);
|
365 |
} |
366 |
} |
367 |
} |
368 |
return null; |
369 |
} |
370 |
|
371 |
private Map getLegendWritersForFormat(String format) { |
372 |
return (Map) legendWriters.get(format); |
373 |
} |
374 |
|
375 |
public IMultiLayerSymbol createMultiLayerSymbol(int shapeType) |
376 |
throws MapContextRuntimeException {
|
377 |
return getSymbolManager().createMultiLayerSymbol(shapeType);
|
378 |
} |
379 |
|
380 |
public IMultiLayerSymbol createMultiLayerSymbol(String symbolName) |
381 |
throws MapContextRuntimeException {
|
382 |
return getSymbolManager().createMultiLayerSymbol(symbolName);
|
383 |
} |
384 |
|
385 |
public ISymbol createSymbol(int shapeType, Color color) |
386 |
throws MapContextRuntimeException {
|
387 |
return getSymbolManager().createSymbol(shapeType, color);
|
388 |
} |
389 |
|
390 |
public ISymbol createSymbol(int shapeType) |
391 |
throws MapContextRuntimeException {
|
392 |
return getSymbolManager().createSymbol(shapeType);
|
393 |
} |
394 |
|
395 |
public ISymbol createSymbol(String symbolName, Color color) |
396 |
throws MapContextRuntimeException {
|
397 |
return getSymbolManager().createSymbol(symbolName, color);
|
398 |
} |
399 |
|
400 |
public ISymbol createSymbol(String symbolName) |
401 |
throws MapContextRuntimeException {
|
402 |
return getSymbolManager().createSymbol(symbolName);
|
403 |
} |
404 |
|
405 |
public IWarningSymbol getWarningSymbol(String message, String symbolDesc, |
406 |
int symbolDrawExceptionType) throws MapContextRuntimeException { |
407 |
return getSymbolManager().getWarningSymbol(message, symbolDesc,
|
408 |
symbolDrawExceptionType); |
409 |
} |
410 |
|
411 |
public ISymbol[] loadSymbols(File folder, FileFilter filter) |
412 |
throws SymbolException {
|
413 |
return getSymbolManager().loadSymbols(folder, filter);
|
414 |
} |
415 |
|
416 |
public ISymbol[] loadSymbols(File folder) throws SymbolException { |
417 |
return getSymbolManager().loadSymbols(folder);
|
418 |
} |
419 |
|
420 |
public void registerMultiLayerSymbol(String symbolName, Class symbolClass) |
421 |
throws MapContextRuntimeException {
|
422 |
getSymbolManager().registerMultiLayerSymbol(symbolName, symbolClass); |
423 |
} |
424 |
|
425 |
public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes, |
426 |
Class symbolClass) throws MapContextRuntimeException { |
427 |
getSymbolManager().registerMultiLayerSymbol(symbolName, shapeTypes, |
428 |
symbolClass); |
429 |
} |
430 |
|
431 |
public void registerSymbol(String symbolName, Class symbolClass) |
432 |
throws MapContextRuntimeException {
|
433 |
getSymbolManager().registerSymbol(symbolName, symbolClass); |
434 |
} |
435 |
|
436 |
public void registerSymbol(String symbolName, int[] shapeTypes, |
437 |
Class symbolClass) throws MapContextException { |
438 |
getSymbolManager().registerSymbol(symbolName, shapeTypes, symbolClass); |
439 |
} |
440 |
|
441 |
public void saveSymbol(ISymbol symbol, String fileName, File folder, |
442 |
boolean overwrite) throws SymbolException { |
443 |
getSymbolManager().saveSymbol(symbol, fileName, folder, overwrite); |
444 |
} |
445 |
|
446 |
public void saveSymbol(ISymbol symbol, String fileName, File folder) |
447 |
throws SymbolException {
|
448 |
getSymbolManager().saveSymbol(symbol, fileName, folder); |
449 |
} |
450 |
|
451 |
public FLayer createLayer(String layerName, DataStoreParameters parameters) |
452 |
throws LoadLayerException {
|
453 |
return LayerFactory.getInstance().createLayer(layerName, parameters);
|
454 |
} |
455 |
|
456 |
public FLayer createLayer(String layerName, DataStore store) |
457 |
throws LoadLayerException {
|
458 |
return LayerFactory.getInstance().createLayer(layerName, store);
|
459 |
} |
460 |
|
461 |
public ILegend getLegend(DataStore dataStore) {
|
462 |
ILegend legend = null;
|
463 |
|
464 |
//Loading the legend from a store based on file
|
465 |
DataServerExplorer dataServerExplorer = null;
|
466 |
try {
|
467 |
// This access by reflection is done because the libFMap_dalfile project
|
468 |
// has to be divided in several projects. The commented code is the fine
|
469 |
// code whereas the used code has to be deleted.
|
470 |
//
|
471 |
// if (dataStore.getExplorer() instanceof FilesystemServerExplorer){
|
472 |
// File file = ((FilesystemServerExplorer)dataStore.getExplorer()).getResourcePath(dataStore, "gvl");
|
473 |
// if ((file != null) && (file.exists())){
|
474 |
// PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
|
475 |
// PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file));
|
476 |
// legend = (ILegend)persistenceManager.create(persistentState);
|
477 |
// }
|
478 |
// }
|
479 |
dataServerExplorer = dataStore.getExplorer(); |
480 |
Class[] args = new Class[2]; |
481 |
args[0] = DataStore.class;
|
482 |
args[1] = String.class; |
483 |
Method method = dataStore.getExplorer().getClass().getMethod("getResourcePath", args); |
484 |
if (method != null){ |
485 |
Object[] params = new Object[2]; |
486 |
params[0] = dataStore;
|
487 |
params[1] = "gvl"; |
488 |
File file = (File)method.invoke(dataServerExplorer, params); |
489 |
if ((file != null) && (file.exists())){ |
490 |
PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager(); |
491 |
PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file)); |
492 |
legend = (ILegend)persistenceManager.create(persistentState); |
493 |
} |
494 |
} |
495 |
|
496 |
} catch (Exception e) { |
497 |
LOG.debug( |
498 |
"Can't load the specific legend provided by the explorer "
|
499 |
+ dataServerExplorer, e); |
500 |
} |
501 |
|
502 |
//If the legend is null, next option is to check if the store has the getLegend method
|
503 |
if (legend == null){ |
504 |
try {
|
505 |
legend = (IVectorLegend) dataStore.invokeDynMethod( |
506 |
"getLegend", null); |
507 |
} catch (DynMethodNotSupportedException e) {
|
508 |
LOG.debug("This store {} does not provide a legend.",
|
509 |
dataStore.getName()); |
510 |
} catch (DynMethodException e) {
|
511 |
LOG.error( |
512 |
"Can't load the specific legend provided for the store {}.",
|
513 |
dataStore.getName(), e); |
514 |
} |
515 |
} |
516 |
|
517 |
//If legend is null, last step is just try to create the legend by default
|
518 |
if( legend == null ) { |
519 |
FeatureType featureType; |
520 |
try {
|
521 |
featureType = (((FeatureStore)dataStore).getDefaultFeatureType()); |
522 |
int indexGeom = featureType.getDefaultGeometryAttributeIndex();
|
523 |
int typeShape = featureType.getAttributeDescriptor(indexGeom).getGeometryType();
|
524 |
legend = MapContextLocator.getMapContextManager().createDefaultVectorLegend(typeShape); |
525 |
} catch (DataException e) {
|
526 |
LOG.error("Error getting the default feature type", e);
|
527 |
} |
528 |
} |
529 |
|
530 |
return legend;
|
531 |
} |
532 |
|
533 |
} |