svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / RasterModule.java @ 18962
History | View | Annotate | Download (20 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.rastertools; |
20 |
|
21 |
import java.util.prefs.Preferences; |
22 |
|
23 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
24 |
import org.gvsig.fmap.raster.layers.StatusLayerRaster; |
25 |
import org.gvsig.raster.Configuration; |
26 |
import org.gvsig.raster.ConfigurationEvent; |
27 |
import org.gvsig.raster.ConfigurationListener; |
28 |
import org.gvsig.raster.RasterLibrary; |
29 |
import org.gvsig.raster.gui.preferences.RasterPreferences; |
30 |
import org.gvsig.raster.gui.properties.dialog.RasterPropertiesTocMenuEntry; |
31 |
import org.gvsig.raster.gui.wizards.FileOpenRaster; |
32 |
import org.gvsig.raster.regionalpha.filter.RegionAlphaListManager; |
33 |
import org.gvsig.rastertools.analysisview.ViewRasterAnalysisTocMenuEntry; |
34 |
import org.gvsig.rastertools.clipping.ClippingTocMenuEntry; |
35 |
import org.gvsig.rastertools.colortable.ColorTableTocMenuEntry; |
36 |
import org.gvsig.rastertools.filter.FilterTocMenuEntry; |
37 |
import org.gvsig.rastertools.geolocation.GeoLocationTocMenuEntry; |
38 |
import org.gvsig.rastertools.histogram.HistogramTocMenuEntry; |
39 |
import org.gvsig.rastertools.overviews.OverviewsTocMenuEntry; |
40 |
import org.gvsig.rastertools.properties.panels.BandSelectorPanel; |
41 |
import org.gvsig.rastertools.properties.panels.EnhancedPanel; |
42 |
import org.gvsig.rastertools.properties.panels.InfoPanel; |
43 |
import org.gvsig.rastertools.properties.panels.PanSharpeningPanel; |
44 |
import org.gvsig.rastertools.properties.panels.ScalePanel; |
45 |
import org.gvsig.rastertools.properties.panels.StatisticsPanel; |
46 |
import org.gvsig.rastertools.properties.panels.TransparencyPanel; |
47 |
import org.gvsig.rastertools.rasterresolution.ZoomPixelCursorTocMenuEntry; |
48 |
import org.gvsig.rastertools.roi.ui.ROIManagerTocMenuEntry; |
49 |
import org.gvsig.rastertools.saveas.SaveAsTocMenuEntry; |
50 |
import org.gvsig.rastertools.selectrasterlayer.SelectImageListener; |
51 |
|
52 |
import com.iver.andami.PluginServices; |
53 |
import com.iver.andami.plugins.Extension; |
54 |
import com.iver.andami.ui.mdiManager.IWindow; |
55 |
import com.iver.cit.gvsig.fmap.MapContext; |
56 |
import com.iver.cit.gvsig.fmap.MapControl; |
57 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
58 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
59 |
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
60 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
61 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
62 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
63 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
64 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener; |
65 |
import com.iver.utiles.extensionPoints.ExtensionPoint; |
66 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
67 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
68 |
/**
|
69 |
* Extensi?n que adapta a FMap y gvSIG la nueva implementaci?n de raster. Para
|
70 |
* el cuadro de Propiedades de visualizaci?n de raster contiene el contenedor
|
71 |
* base se registran la entrada del men? del TOC y los paneles en el cuadro.
|
72 |
* Para la parte de FMap contiene una nueva capa raster y los drivers
|
73 |
* necesarios.
|
74 |
*
|
75 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
76 |
*/
|
77 |
public class RasterModule extends Extension implements ConfigurationListener { |
78 |
|
79 |
/**
|
80 |
* Indica si en el panel de preferencias se refresca automaticamente la vista
|
81 |
* para mostrar los cambios
|
82 |
*/
|
83 |
public static boolean autoRefreshView = true; |
84 |
|
85 |
/**
|
86 |
* Indica si se debe preguntar las coordenadas al cargar una capa que no las
|
87 |
* tenga
|
88 |
*/
|
89 |
public static boolean askCoordinates = false; |
90 |
|
91 |
/*
|
92 |
* (non-Javadoc)
|
93 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
94 |
*/
|
95 |
public void execute(String actionCommand) { |
96 |
View theView = (View) PluginServices.getMDIManager().getActiveWindow(); |
97 |
MapControl mapCtrl = theView.getMapControl(); |
98 |
|
99 |
// Listener de eventos de movimiento que pone las coordenadas del rat?n en
|
100 |
// la barra de estado
|
101 |
StatusBarListener sbl = new StatusBarListener(mapCtrl);
|
102 |
|
103 |
if (actionCommand.equals("SELECTIMAGE")) { |
104 |
loadSelectRasterListener(mapCtrl, sbl); |
105 |
mapCtrl.setTool("selectRasterLayer");
|
106 |
} |
107 |
} |
108 |
|
109 |
/**
|
110 |
* Carga el listener de selecci?n de raster en el MapControl.
|
111 |
*/
|
112 |
private void loadSelectRasterListener(MapControl mapCtrl, StatusBarListener sbl) { |
113 |
if (mapCtrl.getNamesMapTools().get("selectRasterLayer") == null) { |
114 |
SelectImageListener sil = new SelectImageListener(mapCtrl);
|
115 |
mapCtrl.addMapTool("selectRasterLayer", new Behavior[] { new PointBehavior(sil), new MouseMovementBehavior(sbl) }); |
116 |
mapCtrl.setTool("selectRasterLayer");
|
117 |
} |
118 |
} |
119 |
|
120 |
/*
|
121 |
* (non-Javadoc)
|
122 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
123 |
*/
|
124 |
public void initialize() { |
125 |
// Asignamos la configuracion global a FlyrRasterSE
|
126 |
FLyrRasterSE.setConfiguration(Configuration.getSingleton());
|
127 |
|
128 |
Configuration.addValueChangedListener(this); |
129 |
loadConfigurationValues(); |
130 |
|
131 |
registerIcons(); |
132 |
RasterLibrary.wakeUp(); |
133 |
|
134 |
// DiagSignalHandler.install("ALRM");
|
135 |
|
136 |
Preferences prefs = Preferences.userRoot().node("gvsig.foldering"); |
137 |
prefs.put("DataFolder", System.getProperty("user.home")); |
138 |
|
139 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
140 |
|
141 |
// Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades.
|
142 |
if (!extensionPoints.containsKey("RasterSEPropertiesDialog")) { |
143 |
extensionPoints.put(new ExtensionPoint("RasterSEPropertiesDialog", "Raster Properties registrable panels (register instances of javax.swing.JPanel)")); |
144 |
} |
145 |
|
146 |
// A?adimos la configuracion de Raster a gvSIG
|
147 |
extensionPoints.add("AplicationPreferences","RasterPreferences", new RasterPreferences()); |
148 |
|
149 |
// A?adimos paneles al cuadro de propiedades.
|
150 |
extensionPoints.add("RasterSEPropertiesDialog", "info", InfoPanel.class); |
151 |
extensionPoints.add("RasterSEPropertiesDialog", "bands_panel", BandSelectorPanel.class); |
152 |
extensionPoints.add("RasterSEPropertiesDialog", "transparencia", TransparencyPanel.class); |
153 |
extensionPoints.add("RasterSEPropertiesDialog", "realce", EnhancedPanel.class); |
154 |
extensionPoints.add("RasterSEPropertiesDialog", "pansharp", PanSharpeningPanel.class); |
155 |
extensionPoints.add("RasterSEPropertiesDialog", "scale_panel", ScalePanel.class); |
156 |
extensionPoints.add("RasterSEPropertiesDialog", "stats_panel", StatisticsPanel.class); |
157 |
|
158 |
// A?adimos las entradas del men? del toc de raster
|
159 |
extensionPoints.add("View_TocActions", "RasterSEProperties", RasterPropertiesTocMenuEntry.getSingleton()); |
160 |
extensionPoints.add("View_TocActions", "HistogramPanel", HistogramTocMenuEntry.getSingleton()); |
161 |
extensionPoints.add("View_TocActions", "ViewColorTable", ColorTableTocMenuEntry.getSingleton()); |
162 |
extensionPoints.add("View_TocActions", "Overviews", OverviewsTocMenuEntry.getSingleton()); |
163 |
extensionPoints.add("View_TocActions", "RoisManager", ROIManagerTocMenuEntry.getSingleton()); |
164 |
extensionPoints.add("View_TocActions", "ViewRasterAnalysis", ViewRasterAnalysisTocMenuEntry.getSingleton()); |
165 |
|
166 |
extensionPoints.add("View_TocActions", "SaveAs", SaveAsTocMenuEntry.getSingleton()); |
167 |
extensionPoints.add("View_TocActions", "ClippingPanel", ClippingTocMenuEntry.getSingleton()); |
168 |
|
169 |
extensionPoints.add("View_TocActions", "FilterPanel", FilterTocMenuEntry.getSingleton()); |
170 |
|
171 |
extensionPoints.add("View_TocActions", "GeoLocation", GeoLocationTocMenuEntry.getSingleton()); |
172 |
|
173 |
extensionPoints.add("View_TocActions", "ZoomPixelCursor", new ZoomPixelCursorTocMenuEntry()); |
174 |
|
175 |
// A?adimos nuestra extension para el tratamiento de la apertura de ficheros
|
176 |
// dentro de gvSIG
|
177 |
extensionPoints.add("FileExtendingOpenDialog", "FileOpenRaster", FileOpenRaster.class); |
178 |
|
179 |
//Alias
|
180 |
LayerFactory.registerLayerClassForName("com.iver.cit.gvsig.fmap.layers.FLyrRaster", FLyrRasterSE.class);
|
181 |
LayerFactory.registerLayerClassForName("com.iver.cit.gvsig.fmap.layers.StatusLayerRaster", StatusLayerRaster.class);
|
182 |
|
183 |
// Registrar el filtro RegionAlpha
|
184 |
RegionAlphaListManager.register(); |
185 |
} |
186 |
|
187 |
/**
|
188 |
* Registra los iconos a utilizar en andami.
|
189 |
*/
|
190 |
private void registerIcons(){ |
191 |
PluginServices.getIconTheme().registerDefault( |
192 |
"forward-icon",
|
193 |
this.getClass().getClassLoader().getResource("images/forward.png") |
194 |
); |
195 |
PluginServices.getIconTheme().registerDefault( |
196 |
"backward-icon",
|
197 |
this.getClass().getClassLoader().getResource("images/backward.png") |
198 |
); |
199 |
PluginServices.getIconTheme().registerDefault( |
200 |
"map-ok-ico",
|
201 |
MapControl.class.getResource("images/map_ico_ok.gif")
|
202 |
); |
203 |
PluginServices.getIconTheme().registerDefault( |
204 |
"crux-cursor",
|
205 |
MapControl.class.getResource("images/CruxCursor.png")
|
206 |
); |
207 |
PluginServices.getIconTheme().registerDefault( |
208 |
"blank-icon",
|
209 |
getClass().getClassLoader().getResource("images/blank.png")
|
210 |
); |
211 |
PluginServices.getIconTheme().registerDefault( |
212 |
"addlayer-icon",
|
213 |
this.getClass().getClassLoader().getResource("images/addlayer.png") |
214 |
); |
215 |
PluginServices.getIconTheme().registerDefault( |
216 |
"delall-icon",
|
217 |
this.getClass().getClassLoader().getResource("images/delall.png") |
218 |
); |
219 |
PluginServices.getIconTheme().registerDefault( |
220 |
"rotar-icon",
|
221 |
this.getClass().getClassLoader().getResource("images/Rotar.gif") |
222 |
); |
223 |
PluginServices.getIconTheme().registerDefault( |
224 |
"hor-arrow-icon",
|
225 |
this.getClass().getClassLoader().getResource("images/FlechaHorizCursor.gif") |
226 |
); |
227 |
PluginServices.getIconTheme().registerDefault( |
228 |
"ver-arrow-icon",
|
229 |
this.getClass().getClassLoader().getResource("images/FlechaVertCursor.gif") |
230 |
); |
231 |
PluginServices.getIconTheme().registerDefault( |
232 |
"inclder-arrow-icon",
|
233 |
this.getClass().getClassLoader().getResource("images/FlechaInclDerCursor.gif") |
234 |
); |
235 |
PluginServices.getIconTheme().registerDefault( |
236 |
"inclizq-arrow-icon",
|
237 |
this.getClass().getClassLoader().getResource("images/FlechaInclIzqCursor.gif") |
238 |
); |
239 |
PluginServices.getIconTheme().registerDefault( |
240 |
"shear-y-icon",
|
241 |
this.getClass().getClassLoader().getResource("images/y.gif") |
242 |
); |
243 |
PluginServices.getIconTheme().registerDefault( |
244 |
"shear-x-icon",
|
245 |
this.getClass().getClassLoader().getResource("images/x.gif") |
246 |
); |
247 |
PluginServices.getIconTheme().registerDefault( |
248 |
"hand-icon",
|
249 |
this.getClass().getClassLoader().getResource("images/Hand.gif") |
250 |
); |
251 |
PluginServices.getIconTheme().registerDefault( |
252 |
"back-icon",
|
253 |
this.getClass().getClassLoader().getResource("images/back.png") |
254 |
); |
255 |
PluginServices.getIconTheme().registerDefault( |
256 |
"next-icon",
|
257 |
this.getClass().getClassLoader().getResource("images/next.png") |
258 |
); |
259 |
PluginServices.getIconTheme().registerDefault( |
260 |
"undo-icon",
|
261 |
this.getClass().getClassLoader().getResource("images/undo.png") |
262 |
); |
263 |
PluginServices.getIconTheme().registerDefault( |
264 |
"zoom-pixel-cursor",
|
265 |
this.getClass().getClassLoader().getResource("images/ZoomPixelCursor.gif") |
266 |
); |
267 |
PluginServices.getIconTheme().registerDefault( |
268 |
"save-raster",
|
269 |
this.getClass().getClassLoader().getResource("images/Rectangle.png") |
270 |
); |
271 |
PluginServices.getIconTheme().registerDefault( |
272 |
"pixel-increase",
|
273 |
this.getClass().getClassLoader().getResource("images/increase.png") |
274 |
); |
275 |
PluginServices.getIconTheme().registerDefault( |
276 |
"select-raster",
|
277 |
this.getClass().getClassLoader().getResource("images/stock_toggle-info.png") |
278 |
); |
279 |
PluginServices.getIconTheme().registerDefault( |
280 |
"select-raster",
|
281 |
this.getClass().getClassLoader().getResource("images/stock_toggle-info.png") |
282 |
); |
283 |
PluginServices.getIconTheme().registerDefault( |
284 |
"export-icon",
|
285 |
this.getClass().getClassLoader().getResource("images/export.png") |
286 |
); |
287 |
PluginServices.getIconTheme().registerDefault( |
288 |
"pref-raster-icon",
|
289 |
this.getClass().getClassLoader().getResource("images/raster-pref.png") |
290 |
); |
291 |
PluginServices.getIconTheme().registerDefault( |
292 |
"import-icon",
|
293 |
this.getClass().getClassLoader().getResource("images/import.png") |
294 |
); |
295 |
PluginServices.getIconTheme().registerDefault( |
296 |
"save-icon",
|
297 |
this.getClass().getClassLoader().getResource("images/save.png") |
298 |
); |
299 |
PluginServices.getIconTheme().registerDefault( |
300 |
"reset-icon",
|
301 |
this.getClass().getClassLoader().getResource("images/reset.png") |
302 |
); |
303 |
PluginServices.getIconTheme().registerDefault( |
304 |
"tfwload-icon",
|
305 |
this.getClass().getClassLoader().getResource("images/load.png") |
306 |
); |
307 |
PluginServices.getIconTheme().registerDefault( |
308 |
"centerraster-icon",
|
309 |
this.getClass().getClassLoader().getResource("images/center_image.png") |
310 |
); |
311 |
PluginServices.getIconTheme().registerDefault( |
312 |
"increase-icon",
|
313 |
this.getClass().getClassLoader().getResource("images/aumentar.png") |
314 |
); |
315 |
PluginServices.getIconTheme().registerDefault( |
316 |
"decrease-icon",
|
317 |
this.getClass().getClassLoader().getResource("images/disminuir.png") |
318 |
); |
319 |
PluginServices.getIconTheme().registerDefault( |
320 |
"selectzoomarea-icon",
|
321 |
this.getClass().getClassLoader().getResource("images/view-zoom-to-seleccion.png") |
322 |
); |
323 |
PluginServices.getIconTheme().registerDefault( |
324 |
"prevzoom-icon",
|
325 |
this.getClass().getClassLoader().getResource("images/view-zoom-back.png") |
326 |
); |
327 |
PluginServices.getIconTheme().registerDefault( |
328 |
"fullview-icon",
|
329 |
this.getClass().getClassLoader().getResource("images/view-zoom-map-contents.png") |
330 |
); |
331 |
PluginServices.getIconTheme().register( |
332 |
"geolocalization-icon",
|
333 |
this.getClass().getClassLoader().getResource("images/georef.png") |
334 |
); |
335 |
PluginServices.getIconTheme().register( |
336 |
"exporttoascii-icon",
|
337 |
this.getClass().getClassLoader().getResource("images/exportToAscii.png") |
338 |
); |
339 |
PluginServices.getIconTheme().register( |
340 |
"exporttocsv-icon",
|
341 |
this.getClass().getClassLoader().getResource("images/exportToCSV.png") |
342 |
); |
343 |
PluginServices.getIconTheme().register( |
344 |
"importfromcsv-icon",
|
345 |
this.getClass().getClassLoader().getResource("images/importFromCSV.png") |
346 |
); |
347 |
PluginServices.getIconTheme().register( |
348 |
"exit-icon",
|
349 |
this.getClass().getClassLoader().getResource("images/ico_exit.gif") |
350 |
); |
351 |
PluginServices.getIconTheme().register( |
352 |
"process-icon",
|
353 |
this.getClass().getClassLoader().getResource("images/icon_process.gif") |
354 |
); |
355 |
PluginServices.getIconTheme().register( |
356 |
"options-icon",
|
357 |
this.getClass().getClassLoader().getResource("images/ico_options.gif") |
358 |
); |
359 |
PluginServices.getIconTheme().register( |
360 |
"add-icon",
|
361 |
this.getClass().getClassLoader().getResource("images/add-ico.gif") |
362 |
); |
363 |
PluginServices.getIconTheme().register( |
364 |
"centerpoint-icon",
|
365 |
this.getClass().getClassLoader().getResource("images/icon_centerpoint.gif") |
366 |
); |
367 |
PluginServices.getIconTheme().register( |
368 |
"hand-icon",
|
369 |
this.getClass().getClassLoader().getResource("images/Hand.gif") |
370 |
); |
371 |
PluginServices.getIconTheme().registerDefault( |
372 |
"clipping-icon",
|
373 |
getClass().getClassLoader().getResource("images/clipping.gif")
|
374 |
); |
375 |
PluginServices.getIconTheme().registerDefault( |
376 |
"filter-icon",
|
377 |
getClass().getClassLoader().getResource("images/filter.gif")
|
378 |
); |
379 |
PluginServices.getIconTheme().registerDefault( |
380 |
"histogram-icon",
|
381 |
getClass().getClassLoader().getResource("images/histogram.png")
|
382 |
); |
383 |
PluginServices.getIconTheme().registerDefault( |
384 |
"overviews-icon",
|
385 |
getClass().getClassLoader().getResource("images/overviews.gif")
|
386 |
); |
387 |
PluginServices.getIconTheme().registerDefault( |
388 |
"properties-icon",
|
389 |
getClass().getClassLoader().getResource("images/properties.gif")
|
390 |
); |
391 |
PluginServices.getIconTheme().registerDefault( |
392 |
"colortable-icon",
|
393 |
getClass().getClassLoader().getResource("images/colortable.png")
|
394 |
); |
395 |
PluginServices.getIconTheme().registerDefault( |
396 |
"rois-icon",
|
397 |
getClass().getClassLoader().getResource("images/rois.png")
|
398 |
); |
399 |
} |
400 |
/*
|
401 |
* (non-Javadoc)
|
402 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
403 |
*/
|
404 |
public boolean isEnabled() { |
405 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
406 |
if (f == null) { |
407 |
return false; |
408 |
} |
409 |
if (f.getClass() == View.class) { |
410 |
View vista = (View) f; |
411 |
IProjectView model = vista.getModel(); |
412 |
MapContext mapa = model.getMapContext(); |
413 |
FLayers layers = mapa.getLayers(); |
414 |
for (int i = 0; i < layers.getLayersCount(); i++) |
415 |
if (layers.getLayer(i) instanceof FLyrRasterSE) |
416 |
return true; |
417 |
} |
418 |
return false; |
419 |
} |
420 |
|
421 |
/**
|
422 |
* Mostramos el control si hay alguna capa cargada.
|
423 |
*/
|
424 |
public boolean isVisible() { |
425 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
426 |
if (f == null) |
427 |
return false; |
428 |
|
429 |
if (f instanceof View) { |
430 |
View vista = (View) f; |
431 |
IProjectView model = vista.getModel(); |
432 |
MapContext mapa = model.getMapContext(); |
433 |
if (mapa.getLayers().getLayersCount() > 0) |
434 |
return true; |
435 |
} |
436 |
|
437 |
return false; |
438 |
} |
439 |
|
440 |
/**
|
441 |
* Carga los valores de configuracion iniciales
|
442 |
*/
|
443 |
private void loadConfigurationValues() { |
444 |
autoRefreshView = Configuration.getValue("general_auto_preview", Boolean.TRUE).booleanValue(); |
445 |
askCoordinates = Configuration.getValue("general_ask_coordinates", Boolean.FALSE).booleanValue(); |
446 |
RasterLibrary.defaultNumberOfClasses = Configuration.getValue("general_defaultNumberOfClasses", Integer.valueOf(RasterLibrary.defaultNumberOfClasses)).intValue(); |
447 |
RasterLibrary.cacheSize = Configuration.getValue("cache_size", Long.valueOf(RasterLibrary.cacheSize)).longValue(); |
448 |
RasterLibrary.pageSize = Configuration.getValue("cache_pagesize", Double.valueOf(RasterLibrary.pageSize)).doubleValue(); |
449 |
RasterLibrary.pagsPerGroup = Configuration.getValue("cache_pagspergroup", Integer.valueOf(RasterLibrary.pagsPerGroup)).intValue(); |
450 |
RasterLibrary.blockHeight = Configuration.getValue("cache_blockheight", Integer.valueOf(RasterLibrary.blockHeight)).intValue(); |
451 |
RasterLibrary.defaultNoDataValue = Configuration.getValue("nodata_value", Double.valueOf(RasterLibrary.defaultNoDataValue)).doubleValue(); |
452 |
} |
453 |
|
454 |
/*
|
455 |
* (non-Javadoc)
|
456 |
* @see org.gvsig.raster.util.ConfigurationListener#actionConfigurationChanged(org.gvsig.raster.util.ConfigurationEvent)
|
457 |
*/
|
458 |
public void actionConfigurationChanged(ConfigurationEvent e) { |
459 |
if (e.getKey().equals("nodata_transparency_enabled")) { |
460 |
boolean noDataTransparent = ((Boolean) e.getValue()).booleanValue(); |
461 |
IWindow[] f = PluginServices.getMDIManager().getAllWindows();
|
462 |
if (f == null) |
463 |
return;
|
464 |
for (int i = 0; i < f.length; i++) { |
465 |
if (f[i] instanceof View) { |
466 |
View vista = (View) f[i]; |
467 |
IProjectView model = vista.getModel(); |
468 |
MapContext map = model.getMapContext(); |
469 |
FLayers lyrs = map.getLayers(); |
470 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
471 |
if(lyrs.getLayer(j) instanceof FLyrRasterSE) |
472 |
((FLyrRasterSE)lyrs.getLayer(j)).getDataSource().getTransparencyFilesStatus().activeNoData(noDataTransparent); |
473 |
} |
474 |
} |
475 |
} |
476 |
|
477 |
return;
|
478 |
} |
479 |
|
480 |
if (e.getKey().equals("general_auto_preview")) { |
481 |
autoRefreshView = ((Boolean) e.getValue()).booleanValue();
|
482 |
return;
|
483 |
} |
484 |
|
485 |
if (e.getKey().equals("general_ask_coordinates")) { |
486 |
askCoordinates = ((Boolean) e.getValue()).booleanValue();
|
487 |
return;
|
488 |
} |
489 |
|
490 |
if (e.getKey().equals("general_defaultNumberOfClasses")) { |
491 |
RasterLibrary.defaultNumberOfClasses = ((Integer) e.getValue()).intValue();
|
492 |
return;
|
493 |
} |
494 |
|
495 |
if (e.getKey().equals("cache_size")) { |
496 |
RasterLibrary.cacheSize = ((Long) e.getValue()).longValue();
|
497 |
return;
|
498 |
} |
499 |
|
500 |
if (e.getKey().equals("cache_pagesize")) { |
501 |
RasterLibrary.pageSize = ((Double) e.getValue()).doubleValue();
|
502 |
return;
|
503 |
} |
504 |
|
505 |
if (e.getKey().equals("cache_pagspergroup")) { |
506 |
RasterLibrary.pagsPerGroup = ((Integer) e.getValue()).intValue();
|
507 |
return;
|
508 |
} |
509 |
|
510 |
if (e.getKey().equals("cache_blockheight")) { |
511 |
RasterLibrary.blockHeight = ((Integer) e.getValue()).intValue();
|
512 |
return;
|
513 |
} |
514 |
|
515 |
if (e.getKey().equals("nodata_value")) { |
516 |
RasterLibrary.defaultNoDataValue = ((Double) e.getValue()).doubleValue();
|
517 |
return;
|
518 |
} |
519 |
} |
520 |
} |