Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / MapContextManager.java @ 38581

History | View | Annotate | Download (10.7 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;
28

    
29
import java.awt.Color;
30
import java.awt.Font;
31

    
32
import org.cresques.cts.IProjection;
33

    
34
import org.gvsig.fmap.dal.DataStore;
35
import org.gvsig.fmap.dal.DataStoreParameters;
36
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
37
import org.gvsig.fmap.mapcontext.layers.FLayer;
38
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
39
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
40
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
41
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
42
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
43
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy;
44
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
45
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
46
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
47
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
48
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
49

    
50
/**
51
 * Manager of the MapContext library.
52
 * 
53
 * Holds the default implementation of the {@link MapContextDrawer}.
54
 * 
55
 * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
56
 * @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a>
57
 */
58
public interface MapContextManager {
59

    
60
        /**
61
         * Create a new layer from the data parameters passed as parameter.
62
         * 
63
         * @param layerName name used in for the new layer. 
64
         * @param parameters used for create the {@link DataStore} of the new layer
65
         * 
66
         * @return the new FLayer
67
         * 
68
         * @throws LoadLayerException
69
         */
70
        public FLayer createLayer(String layerName,
71
                        DataStoreParameters parameters) throws LoadLayerException;
72

    
73
        /**
74
         * Create a layer from a {@link DataStore}.
75
         * 
76
         * @param layerName name used in for the new layer. 
77
         * @param store used for the new layer
78
         * 
79
         * @return the new FLayer
80
         * 
81
         * @throws LoadLayerException
82
         */
83
        public FLayer createLayer(String layerName, DataStore store)
84
                        throws LoadLayerException;
85

    
86
        /**
87
         * Create a layer to be used as the {@link GraphicLayer}.
88
         * 
89
         * @param projection used in the layer.
90
         * 
91
         * @return the new {@link GraphicLayer}.
92
         */
93
        public GraphicLayer createGraphicsLayer(IProjection projection);
94

    
95
        /**
96
         * Returns the current {@link SymbolManager}.
97
         * 
98
         * @return the {@link SymbolManager}
99
         */
100
        SymbolManager getSymbolManager();
101

    
102
        /**
103
         * Sets the class to use as the default implementation for the
104
         * {@link MapContextDrawer}.
105
         * 
106
         * @param drawerClazz
107
         *            the {@link MapContextDrawer} class to use
108
         * @throws MapContextException
109
         *             if there is any error setting the class
110
         */
111
        public void setDefaultMapContextDrawer(Class drawerClazz)
112
                        throws MapContextException;
113

    
114
        public void validateMapContextDrawer(Class drawerClazz) throws MapContextException;
115

    
116
        /**
117
         * Creates a new instance of the default {@link MapContextDrawer}
118
         * implementation.
119
         * 
120
         * @return the new {@link MapContextDrawer} instance
121
         * @throws MapContextException
122
         *             if there is an error creating the new object instance
123
         */
124
        public MapContextDrawer createDefaultMapContextDrawerInstance()
125
                        throws MapContextException;
126

    
127
        /**
128
         * Creates a new instance of the provided {@link MapContextDrawer}
129
         * implementation.
130
         * 
131
         * @param drawerClazz
132
         *            the {@link MapContextDrawer} implementation class
133
         * @return the new {@link MapContextDrawer} instance
134
         * @throws MapContextException
135
         *             if there is an error creating the new object instance
136
         */
137
        public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz)
138
                        throws MapContextException;
139

    
140
        
141
        
142
        void registerLegend(String legendName, Class legendClass)
143
                        throws MapContextRuntimeException;
144

    
145
        ILegend createLegend(String legendName) throws MapContextRuntimeException;
146

    
147
        void setDefaultVectorLegend(String legendName);
148

    
149
        IVectorLegend createDefaultVectorLegend(int shapeType)
150
                        throws MapContextRuntimeException;
151

    
152
        void registerLegendWriter(String legendName, String format,
153
                        Class writerClass) throws MapContextRuntimeException;
154

    
155
        void registerLegendReader(String format, Class readerClass)
156
                        throws MapContextRuntimeException;
157

    
158
        ILegendWriter createLegendWriter(String legendName, String format)
159
                        throws MapContextException;
160

    
161
        ILegendReader createLegendReader(String format)
162
                        throws MapContextRuntimeException;
163

    
164
        /**
165
         * @deprecated to be removed in gvSIG 2.0
166
         * @see {@link SymbolPreferences}.
167
         */
168
        int getDefaultCartographicSupportMeasureUnit();
169

    
170
        /**
171
         * @deprecated to be removed in gvSIG 2.0
172
         * @see {@link SymbolPreferences}.
173
         */
174
        void setDefaultCartographicSupportMeasureUnit(
175
                        int defaultCartographicSupportMeasureUnit);
176

    
177
        /**
178
         * @deprecated to be removed in gvSIG 2.0
179
         * @see {@link SymbolPreferences}.
180
         */
181
        int getDefaultCartographicSupportReferenceSystem();
182

    
183
        /**
184
         * @deprecated to be removed in gvSIG 2.0
185
         * @see {@link SymbolPreferences}.
186
         */
187
        void setDefaultCartographicSupportReferenceSystem(
188
                        int defaultCartographicSupportReferenceSystem);
189

    
190
        /**
191
         * @deprecated to be removed in gvSIG 2.0
192
         * @see {@link SymbolPreferences}.
193
         */
194
        Color getDefaultSymbolColor();
195

    
196
        /**
197
         * @deprecated to be removed in gvSIG 2.0
198
         * @see {@link SymbolPreferences}.
199
         */
200
        void setDefaultSymbolColor(Color defaultSymbolColor);
201

    
202
        /**
203
         * @deprecated to be removed in gvSIG 2.0
204
         * @see {@link SymbolPreferences}.
205
         */
206
        void resetDefaultSymbolColor();
207

    
208
        /**
209
         * @deprecated to be removed in gvSIG 2.0
210
         * @see {@link SymbolPreferences}.
211
         */
212
        Color getDefaultSymbolFillColor();
213

    
214
        /**
215
         * @deprecated to be removed in gvSIG 2.0
216
         * @see {@link SymbolPreferences}.
217
         */
218
        void setDefaultSymbolFillColor(Color defaultSymbolFillColor);
219

    
220
        /**
221
         * @deprecated to be removed in gvSIG 2.0
222
         * @see {@link SymbolPreferences}.
223
         */
224
        void resetDefaultSymbolFillColor();
225

    
226
        /**
227
         * @deprecated to be removed in gvSIG 2.0
228
         * @see {@link SymbolPreferences}.
229
         */
230
        boolean isDefaultSymbolFillColorAleatory();
231

    
232
        /**
233
         * @deprecated to be removed in gvSIG 2.0
234
         * @see {@link SymbolPreferences}.
235
         */
236
        void setDefaultSymbolFillColorAleatory(
237
                        boolean defaultSymbolFillColorAleatory);
238

    
239
        /**
240
         * @deprecated to be removed in gvSIG 2.0
241
         * @see {@link SymbolPreferences}.
242
         */
243
        void resetDefaultSymbolFillColorAleatory();
244

    
245
        /**
246
         * @deprecated to be removed in gvSIG 2.0
247
         * @see {@link SymbolPreferences}.
248
         */
249
        Font getDefaultSymbolFont();
250

    
251
        /**
252
         * @deprecated to be removed in gvSIG 2.0
253
         * @see {@link SymbolPreferences}.
254
         */
255
        void setDefaultSymbolFont(Font defaultSymbolFont);
256

    
257
        /**
258
         * @deprecated to be removed in gvSIG 2.0
259
         * @see {@link SymbolPreferences}.
260
         */
261
        void resetDefaultSymbolFont();
262

    
263
        /**
264
         * @deprecated to be removed in gvSIG 2.0
265
         * @see {@link SymbolPreferences}.
266
         */
267
        String getSymbolLibraryPath();
268

    
269
        /**
270
         * @deprecated to be removed in gvSIG 2.0
271
         * @see {@link SymbolPreferences}.
272
         */
273
        void setSymbolLibraryPath(String symbolLibraryPath);
274

    
275
        /**
276
         * @deprecated to be removed in gvSIG 2.0
277
         * @see {@link SymbolPreferences}.
278
         */
279
        void resetSymbolLibraryPath();
280
        
281
        
282
        /**
283
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
284
         */
285
        ISymbol createSymbol(String symbolName) throws MapContextRuntimeException;
286

    
287
        /**
288
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
289
         */
290
        ISymbol createSymbol(int shapeType) throws MapContextRuntimeException;
291

    
292
        /**
293
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
294
         */
295
        ISymbol createSymbol(String symbolName, Color color)
296
                        throws MapContextRuntimeException;
297

    
298
        /**
299
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
300
         */
301
        ISymbol createSymbol(int shapeType, Color color)
302
                        throws MapContextRuntimeException;
303

    
304
        /**
305
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
306
         */
307
        IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
308
                        throws MapContextRuntimeException;
309

    
310
        /**
311
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
312
         */
313
        IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
314
                        throws MapContextRuntimeException;
315

    
316
        /**
317
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
318
         */
319
        void registerSymbol(String symbolName, Class symbolClass)
320
                        throws MapContextRuntimeException;
321

    
322
        /**
323
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
324
         */
325
        void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass)
