Revision 4314
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources-plugin/org/gvsig/raster/principalcomponents/sextante/i18n/text.properties | ||
---|---|---|
1 |
multispectral=Raster multiespectral |
|
2 |
principalcomponents=Componentes principales |
|
3 |
use_roi=Usar las regiones de inter?s de la capa de entrada |
|
0 | 4 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources-plugin/org/gvsig/raster/principalcomponents/sextante/i18n/text_en.properties | ||
---|---|---|
1 |
multispectral=Multispectral raster |
|
2 |
principalcomponents=Principal components |
|
3 |
use_roi=Use regions of interest of the input layer |
|
0 | 4 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.principalcomponents.PrincipalComponentsSextanteLibrary |
|
0 | 2 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources/org/gvsig/raster/principalcomponents/sextante/i18n/text_en.properties | ||
---|---|---|
1 |
multispectral=Multispectral raster |
|
2 |
principalcomponents=Principal Components |
|
3 |
use_roi=Use regions of interest |
|
4 |
stadistics=Stadistics |
|
5 |
calc_components=Calculating components |
|
0 | 6 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources/org/gvsig/raster/principalcomponents/sextante/i18n/text.properties | ||
---|---|---|
1 |
multispectral=Raster multiespectral |
|
2 |
principalcomponents=Componentes Principales |
|
3 |
use_roi=Usar las regiones de inter?s |
|
4 |
stadistics=Estad?sticas |
|
5 |
calc_components=Calculando componentes |
|
0 | 6 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources/help/PrincipalComponentsSextanteAlgorithm.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.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/resources/help/PrincipalComponentsSextanteAlgorithm_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.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/java/org/gvsig/raster/principalcomponents/PrincipalComponentsSextanteAlgorithm.java | ||
---|---|---|
1 |
package org.gvsig.raster.principalcomponents; |
|
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 |
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure; |
|
18 |
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary; |
|
19 |
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsProcess; |
|
20 |
|
|
21 |
import es.unex.sextante.core.AnalysisExtent; |
|
22 |
import es.unex.sextante.core.Sextante; |
|
23 |
import es.unex.sextante.dataObjects.IRasterLayer; |
|
24 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
25 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
26 |
|
|
27 |
/** |
|
28 |
* ... |
|
29 |
*/ |
|
30 |
public class PrincipalComponentsSextanteAlgorithm extends AbstractSextanteGeoProcess implements IProcessActions { |
|
31 |
public static final String RESULT = "RESULT"; |
|
32 |
public static final String LAYER = PrincipalComponentsProcess.RASTER_STORE; |
|
33 |
public static final String USE_ROI = "USE_ROI"; |
|
34 |
|
|
35 |
private boolean useROI = false; |
|
36 |
private DataProcess taskStats = null; |
|
37 |
private DataProcess taskPC = null; |
|
38 |
|
|
39 |
|
|
40 |
public void defineCharacteristics() { |
|
41 |
setName(getTranslation("principalcomponents")); |
|
42 |
setGroup(getTranslation("multispectral")); |
|
43 |
|
|
44 |
try { |
|
45 |
m_Parameters.addInputRasterLayer(LAYER, getTranslation("Input_layer"), true); |
|
46 |
m_Parameters.addBoolean(USE_ROI, getTranslation("use_roi"), false); |
|
47 |
} catch (RepeatedParameterNameException e) { |
|
48 |
Sextante.addErrorToLog(e); |
|
49 |
} |
|
50 |
addOutputRasterLayer(RESULT, getTranslation("principalcomponents")); |
|
51 |
} |
|
52 |
|
|
53 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
54 |
|
|
55 |
if(existsOutPutFile(PrincipalComponentsSextanteAlgorithm.RESULT, 0)) { |
|
56 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
57 |
} |
|
58 |
|
|
59 |
IRasterLayer input = m_Parameters.getParameterValueAsRasterLayer(LAYER); |
|
60 |
useROI = m_Parameters.getParameterValueAsBoolean(USE_ROI); |
|
61 |
|
|
62 |
FLyrRaster lyrRaster = ((FLyrRaster)input.getBaseDataObject()); |
|
63 |
IRasterLayer output = null; |
|
64 |
|
|
65 |
output = getNewRORasterLayer( |
|
66 |
RESULT, |
|
67 |
Sextante.getText("principalcomponents_description"), |
|
68 |
input.getDataType(), |
|
69 |
input.getBandsCount()); |
|
70 |
|
|
71 |
String fileName = ((FLyrRasterIRasterLayer)output).getName(); |
|
72 |
|
|
73 |
try { |
|
74 |
setProgressText(getTranslation("stadistics")); |
|
75 |
taskStats = createStatisticsProcess(lyrRaster.getDataStore()); |
|
76 |
taskStats.execute(); |
|
77 |
HashMap<String, Object> params = taskStats.getResult(); |
|
78 |
PCStatsDataStructure stats = (PCStatsDataStructure)params.get("STATS_RESULT"); |
|
79 |
|
|
80 |
setProgressText(getTranslation("calc_components")); |
|
81 |
taskPC = createPCAProcess(lyrRaster.getDataStore(), fileName, stats); |
|
82 |
taskPC.execute(); |
|
83 |
params = taskPC.getResult(); |
|
84 |
|
|
85 |
((FLyrRasterIRasterLayer)output).setBaseDataObject(fileName); |
|
86 |
} catch (ProcessInterruptedException e) { |
|
87 |
Sextante.addErrorToLog(e); |
|
88 |
} catch (ProcessException e) { |
|
89 |
Sextante.addErrorToLog(e); |
|
90 |
} |
|
91 |
|
|
92 |
if(getTaskMonitor().isCanceled()) |
|
93 |
return false; |
|
94 |
|
|
95 |
return true; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Creates a process to calculate statistics |
|
100 |
* @param inputStore |
|
101 |
* @return |
|
102 |
* @throws ProcessException |
|
103 |
*/ |
|
104 |
private DataProcess createStatisticsProcess(RasterDataStore inputStore) throws ProcessException { |
|
105 |
DataProcess taskStats = RasterBaseAlgorithmLibrary.getManager().createRasterTask(PrincipalComponentsAlgorithmLibrary.PC_STATS_PROCESS_LABEL); |
|
106 |
taskStats.setActions(this); |
|
107 |
List<String> params = taskStats.getRasterTaskInputParameters(PrincipalComponentsAlgorithmLibrary.PC_STATS_PROCESS_LABEL); |
|
108 |
for (int i = 0; i < params.size(); i++) { |
|
109 |
String paramName = params.get(i); |
|
110 |
Class<?> paramType = taskStats.getParameterTypeByProcess(PrincipalComponentsAlgorithmLibrary.PC_STATS_PROCESS_LABEL, paramName); |
|
111 |
if(paramType == RasterDataStore.class) { |
|
112 |
taskStats.addParam(paramName, (RasterDataStore)inputStore); |
|
113 |
} |
|
114 |
if(paramName.equals("BANDS")) { |
|
115 |
boolean[] bands = new boolean[inputStore.getBandCount()]; |
|
116 |
for (int j = 0; j < bands.length; j++) { |
|
117 |
bands[j] = true; |
|
118 |
} |
|
119 |
taskStats.addParam(paramName, bands); |
|
120 |
} |
|
121 |
|
|
122 |
if(paramName.equals("ROI_EPSG") && useROI) { |
|
123 |
taskStats.addParam(paramName, "EPSG:4326"); |
|
124 |
} |
|
125 |
|
|
126 |
if(paramName.equals("WINDOW")) { |
|
127 |
AnalysisExtent ext = getAnalysisExtent(); |
|
128 |
Extent bbox = RasterLocator.getManager().getDataStructFactory().createExtent( |
|
129 |
ext.getXMin(), ext.getYMax(), ext.getXMax(), ext.getYMin()); |
|
130 |
Extent inputBbox = inputStore.getExtent(); |
|
131 |
if(bbox.getULX() != inputBbox.getULX() || |
|
132 |
bbox.getULY() != inputBbox.getULY() || |
|
133 |
bbox.getLRX() != inputBbox.getLRX() || |
|
134 |
bbox.getLRY() != inputBbox.getLRY()) { |
|
135 |
taskStats.addParam(paramName, bbox); |
|
136 |
} |
|
137 |
} |
|
138 |
} |
|
139 |
return taskStats; |
|
140 |
} |
|
141 |
|
|
142 |
private DataProcess createPCAProcess(RasterDataStore inputStore, String fileName, PCStatsDataStructure stats) throws ProcessException { |
|
143 |
DataProcess taskPC = RasterBaseAlgorithmLibrary.getManager().createRasterTask(PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
|
144 |
taskPC.setActions(this); |
|
145 |
List<String> params = taskPC.getRasterTaskInputParameters(PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
|
146 |
for (int i = 0; i < params.size(); i++) { |
|
147 |
String paramName = params.get(i); |
|
148 |
Class<?> paramType = taskPC.getParameterTypeByProcess(PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL, paramName); |
|
149 |
if(paramType == RasterDataStore.class) { |
|
150 |
taskPC.addParam(paramName, (RasterDataStore)inputStore); |
|
151 |
} |
|
152 |
|
|
153 |
if(paramType == Boolean[].class) { |
|
154 |
boolean[] bands = new boolean[inputStore.getBandCount()]; |
|
155 |
for (int j = 0; j < bands.length; j++) { |
|
156 |
bands[j] = true; |
|
157 |
} |
|
158 |
taskPC.addParam(paramName, bands); |
|
159 |
} |
|
160 |
|
|
161 |
if(paramType == PCStatsDataStructure.class) { |
|
162 |
taskPC.addParam(paramName, stats); |
|
163 |
} |
|
164 |
|
|
165 |
if(paramName.equals("PATH")) { |
|
166 |
taskPC.addParam(paramName, fileName); |
|
167 |
} |
|
168 |
|
|
169 |
if(paramName.equals("ROI_EPSG") && useROI) { |
|
170 |
taskPC.addParam(paramName, "EPSG:4326"); |
|
171 |
} |
|
172 |
|
|
173 |
if(paramName.equals("WINDOW")) { |
|
174 |
AnalysisExtent ext = getAnalysisExtent(); |
|
175 |
Extent bbox = RasterLocator.getManager().getDataStructFactory().createExtent( |
|
176 |
ext.getXMin(), ext.getYMax(), ext.getXMax(), ext.getYMin()); |
|
177 |
Extent inputBbox = inputStore.getExtent(); |
|
178 |
if(bbox.getULX() != inputBbox.getULX() || |
|
179 |
bbox.getULY() != inputBbox.getULY() || |
|
180 |
bbox.getLRX() != inputBbox.getLRX() || |
|
181 |
bbox.getLRY() != inputBbox.getLRY()) { |
|
182 |
taskPC.addParam(paramName, bbox); |
|
183 |
} |
|
184 |
} |
|
185 |
} |
|
186 |
return taskPC; |
|
187 |
} |
|
188 |
|
|
189 |
public void interrupted() { |
|
190 |
|
|
191 |
} |
|
192 |
|
|
193 |
public void end(Object param) { |
|
194 |
|
|
195 |
} |
|
196 |
|
|
197 |
public void updateProgress(int current, int total) { |
|
198 |
boolean cancelled = setProgress(current, total); |
|
199 |
|
|
200 |
if(!cancelled) { |
|
201 |
if(taskStats != null) |
|
202 |
taskStats.actionCanceled(null); |
|
203 |
if(taskPC != null) |
|
204 |
taskPC.actionCanceled(null); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
/* |
|
209 |
* TODO: Customized panels |
|
210 |
@Override |
|
211 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
|
212 |
return PrincipalComponentsParametersPanel.class; |
|
213 |
}*/ |
|
214 |
} |
|
0 | 215 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.toolbox.algorithm/src/main/java/org/gvsig/raster/principalcomponents/PrincipalComponentsSextanteLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.principalcomponents; |
|
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>PrincipalComponentsSextanteLibrary</code> library. |
|
9 |
*/ |
|
10 |
public class PrincipalComponentsSextanteLibrary 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.principalcomponents.sextante.i18n.text", PrincipalComponentsSextanteLibrary.class |
|
21 |
.getClassLoader(), PrincipalComponentsSextanteLibrary.class.getClass().getName()); |
|
22 |
registerGeoProcess(new PrincipalComponentsSextanteAlgorithm()); |
|
23 |
} |
|
24 |
|
|
25 |
} |
|
0 | 26 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.raster.principalcomponents.toolbox.algorithm</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.raster.principalcomponents</artifactId> |
|
11 |
<version>2.2.18</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId> |
|
32 |
<scope>compile</scope> |
|
33 |
</dependency> |
|
34 |
<dependency> |
|
35 |
<groupId>org.gvsig</groupId> |
|
36 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
37 |
<scope>compile</scope> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>org.gvsig</groupId> |
|
41 |
<artifactId>org.gvsig.ui</artifactId> |
|
42 |
<scope>compile</scope> |
|
43 |
</dependency> |
|
44 |
<dependency> |
|
45 |
<groupId>org.gvsig</groupId> |
|
46 |
<artifactId>org.gvsig.i18n</artifactId> |
|
47 |
<scope>compile</scope> |
|
48 |
</dependency> |
|
49 |
<dependency> |
|
50 |
<groupId>org.gvsig</groupId> |
|
51 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
52 |
<scope>compile</scope> |
|
53 |
</dependency> |
|
54 |
<dependency> |
|
55 |
<groupId>org.gvsig</groupId> |
|
56 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
57 |
<scope>runtime</scope> |
|
58 |
</dependency> |
|
59 |
<dependency> |
|
60 |
<groupId>org.gvsig</groupId> |
|
61 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
62 |
<scope>compile</scope> |
|
63 |
</dependency> |
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
67 |
<scope>runtime</scope> |
|
68 |
</dependency> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
72 |
<scope>compile</scope> |
|
73 |
</dependency> |
|
74 |
</dependencies> |
|
75 |
</project> |
|
0 | 76 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.principalcomponents</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<version>2.2.18</version> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<description /> |
|
9 |
<inceptionYear>2011</inceptionYear> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.desktop</artifactId> |
|
13 |
<version>2.0.115</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<properties> |
|
17 |
<!-- El plugin versions:use-latest-versions falla con scope import --> |
|
18 |
<!-- asi que toca usar el versions:update-properties que si que funciona --> |
|
19 |
<org.gvsig.raster.version>2.2.26</org.gvsig.raster.version> |
|
20 |
<org.gvsig.geoprocess.version>2.2.38</org.gvsig.geoprocess.version> |
|
21 |
</properties> |
|
22 |
|
|
23 |
<repositories> |
|
24 |
<repository> |
|
25 |
<id>gvsig-public-http-repository</id> |
|
26 |
<name>gvSIG maven public HTTP repository</name> |
|
27 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
28 |
<releases> |
|
29 |
<enabled>true</enabled> |
|
30 |
<updatePolicy>daily</updatePolicy> |
|
31 |
<checksumPolicy>warn</checksumPolicy> |
|
32 |
</releases> |
|
33 |
<snapshots> |
|
34 |
<enabled>true</enabled> |
|
35 |
<updatePolicy>daily</updatePolicy> |
|
36 |
<checksumPolicy>warn</checksumPolicy> |
|
37 |
</snapshots> |
|
38 |
</repository> |
|
39 |
</repositories> |
|
40 |
|
|
41 |
<scm> |
|
42 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18</connection> |
|
43 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18</developerConnection> |
|
44 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18</url> |
|
45 |
</scm> |
|
46 |
<build> |
|
47 |
<plugins> |
|
48 |
<plugin> |
|
49 |
<groupId>org.apache.maven.plugins</groupId> |
|
50 |
<artifactId>maven-release-plugin</artifactId> |
|
51 |
<configuration> |
|
52 |
<tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/</tagBase> |
|
53 |
<goals>deploy</goals> |
|
54 |
</configuration> |
|
55 |
</plugin> |
|
56 |
</plugins> |
|
57 |
</build> |
|
58 |
|
|
59 |
<dependencyManagement> |
|
60 |
<dependencies> |
|
61 |
|
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig.legacy</groupId> |
|
64 |
<artifactId>jama</artifactId> |
|
65 |
<version>1.0.3</version> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<!-- |
|
69 |
Versions of other gvSIG projects |
|
70 |
--> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.raster</artifactId> |
|
74 |
<version>${org.gvsig.raster.version}</version> |
|
75 |
<type>pom</type> |
|
76 |
<scope>import</scope> |
|
77 |
</dependency> |
|
78 |
|
|
79 |
<dependency> |
|
80 |
<groupId>org.gvsig</groupId> |
|
81 |
<artifactId>org.gvsig.geoprocess</artifactId> |
|
82 |
<version>${org.gvsig.geoprocess.version}</version> |
|
83 |
<type>pom</type> |
|
84 |
<scope>import</scope> |
|
85 |
</dependency> |
|
86 |
<!-- |
|
87 |
Versions of child projects |
|
88 |
--> |
|
89 |
<dependency> |
|
90 |
<groupId>org.gvsig</groupId> |
|
91 |
<artifactId>org.gvsig.raster.principalcomponents.swing.api</artifactId> |
|
92 |
<version>2.2.18</version> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.raster.principalcomponents.swing.impl</artifactId> |
|
97 |
<version>2.2.18</version> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId> |
|
102 |
<version>2.2.18</version> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId> |
|
107 |
<version>2.2.18</version> |
|
108 |
</dependency> |
|
109 |
|
|
110 |
</dependencies> |
|
111 |
</dependencyManagement> |
|
112 |
<modules> |
|
113 |
<module>org.gvsig.raster.principalcomponents.algorithm</module> |
|
114 |
<module>org.gvsig.raster.principalcomponents.toolbox.algorithm</module> |
|
115 |
<module>org.gvsig.raster.principalcomponents.swing</module> |
|
116 |
<module>org.gvsig.raster.principalcomponents.app.principalcomponentsclient</module> |
|
117 |
</modules> |
|
118 |
</project> |
|
0 | 119 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/buildNumber.properties | ||
---|---|---|
1 |
#Sun Dec 06 22:41:18 CET 2015 |
|
2 |
buildNumber=26 |
|
0 | 3 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>.</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>${project.artifactId}/lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
<outputDirectory>${project.artifactId}</outputDirectory> |
|
16 |
</file> |
|
17 |
|
|
18 |
<!-- <file> |
|
19 |
<source>${user.home}/.m2/repository/org/gvsig/org.gvsig.raster.principalcomponents.toolbox.algorithm/${project.version}/org.gvsig.raster.principalcomponents.toolbox.algorithm-${project.version}.jar</source> |
|
20 |
<outputDirectory>org.gvsig.raster.tools.toolbox.app.client/lib</outputDirectory> |
|
21 |
</file>--> |
|
22 |
</files> |
|
23 |
|
|
24 |
<fileSets> |
|
25 |
<fileSet> |
|
26 |
<directory>src/main/resources-plugin</directory> |
|
27 |
<outputDirectory>${project.artifactId}</outputDirectory> |
|
28 |
</fileSet> |
|
29 |
</fileSets> |
|
30 |
|
|
31 |
|
|
32 |
<dependencySets> |
|
33 |
<dependencySet> |
|
34 |
<useProjectArtifact>false</useProjectArtifact> |
|
35 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
36 |
<outputDirectory>${project.artifactId}/lib</outputDirectory> |
|
37 |
<includes> |
|
38 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.app.principalcomponentsclient:jar</include> |
|
39 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.lib.api:jar</include> |
|
40 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.lib.impl:jar</include> |
|
41 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.swing.api:jar</include> |
|
42 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.swing.impl:jar</include> |
|
43 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.algorithm:jar</include> |
|
44 |
<include>org.gvsig:org.gvsig.raster.principalcomponents.toolbox.algorithm:jar</include> |
|
45 |
</includes> |
|
46 |
</dependencySet> |
|
47 |
|
|
48 |
</dependencySets> |
|
49 |
</assembly> |
|
0 | 50 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/java/org/gvsig/raster/principalcomponents/app/ProcessEndActions.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2011-2012 Prodevelop S.L |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
*/ |
|
21 |
package org.gvsig.raster.principalcomponents.app; |
|
22 |
|
|
23 |
import java.io.File; |
|
24 |
import java.util.HashMap; |
|
25 |
|
|
26 |
import org.gvsig.andami.PluginServices; |
|
27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
28 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
29 |
import org.gvsig.fmap.dal.DALLocator; |
|
30 |
import org.gvsig.fmap.dal.DataManager; |
|
31 |
import org.gvsig.fmap.dal.DataStore; |
|
32 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
33 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
34 |
import org.gvsig.fmap.dal.coverage.util.ProviderServices; |
|
35 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
36 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
37 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
38 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
39 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
40 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
41 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
42 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
43 |
import org.gvsig.raster.algorithm.process.IProcessActions; |
|
44 |
import org.gvsig.raster.algorithm.process.ProcessParamsManagement; |
|
45 |
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary; |
|
46 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
47 |
import org.gvsig.raster.swing.RasterSwingLocator; |
|
48 |
import org.gvsig.raster.util.RasterNotLoadException; |
|
49 |
|
|
50 |
/** |
|
51 |
* Actions when the process finalizes or is interrupted |
|
52 |
* |
|
53 |
* Nacho Brodin (nachobrodin@gmail.com) |
|
54 |
*/ |
|
55 |
public class ProcessEndActions implements IProcessActions { |
|
56 |
private IWindow window = null; |
|
57 |
private FLayer inputLyr = null; |
|
58 |
|
|
59 |
/** |
|
60 |
* Constructor |
|
61 |
* @param window |
|
62 |
* @param lyr |
|
63 |
* The input layer is only used to select the view where the new layer be loaded |
|
64 |
*/ |
|
65 |
public ProcessEndActions(IWindow window, FLayer lyr) { |
|
66 |
this.window = window; |
|
67 |
this.inputLyr = lyr; |
|
68 |
} |
|
69 |
|
|
70 |
@SuppressWarnings("unchecked") |
|
71 |
public void end(Object param) { |
|
72 |
if(window != null) { |
|
73 |
PluginServices.getMDIManager().closeWindow(window); |
|
74 |
window = null; |
|
75 |
} |
|
76 |
|
|
77 |
HashMap<String, Object> params = (HashMap<String, Object>)param; |
|
78 |
String processName = (String)params.get(ProcessParamsManagement.PROCESS_NAME); |
|
79 |
|
|
80 |
//End the process to get statistics (accept main dialog) |
|
81 |
if (processName.equals(PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL)) { |
|
82 |
String fileName = (String)params.get("FILENAME"); |
|
83 |
long milis = (Long)params.get("TIME"); |
|
84 |
processFinalize(fileName, milis); |
|
85 |
RasterSwingLocator.getSwingManager().showSummaryProcessDialog(fileName, milis); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Acciones que se realizan al finalizar de crear los recortes de imagen. |
|
91 |
* Este m?todo es llamado por el thread TailRasterProcess al finalizar. |
|
92 |
*/ |
|
93 |
private void processFinalize(String fileName, long milis) { |
|
94 |
if (!new File(fileName).exists()) |
|
95 |
return; |
|
96 |
|
|
97 |
if (RasterSwingLibrary.messageBoxYesOrNot("cargar_toc", null)) { |
|
98 |
try { |
|
99 |
loadLayer(fileName, fileName.substring(fileName.lastIndexOf(File.separator) + 1)); |
|
100 |
} catch (RasterNotLoadException e) { |
|
101 |
RasterSwingLibrary.messageBoxError("error_load_layer", e); |
|
102 |
} |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
/** |
|
107 |
* Gets the view |
|
108 |
* @return |
|
109 |
*/ |
|
110 |
private AbstractViewPanel getView() { |
|
111 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
112 |
for (int i = 0; i < w.length; i++) { |
|
113 |
if(w[i] instanceof AbstractViewPanel) { |
|
114 |
FLayers lyrs = ((AbstractViewPanel)w[i]).getMapControl().getMapContext().getLayers(); |
|
115 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
|
116 |
FLayer lyr = lyrs.getLayer(j); |
|
117 |
if(inputLyr == lyr) { |
|
118 |
return ((AbstractViewPanel) w[i]); |
|
119 |
} |
|
120 |
} |
|
121 |
} |
|
122 |
} |
|
123 |
return null; |
|
124 |
} |
|
125 |
|
|
126 |
@SuppressWarnings("deprecation") |
|
127 |
private void loadLayer(String fileName, String layerName) throws RasterNotLoadException { |
|
128 |
if(fileName == null) |
|
129 |
return; |
|
130 |
|
|
131 |
//Seleccionamos la vista de gvSIG |
|
132 |
AbstractViewPanel theView = getView(); |
|
133 |
|
|
134 |
theView.getMapControl().getMapContext().beginAtomicEvent(); |
|
135 |
|
|
136 |
try { |
|
137 |
DataManager dataManager = DALLocator.getDataManager(); |
|
138 |
|
|
139 |
ProviderServices provServ = RasterLocator.getManager().getProviderServices(); |
|
140 |
RasterDataParameters storeParameters = provServ.createParameters(fileName); |
|
141 |
storeParameters.setURI(new File(fileName).toURI()); |
|
142 |
|
|
143 |
MapContextManager mcm = MapContextLocator.getMapContextManager(); |
|
144 |
|
|
145 |
DataStore dataStore = null; |
|
146 |
try { |
|
147 |
dataStore = dataManager.createStore(storeParameters); |
|
148 |
} catch (ValidateDataParametersException e) { |
|
149 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
150 |
} catch (InitializeException e) { |
|
151 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
152 |
} catch (ProviderNotRegisteredException e) { |
|
153 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
154 |
} |
|
155 |
|
|
156 |
if(layerName == null) { |
|
157 |
int endIndex = fileName.lastIndexOf("."); |
|
158 |
if (endIndex < 0) |
|
159 |
endIndex = fileName.length(); |
|
160 |
|
|
161 |
layerName = fileName.substring(fileName.lastIndexOf(File.separator) + 1, endIndex); |
|
162 |
} |
|
163 |
|
|
164 |
FLayer lyr = mcm.createLayer(layerName, dataStore); |
|
165 |
theView.getMapControl().getMapContext().getLayers().addLayer(lyr); |
|
166 |
|
|
167 |
} catch (LoadLayerException e) { |
|
168 |
throw new RasterNotLoadException("Error al cargar la capa."); |
|
169 |
} |
|
170 |
theView.getMapControl().getMapContext().invalidate(); |
|
171 |
theView.getMapControl().getMapContext().endAtomicEvent(); |
|
172 |
} |
|
173 |
|
|
174 |
public void interrupted() { |
|
175 |
|
|
176 |
} |
|
177 |
|
|
178 |
public void updateProgress(int current, int total) { |
|
179 |
|
|
180 |
} |
|
181 |
} |
|
0 | 182 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/java/org/gvsig/raster/principalcomponents/app/toolbox/PCToolboxAction.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.principalcomponents.app.toolbox; |
|
27 |
|
|
28 |
import javax.swing.ImageIcon; |
|
29 |
|
|
30 |
import org.gvsig.andami.IconThemeHelper; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.geoprocess.sextante.gui.core.GUIFactory; |
|
33 |
import org.gvsig.i18n.Messages; |
|
34 |
import org.gvsig.raster.principalcomponents.app.PrincipalComponentsTocMenuEntry; |
|
35 |
|
|
36 |
/** |
|
37 |
* Input in Sextante framework for Principal Components tool |
|
38 |
* |
|
39 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
40 |
*/ |
|
41 |
public class PCToolboxAction extends AbstractToolboxAction { |
|
42 |
|
|
43 |
public PCToolboxAction() { |
|
44 |
ImageIcon ico = IconThemeHelper.getImageIcon("gvsig-icon16x16"); |
|
45 |
GUIFactory.registerExternalTool(Messages.getText("gv_tools"), ico, this); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getGroup() { |
|
50 |
return Messages.getText("multispectral"); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public void execute() { |
|
55 |
if(!super.loadLayer()) |
|
56 |
return; |
|
57 |
PrincipalComponentsTocMenuEntry.getSingleton().execute(null, new FLayer[]{lyr}); |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public String getName() { |
|
62 |
return Messages.getText("principalcomponents"); |
|
63 |
} |
|
64 |
|
|
65 |
public ImageIcon getIcon() { |
|
66 |
return (ImageIcon)PrincipalComponentsTocMenuEntry.getSingleton().getIcon(); |
|
67 |
} |
|
68 |
|
|
69 |
public boolean isPluginInstalled() { |
|
70 |
try { |
|
71 |
PrincipalComponentsTocMenuEntry.getSingleton(); |
|
72 |
} catch(Exception e) { |
|
73 |
return false; |
|
74 |
} catch(Error e) { |
|
75 |
return false; |
|
76 |
} |
|
77 |
return true; |
|
78 |
} |
|
79 |
} |
|
0 | 80 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.18/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/java/org/gvsig/raster/principalcomponents/app/toolbox/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.principalcomponents.app.toolbox; |
|
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()) { |
Also available in: Unified diff