gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / RasterDefaultImplLibrary.java @ 2443
History | View | Annotate | Download (8.35 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.raster.impl; |
23 |
|
24 |
import java.util.ArrayList; |
25 |
import java.util.HashMap; |
26 |
import java.util.List; |
27 |
|
28 |
import javax.swing.ImageIcon; |
29 |
|
30 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
31 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
32 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
33 |
import org.gvsig.metadata.exceptions.MetadataException; |
34 |
import org.gvsig.raster.impl.datastruct.BandListImpl; |
35 |
import org.gvsig.raster.impl.datastruct.ColorItemImpl; |
36 |
import org.gvsig.raster.impl.datastruct.DatasetBandImpl; |
37 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
38 |
import org.gvsig.raster.impl.datastruct.Kernel; |
39 |
import org.gvsig.raster.impl.datastruct.TransparencyRangeImpl; |
40 |
import org.gvsig.raster.impl.datastruct.serializer.ColorTableRmfSerializer; |
41 |
import org.gvsig.raster.impl.datastruct.serializer.HistogramRmfSerializer; |
42 |
import org.gvsig.raster.impl.datastruct.serializer.NoDataRmfSerializer; |
43 |
import org.gvsig.raster.impl.grid.filter.DefaultRasterFilterList; |
44 |
import org.gvsig.raster.impl.grid.filter.band.ColorBalanceCMYManager; |
45 |
import org.gvsig.raster.impl.grid.filter.band.ColorBalanceRGBManager; |
46 |
import org.gvsig.raster.impl.grid.filter.band.ColorTableListManager; |
47 |
import org.gvsig.raster.impl.grid.filter.band.HSLToRGBManager; |
48 |
import org.gvsig.raster.impl.grid.filter.band.RGBToHSLManager; |
49 |
import org.gvsig.raster.impl.grid.filter.band.ToLumSaManager; |
50 |
import org.gvsig.raster.impl.grid.filter.convolution.ConvolutionListManager; |
51 |
import org.gvsig.raster.impl.grid.filter.correction.MedianListManager; |
52 |
import org.gvsig.raster.impl.grid.filter.correction.ModeManager; |
53 |
import org.gvsig.raster.impl.grid.filter.enhancement.BrightnessContrastListManager; |
54 |
import org.gvsig.raster.impl.grid.filter.enhancement.EnhancementStretchListManager; |
55 |
import org.gvsig.raster.impl.grid.filter.enhancement.EqualizationManager; |
56 |
import org.gvsig.raster.impl.grid.filter.enhancement.GrayScaleManager; |
57 |
import org.gvsig.raster.impl.grid.filter.pansharp.PanSharpeningListManager; |
58 |
import org.gvsig.raster.impl.grid.filter.segmentation.FirstDerivativeListManager; |
59 |
import org.gvsig.raster.impl.grid.filter.statistics.StatisticsListManager; |
60 |
import org.gvsig.raster.impl.grid.render.DefaultRender; |
61 |
import org.gvsig.raster.impl.store.AbstractRasterDataStore; |
62 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
63 |
import org.gvsig.raster.impl.store.DefaultRemoteRasterStore; |
64 |
import org.gvsig.raster.impl.store.ParamImpl; |
65 |
import org.gvsig.raster.impl.store.ParamsImpl; |
66 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
67 |
import org.gvsig.raster.impl.store.properties.DataStoreColorTable; |
68 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
69 |
import org.gvsig.raster.impl.store.serializer.ColorInterpretationRmfSerializer; |
70 |
import org.gvsig.raster.impl.store.serializer.GeoInfoRmfSerializer; |
71 |
import org.gvsig.raster.impl.store.serializer.GeoPointListRmfSerializer; |
72 |
import org.gvsig.raster.impl.store.serializer.ProjectionRmfSerializer; |
73 |
import org.gvsig.raster.impl.store.serializer.ROIFileRmfSerializer; |
74 |
import org.gvsig.raster.impl.store.serializer.StatisticsRmfSerializer; |
75 |
import org.gvsig.raster.impl.store.serializer.TimeSeriesRmfSerializer; |
76 |
import org.gvsig.raster.util.persistence.GenericPersistentObject; |
77 |
import org.gvsig.raster.util.persistence.PersistencyFilterParams; |
78 |
import org.gvsig.tools.ToolsLocator; |
79 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
80 |
import org.gvsig.tools.library.AbstractLibrary; |
81 |
import org.gvsig.tools.library.LibraryException; |
82 |
|
83 |
/**
|
84 |
* Library for default implementation initialization and configuration.
|
85 |
*
|
86 |
* @author gvSIG team
|
87 |
* @version $Id$
|
88 |
*/
|
89 |
public class RasterDefaultImplLibrary extends AbstractLibrary { |
90 |
public static ImageIcon downloadingImg = null; |
91 |
public static ImageIcon crashImg = null; |
92 |
public static HashMap<String, Buffer> defaultImages = new HashMap<String, Buffer>(); |
93 |
|
94 |
public RasterDefaultImplLibrary() {
|
95 |
registerAsImplementationOf(RasterLibrary.class); |
96 |
} |
97 |
|
98 |
/**
|
99 |
* Ejecuta las acciones necesarias para arrancar la librer?a.
|
100 |
*/
|
101 |
public static void wakeUp() { |
102 |
if (RasterLibrary.wakeup)
|
103 |
return;
|
104 |
|
105 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
106 |
// Punto de extensi?n para registro de drivers de escritura
|
107 |
extensionPoints.add("RasterWriter", "Raster Writer Classes"); |
108 |
// Punto de extensi?n de los filtros
|
109 |
extensionPoints.add("RasterFilter", "Raster Filter Classes"); |
110 |
// Punto de extensi?n de los serializadores
|
111 |
extensionPoints.add("Serializer", "Raster Serializer Classes"); |
112 |
// Registro de clases por defecto
|
113 |
extensionPoints.add("DefaultRasterProvider", "Default Raster Drivers"); |
114 |
|
115 |
// Invoca las llamadas est?ticas de cada clase para registrarlas en los puntos de extensi?n
|
116 |
BrightnessContrastListManager.register(); |
117 |
FirstDerivativeListManager.register(); |
118 |
MedianListManager.register(); |
119 |
ConvolutionListManager.register(); |
120 |
ColorTableListManager.register(); |
121 |
StatisticsListManager.register(); |
122 |
PanSharpeningListManager.register(); |
123 |
RGBToHSLManager.register(); |
124 |
HSLToRGBManager.register(); |
125 |
ColorBalanceCMYManager.register(); |
126 |
ColorBalanceRGBManager.register(); |
127 |
ToLumSaManager.register(); |
128 |
EnhancementStretchListManager.register(); |
129 |
EqualizationManager.register(); |
130 |
ModeManager.register(); |
131 |
GrayScaleManager.register(); |
132 |
|
133 |
// Registro de serializadores
|
134 |
ColorInterpretationRmfSerializer.register(); |
135 |
GeoInfoRmfSerializer.register(); |
136 |
GeoPointListRmfSerializer.register(); |
137 |
ProjectionRmfSerializer.register(); |
138 |
StatisticsRmfSerializer.register(); |
139 |
ColorTableRmfSerializer.register(); |
140 |
HistogramRmfSerializer.register(); |
141 |
NoDataRmfSerializer.register(); |
142 |
TimeSeriesRmfSerializer.register(); |
143 |
ROIFileRmfSerializer.register(); |
144 |
|
145 |
// Cleans the temporary folder
|
146 |
RasterLocator.getManager().getFileUtils().cleanUpTempFiles(); |
147 |
// Builds the temporary folder
|
148 |
RasterLocator.getManager().getFileUtils().getTemporalPath(); |
149 |
RasterLibrary.wakeup = true;
|
150 |
} |
151 |
|
152 |
protected void doInitialize() throws LibraryException { |
153 |
//Register the default GeometryManager
|
154 |
RasterLocator.registerManager(DefaultRasterManager.class); |
155 |
wakeUp(); |
156 |
} |
157 |
|
158 |
@Override
|
159 |
protected void doPostInitialize() throws LibraryException { |
160 |
List<Throwable> exs = new ArrayList<Throwable>(); |
161 |
|
162 |
try {
|
163 |
AbstractRasterDataStore.registerMetadataDefinition(); |
164 |
} catch (MetadataException e) {
|
165 |
exs.add(e); |
166 |
} |
167 |
|
168 |
if (exs.size() > 0) { |
169 |
throw new LibraryException(this.getClass(), exs); |
170 |
} |
171 |
|
172 |
BandListImpl.registerPersistence(); |
173 |
DefaultRender.registerPersistence(); |
174 |
DataStoreColorTable.registerPersistence(); |
175 |
DefaultRasterStore.registerPersistence(); |
176 |
DefaultRemoteRasterStore.registerPersistence(); |
177 |
DataStoreColorTable.registerPersistence(); |
178 |
ColorItemImpl.registerPersistence(); |
179 |
DataStoreColorInterpretation.registerDynClass(); |
180 |
DataStoreTransparency.registerPersistence(); |
181 |
TransparencyRangeImpl.registerPersistence(); |
182 |
DatasetBandImpl.registerPersistence(); |
183 |
ExtentImpl.registerPersistence(); |
184 |
DefaultRasterFilterList.registerPersistence(); |
185 |
GenericPersistentObject.registerPersistence(); |
186 |
|
187 |
Kernel.registerPersistence();
|
188 |
PersistencyFilterParams.registerPersistence(); |
189 |
ParamsImpl.registerPersistence(); |
190 |
ParamImpl.registerPersistence(); |
191 |
|
192 |
//uncomment to show tile downloading image
|
193 |
//if(downloadingImg == null)
|
194 |
//downloadingImg = new ImageIcon(getClass().getResource("images/download.jpg"));
|
195 |
if(crashImg == null) |
196 |
crashImg = new ImageIcon(getClass().getResource("images/Download_Warning.png")); |
197 |
} |
198 |
|
199 |
} |