326
                        throws MapContextException;
327

    
328
        /**
329
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
330
         */
331
        void registerMultiLayerSymbol(String symbolName, Class symbolClass)
332
                        throws MapContextRuntimeException;
333

    
334
        /**
335
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
336
         */
337
        void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
338
                        Class symbolClass) throws MapContextRuntimeException;
339

    
340
        /**
341
         * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
342
         */
343
        IWarningSymbol getWarningSymbol(String message, String symbolDesc,
344
                        int symbolDrawExceptionType) throws MapContextRuntimeException;
345
        
346
        /**
347
         * It returns the legend associated with a {@link DataStore}.
348
         * If the legend doesn't exist it returns <code>null</code>.
349
         * @param dataStore
350
         * the store that could have a legend.
351
         * @return
352
         * the legend or <code>null</code>.
353
         */
354
        ILegend getLegend(DataStore dataStore);        
355
        
356
        /**
357
     * It returns the labeling strategy associated with a {@link DataStore}.
358
     * If the labeling strategy doesn't exist it returns <code>null</code>.
359
     * @param dataStore
360
     * the store that could have a labeling strategy.
361
     * @return
362
     * the labeling strategy or <code>null</code>.
363
     */
364
        ILabelingStrategy getLabelingStrategy(DataStore dataStore);
365

    
366

    
367
        void registerIconLayer(String store, String iconName);
368
        
369
        String getIconLayer(DataStore store);
370
        
371
    // TODO:
372
    // DynObjectModel getFeatureTypeUIModel(DataStore store,
373
    // FeatureType featureType);
374
}