Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / org.gvsig.symbology / src / main / java / org / gvsig / symbology / impl / SymbologyDefaultImplLibrary.java @ 30580

History | View | Annotate | Download (5.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 Gobernment (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 {gvSIG}  {{Task}}
26
 */
27
package org.gvsig.symbology.impl;
28

    
29
import org.gvsig.fmap.geom.Geometry;
30
import org.gvsig.fmap.mapcontext.MapContextException;
31
import org.gvsig.fmap.mapcontext.MapContextLocator;
32
import org.gvsig.fmap.mapcontext.MapContextManager;
33
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
34
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
35
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.ISingleSymbolLegend;
36
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.IVectorialIntervalLegend;
37
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
38
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.SingleSymbolLegend;
39
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialIntervalLegend;
40
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend;
41
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
42
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MultiLayerFillSymbol;
43
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol;
44
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol;
45
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
46
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.MultiLayerLineSymbol;
47
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol;
48
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
49
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.MultiLayerMarkerSymbol;
50
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol;
51
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
52
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.warning.impl.WarningSymbol;
53
import org.gvsig.tools.library.LibraryException;
54
import org.gvsig.tools.library.impl.BaseLibrary;
55

    
56
/**
57
 * Library for the Basic Symbology implementation.
58
 * 
59
 * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
60
 */
61
public class SymbologyDefaultImplLibrary extends BaseLibrary {
62

    
63
        protected void doInitialize() throws LibraryException {
64
        }
65

    
66
        protected void doPostInitialize() throws LibraryException {
67
                MapContextManager manager = MapContextLocator.getMapContextManager();
68

    
69
                try {
70
                        // Register vector legend implementations
71
                        manager.registerLegend(IVectorialUniqueValueLegend.LEGEND_NAME,
72
                                        VectorialUniqueValueLegend.class);
73
                        manager.registerLegend(IVectorialIntervalLegend.LEGEND_NAME,
74
                                        VectorialIntervalLegend.class);
75
                        manager.registerLegend(ISingleSymbolLegend.LEGEND_NAME,
76
                                        SingleSymbolLegend.class);
77

    
78
                        // ///////////////////////////////////
79
                        // Register symbol implementations //
80
                        // ///////////////////////////////////
81

    
82
                        // Fill
83
                        int[] shapeTypes = new int[] { Geometry.TYPES.SURFACE,
84
                                        Geometry.TYPES.MULTISURFACE };
85
                        manager.registerSymbol(IFillSymbol.SYMBOL_NAME, shapeTypes,
86
                                        SimpleFillSymbol.class);
87
                        manager.registerMultiLayerSymbol(IFillSymbol.SYMBOL_NAME,
88
                                        shapeTypes, MultiLayerFillSymbol.class);
89

    
90
                        // Line
91
                        shapeTypes = new int[] { Geometry.TYPES.CURVE,
92
                                        Geometry.TYPES.MULTICURVE };
93
                        manager.registerSymbol(ILineSymbol.SYMBOL_NAME, shapeTypes,
94
                                        SimpleLineSymbol.class);
95
                        manager.registerMultiLayerSymbol(ILineSymbol.SYMBOL_NAME,
96
                                        shapeTypes, MultiLayerLineSymbol.class);
97

    
98
                        // Marker
99
                        shapeTypes = new int[] { Geometry.TYPES.POINT,
100
                                        Geometry.TYPES.MULTIPOINT };
101
                        manager.registerSymbol(IMarkerSymbol.SYMBOL_NAME, shapeTypes,
102
                                        SimpleMarkerSymbol.class);
103
                        manager.registerMultiLayerSymbol(IMarkerSymbol.SYMBOL_NAME,
104
                                        shapeTypes, MultiLayerMarkerSymbol.class);
105

    
106
                        // Text
107
                        shapeTypes = new int[] { Geometry.TYPES.TEXT };
108
                        manager.registerSymbol(ITextSymbol.SYMBOL_NAME, shapeTypes,
109
                                        SimpleTextSymbol.class);
110

    
111
                        // MultiShape
112
                        shapeTypes = new int[] { Geometry.TYPES.GEOMETRY };
113
                        manager.registerSymbol(MultiShapeSymbol.SYMBOL_NAME, shapeTypes,
114
                                        MultiShapeSymbol.class);
115

    
116
                        // Warning
117
                        manager.registerSymbol(IWarningSymbol.SYMBOL_NAME,
118
                                        WarningSymbol.class);
119

    
120
                } catch (MapContextException e) {
121
                        throw new LibraryException(getClass(), e);
122
                }
123
        }
124
}