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