Statistics
| Revision:

gvsig-educa / org.gvsig.educa.thematicmap / trunk / org.gvsig.educa.thematicmap / org.gvsig.educa.thematicmap.lib / org.gvsig.educa.thematicmap.lib.api / src / main / java / org / gvsig / educa / thematicmap / ThematicMapManager.java @ 219

History | View | Annotate | Download (12.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
package org.gvsig.educa.thematicmap;
23

    
24
import java.io.File;
25
import java.io.IOException;
26
import java.util.List;
27

    
28
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompilation;
29
import org.gvsig.educa.thematicmap.compilation.ThematicMapCompiler;
30
import org.gvsig.educa.thematicmap.editor.ThematicMapAddLayerComponent;
31
import org.gvsig.educa.thematicmap.editor.ThematicMapCompilationEditor;
32
import org.gvsig.educa.thematicmap.editor.ThematicMapLayerPropertiesEditor;
33
import org.gvsig.educa.thematicmap.editor.ThematicMapLayersEditor;
34
import org.gvsig.educa.thematicmap.map.CantLoadContextException;
35
import org.gvsig.educa.thematicmap.map.InvalidThematicMapFormatException;
36
import org.gvsig.educa.thematicmap.map.ThematicMap;
37
import org.gvsig.educa.thematicmap.map.ThematicMapInformation;
38
import org.gvsig.educa.thematicmap.viewer.MapControlToolRegistrant;
39
import org.gvsig.educa.thematicmap.viewer.ThematicMapInformationViewer;
40
import org.gvsig.educa.thematicmap.viewer.ThematicMapToc;
41
import org.gvsig.educa.thematicmap.viewer.ThematicMapTocImageProvider;
42
import org.gvsig.educa.thematicmap.viewer.ThematicMapViewer;
43
import org.gvsig.tools.dispose.Disposable;
44
import org.gvsig.tools.service.Manager;
45
import org.gvsig.tools.service.ServiceException;
46
import org.gvsig.tools.service.spi.ProviderManager;
47

    
48
/**
49
 * Library Manager.
50
 * </p>
51
 * Expose main library's functionalities:
52
 * <ul>
53
 * <li>Set default folders configuration</li>
54
 * <li>Get installed <i>Thematic Map</i></li>
55
 * <li>Identify and get a <i>Thematic Map</i> from a file</li>
56
 * <li>Create a new {@link ThematicMapCompilation} instance</li>
57
 * <li>Create a new {@link ThematicMapCompiler} instance</li>
58
 * </ul>
59
 * 
60
 * @author gvSIG team
61
 * @version $Id$
62
 */
63
public interface ThematicMapManager extends Disposable, Manager {
64

    
65
    /**
66
     * Gets default folder to locate installed <i>Thematic Map</i>
67
     * 
68
     * @return default installation folder
69
     */
70
    String getInstallationMapFolder();
71

    
72
    /**
73
     * Sets default folder to locate installed <i>Thematic Map</i>
74
     * 
75
     * @param folder
76
     * @throws IllegalArgumentException
77
     *             if <code>folder</code> is a file or can't read or not exists
78
     */
79
    void setInstallationMapFolder(String folder);
80

    
81
    /**
82
     * Gets the folder to use to <i>open</i> any <i>Thematic
83
     * Map</i> before access to the information contained in it.
84
     * 
85
     * @return temporal folder
86
     */
87
    String getTemporalFolder();
88

    
89
    /**
90
     * Sets the folder to use to <i>open</i> any <i>Thematic Map</i>
91
     * 
92
     * @param folder
93
     * @throws IllegalArgumentException
94
     *             if <code>folder</code> is a file or can't write
95
     */
96
    void setTemporalFolder(String folder);
97

    
98
    /**
99
     * Clear all data in temporal folder
100
     */
101
    void cleanAllTemporalData();
102

    
103
    /**
104
     * Returns all <i>Thematic Map</i> installed
105
     * </p>
106
     * Uses installation folder to locate them
107
     * 
108
     * @return All <i>Thematic Map></i> installed
109
     */
110
    List<ThematicMap> getInstalledMaps();
111

    
112
    /**
113
     * Returns all <i>Thematic Map</i> installed into the specified folder
114
     * </p>
115
     * Uses installation folder to locate them
116
     * 
117
     * @param folder
118
     *            to analyze
119
     * @return All <i>Thematic Map></i> installed
120
     * @throws IllegalArgumentException
121
     *             if folder is not valid (a readable folder)
122
     */
123
    List<ThematicMap> getInstalledMaps(String folder);
124

    
125
    /**
126
     * Gets a {@link ThematicMap} from a file
127
     * </p>
128
     * 
129
     * @param file
130
     * @return the <i>Thematic Map</i>
131
     * @throws InvalidThematicMapFormatException
132
     */
133
    ThematicMap getMapFromFile(File file)
134
        throws InvalidThematicMapFormatException;
135

    
136
    /**
137
     * Gets a {@link ThematicMap} from intalledMaps
138
     * by its id
139
     * </p>
140
     * 
141
     * @param mapid
142
     *            ThematicMap id
143
     * @return the <i>Thematic Map</i>
144
     */
145
    ThematicMap getMapById(String mapId);
146

    
147
    /**
148
     * Informs if a file is a valid <i>Thematic Map</i> file
149
     * 
150
     * @param file
151
     * @return
152
     */
153
    boolean isMap(File file);
154

    
155
    /**
156
     * Informs if a folder is a valid <i>Thematic Map</i> installed folder
157
     * 
158
     * @param file
159
     * @return
160
     */
161
    boolean isAThematicMapIntalledFolder(File folder);
162

    
163
    /**
164
     * Creates a new instance of a {@link ThematicMapCompilation} for a
165
     * game with the given name.
166
     * 
167
     * @return the compilation
168
     * @throws ServiceException
169
     *             if there is an error creating the compilation
170
     */
171
    ThematicMapCompilation createCompilationInstance(String gameName)
172
        throws ServiceException;
173

    
174
    /**
175
     * Creates a new instance of a {@link ThematicMapCompilation} without
176
     * any active game.
177
     * 
178
     * @return the compilation
179
     * @throws ServiceException
180
     *             if there is an error creating the compilation
181
     */
182
    ThematicMapCompilation createCompilationInstance() throws ServiceException;
183

    
184
    /**
185
     * Creates a new instance of a {@link ThematicMapCompilation} based on
186
     * values <code>map</code>
187
     * 
188
     * @param map
189
     *            to use as template
190
     * @return
191
     * @throws IOException
192
     * @throws CantLoadContextException
193
     * @throws InvalidThematicMapFormatException
194
     */
195
    ThematicMapCompilation createCompilationInstanceFromMap(ThematicMap map)
196
        throws InvalidThematicMapFormatException, CantLoadContextException,
197
        IOException;
198

    
199
    /**
200
     * Create a new instance of a {@link ThematicMapCompiler}
201
     * 
202
     * @return
203
     */
204
    ThematicMapCompiler createCompilerInstance();
205

    
206
    /**
207
     * Generates the base name for a ThematicMap file using its info data
208
     * 
209
     * @param info
210
     * @return
211
     */
212
    String getBaseFileNameFromInfo(ThematicMapInformation info);
213

    
214
    /**
215
     * Generates the base name for a ThematicMap file
216
     * 
217
     * @param info
218
     * @return
219
     */
220
    String getBaseFileNameFromInfo(String id, String name, int version,
221
        int buildNumber);
222

    
223
    /**
224
     * Create a gvSIG package file (gvspkg) from a thematicMap
225
     * 
226
     * @param mapId
227
     *            id of map to export
228
     * @param targetFolder
229
     *            where write package file
230
     * @return
231
     * @throws ThematicMapException
232
     * @throws IOException
233
     */
234
    File generatePackageFile(String mapId, File targetFolder)
235
        throws ThematicMapException, IOException;
236

    
237
    /**
238
     * Create a gvSIG package file (gvspkg) from a thematicMap installed folder
239
     * 
240
     * @param thematicMapIntallFolder
241
     *            folder of a installed ThematicMap
242
     * @param targetFolder
243
     *            where write package file
244
     * @return
245
     * @throws ThematicMapException
246
     * @throws IOException
247
     */
248
    File generatePackageFile(File thematicMapIntallFolder, File targetFolder)
249
        throws ThematicMapException, IOException;
250

    
251
    /**
252
     * Returns the translation of a string.
253
     * 
254
     * @param key
255
     *            String to translate
256
     * @return a String with the translation of the string passed by parameter
257
     */
258
    public String getTranslation(String key);
259

    
260
    /**
261
     * Get a {@link ThematicMapViewer} to show the <code>thematicMap</code>
262
     * 
263
     * @param thematicMap
264
     * @return
265
     * @throws IOException
266
     * @throws CantLoadContextException
267
     * @throws InvalidThematicMapFormatException
268
     */
269
    public ThematicMapViewer getViewer(ThematicMap thematicMap)
270
        throws InvalidThematicMapFormatException, CantLoadContextException,
271
        IOException;
272

    
273
    /**
274
     * Get a {@link ThematicMapCompilationEditor} to modify the
275
     * <code>thematicMapCompilation</code>
276
     * 
277
     * @param thematicMapCompilation
278
     * @param editLayers
279
     * @return
280
     */
281
    public ThematicMapCompilationEditor getCompilationEditor(
282
        ThematicMapCompilation thematicMapCompilation, boolean editLayers);
283

    
284
    /**
285
     * Returns the {@link ThematicMapWindowManager}.
286
     * 
287
     * @return {@link ThematicMapWindowManager}
288
     * @see {@link ThematicMapWindowManager}
289
     */
290
    public ThematicMapWindowManager getWindowManager();
291

    
292
    /**
293
     * Registers a new instance of a WindowManager which provides services to
294
     * the management of the application windows.
295
     * 
296
     * @param manager
297
     *            {@link ThematicMapWindowManager} to register in the
298
     *            ScriptingUIManager.
299
     * @see ThematicMapWindowManager
300
     */
301
    public void registerWindowManager(ThematicMapWindowManager manager);
302

    
303
    /**
304
     * Returns a new instance of {@link ThematicMapToc}
305
     * 
306
     * @return
307
     */
308
    public ThematicMapToc newToc();
309

    
310
    /**
311
     * Register the class for {@link ThematicMapToc} components
312
     * 
313
     * @param tocComponentClass
314
     */
315
    public void registerTocComponent(
316
        Class<? extends ThematicMapToc> tocComponentClass);
317

    
318
    /**
319
     * Returns a new instance of {@link ThematicMapAddLayerComponent}
320
     * 
321
     * @return
322
     * @throws ThematicMapRuntimeException
323
     *             on a instance creation problem
324
     */
325
    public ThematicMapAddLayerComponent newAddLayerComponent();
326

    
327
    /**
328
     * Register the class for {@link ThematicMapAddLayerComponent} components
329
     * 
330
     * @param addLayerComponent
331
     */
332
    public void registerAddLayerComponent(
333
        Class<? extends ThematicMapAddLayerComponent> addLayerComponent);
334

    
335
    /**
336
     * Returns a new instance of {@link ThematicMapLayerPropertiesEditor}
337
     * 
338
     * @return
339
     * @throws ThematicMapRuntimeException
340
     *             on a instance creation problem
341
     */
342
    public ThematicMapLayerPropertiesEditor newLayerPropertiesEditor();
343

    
344
    /**
345
     * Register the class for {@link ThematicMapLayerPropertiesEditor}
346
     * components
347
     * 
348
     * @param addLayerComponent
349
     */
350
    public void registerLayerPropertiesEditor(
351
        Class<? extends ThematicMapLayerPropertiesEditor> layerPropertiesEditorClass);
352

    
353
    /**
354
     * Returns a new instance of {@link ThematicMapLayersEditor}
355
     * 
356
     * @return
357
     * @throws ThematicMapRuntimeException
358
     *             on a instance creation problem
359
     */
360
    public ThematicMapLayersEditor newLayersEditor();
361

    
362
    /**
363
     * Register the class for {@link ThematicMapLayersEditor} components
364
     * 
365
     * @param addLayerComponent
366
     * 
367
     */
368
    public void registerLayersEditor(
369
        Class<? extends ThematicMapLayersEditor> layersEditorClass);
370

    
371
    /**
372
     * Returns a new instance of {@link ThematicMapInformationViewer}
373
     * 
374
     * @return
375
     * @throws ThematicMapRuntimeException
376
     *             on a instance creation problem
377
     */
378
    public ThematicMapInformationViewer newInformationViewer();
379

    
380
    /**
381
     * Register the class for {@link ThematicMapInformationViewer} components
382
     * 
383
     * @param addLayerComponent
384
     * 
385
     */
386
    public void registerInformationViewer(
387
        Class<? extends ThematicMapInformationViewer> informationViewerClass);
388

    
389
    /**
390
     * Sets the default image icon provider to represents layers and preview
391
     * symbology in Thematic Maps TOC
392
     * 
393
     * @param imageProvider
394
     */
395
    public void setDefaultTocImageProvider(
396
        ThematicMapTocImageProvider imageProvider);
397

    
398
    /**
399
     * Gets the default image icon provider to represents layers and preview
400
     * symbology in Thematic Maps TOC
401
     * 
402
     * @param imageProvider
403
     */
404
    public ThematicMapTocImageProvider getDefaultTocImageProvider();
405

    
406
    /**
407
     * Register an instance of a {@link MapControlToolRegistrant} which
408
     * register
409
     * tools in all new {@link ThematicMapViewer} instances
410
     * 
411
     * @param registrant
412
     */
413
    public void addMapControlRegistrant(MapControlToolRegistrant registrant);
414

    
415
    /**
416
     * Returns a read-only list of all current {@link MapControlToolRegistrant}
417
     * 
418
     * @return
419
     */
420
    public List<MapControlToolRegistrant> getMapControlRegistrantList();
421
    
422
    public ProviderManager getProviderManager();
423
}