Revision 17491 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/RasterModule.java
RasterModule.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
24 | 24 |
import org.gvsig.fmap.raster.layers.StatusLayerRaster; |
25 |
import org.gvsig.fmap.raster.util.Configuration; |
|
26 |
import org.gvsig.fmap.raster.util.ConfigurationEvent; |
|
27 |
import org.gvsig.fmap.raster.util.ConfigurationListener; |
|
25 | 28 |
import org.gvsig.raster.RasterLibrary; |
29 |
import org.gvsig.raster.RasterLibrary; |
|
26 | 30 |
import org.gvsig.raster.gui.preferences.RasterPreferences; |
27 | 31 |
import org.gvsig.raster.gui.properties.dialog.RasterPropertiesTocMenuEntry; |
28 | 32 |
import org.gvsig.raster.gui.wizards.FileOpenRaster; |
... | ... | |
68 | 72 |
* |
69 | 73 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
70 | 74 |
*/ |
71 |
public class RasterModule extends Extension { |
|
75 |
public class RasterModule extends Extension implements ConfigurationListener {
|
|
72 | 76 |
/** |
73 | 77 |
* Contador global de las capas generadas para raster |
74 | 78 |
*/ |
75 | 79 |
public static int layerCount = 1; |
76 | 80 |
|
81 |
/** |
|
82 |
* Indica si en el panel de preferencias se refresca automaticamente la vista |
|
83 |
* para mostrar los cambios |
|
84 |
*/ |
|
85 |
public static boolean autoRefreshView = true; |
|
86 |
|
|
87 |
/** |
|
88 |
* Indica si se debe preguntar las coordenadas al cargar una capa que no las |
|
89 |
* tenga |
|
90 |
*/ |
|
91 |
public static boolean askCoordinates = false; |
|
92 |
|
|
77 | 93 |
/* |
78 | 94 |
* (non-Javadoc) |
79 | 95 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
... | ... | |
108 | 124 |
* @see com.iver.andami.plugins.IExtension#initialize() |
109 | 125 |
*/ |
110 | 126 |
public void initialize() { |
127 |
Configuration.addValueChangedListener(this); |
|
128 |
loadConfigurationValues(); |
|
129 |
|
|
111 | 130 |
registerIcons(); |
112 | 131 |
RasterLibrary.wakeUp(); |
113 | 132 |
|
... | ... | |
320 | 339 |
|
321 | 340 |
return false; |
322 | 341 |
} |
342 |
|
|
343 |
/** |
|
344 |
* Carga los valores de configuracion iniciales |
|
345 |
*/ |
|
346 |
private void loadConfigurationValues() { |
|
347 |
autoRefreshView = Configuration.getValue("general_auto_preview", Boolean.TRUE).booleanValue(); |
|
348 |
askCoordinates = Configuration.getValue("general_ask_coordinates", Boolean.FALSE).booleanValue(); |
|
349 |
RasterLibrary.defaultNumberOfClasses = Configuration.getValue("general_defaultNumberOfClasses", Integer.valueOf(RasterLibrary.defaultNumberOfClasses)).intValue(); |
|
350 |
RasterLibrary.cacheSize = Configuration.getValue("cache_size", Long.valueOf(RasterLibrary.cacheSize)).longValue(); |
|
351 |
RasterLibrary.pageSize = Configuration.getValue("cache_pagesize", Double.valueOf(RasterLibrary.pageSize)).doubleValue(); |
|
352 |
RasterLibrary.pagsPerGroup = Configuration.getValue("cache_pagspergroup", Integer.valueOf(RasterLibrary.pagsPerGroup)).intValue(); |
|
353 |
RasterLibrary.blockHeight = Configuration.getValue("cache_blockheight", Integer.valueOf(RasterLibrary.blockHeight)).intValue(); |
|
354 |
RasterLibrary.noDataEnabled = Configuration.getValue("nodata_enabled", Boolean.valueOf(RasterLibrary.noDataEnabled)).booleanValue(); |
|
355 |
RasterLibrary.noDataValue = Configuration.getValue("nodata_value", Double.valueOf(RasterLibrary.noDataValue)).doubleValue(); |
|
356 |
} |
|
357 |
|
|
358 |
/* |
|
359 |
* (non-Javadoc) |
|
360 |
* @see org.gvsig.raster.util.ConfigurationListener#actionConfigurationChanged(org.gvsig.raster.util.ConfigurationEvent) |
|
361 |
*/ |
|
362 |
public void actionConfigurationChanged(ConfigurationEvent e) { |
|
363 |
if (e.getKey().equals("general_auto_preview")) { |
|
364 |
autoRefreshView = ((Boolean) e.getValue()).booleanValue(); |
|
365 |
return; |
|
366 |
} |
|
367 |
|
|
368 |
if (e.getKey().equals("general_ask_coordinates")) { |
|
369 |
askCoordinates = ((Boolean) e.getValue()).booleanValue(); |
|
370 |
return; |
|
371 |
} |
|
372 |
|
|
373 |
if (e.getKey().equals("general_defaultNumberOfClasses")) { |
|
374 |
RasterLibrary.defaultNumberOfClasses = ((Integer) e.getValue()).intValue(); |
|
375 |
return; |
|
376 |
} |
|
377 |
|
|
378 |
if (e.getKey().equals("cache_size")) { |
|
379 |
RasterLibrary.cacheSize = ((Long) e.getValue()).longValue(); |
|
380 |
return; |
|
381 |
} |
|
382 |
|
|
383 |
if (e.getKey().equals("cache_pagesize")) { |
|
384 |
RasterLibrary.pageSize = ((Double) e.getValue()).doubleValue(); |
|
385 |
return; |
|
386 |
} |
|
387 |
|
|
388 |
if (e.getKey().equals("cache_pagspergroup")) { |
|
389 |
RasterLibrary.pagsPerGroup = ((Integer) e.getValue()).intValue(); |
|
390 |
return; |
|
391 |
} |
|
392 |
|
|
393 |
if (e.getKey().equals("cache_blockheight")) { |
|
394 |
RasterLibrary.blockHeight = ((Integer) e.getValue()).intValue(); |
|
395 |
return; |
|
396 |
} |
|
397 |
|
|
398 |
if (e.getKey().equals("nodata_enabled")) { |
|
399 |
RasterLibrary.noDataEnabled = ((Boolean) e.getValue()).booleanValue(); |
|
400 |
return; |
|
401 |
} |
|
402 |
|
|
403 |
if (e.getKey().equals("nodata_value")) { |
|
404 |
RasterLibrary.noDataValue = ((Double) e.getValue()).doubleValue(); |
|
405 |
return; |
|
406 |
} |
|
407 |
} |
|
323 | 408 |
} |
Also available in: Unified diff