Revision 2399
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/java/org/gvsig/raster/tools/LayerDatatypeSextanteAlgorithm.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools; |
|
2 |
|
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
7 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
8 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
9 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
10 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
11 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FLyrRasterIRasterLayer; |
|
12 |
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary; |
|
13 |
import org.gvsig.raster.algorithm.process.DataProcess; |
|
14 |
import org.gvsig.raster.algorithm.process.IProcessActions; |
|
15 |
import org.gvsig.raster.algorithm.process.ProcessException; |
|
16 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
17 |
|
|
18 |
import es.unex.sextante.core.AnalysisExtent; |
|
19 |
import es.unex.sextante.core.Sextante; |
|
20 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
21 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
22 |
import es.unex.sextante.exceptions.NullParameterAdditionalInfoException; |
|
23 |
import es.unex.sextante.exceptions.NullParameterValueException; |
|
24 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
25 |
import es.unex.sextante.exceptions.WrongParameterIDException; |
|
26 |
import es.unex.sextante.exceptions.WrongParameterTypeException; |
|
27 |
|
|
28 |
/** |
|
29 |
* Process to change a layer of data type |
|
30 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
31 |
*/ |
|
32 |
public class LayerDatatypeSextanteAlgorithm extends AbstractSextanteGeoProcess implements IProcessActions { |
|
33 |
public static final String RESULT = "RESULT"; |
|
34 |
public static final String LAYER = "RasterStore1"; |
|
35 |
public static final String DATATYPE = "Datatype"; |
|
36 |
public static final String ADJUST_DEC2INT = "AdjustDec2Int"; |
|
37 |
public static final String ADJUST_BIG2SMALL = "AdjustBig2Small"; |
|
38 |
|
|
39 |
public static String[] DEC2INT_OPTIONS = new String[]{"Trunk", "Round", "Ceil", "Floor"}; |
|
40 |
public static String[] BIG2SMALL_OPTIONS = new String[]{"Trunk", "Maxvalue", "NoData"}; |
|
41 |
public static String[] DATATYPES = new String[]{"Byte", "UShort", "Short", "Integer", "Float", "Double"}; |
|
42 |
|
|
43 |
private DataProcess task = null; |
|
44 |
|
|
45 |
|
|
46 |
public void defineCharacteristics() { |
|
47 |
setName(getTranslation("layer_datatype")); |
|
48 |
setGroup(getTranslation("raster_layer")); |
|
49 |
|
|
50 |
try { |
|
51 |
m_Parameters.addInputRasterLayer(LAYER, getTranslation("Input_layer"), true); |
|
52 |
m_Parameters.addSelection(DATATYPE, getTranslation("dst_datatype"), DATATYPES); |
|
53 |
m_Parameters.addSelection(ADJUST_DEC2INT, getTranslation("dec_2_int"), DEC2INT_OPTIONS); |
|
54 |
m_Parameters.addSelection(ADJUST_BIG2SMALL, getTranslation("big_2_small"), BIG2SMALL_OPTIONS); |
|
55 |
} catch (RepeatedParameterNameException e) { |
|
56 |
Sextante.addErrorToLog(e); |
|
57 |
} |
|
58 |
addOutputRasterLayer(RESULT, getTranslation("principalcomponents")); |
|
59 |
} |
|
60 |
|
|
61 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
62 |
|
|
63 |
if(existsOutPutFile(LayerDatatypeSextanteAlgorithm.RESULT, 0)) { |
|
64 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
65 |
} |
|
66 |
|
|
67 |
IRasterLayer input = m_Parameters.getParameterValueAsRasterLayer(LAYER); |
|
68 |
|
|
69 |
FLyrRaster lyrRaster = ((FLyrRaster)input.getBaseDataObject()); |
|
70 |
IRasterLayer output = null; |
|
71 |
|
|
72 |
output = getNewRORasterLayer( |
|
73 |
RESULT, |
|
74 |
Sextante.getText("layerdatatype_description"), |
|
75 |
input.getDataType(), |
|
76 |
input.getBandsCount()); |
|
77 |
|
|
78 |
String fileName = ((FLyrRasterIRasterLayer)output).getFileName(); //getOutPutFile(RESULT); |
|
79 |
|
|
80 |
try { |
|
81 |
setProgressText(getTranslation("convert_datatype")); |
|
82 |
task = createLayerDatatypeProcess(lyrRaster.getDataStore(), fileName); |
|
83 |
task.execute(); |
|
84 |
HashMap<String, Object> params = task.getResult(); |
|
85 |
fileName = (String)params.get("FileName"); |
|
86 |
|
|
87 |
((FLyrRasterIRasterLayer)output).setBaseDataObject(fileName); |
|
88 |
} catch (ProcessInterruptedException e) { |
|
89 |
Sextante.addErrorToLog(e); |
|
90 |
} catch (ProcessException e) { |
|
91 |
Sextante.addErrorToLog(e); |
|
92 |
} |
|
93 |
|
|
94 |
if(getTaskMonitor().isCanceled()) |
|
95 |
return false; |
|
96 |
|
|
97 |
return true; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Creates a process to calculate statistics |
|
102 |
* @param inputStore |
|
103 |
* @return |
|
104 |
* @throws ProcessException |
|
105 |
* @throws NullParameterAdditionalInfoException |
|
106 |
* @throws NullParameterValueException |
|
107 |
* @throws WrongParameterIDException |
|
108 |
* @throws WrongParameterTypeException |
|
109 |
*/ |
|
110 |
private DataProcess createLayerDatatypeProcess(RasterDataStore inputStore, String fileName) throws ProcessException, WrongParameterTypeException, WrongParameterIDException, NullParameterValueException, NullParameterAdditionalInfoException { |
|
111 |
DataProcess taskStats = RasterBaseAlgorithmLibrary.getManager().createRasterTask("LayerDatatypeProcess"); |
|
112 |
taskStats.setActions(this); |
|
113 |
List<String> params = taskStats.getRasterTaskInputParameters("LayerDatatypeProcess"); |
|
114 |
for (int i = 0; i < params.size(); i++) { |
|
115 |
String paramName = params.get(i); |
|
116 |
Class<?> paramType = taskStats.getParameterTypeByProcess("LayerDatatypeProcess", paramName); |
|
117 |
if(paramType == RasterDataStore.class) { |
|
118 |
taskStats.addParam(paramName, (RasterDataStore)inputStore); |
|
119 |
} |
|
120 |
|
|
121 |
if(paramName.equals("Path")) { |
|
122 |
taskStats.addParam(paramName, fileName); |
|
123 |
} |
|
124 |
|
|
125 |
if(paramName.equals(DATATYPE)) { |
|
126 |
String value = m_Parameters.getParameterValueAsString(DATATYPE); |
|
127 |
int position = 0; |
|
128 |
for (int j = 0; j < DATATYPES.length; j++) { |
|
129 |
if(DATATYPES[j].equals(value)) |
|
130 |
position = j; |
|
131 |
} |
|
132 |
taskStats.addParam(paramName, position); |
|
133 |
} |
|
134 |
|
|
135 |
if(paramName.equals(ADJUST_DEC2INT)) { |
|
136 |
String value = m_Parameters.getParameterValueAsString(ADJUST_DEC2INT); |
|
137 |
int position = 0; |
|
138 |
for (int j = 0; j < DEC2INT_OPTIONS.length; j++) { |
|
139 |
if(DEC2INT_OPTIONS[j].equals(value)) |
|
140 |
position = j; |
|
141 |
} |
|
142 |
taskStats.addParam(paramName, position); |
|
143 |
} |
|
144 |
|
|
145 |
if(paramName.equals(ADJUST_BIG2SMALL)) { |
|
146 |
String value = m_Parameters.getParameterValueAsString(ADJUST_BIG2SMALL); |
|
147 |
int position = 0; |
|
148 |
for (int j = 0; j < BIG2SMALL_OPTIONS.length; j++) { |
|
149 |
if(BIG2SMALL_OPTIONS[j].equals(value)) |
|
150 |
position = j; |
|
151 |
} |
|
152 |
taskStats.addParam(paramName, position); |
|
153 |
} |
|
154 |
|
|
155 |
if(paramName.equals("WINDOW")) { |
|
156 |
AnalysisExtent ext = getAnalysisExtent(); |
|
157 |
Extent bbox = RasterLocator.getManager().getDataStructFactory().createExtent( |
|
158 |
ext.getXMin(), ext.getYMax(), ext.getXMax(), ext.getYMin()); |
|
159 |
Extent inputBbox = inputStore.getExtent(); |
|
160 |
if(bbox.getULX() != inputBbox.getULX() || |
|
161 |
bbox.getULY() != inputBbox.getULY() || |
|
162 |
bbox.getLRX() != inputBbox.getLRX() || |
|
163 |
bbox.getLRY() != inputBbox.getLRY()) { |
|
164 |
taskStats.addParam(paramName, bbox); |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
return taskStats; |
|
169 |
} |
|
170 |
|
|
171 |
public void interrupted() { |
|
172 |
|
|
173 |
} |
|
174 |
|
|
175 |
public void end(Object param) { |
|
176 |
|
|
177 |
} |
|
178 |
|
|
179 |
public void updateProgress(int current, int total) { |
|
180 |
boolean cancelled = setProgress(current, total); |
|
181 |
|
|
182 |
if(!cancelled) { |
|
183 |
if(task != null) |
|
184 |
task.actionCanceled(null); |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
/* |
|
189 |
* TODO: Customized panels |
|
190 |
@Override |
|
191 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
|
192 |
return PrincipalComponentsParametersPanel.class; |
|
193 |
}*/ |
|
194 |
} |
|
0 | 195 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/java/org/gvsig/raster/tools/RasterToolsSextanteLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools; |
|
2 |
|
|
3 |
import org.gvsig.geoprocess.algorithm.base.core.AlgorithmAbstractLibrary; |
|
4 |
import org.gvsig.i18n.Messages; |
|
5 |
import org.gvsig.tools.library.LibraryException; |
|
6 |
|
|
7 |
/** |
|
8 |
* Initialization of <code>RasterToolsSextanteLibrary</code> library. |
|
9 |
*/ |
|
10 |
public class RasterToolsSextanteLibrary extends AlgorithmAbstractLibrary { |
|
11 |
|
|
12 |
@Override |
|
13 |
protected void doInitialize() throws LibraryException { |
|
14 |
// Nothing to do |
|
15 |
} |
|
16 |
|
|
17 |
@Override |
|
18 |
protected void doPostInitialize() throws LibraryException { |
|
19 |
Messages.addResourceFamily( |
|
20 |
"org.gvsig.raster.tools.sextante.i18n.text", RasterToolsSextanteLibrary.class |
|
21 |
.getClassLoader(), RasterToolsSextanteLibrary.class.getClass().getName()); |
|
22 |
|
|
23 |
registerGeoProcess(new LayerDatatypeSextanteAlgorithm()); |
|
24 |
} |
|
25 |
|
|
26 |
} |
|
0 | 27 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/resources-plugin/help/LayerDatatypeAlgorithm.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<help> |
|
3 |
<element name="DESCRIPTION" |
|
4 |
text="" |
|
5 |
description="Descripción" type="0"> |
|
6 |
<image description="" file=""> |
|
7 |
</image> |
|
8 |
</element> |
|
9 |
<element name="ADDITIONAL_INFO" text="" |
|
10 |
description="Información adicional" type="0"> |
|
11 |
</element> |
|
12 |
<element name="EXTENSION_AUTHOR" text="" |
|
13 |
description="Algoritmo creado por" type="0"> |
|
14 |
</element> |
|
15 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" |
|
16 |
type="0"> |
|
17 |
</element> |
|
18 |
<element name="USER_NOTES" text="" description="Notas de usuario" |
|
19 |
type="0"> |
|
20 |
</element> |
|
21 |
</help> |
|
0 | 22 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/resources-plugin/help/LayerDatatypeAlgorithm_en.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<help> |
|
3 |
<element name="DESCRIPTION" |
|
4 |
text="" |
|
5 |
description="Descripción" type="0"> |
|
6 |
<image description="" file=""> |
|
7 |
</image> |
|
8 |
</element> |
|
9 |
<element name="ADDITIONAL_INFO" text="" |
|
10 |
description="Información adicional" type="0"> |
|
11 |
</element> |
|
12 |
<element name="EXTENSION_AUTHOR" text="" |
|
13 |
description="Algoritmo creado por" type="0"> |
|
14 |
</element> |
|
15 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" |
|
16 |
type="0"> |
|
17 |
</element> |
|
18 |
<element name="USER_NOTES" text="" description="Notas de usuario" |
|
19 |
type="0"> |
|
20 |
</element> |
|
21 |
</help> |
|
0 | 22 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/resources/org/gvsig/raster/tools/sextante/i18n/text.properties | ||
---|---|---|
1 |
layer_datatype=Cambiar tipo de dato |
|
2 |
raster_layer=Capas r?ster |
|
3 |
Input_layer=Capa de entrada |
|
4 |
dst_datatype=Tipo de dato de destino |
|
5 |
dec_2_int=De decimal a entero |
|
6 |
big_2_small=De mayor a menor |
|
7 |
file_exists=El fichero existe |
|
8 |
convert_datatype=Convirtiendo el tipo de dato |
|
0 | 9 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/resources/org/gvsig/raster/tools/sextante/i18n/text_en.properties | ||
---|---|---|
1 |
layer_datatype=Change the data type |
|
2 |
raster_layer=Raster layers |
|
3 |
Input_layer=Input layer |
|
4 |
dst_datatype=Data type of the result |
|
5 |
dec_2_int=From decimal to integer |
|
6 |
big_2_small=From greater type to lesser type |
|
7 |
file_exists=The file exists |
|
8 |
convert_datatype=Transforming the data type |
|
0 | 9 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.tools.RasterToolsSextanteLibrary |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.algorithm/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
4 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
|
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<artifactId>org.gvsig.raster.tools.toolbox.algorithm</artifactId> |
|
8 |
<packaging>jar</packaging> |
|
9 |
<name>org.gvsig.raster.tools.toolbox.algorithm</name> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.raster.tools.toolbox</artifactId> |
|
13 |
<version>2.1.0-SNAPSHOT</version> |
|
14 |
</parent> |
|
15 |
<dependencies> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.raster.tools.algorithm.layerdatatype</artifactId> |
|
19 |
<scope>runtime</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.ui</artifactId> |
|
44 |
<scope>compile</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.i18n</artifactId> |
|
49 |
<scope>compile</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.gvsig</groupId> |
|
53 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
54 |
<scope>compile</scope> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>org.gvsig</groupId> |
|
58 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
59 |
<scope>runtime</scope> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
64 |
<scope>compile</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
69 |
<scope>runtime</scope> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
74 |
<scope>compile</scope> |
|
75 |
</dependency> |
|
76 |
</dependencies> |
|
77 |
</project> |
|
0 | 78 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Wed May 15 12:24:07 CEST 2013 |
|
3 |
buildNumber=1 |
|
0 | 4 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/SaveAsToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.tools.app.basic.tool.saveas.SaveAsTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for SaveAs tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class SaveAsToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
SaveAsTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getName() { |
|
50 |
return Messages.getText("save_as"); |
|
51 |
} |
|
52 |
|
|
53 |
public ImageIcon getIcon() { |
|
54 |
return (ImageIcon)SaveAsTocMenuEntry.getSingleton().getIcon(); |
|
55 |
} |
|
56 |
|
|
57 |
public boolean isPluginInstalled() { |
|
58 |
try { |
|
59 |
SaveAsTocMenuEntry.getSingleton(); |
|
60 |
} catch(Exception e) { |
|
61 |
return false; |
|
62 |
} catch(Error e) { |
|
63 |
return false; |
|
64 |
} |
|
65 |
return true; |
|
66 |
} |
|
67 |
} |
|
0 | 68 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/AbstractToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
26 |
|
|
27 |
import org.gvsig.andami.PluginServices; |
|
28 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
29 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
30 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
32 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FLyrRasterIRasterLayer; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
35 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
36 |
|
|
37 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
38 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
39 |
import es.unex.sextante.gui.core.ToolboxAction; |
|
40 |
|
|
41 |
/** |
|
42 |
* Base class for toolBox actions |
|
43 |
* |
|
44 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
45 |
*/ |
|
46 |
public abstract class AbstractToolboxAction extends ToolboxAction { |
|
47 |
protected FLyrRaster lyr = null; |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getGroup() { |
|
51 |
return Messages.getText("group_tools"); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
@Override |
|
56 |
public boolean isActive() { |
|
57 |
IWindow[] windows = PluginServices.getMDIManager().getAllWindows(); |
|
58 |
for (int i = 0; i < windows.length; i++) { |
|
59 |
if(windows[i] instanceof AbstractViewPanel) { |
|
60 |
FLayers lyrs = ((AbstractViewPanel)windows[i]).getMapControl().getMapContext().getLayers(); |
|
61 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
|
62 |
if(lyrs.getLayer(j) instanceof FLyrRaster) |
|
63 |
return true; |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
67 |
return false; |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Returns true if the plugin which gives the functionality is installed |
|
72 |
* in gvSIG |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
public abstract boolean isPluginInstalled(); |
|
76 |
|
|
77 |
/** |
|
78 |
* Loads the raster layer for the tool |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public boolean loadLayer() { |
|
82 |
if(!isPluginInstalled()) { |
|
83 |
RasterSwingLibrary.messageBoxError(Messages.getText("plugin_not_installed"), null); |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
87 |
if(!isActive()) { |
|
88 |
RasterSwingLibrary.messageBoxError(Messages.getText("layer_not_valid"), null); |
|
89 |
return false; |
|
90 |
} |
|
91 |
|
|
92 |
boolean existsRasterButNotActive = false; |
|
93 |
lyr = null; |
|
94 |
IWindow[] windows = PluginServices.getMDIManager().getAllWindows(); |
|
95 |
MapContext mapCtx = null; |
|
96 |
for (int i = 0; i < windows.length; i++) { |
|
97 |
if(windows[i] instanceof AbstractViewPanel) { |
|
98 |
mapCtx = ((AbstractViewPanel)windows[i]).getMapControl().getMapContext(); |
|
99 |
break; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
IRasterLayer[] layers = SextanteGUI.getInputFactory().getRasterLayers(); |
|
104 |
for (int i = 0; i < layers.length; i++) { |
|
105 |
FLyrRaster l = (FLyrRaster)((FLyrRasterIRasterLayer)layers[i]).getBaseDataObject(); |
|
106 |
existsRasterButNotActive = true; |
|
107 |
if(l.isActive() && mapCtx == l.getMapContext()) { |
|
108 |
existsRasterButNotActive = false; |
|
109 |
lyr = l; |
|
110 |
break; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
if(existsRasterButNotActive) { |
|
115 |
RasterSwingLibrary.messageBoxError(Messages.getText("raster_layer_not_active"), null); |
|
116 |
return false; |
|
117 |
} |
|
118 |
|
|
119 |
return true; |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
0 | 123 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/ReprojectionToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.reproject.app.ReprojectTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for reprojection tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class ReprojectionToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
|
|
46 |
ReprojectTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getName() { |
|
51 |
return Messages.getText("reprojection"); |
|
52 |
} |
|
53 |
|
|
54 |
public ImageIcon getIcon() { |
|
55 |
return (ImageIcon)ReprojectTocMenuEntry.getSingleton().getIcon(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isPluginInstalled() { |
|
59 |
try { |
|
60 |
ReprojectTocMenuEntry.getSingleton(); |
|
61 |
} catch(Exception e) { |
|
62 |
return false; |
|
63 |
} catch(Error e) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
return true; |
|
67 |
} |
|
68 |
|
|
69 |
} |
|
0 | 70 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/SetViewProjectionToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.tools.app.basic.tool.setviewprojection.SetViewProjectionTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for "SetViewProjection" tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class SetViewProjectionToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
|
|
46 |
SetViewProjectionTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getName() { |
|
51 |
return Messages.getText("set_view_projection"); |
|
52 |
} |
|
53 |
|
|
54 |
public ImageIcon getIcon() { |
|
55 |
return (ImageIcon)SetViewProjectionTocMenuEntry.getSingleton().getIcon(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isPluginInstalled() { |
|
59 |
try { |
|
60 |
SetViewProjectionTocMenuEntry.getSingleton(); |
|
61 |
} catch(Exception e) { |
|
62 |
return false; |
|
63 |
} catch(Error e) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
return true; |
|
67 |
} |
|
68 |
|
|
69 |
} |
|
0 | 70 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/FilterToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
26 |
|
|
27 |
import javax.swing.ImageIcon; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
30 |
import org.gvsig.i18n.Messages; |
|
31 |
import org.gvsig.raster.tools.app.basic.tool.filter.FilterTocMenuEntry; |
|
32 |
|
|
33 |
/** |
|
34 |
* Input in Sextante framework for Radiometric enhancement tool |
|
35 |
* |
|
36 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
37 |
*/ |
|
38 |
public class FilterToolboxAction extends AbstractToolboxAction { |
|
39 |
|
|
40 |
@Override |
|
41 |
public void execute() { |
|
42 |
if(!super.loadLayer()) |
|
43 |
return; |
|
44 |
|
|
45 |
FilterTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getName() { |
|
50 |
return Messages.getText("filters"); |
|
51 |
} |
|
52 |
|
|
53 |
public ImageIcon getIcon() { |
|
54 |
return (ImageIcon)FilterTocMenuEntry.getSingleton().getIcon(); |
|
55 |
} |
|
56 |
|
|
57 |
public boolean isPluginInstalled() { |
|
58 |
try { |
|
59 |
FilterTocMenuEntry.getSingleton(); |
|
60 |
} catch(Exception e) { |
|
61 |
return false; |
|
62 |
} catch(Error e) { |
|
63 |
return false; |
|
64 |
} |
|
65 |
return true; |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
0 | 69 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/ROIMaskToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.roimask.app.ROIMaskTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for clip tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class ROIMaskToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
|
|
46 |
ROIMaskTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getName() { |
|
51 |
return Messages.getText("roimask"); |
|
52 |
} |
|
53 |
|
|
54 |
public ImageIcon getIcon() { |
|
55 |
return (ImageIcon)ROIMaskTocMenuEntry.getSingleton().getIcon(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isPluginInstalled() { |
|
59 |
try { |
|
60 |
ROIMaskTocMenuEntry.getSingleton(); |
|
61 |
} catch(Exception e) { |
|
62 |
return false; |
|
63 |
} catch(Error e) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
return true; |
|
67 |
} |
|
68 |
|
|
69 |
} |
|
0 | 70 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/ClipToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.tools.app.basic.tool.clip.ClippingTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for clip tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class ClipToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
|
|
46 |
ClippingTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getName() { |
|
51 |
return Messages.getText("clip_raster"); |
|
52 |
} |
|
53 |
|
|
54 |
public ImageIcon getIcon() { |
|
55 |
return (ImageIcon)ClippingTocMenuEntry.getSingleton().getIcon(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isPluginInstalled() { |
|
59 |
try { |
|
60 |
ClippingTocMenuEntry.getSingleton(); |
|
61 |
} catch(Exception e) { |
|
62 |
return false; |
|
63 |
} catch(Error e) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
return true; |
|
67 |
} |
|
68 |
|
|
69 |
} |
|
0 | 70 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/PrincipalComponentsToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.principalcomponents.app.PrincipalComponentsTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for Principal Components tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class PrincipalComponentsToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public String getGroup() { |
|
43 |
return Messages.getText("multispectral"); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public void execute() { |
|
48 |
if(!super.loadLayer()) |
|
49 |
return; |
|
50 |
PrincipalComponentsTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public String getName() { |
|
55 |
return Messages.getText("principalcomponents"); |
|
56 |
} |
|
57 |
|
|
58 |
public ImageIcon getIcon() { |
|
59 |
return (ImageIcon)PrincipalComponentsTocMenuEntry.getSingleton().getIcon(); |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isPluginInstalled() { |
|
63 |
try { |
|
64 |
PrincipalComponentsTocMenuEntry.getSingleton(); |
|
65 |
} catch(Exception e) { |
|
66 |
return false; |
|
67 |
} catch(Error e) { |
|
68 |
return false; |
|
69 |
} |
|
70 |
return true; |
|
71 |
} |
|
72 |
} |
|
0 | 73 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/LayerDatatypeToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.tools.app.basic.tool.layerdatatype.LayerDatatypeTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for layer datatype tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class LayerDatatypeToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void execute() { |
|
43 |
if(!super.loadLayer()) |
|
44 |
return; |
|
45 |
LayerDatatypeTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getName() { |
|
50 |
return Messages.getText("layer_datatype"); |
|
51 |
} |
|
52 |
|
|
53 |
public ImageIcon getIcon() { |
|
54 |
return (ImageIcon)LayerDatatypeTocMenuEntry.getSingleton().getIcon(); |
|
55 |
} |
|
56 |
|
|
57 |
public boolean isPluginInstalled() { |
|
58 |
try { |
|
59 |
LayerDatatypeTocMenuEntry.getSingleton(); |
|
60 |
} catch(Exception e) { |
|
61 |
return false; |
|
62 |
} catch(Error e) { |
|
63 |
return false; |
|
64 |
} |
|
65 |
return true; |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
0 | 69 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/RadiometricEnhancementToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
26 |
|
|
27 |
import javax.swing.ImageIcon; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
30 |
import org.gvsig.i18n.Messages; |
|
31 |
import org.gvsig.raster.tools.app.basic.tool.enhanced.EnhancedTocMenuEntry; |
|
32 |
|
|
33 |
/** |
|
34 |
* Input in Sextante framework for Radiometric enhancement tool |
|
35 |
* |
|
36 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
37 |
*/ |
|
38 |
public class RadiometricEnhancementToolboxAction extends AbstractToolboxAction { |
|
39 |
|
|
40 |
@Override |
|
41 |
public void execute() { |
|
42 |
if(!super.loadLayer()) |
|
43 |
return; |
|
44 |
|
|
45 |
EnhancedTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
46 |
} |
|
47 |
|
|
48 |
|
|
49 |
@Override |
|
50 |
public String getName() { |
|
51 |
return Messages.getText("radiometric_enhancedment"); |
|
52 |
} |
|
53 |
|
|
54 |
public ImageIcon getIcon() { |
|
55 |
return (ImageIcon)EnhancedTocMenuEntry.getSingleton().getIcon(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isPluginInstalled() { |
|
59 |
try { |
|
60 |
EnhancedTocMenuEntry.getSingleton(); |
|
61 |
} catch(Exception e) { |
|
62 |
return false; |
|
63 |
} catch(Error e) { |
|
64 |
return false; |
|
65 |
} |
|
66 |
return true; |
|
67 |
} |
|
68 |
} |
|
0 | 69 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/TasseledCapToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
package org.gvsig.raster.tools.toolbox.app.client; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.i18n.Messages; |
|
32 |
import org.gvsig.raster.tasseledcab.app.TasseledCabTocMenuEntry; |
|
33 |
|
|
34 |
/** |
|
35 |
* Input in Sextante framework for Tasseled Cap tool |
|
36 |
* |
|
37 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
38 |
*/ |
|
39 |
public class TasseledCapToolboxAction extends AbstractToolboxAction { |
|
40 |
|
|
41 |
@Override |
|
42 |
public String getGroup() { |
|
43 |
return Messages.getText("multispectral"); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public void execute() { |
|
48 |
if(!super.loadLayer()) |
|
49 |
return; |
|
50 |
TasseledCabTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public String getName() { |
|
55 |
return Messages.getText("tasseledcap"); |
|
56 |
} |
|
57 |
|
|
58 |
public ImageIcon getIcon() { |
|
59 |
return (ImageIcon)TasseledCabTocMenuEntry.getSingleton().getIcon(); |
|
60 |
} |
|
61 |
|
|
62 |
public boolean isPluginInstalled() { |
|
63 |
try { |
|
64 |
TasseledCabTocMenuEntry.getSingleton(); |
|
65 |
} catch(Exception e) { |
|
66 |
return false; |
|
67 |
} catch(Error e) { |
|
68 |
return false; |
|
69 |
} |
|
70 |
return true; |
|
71 |
} |
|
72 |
} |
|
0 | 73 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools.toolbox_deprecated/org.gvsig.raster.tools.toolbox.app.client/src/main/java/org/gvsig/raster/tools/toolbox/app/client/OverviewsToolboxAction.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
Also available in: Unified diff