svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extRasterTools-SE / src / org / gvsig / rastertools / RasterModule.java @ 26837
History | View | Annotate | Download (20.8 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.ArrayList; |
22 |
import java.util.prefs.Preferences; |
23 |
|
24 |
import org.gvsig.fmap.dal.raster.CoverageStore; |
25 |
import org.gvsig.fmap.dal.store.raster.RasterStoreLibrary; |
26 |
import org.gvsig.fmap.mapcontext.MapContext; |
27 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
28 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
29 |
import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
30 |
import org.gvsig.fmap.mapcontrol.MapControl; |
31 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
32 |
import org.gvsig.raster.Configuration; |
33 |
import org.gvsig.raster.ConfigurationEvent; |
34 |
import org.gvsig.raster.ConfigurationListener; |
35 |
import org.gvsig.raster.RasterLibrary; |
36 |
import org.gvsig.raster.filter.grayscale.GrayScaleManager; |
37 |
import org.gvsig.raster.filter.mask.MaskListManager; |
38 |
import org.gvsig.raster.filter.regionalpha.RegionAlphaListManager; |
39 |
import org.gvsig.raster.gui.preferences.RasterPreferences; |
40 |
import org.gvsig.raster.gui.wizards.FileOpenRaster; |
41 |
import org.gvsig.raster.gui.wizards.FileOpenWizard; |
42 |
import org.gvsig.raster.util.RasterToolsUtil; |
43 |
import org.gvsig.raster.util.extensionPoints.ExtensionPoint; |
44 |
import org.gvsig.rastertools.properties.RasterPropertiesTocMenuEntry; |
45 |
import org.gvsig.rastertools.properties.panels.BandSelectorPanel; |
46 |
import org.gvsig.rastertools.properties.panels.EnhancedPanel; |
47 |
import org.gvsig.rastertools.properties.panels.GeneralPanel; |
48 |
import org.gvsig.rastertools.properties.panels.InfoPanel; |
49 |
import org.gvsig.rastertools.properties.panels.TransparencyPanel; |
50 |
import org.gvsig.rastertools.rasterresolution.ZoomPixelCursorTocMenuEntry; |
51 |
import org.gvsig.rastertools.saveas.SaveAsTocMenuEntry; |
52 |
import org.gvsig.tools.ToolsLocator; |
53 |
|
54 |
import com.iver.andami.PluginServices; |
55 |
import com.iver.andami.plugins.Extension; |
56 |
import com.iver.andami.ui.mdiManager.IWindow; |
57 |
import com.iver.cit.gvsig.AddLayer; |
58 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
59 |
import com.iver.cit.gvsig.project.documents.view.gui.BaseView; |
60 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
61 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
62 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
63 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
64 |
|
65 |
/**
|
66 |
* Extensi?n que adapta a FMap y gvSIG la nueva implementaci?n de raster. Para
|
67 |
* el cuadro de Propiedades de visualizaci?n de raster contiene el contenedor
|
68 |
* base se registran la entrada del men? del TOC y los paneles en el cuadro.
|
69 |
* Para la parte de FMap contiene una nueva capa raster y los drivers
|
70 |
* necesarios.
|
71 |
*
|
72 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
73 |
*/
|
74 |
public class RasterModule extends Extension implements ConfigurationListener { |
75 |
|
76 |
/**
|
77 |
* Indica si en el panel de preferencias se refresca automaticamente la vista
|
78 |
* para mostrar los cambios
|
79 |
*/
|
80 |
public static boolean autoRefreshView = true; |
81 |
|
82 |
/**
|
83 |
* Indica si se debe preguntar las coordenadas al cargar una capa que no las
|
84 |
* tenga
|
85 |
*/
|
86 |
public static boolean askCoordinates = false; |
87 |
|
88 |
private RasterStoreLibrary storeLibrary;
|
89 |
|
90 |
/*
|
91 |
* (non-Javadoc)
|
92 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
93 |
*/
|
94 |
public void execute(String actionCommand) { |
95 |
|
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
101 |
*/
|
102 |
public void initialize() { |
103 |
// Asignamos la configuracion global a FlyrRasterSE
|
104 |
FLyrRasterSE.setConfiguration(Configuration.getSingleton());
|
105 |
|
106 |
Configuration.addValueChangedListener(this); |
107 |
loadConfigurationValues(); |
108 |
|
109 |
registerIcons(); |
110 |
RasterLibrary.wakeUp(); |
111 |
|
112 |
// DiagSignalHandler.install("ALRM");
|
113 |
|
114 |
Preferences prefs = Preferences.userRoot().node("gvsig.foldering"); |
115 |
prefs.put("DataFolder", System.getProperty("user.home")); |
116 |
|
117 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
118 |
|
119 |
// Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades.
|
120 |
if (!extensionPoints.containsKey("RasterSEPropertiesDialog")) { |
121 |
ExtensionPoint p = ExtensionPoint.getExtensionPoint("RasterSEPropertiesDialog");
|
122 |
p.setDescription("Raster Properties registrable panels (register instances of javax.swing.JPanel)");
|
123 |
//extensionPoints.put(new ExtensionPoint("RasterSEPropertiesDialog", "Raster Properties registrable panels (register instances of javax.swing.JPanel)"));
|
124 |
} |
125 |
|
126 |
// A?adimos la configuracion de Raster a gvSIG
|
127 |
extensionPoints.add("AplicationPreferences","RasterPreferences", new RasterPreferences()); |
128 |
|
129 |
// A?adimos paneles al cuadro de propiedades.
|
130 |
extensionPoints.add("RasterSEPropertiesDialog", "info", InfoPanel.class); |
131 |
extensionPoints.add("RasterSEPropertiesDialog", "bands_panel", BandSelectorPanel.class); |
132 |
extensionPoints.add("RasterSEPropertiesDialog", "transparencia", TransparencyPanel.class); |
133 |
extensionPoints.add("RasterSEPropertiesDialog", "realce", EnhancedPanel.class); |
134 |
//extensionPoints.add("RasterSEPropertiesDialog", "pansharp", PanSharpeningPanel.class);
|
135 |
extensionPoints.add("RasterSEPropertiesDialog", "general_panel", GeneralPanel.class); |
136 |
|
137 |
// A?adimos las entradas del men? del toc de raster
|
138 |
extensionPoints.add("View_TocActions", "RasterSEProperties", RasterPropertiesTocMenuEntry.getSingleton()); |
139 |
extensionPoints.add("View_TocActions", "SaveAs", SaveAsTocMenuEntry.getSingleton()); |
140 |
extensionPoints.add("View_TocActions", "ZoomPixelCursor", new ZoomPixelCursorTocMenuEntry()); |
141 |
|
142 |
// A?adimos nuestra extension para el tratamiento de la apertura de ficheros mdentro de gvSIG
|
143 |
AddLayer.addWizard(FileOpenWizard.class); |
144 |
ToolsLocator.getExtensionPointManager().add("FileExtendingOpenDialog",
|
145 |
"").append("FileOpenRaster", "", FileOpenRaster.class); |
146 |
|
147 |
|
148 |
//Alias
|
149 |
LayerFactory lFactory=LayerFactory.getInstance(); |
150 |
// lFactory.registerLayerToUseForStore("com.iver.cit.gvsig.fmap.layers.FLyrRaster", FLyrRasterSE.class);
|
151 |
// lFactory.registerLayerToUseForStore("com.iver.cit.gvsig.fmap.layers.StatusLayerRaster", StatusLayerRaster.class);
|
152 |
lFactory.registerLayerToUseForStore(CoverageStore.class, |
153 |
FLyrRasterSE.class); |
154 |
|
155 |
storeLibrary = new RasterStoreLibrary();
|
156 |
storeLibrary.initialize(); |
157 |
|
158 |
|
159 |
|
160 |
// Registrar filtros
|
161 |
RegionAlphaListManager.register(); |
162 |
MaskListManager.register(); |
163 |
GrayScaleManager.register(); |
164 |
} |
165 |
|
166 |
/**
|
167 |
* Registra los iconos a utilizar en andami.
|
168 |
*/
|
169 |
private void registerIcons(){ |
170 |
PluginServices.getIconTheme().registerDefault( |
171 |
"forward-icon",
|
172 |
this.getClass().getClassLoader().getResource("images/forward.png") |
173 |
); |
174 |
PluginServices.getIconTheme().registerDefault( |
175 |
"backward-icon",
|
176 |
this.getClass().getClassLoader().getResource("images/backward.png") |
177 |
); |
178 |
PluginServices.getIconTheme().registerDefault( |
179 |
"map-ok-ico",
|
180 |
MapControl.class.getResource("images/map_ico_ok.gif")
|
181 |
); |
182 |
PluginServices.getIconTheme().registerDefault( |
183 |
"crux-cursor",
|
184 |
MapControl.class.getResource("images/CruxCursor.png")
|
185 |
); |
186 |
PluginServices.getIconTheme().registerDefault( |
187 |
"blank-icon",
|
188 |
getClass().getClassLoader().getResource("images/blank.png")
|
189 |
); |
190 |
PluginServices.getIconTheme().registerDefault( |
191 |
"addlayer-icon",
|
192 |
this.getClass().getClassLoader().getResource("images/addlayer.png") |
193 |
); |
194 |
PluginServices.getIconTheme().registerDefault( |
195 |
"delall-icon",
|
196 |
this.getClass().getClassLoader().getResource("images/delall.png") |
197 |
); |
198 |
PluginServices.getIconTheme().registerDefault( |
199 |
"rotar-icon",
|
200 |
this.getClass().getClassLoader().getResource("images/Rotar.gif") |
201 |
); |
202 |
PluginServices.getIconTheme().registerDefault( |
203 |
"hor-arrow-icon",
|
204 |
this.getClass().getClassLoader().getResource("images/FlechaHorizCursor.gif") |
205 |
); |
206 |
PluginServices.getIconTheme().registerDefault( |
207 |
"ver-arrow-icon",
|
208 |
this.getClass().getClassLoader().getResource("images/FlechaVertCursor.gif") |
209 |
); |
210 |
PluginServices.getIconTheme().registerDefault( |
211 |
"inclder-arrow-icon",
|
212 |
this.getClass().getClassLoader().getResource("images/FlechaInclDerCursor.gif") |
213 |
); |
214 |
PluginServices.getIconTheme().registerDefault( |
215 |
"inclizq-arrow-icon",
|
216 |
this.getClass().getClassLoader().getResource("images/FlechaInclIzqCursor.gif") |
217 |
); |
218 |
PluginServices.getIconTheme().registerDefault( |
219 |
"shear-y-icon",
|
220 |
this.getClass().getClassLoader().getResource("images/y.gif") |
221 |
); |
222 |
PluginServices.getIconTheme().registerDefault( |
223 |
"shear-x-icon",
|
224 |
this.getClass().getClassLoader().getResource("images/x.gif") |
225 |
); |
226 |
PluginServices.getIconTheme().registerDefault( |
227 |
"hand-icon",
|
228 |
this.getClass().getClassLoader().getResource("images/Hand.gif") |
229 |
); |
230 |
PluginServices.getIconTheme().registerDefault( |
231 |
"back-icon",
|
232 |
this.getClass().getClassLoader().getResource("images/back.png") |
233 |
); |
234 |
PluginServices.getIconTheme().registerDefault( |
235 |
"next-icon",
|
236 |
this.getClass().getClassLoader().getResource("images/next.png") |
237 |
); |
238 |
PluginServices.getIconTheme().registerDefault( |
239 |
"undo-icon",
|
240 |
this.getClass().getClassLoader().getResource("images/undo.png") |
241 |
); |
242 |
PluginServices.getIconTheme().registerDefault( |
243 |
"zoom-pixel-cursor",
|
244 |
this.getClass().getClassLoader().getResource("images/ZoomPixelCursor.gif") |
245 |
); |
246 |
PluginServices.getIconTheme().registerDefault( |
247 |
"save-raster",
|
248 |
this.getClass().getClassLoader().getResource("images/Rectangle.png") |
249 |
); |
250 |
PluginServices.getIconTheme().registerDefault( |
251 |
"pixel-increase",
|
252 |
this.getClass().getClassLoader().getResource("images/increase.png") |
253 |
); |
254 |
PluginServices.getIconTheme().registerDefault( |
255 |
"select-raster",
|
256 |
this.getClass().getClassLoader().getResource("images/stock_toggle-info.png") |
257 |
); |
258 |
PluginServices.getIconTheme().registerDefault( |
259 |
"select-raster",
|
260 |
this.getClass().getClassLoader().getResource("images/stock_toggle-info.png") |
261 |
); |
262 |
PluginServices.getIconTheme().registerDefault( |
263 |
"export-icon",
|
264 |
this.getClass().getClassLoader().getResource("images/export.png") |
265 |
); |
266 |
PluginServices.getIconTheme().registerDefault( |
267 |
"pref-raster-icon",
|
268 |
this.getClass().getClassLoader().getResource("images/raster-pref.png") |
269 |
); |
270 |
PluginServices.getIconTheme().registerDefault( |
271 |
"import-icon",
|
272 |
this.getClass().getClassLoader().getResource("images/import.png") |
273 |
); |
274 |
PluginServices.getIconTheme().registerDefault( |
275 |
"save-icon",
|
276 |
this.getClass().getClassLoader().getResource("images/save.png") |
277 |
); |
278 |
PluginServices.getIconTheme().registerDefault( |
279 |
"reset-icon",
|
280 |
this.getClass().getClassLoader().getResource("images/reset.png") |
281 |
); |
282 |
PluginServices.getIconTheme().registerDefault( |
283 |
"tfwload-icon",
|
284 |
this.getClass().getClassLoader().getResource("images/load.png") |
285 |
); |
286 |
PluginServices.getIconTheme().registerDefault( |
287 |
"centerraster-icon",
|
288 |
this.getClass().getClassLoader().getResource("images/center_image.png") |
289 |
); |
290 |
PluginServices.getIconTheme().registerDefault( |
291 |
"increase-icon",
|
292 |
this.getClass().getClassLoader().getResource("images/aumentar.png") |
293 |
); |
294 |
PluginServices.getIconTheme().registerDefault( |
295 |
"decrease-icon",
|
296 |
this.getClass().getClassLoader().getResource("images/disminuir.png") |
297 |
); |
298 |
PluginServices.getIconTheme().registerDefault( |
299 |
"selectzoomarea-icon",
|
300 |
this.getClass().getClassLoader().getResource("images/view-zoom-to-seleccion.png") |
301 |
); |
302 |
PluginServices.getIconTheme().registerDefault( |
303 |
"prevzoom-icon",
|
304 |
this.getClass().getClassLoader().getResource("images/view-zoom-back.png") |
305 |
); |
306 |
PluginServices.getIconTheme().registerDefault( |
307 |
"fullview-icon",
|
308 |
this.getClass().getClassLoader().getResource("images/view-zoom-map-contents.png") |
309 |
); |
310 |
PluginServices.getIconTheme().register( |
311 |
"geolocalization-icon",
|
312 |
this.getClass().getClassLoader().getResource("images/georef.png") |
313 |
); |
314 |
PluginServices.getIconTheme().register( |
315 |
"exporttoascii-icon",
|
316 |
this.getClass().getClassLoader().getResource("images/exportToAscii.png") |
317 |
); |
318 |
PluginServices.getIconTheme().register( |
319 |
"exporttocsv-icon",
|
320 |
this.getClass().getClassLoader().getResource("images/exportToCSV.png") |
321 |
); |
322 |
PluginServices.getIconTheme().register( |
323 |
"importfromcsv-icon",
|
324 |
this.getClass().getClassLoader().getResource("images/importFromCSV.png") |
325 |
); |
326 |
PluginServices.getIconTheme().register( |
327 |
"exit-icon",
|
328 |
this.getClass().getClassLoader().getResource("images/ico_exit.gif") |
329 |
); |
330 |
PluginServices.getIconTheme().register( |
331 |
"options-icon",
|
332 |
this.getClass().getClassLoader().getResource("images/ico_options.gif") |
333 |
); |
334 |
PluginServices.getIconTheme().register( |
335 |
"add-icon",
|
336 |
this.getClass().getClassLoader().getResource("images/add-ico.gif") |
337 |
); |
338 |
PluginServices.getIconTheme().register( |
339 |
"centerpoint-icon",
|
340 |
this.getClass().getClassLoader().getResource("images/icon_centerpoint.gif") |
341 |
); |
342 |
PluginServices.getIconTheme().register( |
343 |
"hand-icon",
|
344 |
this.getClass().getClassLoader().getResource("images/Hand.gif") |
345 |
); |
346 |
PluginServices.getIconTheme().register( |
347 |
"analisis-icon",
|
348 |
this.getClass().getClassLoader().getResource("images/prismaticos.gif") |
349 |
); |
350 |
PluginServices.getIconTheme().registerDefault( |
351 |
"clipping-icon",
|
352 |
getClass().getClassLoader().getResource("images/clipping.gif")
|
353 |
); |
354 |
PluginServices.getIconTheme().registerDefault( |
355 |
"filter-icon",
|
356 |
getClass().getClassLoader().getResource("images/raster-filter.png")
|
357 |
); |
358 |
PluginServices.getIconTheme().registerDefault( |
359 |
"histogram-icon",
|
360 |
getClass().getClassLoader().getResource("images/histogram.png")
|
361 |
); |
362 |
PluginServices.getIconTheme().registerDefault( |
363 |
"overviews-icon",
|
364 |
getClass().getClassLoader().getResource("images/overviews.gif")
|
365 |
); |
366 |
PluginServices.getIconTheme().registerDefault( |
367 |
"properties-icon",
|
368 |
getClass().getClassLoader().getResource("images/properties.gif")
|
369 |
); |
370 |
PluginServices.getIconTheme().registerDefault( |
371 |
"colortable-icon",
|
372 |
getClass().getClassLoader().getResource("images/colortable.png")
|
373 |
); |
374 |
PluginServices.getIconTheme().registerDefault( |
375 |
"rois-icon",
|
376 |
getClass().getClassLoader().getResource("images/rois.png")
|
377 |
); |
378 |
PluginServices.getIconTheme().registerDefault( |
379 |
"brush-icon",
|
380 |
getClass().getClassLoader().getResource("images/brush.png")
|
381 |
); |
382 |
PluginServices.getIconTheme().registerDefault( |
383 |
"selectrgb-icon",
|
384 |
getClass().getClassLoader().getResource("images/select_rgb.gif")
|
385 |
); |
386 |
PluginServices.getIconTheme().registerDefault( |
387 |
"reproj-icon",
|
388 |
getClass().getClassLoader().getResource("images/reproject.png")
|
389 |
); |
390 |
PluginServices.getIconTheme().registerDefault( |
391 |
"vectorization-icon",
|
392 |
getClass().getClassLoader().getResource("images/vectorT.png")
|
393 |
); |
394 |
} |
395 |
/*
|
396 |
* (non-Javadoc)
|
397 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
398 |
*/
|
399 |
public boolean isEnabled() { |
400 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
401 |
if (f == null) { |
402 |
return false; |
403 |
} |
404 |
if (f.getClass() == View.class) { |
405 |
BaseView vista = (BaseView) f; |
406 |
IProjectView model = vista.getModel(); |
407 |
MapContext mapa = model.getMapContext(); |
408 |
FLayers layers = mapa.getLayers(); |
409 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
410 |
if (layers.getLayer(i) instanceof FLyrRasterSE) { |
411 |
return true; |
412 |
} |
413 |
} |
414 |
} |
415 |
return false; |
416 |
} |
417 |
|
418 |
/**
|
419 |
* Mostramos el control si hay alguna capa cargada.
|
420 |
*/
|
421 |
public boolean isVisible() { |
422 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
423 |
if (f == null) { |
424 |
return false; |
425 |
} |
426 |
|
427 |
if (f instanceof View) { |
428 |
View vista = (View) f; |
429 |
IProjectView model = vista.getModel(); |
430 |
MapContext mapa = model.getMapContext(); |
431 |
if (mapa.getLayers().getLayersCount() > 0) { |
432 |
return true; |
433 |
} |
434 |
} |
435 |
|
436 |
return false; |
437 |
} |
438 |
|
439 |
/**
|
440 |
* Carga los valores de configuracion iniciales
|
441 |
*/
|
442 |
private void loadConfigurationValues() { |
443 |
autoRefreshView = Configuration.getValue("general_auto_preview", Boolean.TRUE).booleanValue(); |
444 |
askCoordinates = Configuration.getValue("general_ask_coordinates", Boolean.FALSE).booleanValue(); |
445 |
RasterLibrary.defaultNumberOfClasses = Configuration.getValue("general_defaultNumberOfClasses", Integer.valueOf(RasterLibrary.defaultNumberOfClasses)).intValue(); |
446 |
RasterLibrary.cacheSize = Configuration.getValue("cache_size", Long.valueOf(RasterLibrary.cacheSize)).longValue(); |
447 |
RasterLibrary.pageSize = Configuration.getValue("cache_pagesize", Double.valueOf(RasterLibrary.pageSize)).doubleValue(); |
448 |
RasterLibrary.pagsPerGroup = Configuration.getValue("cache_pagspergroup", Integer.valueOf(RasterLibrary.pagsPerGroup)).intValue(); |
449 |
RasterLibrary.blockHeight = Configuration.getValue("cache_blockheight", Integer.valueOf(RasterLibrary.blockHeight)).intValue(); |
450 |
RasterLibrary.defaultNoDataValue = Configuration.getValue("nodata_value", Double.valueOf(RasterLibrary.defaultNoDataValue)).doubleValue(); |
451 |
} |
452 |
|
453 |
/*
|
454 |
* (non-Javadoc)
|
455 |
* @see org.gvsig.raster.util.ConfigurationListener#actionConfigurationChanged(org.gvsig.raster.util.ConfigurationEvent)
|
456 |
*/
|
457 |
public void actionConfigurationChanged(ConfigurationEvent e) { |
458 |
if (e.getKey().equals("nodata_transparency_enabled")) { |
459 |
boolean noDataTransparent = ((Boolean) e.getValue()).booleanValue(); |
460 |
IWindow[] f = PluginServices.getMDIManager().getAllWindows();
|
461 |
if (f == null) { |
462 |
return;
|
463 |
} |
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 |
|
471 |
ArrayList list = RasterToolsUtil.getRasterLayerList(lyrs, null); |
472 |
for (int j = 0; j < list.size(); j++) { |
473 |
if(list.get(j) instanceof FLyrRasterSE) { |
474 |
((FLyrRasterSE)list.get(j)).getDataSource().getTransparencyFilesStatus().activeNoData(noDataTransparent); |
475 |
} |
476 |
} |
477 |
} |
478 |
} |
479 |
|
480 |
return;
|
481 |
} |
482 |
|
483 |
if (e.getKey().equals("general_auto_preview")) { |
484 |
if(e.getValue() instanceof String) { |
485 |
autoRefreshView = new Boolean((String) e.getValue()).booleanValue(); |
486 |
} |
487 |
if(e.getValue() instanceof Boolean) { |
488 |
autoRefreshView = ((Boolean) e.getValue()).booleanValue();
|
489 |
} |
490 |
return;
|
491 |
} |
492 |
|
493 |
if (e.getKey().equals("general_ask_coordinates")) { |
494 |
if(e.getValue() instanceof String) { |
495 |
askCoordinates = new Boolean((String) e.getValue()).booleanValue(); |
496 |
} |
497 |
if(e.getValue() instanceof Boolean) { |
498 |
askCoordinates = ((Boolean) e.getValue()).booleanValue();
|
499 |
} |
500 |
return;
|
501 |
} |
502 |
|
503 |
if (e.getKey().equals("general_defaultNumberOfClasses")) { |
504 |
if(e.getValue() instanceof String) { |
505 |
RasterLibrary.defaultNumberOfClasses = new Integer((String) e.getValue()).intValue(); |
506 |
} |
507 |
if(e.getValue() instanceof Integer) { |
508 |
RasterLibrary.defaultNumberOfClasses = ((Integer) e.getValue()).intValue();
|
509 |
} |
510 |
return;
|
511 |
} |
512 |
|
513 |
if (e.getKey().equals("cache_size")) { |
514 |
if(e.getValue() instanceof String) { |
515 |
RasterLibrary.cacheSize = new Long((String) e.getValue()).longValue(); |
516 |
} |
517 |
if(e.getValue() instanceof Long) { |
518 |
RasterLibrary.cacheSize = ((Long) e.getValue()).longValue();
|
519 |
} |
520 |
return;
|
521 |
} |
522 |
|
523 |
if (e.getKey().equals("cache_pagesize")) { |
524 |
if(e.getValue() instanceof String) { |
525 |
RasterLibrary.pageSize = new Double((String) e.getValue()).doubleValue(); |
526 |
} |
527 |
if(e.getValue() instanceof Double) { |
528 |
RasterLibrary.pageSize = ((Double) e.getValue()).doubleValue();
|
529 |
} |
530 |
return;
|
531 |
} |
532 |
|
533 |
if (e.getKey().equals("cache_pagspergroup")) { |
534 |
if(e.getValue() instanceof String) { |
535 |
RasterLibrary.pagsPerGroup = new Integer((String) e.getValue()).intValue(); |
536 |
} |
537 |
if(e.getValue() instanceof Integer) { |
538 |
RasterLibrary.pagsPerGroup = ((Integer) e.getValue()).intValue();
|
539 |
} |
540 |
return;
|
541 |
} |
542 |
|
543 |
if (e.getKey().equals("cache_blockheight")) { |
544 |
if(e.getValue() instanceof String) { |
545 |
RasterLibrary.blockHeight = new Integer((String) e.getValue()).intValue(); |
546 |
} |
547 |
if(e.getValue() instanceof Integer) { |
548 |
RasterLibrary.blockHeight = ((Integer) e.getValue()).intValue();
|
549 |
} |
550 |
return;
|
551 |
} |
552 |
|
553 |
if (e.getKey().equals("nodata_value")) { |
554 |
if(e.getValue() instanceof String) { |
555 |
RasterLibrary.defaultNoDataValue = new Double((String) e.getValue()).doubleValue(); |
556 |
} |
557 |
if(e.getValue() instanceof Double) { |
558 |
RasterLibrary.defaultNoDataValue = ((Double) e.getValue()).doubleValue();
|
559 |
} |
560 |
return;
|
561 |
} |
562 |
} |
563 |
|
564 |
/*
|
565 |
* (non-Javadoc)
|
566 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
567 |
*/
|
568 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
569 |
this.execute("SELECTIMAGE"); |
570 |
} |
571 |
|
572 |
public void postInitialize() { |
573 |
super.postInitialize();
|
574 |
storeLibrary.postInitialize(); |
575 |
} |
576 |
} |