Revision 10052

View differences:

org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.85/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.85/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.85/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.85/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.85/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.85/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.85/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.85/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&#243;n" type="0">
6
		<image description="" file="">
7
		</image>
8
	</element>
9
	<element name="ADDITIONAL_INFO" text=""
10
		description="Informaci&#243;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.85/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&#243;n" type="0">
6
		<image description="" file="">
7
		</image>
8
	</element>
9
	<element name="ADDITIONAL_INFO" text=""
10
		description="Informaci&#243;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.85/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.85</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.85/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.85</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.250</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.99</org.gvsig.raster.version>
20
            <org.gvsig.geoprocess.version>2.2.110</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.85</connection>
43
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.85</developerConnection>
44
        <url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.85</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.85</version>
93
			</dependency>
94
			<dependency>
95
				<groupId>org.gvsig</groupId>
96
				<artifactId>org.gvsig.raster.principalcomponents.swing.impl</artifactId>
97
				<version>2.2.85</version>
98
			</dependency>
99
			<dependency>
100
				<groupId>org.gvsig</groupId>
101
				<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId>
102
				<version>2.2.85</version>
103
			</dependency>
104
 			<dependency>
105
				<groupId>org.gvsig</groupId>
106
				<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId>
107
				<version>2.2.85</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.85/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/pom.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2

  
3
<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/maven-v4_0_0.xsd">
4
	<modelVersion>4.0.0</modelVersion>
5
	<artifactId>org.gvsig.raster.principalcomponents.app.principalcomponentsclient</artifactId>
6
	<packaging>jar</packaging>
7
	<name>Principal components</name>
8
	<description>Principal components for remote sensing images</description>
9
	<parent>
10
		<groupId>org.gvsig</groupId>
11
		<artifactId>org.gvsig.raster.principalcomponents</artifactId>
12
		<version>2.2.85</version>
13
	</parent>
14
	<dependencies>
15
		<dependency>
16
			<groupId>org.gvsig</groupId>
17
			<artifactId>org.gvsig.raster.app.common</artifactId>
18
			<scope>compile</scope>
19
		</dependency>
20
		<dependency>
21
			<groupId>org.gvsig</groupId>
22
			<artifactId>org.gvsig.raster.principalcomponents.swing.api</artifactId>
23
			<scope>compile</scope>
24
		</dependency>
25
		<dependency>
26
			<groupId>org.gvsig</groupId>
27
			<artifactId>org.gvsig.raster.principalcomponents.swing.impl</artifactId>
28
			<scope>runtime</scope>
29
		</dependency>
30
		<dependency>
31
			<groupId>org.gvsig</groupId>
32
			<artifactId>org.gvsig.raster.principalcomponents.algorithm</artifactId>
33
			<scope>compile</scope>
34
		</dependency>
35
		<dependency>
36
			<groupId>org.gvsig</groupId>
37
			<artifactId>org.gvsig.raster.principalcomponents.toolbox.algorithm</artifactId>
38
			<scope>runtime</scope>
39
		</dependency>
40
		<dependency>
41
			<groupId>org.gvsig</groupId>
42
			<artifactId>org.gvsig.app.mainplugin</artifactId>
43
			<scope>compile</scope>
44
		</dependency>
45
		<dependency>
46
			<groupId>org.gvsig</groupId>
47
			<artifactId>org.gvsig.raster.lib.api</artifactId>
48
			<scope>compile</scope>
49
		</dependency>
50
		<dependency>
51
			<groupId>org.gvsig</groupId>
52
			<artifactId>org.gvsig.raster.lib.impl</artifactId>
53
			<scope>runtime</scope>
54
		</dependency>
55
		<dependency>
56
			<groupId>org.gvsig</groupId>
57
			<artifactId>org.gvsig.raster.fmap</artifactId>
58
			<scope>compile</scope>
59
		</dependency>
60
		<dependency>
61
			<groupId>org.gvsig</groupId>
62
			<artifactId>org.gvsig.fmap.control</artifactId>
63
			<scope>compile</scope>
64
		</dependency>
65
		<dependency>
66
			<groupId>org.gvsig</groupId>
67
			<artifactId>org.gvsig.utils</artifactId>
68
			<scope>compile</scope>
69
		</dependency>
70
		<dependency>
