svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.lib / org.gvsig.symbology.lib.impl / src / main / java / org / gvsig / symbology / impl / SymbologyDefaultImplLibrary.java @ 43326
History | View | Annotate | Download (11.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 |
package org.gvsig.symbology.impl; |
26 |
|
27 |
import org.gvsig.fmap.mapcontext.MapContextLibrary; |
28 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
29 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
30 |
import org.gvsig.fmap.mapcontext.rendering.legend.ISingleSymbolLegend; |
31 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialIntervalLegend; |
32 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend; |
33 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
34 |
import org.gvsig.svgsupport.DefaultSVGSupportManager; |
35 |
import org.gvsig.symbology.SymbologyLibrary; |
36 |
import org.gvsig.symbology.SymbologyLocator; |
37 |
import org.gvsig.symbology.SymbologyManager; |
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendReader; |
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendWriter; |
40 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend; |
41 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend; |
42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractLegend; |
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend; |
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.SingleSymbolLegend; |
46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialIntervalLegend; |
47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend; |
48 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy; |
49 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.DefaultLabelingMethod; |
50 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelClass; |
51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelClassFactory; |
52 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.ZoomConstraintsImpl; |
53 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.AbstractFillSymbol; |
54 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MarkerFillSymbol; |
55 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.MultiLayerFillSymbol; |
56 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.PictureFillSymbol; |
57 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
58 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
59 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.MultiShapeSymbol; |
60 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.AbstractLineSymbol; |
61 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.MultiLayerLineSymbol; |
62 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.PictureLineSymbol; |
63 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol; |
64 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.AbstractMarkerSymbol; |
65 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.ArrowMarkerSymbol; |
66 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.MultiLayerMarkerSymbol; |
67 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.PictureMarkerSymbol; |
68 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol; |
69 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.AbstractStyle; |
70 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ArrowDecoratorStyle; |
71 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.BackgroundFileStyle; |
72 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.DefaultMask; |
73 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ImageStyle; |
74 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.RemoteFileStyle; |
75 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SVGStyle; |
76 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLabelStyle; |
77 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleLineStyle; |
78 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.SimpleMarkerFillPropertiesStyle; |
79 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol; |
80 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.warning.impl.WarningSymbol; |
81 |
import org.gvsig.tools.library.AbstractLibrary; |
82 |
import org.gvsig.tools.library.LibraryException; |
83 |
import org.gvsig.tools.util.Caller; |
84 |
import org.gvsig.tools.util.impl.DefaultCaller; |
85 |
|
86 |
/**
|
87 |
* Library for the Basic Symbology implementation.
|
88 |
*
|
89 |
* @author gvSIG team
|
90 |
*/
|
91 |
public class SymbologyDefaultImplLibrary extends AbstractLibrary { |
92 |
|
93 |
@Override
|
94 |
public void doRegistration() { |
95 |
registerAsImplementationOf(SymbologyLibrary.class); |
96 |
require(MapContextLibrary.class); |
97 |
} |
98 |
|
99 |
protected void doInitialize() throws LibraryException { |
100 |
Caller caller = new DefaultCaller();
|
101 |
caller.add(new DefaultSymbologyManager.RegisterSymbologyManager());
|
102 |
caller.add(new DefaultSVGSupportManager.registerSVGSupportManager());
|
103 |
if (!caller.call()) {
|
104 |
throw new LibraryException(SymbologyDefaultImplLibrary.class, |
105 |
caller.getExceptions()); |
106 |
} |
107 |
} |
108 |
|
109 |
protected void doPostInitialize() throws LibraryException { |
110 |
Caller caller = new DefaultCaller();
|
111 |
|
112 |
/*
|
113 |
* Add registry of symbols
|
114 |
*/
|
115 |
caller.add( new SimpleFillSymbol.RegisterSymbol() );
|
116 |
caller.add( new MultiLayerFillSymbol.RegisterSymbol() );
|
117 |
caller.add( new SimpleLineSymbol.RegisterSymbol() );
|
118 |
caller.add( new MultiLayerLineSymbol.RegisterSymbol() );
|
119 |
caller.add( new SimpleMarkerSymbol.RegisterSymbol() );
|
120 |
caller.add( new MultiLayerMarkerSymbol.RegisterSymbol() );
|
121 |
caller.add( new SimpleTextSymbol.RegisterSymbol() );
|
122 |
caller.add( new MultiShapeSymbol.RegisterSymbol() );
|
123 |
caller.add( new WarningSymbol.RegisterSymbol() );
|
124 |
|
125 |
caller.add( new PictureFillSymbol.RegisterSymbol() );
|
126 |
caller.add( new PictureLineSymbol.RegisterSymbol() );
|
127 |
caller.add( new PictureMarkerSymbol.RegisterSymbol() );
|
128 |
|
129 |
// caller.add( new MarkerFillSymbol.RegisterSymbol() );
|
130 |
|
131 |
/*
|
132 |
* Add registry of legends
|
133 |
*/
|
134 |
caller.add( new VectorialUniqueValueLegend.RegisterLegend() );
|
135 |
caller.add( new VectorialIntervalLegend.RegisterLegend() );
|
136 |
caller.add( new SingleSymbolLegend.RegisterLegend() );
|
137 |
|
138 |
/*
|
139 |
* Add registry of persistent styles
|
140 |
*/
|
141 |
caller.add( new AbstractStyle.RegisterPersistence() );
|
142 |
caller.add( new ArrowDecoratorStyle.RegisterPersistence() );
|
143 |
caller.add( new DefaultMask.RegisterPersistence() );
|
144 |
caller.add( new SimpleLineStyle.RegisterPersistence() );
|
145 |
|
146 |
caller.add( new BackgroundFileStyle.RegisterPersistence() );
|
147 |
caller.add( new ImageStyle.RegisterPersistence() );
|
148 |
caller.add( new RemoteFileStyle.RegisterPersistence() );
|
149 |
caller.add( new SVGStyle.RegisterPersistence() );
|
150 |
|
151 |
/*
|
152 |
* Add registry of persistent symbols
|
153 |
*/
|
154 |
caller.add( new AbstractSymbol.RegisterPersistence() );
|
155 |
caller.add( new AbstractFillSymbol.RegisterPersistence() );
|
156 |
caller.add( new SimpleFillSymbol.RegisterPersistence() );
|
157 |
caller.add( new MultiLayerFillSymbol.RegisterPersistence() );
|
158 |
caller.add( new AbstractLineSymbol.RegisterPersistence() );
|
159 |
caller.add( new SimpleLineSymbol.RegisterPersistence() );
|
160 |
caller.add( new MultiLayerLineSymbol.RegisterPersistence() );
|
161 |
caller.add( new AbstractMarkerSymbol.RegisterPersistence() );
|
162 |
caller.add( new SimpleMarkerSymbol.RegisterPersistence() );
|
163 |
caller.add( new ArrowMarkerSymbol.RegisterPersistence() );
|
164 |
caller.add( new MultiLayerMarkerSymbol.RegisterPersistence() );
|
165 |
caller.add( new SimpleTextSymbol.RegisterPersistence() );
|
166 |
caller.add( new MultiShapeSymbol.RegisterPersistence() );
|
167 |
caller.add( new WarningSymbol.RegisterPersistence() );
|
168 |
|
169 |
caller.add( new PictureFillSymbol.RegisterPersistence() );
|
170 |
caller.add( new PictureLineSymbol.RegisterPersistence() );
|
171 |
caller.add( new PictureMarkerSymbol.RegisterPersistence() );
|
172 |
caller.add( new MarkerFillSymbol.RegisterPersistence() );
|
173 |
caller.add( new SimpleMarkerFillPropertiesStyle.RegisterPersistence() );
|
174 |
|
175 |
|
176 |
/*
|
177 |
* Add registry of persistent legends
|
178 |
*/
|
179 |
caller.add(new AbstractLegend.RegisterPersistence());
|
180 |
caller.add(new AbstractVectorialLegend.RegisterPersistence());
|
181 |
caller.add(new AbstractClassifiedVectorLegend.RegisterPersistence());
|
182 |
caller.add(new FInterval.RegisterPersistence());
|
183 |
caller.add(new AbstractIntervalLegend.RegisterPersistence());
|
184 |
caller.add(new VectorialIntervalLegend.RegisterPersistence());
|
185 |
caller.add(new VectorialUniqueValueLegend.RegisterPersistence());
|
186 |
caller.add(new SingleSymbolLegend.RegisterPersistence());
|
187 |
|
188 |
/*
|
189 |
* Add registry of labeling classes
|
190 |
*/
|
191 |
caller.add(new ZoomConstraintsImpl.RegisterPersistence());
|
192 |
caller.add(new LabelClass.RegisterPersistence());
|
193 |
caller.add(new DefaultLabelingMethod.RegisterPersistence());
|
194 |
caller.add(new AttrInTableLabelingStrategy.RegisterPersistence());
|
195 |
|
196 |
/*
|
197 |
* Default impl of simple label style
|
198 |
*/
|
199 |
caller.add(new SimpleLabelStyle.RegisterPersistence());
|
200 |
|
201 |
/*
|
202 |
* Do register of all
|
203 |
*/
|
204 |
if( !caller.call() ) {
|
205 |
throw new LibraryException(SymbologyDefaultImplLibrary.class, caller.getExceptions()); |
206 |
} |
207 |
|
208 |
// Registering persistence-based legend reader/writer
|
209 |
// ===============================================
|
210 |
MapContextManager mcoman = MapContextLocator.getMapContextManager(); |
211 |
// =================================
|
212 |
mcoman.registerLegendReader( |
213 |
// removing dot
|
214 |
SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
|
215 |
PersistenceBasedLegendReader.class); |
216 |
// =================================
|
217 |
mcoman.registerLegendWriter( |
218 |
ISingleSymbolLegend.class, |
219 |
SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
|
220 |
PersistenceBasedLegendWriter.class); |
221 |
mcoman.registerLegendWriter( |
222 |
IVectorialUniqueValueLegend.class, |
223 |
SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
|
224 |
PersistenceBasedLegendWriter.class); |
225 |
mcoman.registerLegendWriter( |
226 |
IVectorialIntervalLegend.class, |
227 |
SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
|
228 |
PersistenceBasedLegendWriter.class); |
229 |
// ===========================================================
|
230 |
|
231 |
SymbologyManager symbologyManager = SymbologyLocator.getSymbologyManager(); |
232 |
symbologyManager.registerLabelClass(new LabelClassFactory());
|
233 |
} |
234 |
|
235 |
} |