Revision 9496
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.78/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.78/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.78/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.78/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.78/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.78/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.78/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.78/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.78/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.78/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.78</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.78/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.78</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.241</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.92</org.gvsig.raster.version> |
|
20 |
<org.gvsig.geoprocess.version>2.2.103</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.78</connection> |
|
43 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.78</developerConnection> |
|
44 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.78</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.78</version> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.raster.principalcomponents.swing.impl</artifactId> |
|
97 |
<version>2.2.78</version> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId> |
|
102 |
<version>2.2.78</version> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId> |
|
107 |
<version>2.2.78</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.78/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/buildNumber.properties | ||
---|---|---|
1 |
#Sun Mar 03 13:40:32 CET 2019 |
|
2 |
buildNumber=86 |
|
0 | 3 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.78/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.78/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/java/org/gvsig/raster/principalcomponents/app/MainWindow.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.awt.BorderLayout; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.JComponent; |
|
28 |
|
|
29 |
import org.gvsig.andami.PluginServices; |
|
30 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
31 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
32 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
33 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* Basic frame for a gvSIG <code>IWindow</code> object. This frame adds buttons |
|
38 |
* of Cancel, Accept and others. |
|
39 |
* |
|
40 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
41 |
*/ |
|
42 |
public class MainWindow extends DefaultButtonsPanel implements IWindow, ActionListener { |
|
43 |
|
|
44 |
private static final long serialVersionUID = -4401123724140025094L; |
|
45 |
private ActionListener listener = null; |
|
46 |
private WindowInfo info = null; |
|
47 |
|
|
48 |
private Object profile = WindowInfo.EDITOR_PROFILE; |
|
49 |
|
|
50 |
public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener) { |
|
51 |
this.listener = actionListener; |
|
52 |
|
|
53 |
setLayout(new BorderLayout()); |
|
54 |
add(panel, BorderLayout.CENTER); |
|
55 |
|
|
56 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setVisible(false); |
|
57 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).addActionListener(this); |
|
58 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(this); |
|
59 |
|
|
60 |
info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE); |
|
61 |
info.setTitle(title); |
|
62 |
info.setWidth(w); |
|
63 |
info.setHeight(h); |
|
64 |
} |
|
65 |
|
|
66 |
public MainWindow(JComponent panel, String title, int w, int h, ActionListener actionListener, boolean closeButton) { |
|
67 |
this.listener = actionListener; |
|
68 |
|
|
69 |
setLayout(new BorderLayout()); |
|
70 |
add(panel, BorderLayout.CENTER); |
|
71 |
|
|
72 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setVisible(false); |
|
73 |
|
|
74 |
if(closeButton) { |
|
75 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setVisible(false); |
|
76 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).setVisible(false); |
|
77 |
getButtonsPanel().addClose(); |
|
78 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_CLOSE).addActionListener(this); |
|
79 |
} else { |
|
80 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).addActionListener(this); |
|
81 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(this); |
|
82 |
} |
|
83 |
|
|
84 |
info = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE); |
|
85 |
info.setTitle(title); |
|
86 |
info.setWidth(w); |
|
87 |
info.setHeight(h); |
|
88 |
} |
|
89 |
|
|
90 |
public WindowInfo getWindowInfo() { |
|
91 |
return info; |
|
92 |
} |
|
93 |
|
|
94 |
public Object getWindowProfile() { |
|
95 |
return profile; |
|
96 |
} |
|
97 |
|
|
98 |
public void actionPerformed(ActionEvent e) { |
|
99 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT)) { |
|
100 |
listener.actionPerformed(e); |
|
101 |
PluginServices.getMDIManager().closeWindow(this); |
|
102 |
} |
|
103 |
|
|
104 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY)) { |
|
105 |
listener.actionPerformed(e); |
|
106 |
} |
|
107 |
|
|
108 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL)) { |
|
109 |
PluginServices.getMDIManager().closeWindow(this); |
|
110 |
} |
|
111 |
|
|
112 |
if(e.getSource() == getButtonsPanel().getButton(ButtonsPanel.BUTTON_CLOSE)) { |
|
113 |
PluginServices.getMDIManager().closeWindow(this); |
|
114 |
} |
|
115 |
} |
|
116 |
} |
|
0 | 117 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.78/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/java/org/gvsig/raster/principalcomponents/app/PrincipalComponentsExtension.java | ||
---|---|---|
1 |
package org.gvsig.raster.principalcomponents.app; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.util.HashMap; |
|
6 |
|
|
7 |
import javax.swing.JPanel; |
|
8 |
|
|
9 |
import org.gvsig.andami.IconThemeHelper; |
|
10 |
import org.gvsig.andami.PluginServices; |
|
11 |
import org.gvsig.andami.plugins.Extension; |
|
12 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
13 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
14 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
15 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
16 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
17 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
|
18 |
import org.gvsig.i18n.Messages; |
|
19 |
import org.gvsig.raster.algorithm.BasicAPISwingPanel; |
|
20 |
import org.gvsig.raster.algorithm.process.DataProcess; |
|
21 |
import org.gvsig.raster.algorithm.process.IProcessActions; |
|
22 |
import org.gvsig.raster.algorithm.process.ProcessParamsManagement; |
|
23 |
import org.gvsig.raster.fmap.layers.*; |
|
24 |
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure; |
|
25 |
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary; |
|
26 |
import org.gvsig.raster.principalcomponents.app.toolbox.ToolboxPCLoader; |
|
27 |
import org.gvsig.raster.principalcomponents.swing.PrincipalComponentsSwingLibrary; |
|
28 |
import org.gvsig.raster.principalcomponents.swing.PrincipalComponentsSwingLocator; |
|
29 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
30 |
import org.gvsig.tools.ToolsLocator; |
|
31 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
32 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
33 |
|
|
34 |
|
|
35 |
public class PrincipalComponentsExtension extends Extension implements ActionListener, IProcessActions { |
|
36 |
private BasicAPISwingPanel mainPanel = null; |
|
37 |
private BasicAPISwingPanel componentsPanel = null; |
|
38 |
private MainWindow windowMainPanel = null; |
|
39 |
private MainWindow windowComponentsPanel = null; |
|
40 |
private MainWindow statisticsPanel = null; |
|
41 |
private FLyrRaster lyr = null; |
|
42 |
private PCStatsDataStructure stats = null; |
|
43 |
|
|
44 |
public void initialize() { |
|
45 |
|
|
46 |
// Adds an entry to the TOC's floating menu to those layers defined in this extension |
|
47 |
|
|
48 |
//ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().add("My_TocActions"); |
|
49 |
//exPoint.append("MyMenuEntry", "", new PrincipalComponentsTocMenuEntry()); |
|
50 |
|
|
51 |
// Adds a new tab to the "add layer" dialog |
|
52 |
|
|
53 |
//AddLayer.addWizard(PrincipalComponentsWizard.class); |
|
54 |
|
|
55 |
// Adds a new button in the raster bar |
|
56 |
// TODO: Remove for providers |
|
57 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
58 |
ExtensionPoint point = extensionPoints.add("GenericToolBarMenu"); |
|
59 |
point.append("PrincipalComponents", "", PrincipalComponentsTocMenuEntry.getSingleton()); |
|
60 |
PrincipalComponentsTocMenuEntry.setExtension(this); |
|
61 |
|
|
62 |
Messages.addResourceFamily("org.gvsig.raster.principalcomponents.app.i18n.text", |
|
63 |
PrincipalComponentsExtension.class.getClassLoader(), |
|
64 |
PrincipalComponentsExtension.class.getClass().getName()); |
|
65 |
|
|
66 |
initilizeIcons(); |
|
67 |
} |
|
68 |
|
|
69 |
public void postInitialize() { |
|
70 |
new ToolboxPCLoader().registerTool(); |
|
71 |
} |
|
72 |
|
|
73 |
public void execute(String actionCommand) { |
|
74 |
if (actionCommand.compareTo("PrincipalComponents") == 0) { |
|
75 |
lyr = getSelectedLayer(); |
|
76 |
if(lyr == null) { |
|
77 |
RasterSwingLibrary.messageBoxError(Messages.getText("layer_not_found"), null); |
|
78 |
return; |
|
79 |
} |
|
80 |
|
|
81 |
String defaultROIEPSG = getFirstMapCtrl().getProjection().getAbrev(); |
|
82 |
|
|
83 |
mainPanel = PrincipalComponentsSwingLocator.getSwingManager().createPCAMainPanel( |
|
84 |
lyr.getDataStore(), |
|
85 |
lyr.getName(), |
|
86 |
lyr.getDataStore().getBandCount(), |
|
87 |
defaultROIEPSG); |
|
88 |
|
|
89 |
windowMainPanel = new MainWindow(mainPanel.getComponent(), |
|
90 |
Messages.getText("principal_components"), |
|
91 |
400, 350, |
|
92 |
this); |
|
93 |
|
|
94 |
PluginServices.getMDIManager().addCentredWindow(windowMainPanel); |
|
95 |
|
|
96 |
mainPanel.initialize(); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Gets the Mapcontrol for the first view found. |
|
102 |
* @return |
|
103 |
*/ |
|
104 |
private MapControl getFirstMapCtrl() { |
|
105 |
IWindow[] windowList = PluginServices.getMDIManager().getOrderedWindows(); |
|
106 |
for (int i = 0; i < windowList.length; i++) { |
|
107 |
if(windowList[i] instanceof IView) { |
|
108 |
return ((IView)windowList[i]).getMapControl(); |
|
109 |
} |
|
110 |
} |
|
111 |
return null; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Gets the selected and valid layer |
|
116 |
* @return |
|
117 |
*/ |
|
118 |
private FLyrRaster getSelectedLayer() { |
|
119 |
|
|
120 |
MapControl firstMapCtrl = getFirstMapCtrl(); |
|
121 |
if (firstMapCtrl != null) { |
|
122 |
FLayer[] lyrList = |
|
123 |
firstMapCtrl.getMapContext().getLayers().getActives(); |
|
124 |
for (int i = 0; i < lyrList.length; i++) { |
|
125 |
if (lyrList[i] instanceof FLyrRaster) |
|
126 |
return (FLyrRaster) lyrList[i]; |
|
127 |
} |
|
128 |
} |
|
129 |
return null; |
|
130 |
} |
|
131 |
|
|
132 |
public boolean isEnabled() { |
|
133 |
FLyrRaster selectedLayer = getSelectedLayer(); |
|
134 |
if (selectedLayer == null) |
|
135 |
return false; |
|
136 |
|
|
137 |
if (!(selectedLayer instanceof ILayerState)) |
|
138 |
return false; |
|
139 |
|
|
140 |
if (!((ILayerState) selectedLayer).isOpen()) |
|
141 |
return false; |
|
142 |
|
|
143 |
if(((FLyrRaster) selectedLayer).getRender().getFilterList().get("colortable") != null) |
|
144 |
return false; |
|
145 |
|
|
146 |
return true; |
|
147 |
} |
|
148 |
|
|
149 |
public boolean isVisible() { |
|
150 |
FLyrRaster selectedLayer = getSelectedLayer(); |
|
151 |
if (selectedLayer == null) { |
|
152 |
return false; |
|
153 |
} |
|
154 |
|
|
155 |
if (!(selectedLayer instanceof IRasterLayerActions)) |
|
156 |
return false; |
|
157 |
|
|
158 |
return ((IRasterLayerActions) selectedLayer).isActionEnabled(IRasterLayerActions.ENHANCED); |
|
159 |
} |
|
160 |
|
|
161 |
void initilizeIcons(){ |
|
162 |
IconThemeHelper.registerIcon(null, "principal-components", this); |
|
163 |
IconThemeHelper.registerIcon(null, "gvsig-icon", this); |
|
164 |
IconThemeHelper.registerIcon(null, "gvsig-icon16x16", this); |
|
165 |
} |
|
166 |
|
|
167 |
public void actionPerformed(ActionEvent e) { |
|
168 |
//ACCEPT MAIN PANEL |
|
169 |
if( e.getSource() == ((DefaultButtonsPanel)windowMainPanel).getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY) || |
|
170 |
e.getSource() == ((DefaultButtonsPanel)windowMainPanel).getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT)) { |
|
171 |
DataProcess task = null; |
|
172 |
try { |
|
173 |
task = (DataProcess)mainPanel.getResult(); |
|
174 |
} catch (Exception e1) { |
|
175 |
RasterSwingLibrary.messageBoxError(Messages.getText("problems_creating_process"), null); |
|
176 |
return; |
|
177 |
} |
|
178 |
task.setActions(this); |
|
179 |
task.init(); |
|
180 |
task.start(); |
|
181 |
} |
|
182 |
|
|
183 |
//GENERATE STATISTICS BUTTON |
|
184 |
if( componentsPanel != null && |
|
185 |
PrincipalComponentsSwingLibrary.GENERATE_STATIST == componentsPanel.getComponentIDByObject(e.getSource())) { |
|
186 |
try { |
|
187 |
Object[] result = (Object[])componentsPanel.getResult(); |
|
188 |
JPanel statsPanel = PrincipalComponentsSwingLocator.getSwingManager().createStatisticsPanel( |
|
189 |
stats, |
|
190 |
(Boolean)result[1], |
|
191 |
(Boolean)result[2], |
|
192 |
(Boolean)result[3]); |
|
193 |
statisticsPanel = new MainWindow(statsPanel, |
|
194 |
Messages.getText("stats"), |
|
195 |
800, 500, |
|
196 |
this, |
|
197 |
true); |
|
198 |
|
|
199 |
PluginServices.getMDIManager().addWindow(statisticsPanel); |
|
200 |
} catch (Exception e1) { |
|
201 |
RasterSwingLibrary.messageBoxError(Messages.getText("problems_creating_process"), null); |
|
202 |
return; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 |
//ACCEPT COMPONENTS PANEL |
|
207 |
if( windowComponentsPanel != null && |
|
208 |
(e.getSource() == ((DefaultButtonsPanel)windowComponentsPanel).getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY) || |
|
209 |
e.getSource() == ((DefaultButtonsPanel)windowComponentsPanel).getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT))) { |
|
210 |
DataProcess task = null; |
|
211 |
try { |
|
212 |
Object[] result = (Object[])componentsPanel.getResult(); |
|
213 |
task = (DataProcess)result[0]; |
|
214 |
task.setActions(new ProcessEndActions(windowComponentsPanel, lyr)); |
|
215 |
task.init(); |
|
216 |
task.start(); |
|
217 |
} catch (Exception e1) { |
|
218 |
RasterSwingLibrary.messageBoxError(Messages.getText("problems_creating_process"), null); |
|
219 |
return; |
|
220 |
} |
|
221 |
} |
|
222 |
} |
|
223 |
|
|
224 |
@SuppressWarnings("unchecked") |
|
225 |
public void end(Object param) { |
|
226 |
HashMap<String, Object> params = (HashMap<String, Object>)param; |
|
227 |
String processName = (String)params.get(ProcessParamsManagement.PROCESS_NAME); |
|
228 |
|
|
229 |
//END STATISTICS PROCESS (after accept main dialog) |
|
230 |
if (processName.equals(PrincipalComponentsAlgorithmLibrary.PC_STATS_PROCESS_LABEL)) { |
|
231 |
PluginServices.getMDIManager().closeWindow(windowMainPanel); |
|
232 |
stats = (PCStatsDataStructure)params.get("STATS_RESULT"); |
|
233 |
String fileName = (String)params.get("PATH"); |
|
234 |
boolean[] bands = (boolean[])params.get("BANDS"); |
|
235 |
String rois = (String)params.get("ROI_EPSG"); |
|
236 |
|
|
237 |
componentsPanel = PrincipalComponentsSwingLocator.getSwingManager().createPCAComponentsListPanel( |
|
238 |
lyr.getDataStore(), |
|
239 |
stats, |
|
240 |
fileName, |
|
241 |
bands, |
|
242 |
rois); |
Also available in: Unified diff