71
			<groupId>org.gvsig</groupId>
72
			<artifactId>org.gvsig.ui</artifactId>
73
			<scope>compile</scope>
74
		</dependency>
75
		<dependency>
76
			<groupId>org.gvsig</groupId>
77
			<artifactId>org.gvsig.symbology.lib.impl</artifactId>
78
			<scope>compile</scope>
79
		</dependency>
80
		<dependency>
81
			<groupId>org.gvsig</groupId>
82
			<artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
83
			<scope>compile</scope>
84
		</dependency>		
85
		<dependency>
86
            <groupId>org.gvsig</groupId>
87
            <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
88
            <scope>compile</scope>
89
        </dependency>
90
        <dependency>
91
            <groupId>org.gvsig</groupId>
92
            <artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
93
            <scope>runtime</scope>
94
        </dependency>
95
		<dependency>
96
            <groupId>org.gvsig</groupId>
97
            <artifactId>org.gvsig.projection.api</artifactId>
98
            <scope>compile</scope>
99
        </dependency>
100
        <dependency>
101
            <groupId>org.gvsig</groupId>
102
            <artifactId>org.gvsig.projection.cresques.impl</artifactId>
103
            <scope>runtime</scope>
104
        </dependency>
105
        <dependency>
106
            <groupId>org.gvsig</groupId>
107
            <artifactId>org.gvsig.compat.api</artifactId>
108
            <scope>compile</scope>
109
        </dependency>
110
        <dependency>
111
            <groupId>org.gvsig</groupId>
112
            <artifactId>org.gvsig.compat.se</artifactId>
113
            <scope>compile</scope>
114
        </dependency>
115
        <dependency>
116
            <groupId>org.gvsig</groupId>
117
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
118
            <scope>compile</scope>
119
        </dependency>
120
        <dependency>
121
            <groupId>org.gvsig</groupId>
122
            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
123
            <scope>compile</scope>
124
        </dependency>
125
        <dependency>
126
            <groupId>org.gvsig</groupId>
127
            <artifactId>org.gvsig.fmap.dal.file.lib</artifactId>
128
            <scope>compile</scope>
129
        </dependency>
130
        <dependency>
131
            <groupId>org.gvsig</groupId>
132
            <artifactId>org.gvsig.fmap.dal.spi</artifactId>
133
            <scope>compile</scope>
134
        </dependency>
135
        <dependency>
136
            <groupId>org.gvsig</groupId>
137
            <artifactId>org.gvsig.fmap.geometry.api</artifactId>
138
            <scope>compile</scope>
139
        </dependency>
140
    <!--
141
        <dependency>
142
            <groupId>org.gvsig</groupId>
143
            <artifactId>org.gvsig.fmap.geometry.generalpath</artifactId>
144
            <scope>runtime</scope>
145
        </dependency>
146
        <dependency>
147
            <groupId>org.gvsig</groupId>
148
            <artifactId>org.gvsig.fmap.geometry.operation</artifactId>
149
            <scope>runtime</scope>
150
        </dependency>
151
    -->
152
        <dependency>
153
			<groupId>org.gvsig</groupId>
154
			<artifactId>org.gvsig.geoprocess.lib.sextante</artifactId>
155
			<scope>compile</scope>
156
		</dependency>
157
		<dependency>
158
			<groupId>org.gvsig</groupId>
159
			<artifactId>org.gvsig.geoprocess.app.mainplugin</artifactId>
160
			<scope>compile</scope>
161
		</dependency>
162
	</dependencies>
163
	<properties>
164
		<gvsig.package.info.state>final</gvsig.package.info.state>
165
		<gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.mainplugin -ge 2</gvsig.package.info.dependencies>
166
		<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL>
167
		<gvsig.package.info.categories>OGC,Remote Services,Raster</gvsig.package.info.categories>
168
		<gvsig.package.info.official>true</gvsig.package.info.official>
169
	</properties>
170
</project>
0 171

  
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.85/org.gvsig.raster.principalcomponents.app.principalcomponentsclient/buildNumber.properties
1
#Wed Oct 16 00:21:31 CEST 2019
2
buildNumber=93
0 3

  
org.gvsig.raster.principalcomponents/tags/org.gvsig.raster.principalcomponents-2.2.85/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.85/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.85/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

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff