Revision 10131
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86/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.86/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.86/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.86/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.86/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.86/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.86/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.86/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.86/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.86/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.86</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.86/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.86</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.251</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.100</org.gvsig.raster.version> |
|
20 |
<org.gvsig.geoprocess.version>2.2.111</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.86</connection> |
|
43 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86</developerConnection> |
|
44 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86</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.86</version> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.gvsig</groupId> |
|
96 |
<artifactId>org.gvsig.raster.principalcomponents.swing.impl</artifactId> |
|
97 |
<version>2.2.86</version> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId> |
|
102 |
<version>2.2.86</version> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId> |
|
107 |
<version>2.2.86</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.86/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.raster.mainplugin" /> |
|
4 |
|
|
5 |
<depends plugin-name="org.gvsig.geoprocess.app.mainplugin" optional="true" /> |
|
6 |
<depends plugin-name="org.gvsig.geoprocess.app.algorithm" optional="true" /> |
|
7 |
|
|
8 |
<resourceBundle name="text"/> |
|
9 |
<libraries library-dir="lib"/> |
|
10 |
<extensions> |
|
11 |
<extension class-name="org.gvsig.raster.principalcomponents.app.PrincipalComponentsExtension" |
|
12 |
description="" |
|
13 |
active="true" |
|
14 |
priority="1"> |
|
15 |
|
|
16 |
<menu text="Layer/multispectral/principal_components" |
|
17 |
name="PrincipalComponents"/> |
|
18 |
|
|
19 |
<action |
|
20 |
name="PrincipalComponents" |
|
21 |
label="principal_components" |
|
22 |
action-command="PrincipalComponents" |
|
23 |
icon="principal-components" |
|
24 |
position="000601600" |
|
25 |
accelerator="" |
|
26 |
/> |
|
27 |
</extension> |
|
28 |
</extensions> |
|
29 |
</plugin-config> |
|
0 | 30 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/resources-plugin/org/gvsig/raster/principalcomponents/app/i18n/text_en.properties | ||
---|---|---|
1 |
principalcomponents=Principal components |
|
2 |
layer_not_found=There is not selected a valid layer |
|
3 |
problems_creating_process=The process has not be created |
|
4 |
gv_tools=gvSIG Tools |
|
5 |
group_tools=Tools for raster layers |
|
6 |
raster_layer_not_active=This tool needs a raster layer selected in the view |
|
7 |
multispectral=Multispectral raster |
|
0 | 8 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/src/main/resources-plugin/org/gvsig/raster/principalcomponents/app/i18n/text.properties | ||
---|---|---|
1 |
principalcomponents=Componentes principales |
|
2 |
layer_not_found=No hay seleccionada una capa v?lida |
|
3 |
problems_creating_process=No se ha podido crear el proceso |
|
4 |
gv_tools=gvSIG Herramientas |
|
5 |
group_tools=Capas raster |
|
6 |
raster_layer_not_active=Esta herramienta necesita una capa raster seleccionada en la vista |
|
7 |
multispectral=Raster multiespectral |
|
0 | 8 |
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.86/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.86/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 |
|
Also available in: Unified diff