Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / RasterModule.java @ 20856

History | View | Annotate | Download (22 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 javax.swing.Icon;
24

    
25
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
26
import org.gvsig.fmap.raster.layers.StatusLayerRaster;
27
import org.gvsig.raster.Configuration;
28
import org.gvsig.raster.ConfigurationEvent;
29
import org.gvsig.raster.ConfigurationListener;
30
import org.gvsig.raster.RasterLibrary;
31
import org.gvsig.raster.filter.mask.MaskListManager;
32
import org.gvsig.raster.filter.regionalpha.RegionAlphaListManager;
33
import org.gvsig.raster.gui.IGenericToolBarMenuItem;
34
import org.gvsig.raster.gui.preferences.RasterPreferences;
35
import org.gvsig.raster.gui.wizards.FileOpenRaster;
36
import org.gvsig.raster.util.RasterToolsUtil;
37
import org.gvsig.rastertools.properties.RasterPropertiesTocMenuEntry;
38
import org.gvsig.rastertools.properties.panels.BandSelectorPanel;
39
import org.gvsig.rastertools.properties.panels.EnhancedPanel;
40
import org.gvsig.rastertools.properties.panels.GeneralPanel;
41
import org.gvsig.rastertools.properties.panels.InfoPanel;
42
import org.gvsig.rastertools.properties.panels.TransparencyPanel;
43
import org.gvsig.rastertools.rasterresolution.ZoomPixelCursorTocMenuEntry;
44
import org.gvsig.rastertools.saveas.SaveAsTocMenuEntry;
45
import org.gvsig.rastertools.selectrasterlayer.SelectImageListener;
46

    
47
import com.iver.andami.PluginServices;
48
import com.iver.andami.plugins.Extension;
49
import com.iver.andami.ui.mdiManager.IWindow;
50
import com.iver.cit.gvsig.fmap.MapContext;
51
import com.iver.cit.gvsig.fmap.MapControl;
52
import com.iver.cit.gvsig.fmap.layers.FLayer;
53
import com.iver.cit.gvsig.fmap.layers.FLayers;
54
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
55
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
56
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
57
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
58
import com.iver.cit.gvsig.project.documents.view.IProjectView;
59
import com.iver.cit.gvsig.project.documents.view.gui.View;
60
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
61
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener;
62
import com.iver.utiles.extensionPoints.ExtensionPoint;
63
import com.iver.utiles.extensionPoints.ExtensionPoints;
64
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
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, IGenericToolBarMenuItem {
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
        /*
89
         * (non-Javadoc)
90
         * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
91
         */
92
        public void execute(String actionCommand) {
93
                View theView = (View) PluginServices.getMDIManager().getActiveWindow();
94
                MapControl mapCtrl = theView.getMapControl();
95

    
96
                // Listener de eventos de movimiento que pone las coordenadas del rat?n en
97
                // la barra de estado
98
                StatusBarListener sbl = new StatusBarListener(mapCtrl);
99

    
100
                if (actionCommand.equals("SELECTIMAGE")) {
101
                        loadSelectRasterListener(mapCtrl, sbl);
102
                        mapCtrl.setTool("selectRasterLayer");
103
                }
104
        }
105

    
106
        /**
107
         * Carga el listener de selecci?n de raster en el MapControl.
108
         */
109
        private void loadSelectRasterListener(MapControl mapCtrl, StatusBarListener sbl) {
110
                if (mapCtrl.getNamesMapTools().get("selectRasterLayer") == null) {
111
                        SelectImageListener sil = new SelectImageListener(mapCtrl);
112
                        mapCtrl.addMapTool("selectRasterLayer", new Behavior[] { new PointBehavior(sil), new MouseMovementBehavior(sbl) });
113
                        mapCtrl.setTool("selectRasterLayer");
114
                }
115
        }
116

    
117
        /*
118
         * (non-Javadoc)
119
         * @see com.iver.andami.plugins.IExtension#initialize()
120
         */
121
        public void initialize() {
122
                // Asignamos la configuracion global a FlyrRasterSE
123
                FLyrRasterSE.setConfiguration(Configuration.getSingleton());
124

    
125
                Configuration.addValueChangedListener(this);
126
                loadConfigurationValues();
127

    
128
                registerIcons();
129
                RasterLibrary.wakeUp();
130

    
131
                // DiagSignalHandler.install("ALRM");
132

    
133
                Preferences prefs = Preferences.userRoot().node("gvsig.foldering");
134
                prefs.put("DataFolder", System.getProperty("user.home"));
135

    
136
                ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
137

    
138
                // Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades.
139
                if (!extensionPoints.containsKey("RasterSEPropertiesDialog")) {
140
                        extensionPoints.put(new ExtensionPoint("RasterSEPropertiesDialog", "Raster Properties registrable panels (register instances of javax.swing.JPanel)"));
141
                }
142

    
143
                // A?adimos la configuracion de Raster a gvSIG
144
                extensionPoints.add("AplicationPreferences","RasterPreferences", new RasterPreferences());
145

    
146
                // A?adimos paneles al cuadro de propiedades.
147
                extensionPoints.add("RasterSEPropertiesDialog", "info", InfoPanel.class);
148
                extensionPoints.add("RasterSEPropertiesDialog", "bands_panel", BandSelectorPanel.class);
149
                extensionPoints.add("RasterSEPropertiesDialog", "transparencia", TransparencyPanel.class);
150
                extensionPoints.add("RasterSEPropertiesDialog", "realce", EnhancedPanel.class);
151
                //extensionPoints.add("RasterSEPropertiesDialog", "pansharp", PanSharpeningPanel.class);
152
                extensionPoints.add("RasterSEPropertiesDialog", "general_panel", GeneralPanel.class);
153

    
154
                // A?adimos las entradas del men?  del toc de raster
155
                extensionPoints.add("View_TocActions", "RasterSEProperties", RasterPropertiesTocMenuEntry.getSingleton());
156
//                extensionPoints.add("View_TocActions", "HistogramPanel", HistogramTocMenuEntry.getSingleton());
157
//                extensionPoints.add("View_TocActions", "ViewColorTable", ColorTableTocMenuEntry.getSingleton());
158
//                extensionPoints.add("View_TocActions", "Overviews", OverviewsTocMenuEntry.getSingleton());
159
//                extensionPoints.add("View_TocActions", "RoisManager", ROIManagerTocMenuEntry.getSingleton());
160
//                extensionPoints.add("View_TocActions", "ViewRasterAnalysis", ViewRasterAnalysisTocMenuEntry.getSingleton());
161

    
162
                extensionPoints.add("View_TocActions", "SaveAs", SaveAsTocMenuEntry.getSingleton());
163
//                extensionPoints.add("View_TocActions", "ClippingPanel", ClippingTocMenuEntry.getSingleton());
164

    
165
//                extensionPoints.add("View_TocActions", "FilterPanel", FilterTocMenuEntry.getSingleton());
166
//                extensionPoints.add("View_TocActions", "EnhancedPanel", EnhancedTocMenuEntry.getSingleton());
167

    
168
//                extensionPoints.add("View_TocActions", "GeoLocation", GeoLocationTocMenuEntry.getSingleton());
169

    
170
                extensionPoints.add("View_TocActions", "ZoomPixelCursor", new ZoomPixelCursorTocMenuEntry());
171

    
172
                // A?adimos nuestra extension para el tratamiento de la apertura de ficheros
173
                // dentro de gvSIG
174
                extensionPoints.add("FileExtendingOpenDialog", "FileOpenRaster", FileOpenRaster.class);
175

    
176
                //Alias
177
                LayerFactory.registerLayerClassForName("com.iver.cit.gvsig.fmap.layers.FLyrRaster", FLyrRasterSE.class);
178
                LayerFactory.registerLayerClassForName("com.iver.cit.gvsig.fmap.layers.StatusLayerRaster", StatusLayerRaster.class);
179

    
180
                // Registrar filtros
181
                RegionAlphaListManager.register();
182
                MaskListManager.register();
183
                
184
                if (!extensionPoints.containsKey("GenericToolBarMenu")) {
185
                        extensionPoints.put(new ExtensionPoint("GenericToolBarMenu", "Punto de extension para los submenus del GenericToolBarPanel"));
186
                }
187
                extensionPoints.add("GenericToolBarMenu", "SelectRasterLayer", this);
188
        }
189

    
190
        /**
191
         * Registra los iconos a utilizar en andami.
192
         */
193
        private void registerIcons(){
194
                PluginServices.getIconTheme().registerDefault(
195
                                "forward-icon",
196
                                this.getClass().getClassLoader().getResource("images/forward.png")
197
                        );
198
                PluginServices.getIconTheme().registerDefault(
199
                                "backward-icon",
200
                                this.getClass().getClassLoader().getResource("images/backward.png")
201
                        );
202
                PluginServices.getIconTheme().registerDefault(
203
                                "map-ok-ico",
204
                                MapControl.class.getResource("images/map_ico_ok.gif")
205
                        );
206
                PluginServices.getIconTheme().registerDefault(
207
                                "crux-cursor",
208
                                MapControl.class.getResource("images/CruxCursor.png")
209
                        );
210
                PluginServices.getIconTheme().registerDefault(
211
                                "blank-icon",
212
                                getClass().getClassLoader().getResource("images/blank.png")
213
                        );
214
                PluginServices.getIconTheme().registerDefault(
215
                                "addlayer-icon",
216
                                this.getClass().getClassLoader().getResource("images/addlayer.png")
217
                        );
218
                PluginServices.getIconTheme().registerDefault(
219
                                "delall-icon",
220
                                this.getClass().getClassLoader().getResource("images/delall.png")
221
                        );
222
                PluginServices.getIconTheme().registerDefault(
223
                                "rotar-icon",
224
                                this.getClass().getClassLoader().getResource("images/Rotar.gif")
225
                        );
226
                PluginServices.getIconTheme().registerDefault(
227
                                "hor-arrow-icon",
228
                                this.getClass().getClassLoader().getResource("images/FlechaHorizCursor.gif")
229
                        );
230
                PluginServices.getIconTheme().registerDefault(
231
                                "ver-arrow-icon",
232
                                this.getClass().getClassLoader().getResource("images/FlechaVertCursor.gif")
233
                        );
234
                PluginServices.getIconTheme().registerDefault(
235
                                "inclder-arrow-icon",
236
                                this.getClass().getClassLoader().getResource("images/FlechaInclDerCursor.gif")
237
                        );
238
                PluginServices.getIconTheme().registerDefault(
239
                                "inclizq-arrow-icon",
240
                                this.getClass().getClassLoader().getResource("images/FlechaInclIzqCursor.gif")
241
                        );
242
                PluginServices.getIconTheme().registerDefault(
243
                                "shear-y-icon",
244
                                this.getClass().getClassLoader().getResource("images/y.gif")
245
                        );
246
                PluginServices.getIconTheme().registerDefault(
247
                                "shear-x-icon",
248
                                this.getClass().getClassLoader().getResource("images/x.gif")
249
                        );
250
                PluginServices.getIconTheme().registerDefault(
251
                                "hand-icon",
252
                                this.getClass().getClassLoader().getResource("images/Hand.gif")
253
                        );
254
                PluginServices.getIconTheme().registerDefault(
255
                                "back-icon",
256
                                this.getClass().getClassLoader().getResource("images/back.png")
257
                        );
258
                PluginServices.getIconTheme().registerDefault(
259
                                "next-icon",
260
                                this.getClass().getClassLoader().getResource("images/next.png")
261
                        );
262
                PluginServices.getIconTheme().registerDefault(
263
                                "undo-icon",
264
                                this.getClass().getClassLoader().getResource("images/undo.png")
265
                        );
266
                PluginServices.getIconTheme().registerDefault(
267
                                "zoom-pixel-cursor",
268
                                this.getClass().getClassLoader().getResource("images/ZoomPixelCursor.gif")
269
                        );
270
                PluginServices.getIconTheme().registerDefault(
271
                                "save-raster",
272
                                this.getClass().getClassLoader().getResource("images/Rectangle.png")
273
                        );
274
                PluginServices.getIconTheme().registerDefault(
275
                                "pixel-increase",
276
                                this.getClass().getClassLoader().getResource("images/increase.png")
277
                        );
278
                PluginServices.getIconTheme().registerDefault(
279
                                "select-raster",
280
                                this.getClass().getClassLoader().getResource("images/stock_toggle-info.png")
281
                        );
282
                PluginServices.getIconTheme().registerDefault(
283
                                "select-raster",
284
                                this.getClass().getClassLoader().getResource("images/stock_toggle-info.png")
285
                        );
286
                PluginServices.getIconTheme().registerDefault(
287
                                "export-icon",
288
                                this.getClass().getClassLoader().getResource("images/export.png")
289
                        );
290
                PluginServices.getIconTheme().registerDefault(
291
                                "pref-raster-icon",
292
                                this.getClass().getClassLoader().getResource("images/raster-pref.png")
293
                        );
294
                PluginServices.getIconTheme().registerDefault(
295
                                "import-icon",
296
                                this.getClass().getClassLoader().getResource("images/import.png")
297
                        );
298
                PluginServices.getIconTheme().registerDefault(
299
                                "save-icon",
300
                                this.getClass().getClassLoader().getResource("images/save.png")
301
                        );
302
                PluginServices.getIconTheme().registerDefault(
303
                                "reset-icon",
304
                                this.getClass().getClassLoader().getResource("images/reset.png")
305
                        );
306
                PluginServices.getIconTheme().registerDefault(
307
                                "tfwload-icon",
308
                                this.getClass().getClassLoader().getResource("images/load.png")
309
                        );
310
                PluginServices.getIconTheme().registerDefault(
311
                                "centerraster-icon",
312
                                this.getClass().getClassLoader().getResource("images/center_image.png")
313
                        );
314
                PluginServices.getIconTheme().registerDefault(
315
                                "increase-icon",
316
                                this.getClass().getClassLoader().getResource("images/aumentar.png")
317
                        );
318
                PluginServices.getIconTheme().registerDefault(
319
                                "decrease-icon",
320
                                this.getClass().getClassLoader().getResource("images/disminuir.png")
321
                        );
322
                PluginServices.getIconTheme().registerDefault(
323
                                "selectzoomarea-icon",
324
                                this.getClass().getClassLoader().getResource("images/view-zoom-to-seleccion.png")
325
                        );
326
                PluginServices.getIconTheme().registerDefault(
327
                                "prevzoom-icon",
328
                                this.getClass().getClassLoader().getResource("images/view-zoom-back.png")
329
                        );
330
                PluginServices.getIconTheme().registerDefault(
331
                                "fullview-icon",
332
                                this.getClass().getClassLoader().getResource("images/view-zoom-map-contents.png")
333
                        );
334
                PluginServices.getIconTheme().register(
335
                                "geolocalization-icon",
336
                                this.getClass().getClassLoader().getResource("images/georef.png")
337
                        );
338
                PluginServices.getIconTheme().register(
339
                                "exporttoascii-icon",
340
                                this.getClass().getClassLoader().getResource("images/exportToAscii.png")
341
                        );
342
                PluginServices.getIconTheme().register(
343
                                "exporttocsv-icon",
344
                                this.getClass().getClassLoader().getResource("images/exportToCSV.png")
345
                        );
346
                PluginServices.getIconTheme().register(
347
                                "importfromcsv-icon",
348
                                this.getClass().getClassLoader().getResource("images/importFromCSV.png")
349
                        );
350
                PluginServices.getIconTheme().register(
351
                                "exit-icon",
352
                                this.getClass().getClassLoader().getResource("images/ico_exit.gif")
353
                        );
354
                PluginServices.getIconTheme().register(
355
                                "options-icon",
356
                                this.getClass().getClassLoader().getResource("images/ico_options.gif")
357
                        );
358
                PluginServices.getIconTheme().register(
359
                                "add-icon",
360
                                this.getClass().getClassLoader().getResource("images/add-ico.gif")
361
                        );
362
                PluginServices.getIconTheme().register(
363
                                "centerpoint-icon",
364
                                this.getClass().getClassLoader().getResource("images/icon_centerpoint.gif")
365
                        );
366
                PluginServices.getIconTheme().register(
367
                                "hand-icon",
368
                                this.getClass().getClassLoader().getResource("images/Hand.gif")
369
                        );
370
                PluginServices.getIconTheme().register(
371
                                "analisis-icon",
372
                                this.getClass().getClassLoader().getResource("images/prismaticos.gif")
373
                        );
374
                PluginServices.getIconTheme().registerDefault(
375
                                "clipping-icon",
376
                                getClass().getClassLoader().getResource("images/clipping.gif")
377
                        );
378
                PluginServices.getIconTheme().registerDefault(
379
                                "filter-icon",
380
                                getClass().getClassLoader().getResource("images/raster-filter.png")
381
                        );
382
                PluginServices.getIconTheme().registerDefault(
383
                                "histogram-icon",
384
                                getClass().getClassLoader().getResource("images/histogram.png")
385
                        );
386
                PluginServices.getIconTheme().registerDefault(
387
                                "overviews-icon",
388
                                getClass().getClassLoader().getResource("images/overviews.gif")
389
                        );
390
                PluginServices.getIconTheme().registerDefault(
391
                                "properties-icon",
392
                                getClass().getClassLoader().getResource("images/properties.gif")
393
                        );
394
                PluginServices.getIconTheme().registerDefault(
395
                                "colortable-icon",
396
                                getClass().getClassLoader().getResource("images/colortable.png")
397
                        );
398
                PluginServices.getIconTheme().registerDefault(
399
                                "rois-icon",
400
                                getClass().getClassLoader().getResource("images/rois.png")
401
                        );
402
                PluginServices.getIconTheme().registerDefault(
403
                                "brush-icon",
404
                                getClass().getClassLoader().getResource("images/brush.png")
405
                        );
406
                PluginServices.getIconTheme().registerDefault(
407
                                "selectrgb-icon",
408
                                getClass().getClassLoader().getResource("images/select_rgb.gif")
409
                        );
410
                PluginServices.getIconTheme().registerDefault(
411
                                "reproj-icon",
412
                                getClass().getClassLoader().getResource("images/reproject.png")
413
                        );
414
        }
415
        /*
416
         * (non-Javadoc)
417
         * @see com.iver.andami.plugins.IExtension#isEnabled()
418
         */
419
        public boolean isEnabled() {
420
                com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow();
421
                if (f == null) {
422
                        return false;
423
                }
424
                if (f.getClass() == View.class) {
425
                        View vista = (View) f;
426
                        IProjectView model = vista.getModel();
427
                        MapContext mapa = model.getMapContext();
428
                        FLayers layers = mapa.getLayers();
429
                        for (int i = 0; i < layers.getLayersCount(); i++)
430
                                if (layers.getLayer(i) instanceof FLyrRasterSE)
431
                                        return true;
432
                }
433
                return false;
434
        }
435

    
436
        /**
437
         * Mostramos el control si hay alguna capa cargada.
438
         */
439
        public boolean isVisible() {
440
                com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow();
441
                if (f == null)
442
                        return false;
443

    
444
                if (f instanceof View) {
445
                        View vista = (View) f;
446
                        IProjectView model = vista.getModel();
447
                        MapContext mapa = model.getMapContext();
448
                        if (mapa.getLayers().getLayersCount() > 0)
449
                                return true;
450
                }
451

    
452
                return false;
453
        }
454

    
455
        /**
456
         * Carga los valores de configuracion iniciales
457
         */
458
        private void loadConfigurationValues() {
459
                autoRefreshView = Configuration.getValue("general_auto_preview", Boolean.TRUE).booleanValue();
460
                askCoordinates = Configuration.getValue("general_ask_coordinates", Boolean.FALSE).booleanValue();
461
                RasterLibrary.defaultNumberOfClasses = Configuration.getValue("general_defaultNumberOfClasses", Integer.valueOf(RasterLibrary.defaultNumberOfClasses)).intValue();
462
                RasterLibrary.cacheSize = Configuration.getValue("cache_size", Long.valueOf(RasterLibrary.cacheSize)).longValue();
463
                RasterLibrary.pageSize = Configuration.getValue("cache_pagesize", Double.valueOf(RasterLibrary.pageSize)).doubleValue();
464
                RasterLibrary.pagsPerGroup = Configuration.getValue("cache_pagspergroup", Integer.valueOf(RasterLibrary.pagsPerGroup)).intValue();
465
                RasterLibrary.blockHeight = Configuration.getValue("cache_blockheight", Integer.valueOf(RasterLibrary.blockHeight)).intValue();
466
                RasterLibrary.defaultNoDataValue = Configuration.getValue("nodata_value", Double.valueOf(RasterLibrary.defaultNoDataValue)).doubleValue();
467
        }
468

    
469
        /*
470
         * (non-Javadoc)
471
         * @see org.gvsig.raster.util.ConfigurationListener#actionConfigurationChanged(org.gvsig.raster.util.ConfigurationEvent)
472
         */
473
        public void actionConfigurationChanged(ConfigurationEvent e) {
474
                if (e.getKey().equals("nodata_transparency_enabled")) {
475
                        boolean noDataTransparent = ((Boolean) e.getValue()).booleanValue();
476
                        IWindow[] f = PluginServices.getMDIManager().getAllWindows();
477
                        if (f == null)
478
                                return;
479
                        for (int i = 0; i < f.length; i++) {
480
                                if (f[i] instanceof View) {
481
                                        View vista = (View) f[i];
482
                                        IProjectView model = vista.getModel();
483
                                        MapContext map = model.getMapContext();
484
                                        FLayers lyrs = map.getLayers();
485
                                        for (int j = 0; j < lyrs.getLayersCount(); j++) {
486
                                                if(lyrs.getLayer(j) instanceof FLyrRasterSE)
487
                                                        ((FLyrRasterSE)lyrs.getLayer(j)).getDataSource().getTransparencyFilesStatus().activeNoData(noDataTransparent);
488
                                        }
489
                                }        
490
                        }
491
                        
492
                        return;
493
                }
494
                
495
                if (e.getKey().equals("general_auto_preview")) {
496
                        autoRefreshView = ((Boolean) e.getValue()).booleanValue();
497
                        return;
498
                }
499

    
500
                if (e.getKey().equals("general_ask_coordinates")) {
501
                        askCoordinates = ((Boolean) e.getValue()).booleanValue();
502
                        return;
503
                }
504

    
505
                if (e.getKey().equals("general_defaultNumberOfClasses")) {
506
                        RasterLibrary.defaultNumberOfClasses = ((Integer) e.getValue()).intValue();
507
                        return;
508
                }
509

    
510
                if (e.getKey().equals("cache_size")) {
511
                        RasterLibrary.cacheSize = ((Long) e.getValue()).longValue();
512
                        return;
513
                }
514

    
515
                if (e.getKey().equals("cache_pagesize")) {
516
                        RasterLibrary.pageSize = ((Double) e.getValue()).doubleValue();
517
                        return;
518
                }
519

    
520
                if (e.getKey().equals("cache_pagspergroup")) {
521
                        RasterLibrary.pagsPerGroup = ((Integer) e.getValue()).intValue();
522
                        return;
523
                }
524

    
525
                if (e.getKey().equals("cache_blockheight")) {
526
                        RasterLibrary.blockHeight = ((Integer) e.getValue()).intValue();
527
                        return;
528
                }
529

    
530
                if (e.getKey().equals("nodata_value")) {
531
                        RasterLibrary.defaultNoDataValue = ((Double) e.getValue()).doubleValue();
532
                        return;
533
                }
534
        }
535

    
536
        /*
537
         * (non-Javadoc)
538
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
539
         */
540
        public void execute(ITocItem item, FLayer[] selectedItems) {
541
                this.execute("SELECTIMAGE");
542
        }
543

    
544
        /*
545
         * (non-Javadoc)
546
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getGroup()
547
         */
548
        public String getGroup() {
549
                return "RasterLayer";
550
        }
551

    
552
        /*
553
         * (non-Javadoc)
554
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getGroupOrder()
555
         */
556
        public int getGroupOrder() {
557
                return 0;
558
        }
559

    
560
        /*
561
         * (non-Javadoc)
562
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getIcon()
563
         */
564
        public Icon getIcon() {
565
                return PluginServices.getIconTheme().get("select-raster");
566
        }
567

    
568
        /*
569
         * (non-Javadoc)
570
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getOrder()
571
         */
572
        public int getOrder() {
573
                return 0;
574
        }
575

    
576
        /*
577
         * (non-Javadoc)
578
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getText()
579
         */
580
        public String getText() {
581
                return RasterToolsUtil.getText(this, "seleccionar_capas_raster");
582
        }
583

    
584
        /*
585
         * (non-Javadoc)
586
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
587
         */
588
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
589
                return this.isEnabled();
590
        }
591

    
592
        /*
593
         * (non-Javadoc)
594
         * @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
595
         */
596
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
597
                return this.isVisible();
598
        }
599
}