Revision 2098

View differences:

org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.api/src/main/java/org/gvsig/raster/principalcomponents/swing/PrincipalComponentsSwingManager.java
1 1
package org.gvsig.raster.principalcomponents.swing;
2 2

  
3 3
import org.gvsig.raster.algorithm.BaseAlgorithmPanel;
4
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure;
4 5

  
5 6
/**
6 7
 * This class is responsible of the management of the library's business logic.
......
12 13
 * @version $Id$
13 14
 */
14 15
public interface PrincipalComponentsSwingManager {
15
	public BaseAlgorithmPanel createPrincipalComponentsPanel(Object inputStore, String layerName, int bandList);
16
	public BaseAlgorithmPanel createPCAMainPanel(Object inputStore, String layerName, int bandList);
17
	
18
	public BaseAlgorithmPanel createPCAComponentsListPanel(Object inputStore, PCStatsDataStructure stats);
16 19
}
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/java/org/gvsig/raster/principalcomponents/swing/impl/DefaultPrincipalComponentsSwingManager.java
1 1
package org.gvsig.raster.principalcomponents.swing.impl;
2 2

  
3
import java.util.List;
4

  
5 3
import org.gvsig.raster.algorithm.BaseAlgorithmPanel;
4
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure;
6 5
import org.gvsig.raster.principalcomponents.swing.PrincipalComponentsSwingManager;
7
import org.gvsig.raster.principalcomponents.swing.impl.main.PrincipalComponentsPanelImpl;
6
import org.gvsig.raster.principalcomponents.swing.impl.main.PCAComponentsListPanelImpl;
7
import org.gvsig.raster.principalcomponents.swing.impl.main.PCAMainPanelImpl;
8 8

  
9 9
/**
10 10
 * Default {@link PrincipalComponentsManager} implementation.
......
24 24
		return internalInstance;
25 25
	}
26 26

  
27
	public BaseAlgorithmPanel createPrincipalComponentsPanel(Object inputStore, String layerName, int bandList) {
28
		return new PrincipalComponentsPanelImpl(inputStore, layerName, bandList);
27
	public BaseAlgorithmPanel createPCAMainPanel(Object inputStore, String layerName, int bandList) {
28
		return new PCAMainPanelImpl(inputStore, layerName, bandList);
29 29
	}
30

  
31
	public BaseAlgorithmPanel createPCAComponentsListPanel(Object inputStore, PCStatsDataStructure stats) {
32
		return new PCAComponentsListPanelImpl(inputStore, stats);
33
	}
30 34
}
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/java/org/gvsig/raster/principalcomponents/swing/impl/main/PCAMainPanelImpl.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.principalcomponents.swing.impl.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.io.File;
28
import java.util.List;
29

  
30
import javax.swing.BorderFactory;
31
import javax.swing.JComponent;
32
import javax.swing.JLabel;
33
import javax.swing.JPanel;
34

  
35
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
36
import org.gvsig.i18n.Messages;
37
import org.gvsig.raster.algorithm.BaseAlgorithmPanel;
38
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary;
39
import org.gvsig.raster.algorithm.process.DataProcess;
40
import org.gvsig.raster.algorithm.process.ProcessException;
41
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary;
42
import org.gvsig.raster.swing.RasterSwingLocator;
43
import org.gvsig.raster.swing.RasterSwingManager;
44
import org.gvsig.raster.swing.newlayer.CreateNewLayerPanel;
45
import org.gvsig.raster.swing.pagedtable.ModelLoader;
46
import org.gvsig.raster.swing.pagedtable.PagedTable;
47

  
48
/**
49
 * @author Nacho Brodin (nachobrodin@gmail.com)
50
 */
51
public class PCAMainPanelImpl extends JPanel implements BaseAlgorithmPanel {
52
	private static final long               serialVersionUID     = 1L;
53
	private String                          layerName            = null;
54
	private CreateNewLayerPanel             newLayerPanel        = null;
55
	private Object                          inputStore           = null;
56
	private PagedTable                      table                = null;
57
	private int                             bandList             = 0;
58
	
59
	public PCAMainPanelImpl(Object inputStore, String layerName, int bandList) {
60
		this.inputStore = inputStore;
61
		this.layerName = layerName;
62
		this.bandList = bandList;
63
		init();
64
	}
65
	
66
	private void init() {
67
		setLayout(new GridBagLayout());
68
		
69
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
70
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
71
		gridBagConstraints1.weightx = 1;
72
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 0);
73
		gridBagConstraints1.gridx = 0;
74
		gridBagConstraints1.gridy = 0;
75
		add(getLayerPanel(), gridBagConstraints1);
76
		
77
		gridBagConstraints1.gridy = 2;
78
		add((JComponent)getCreateNewLayerPanel(), gridBagConstraints1);
79
		
80
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
81
		gridBagConstraints1.gridy = 1;
82
		gridBagConstraints1.weighty = 1;
83
		add(getInputsPanel(), gridBagConstraints1);
84
	}
85
	
86
	private JPanel getLayerPanel() {
87
		JPanel p = new JPanel();
88
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("layer")));
89
		p.setLayout(new GridBagLayout());
90
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
91
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
92
		gridBagConstraints1.weightx = 1;
93
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 2, 0);
94
		
95
		gridBagConstraints1.gridx = 0;
96
		gridBagConstraints1.gridy = 0;
97
		p.add(new JLabel(layerName), gridBagConstraints1);
98
		
99
		return p;
100
	}
101
	
102
	private JPanel getInputsPanel() {
103
		JPanel p = new JPanel();
104
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("bands")));
105
		p.setLayout(new BorderLayout());
106
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
107
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
108
		gridBagConstraints1.weightx = 1;
109
		gridBagConstraints1.weighty = 1;
110
		gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2);
111
		
112
		gridBagConstraints1.gridx = 0;
113
		gridBagConstraints1.gridy = 0;
114
		p.add(getPagedTable().getComponent(), BorderLayout.CENTER);
115
		
116
		return p;
117
	}
118
	
119
	public JComponent getComponent() {
120
		return this;
121
	}
122
	
123
	public PagedTable getPagedTable() {
124
		if(table == null) {
125
			RasterSwingManager manager = RasterSwingLocator.getSwingManager();
126
			String[] columnNames = {
127
					"", 
128
					Messages.getText("bands")};
129
			int[] columnSizes = {30, -1};
130

  
131
			BandTableModel model = new BandTableModel(columnNames);
132
			ModelLoader loader = manager.createModelLoader(model);
133
			CheckBoxColumnRenderer render = new CheckBoxColumnRenderer(null);
134
			CheckBoxColumnEditor editor = new CheckBoxColumnEditor();
135
			loader.setRenderForColumn(0, render);
136
			loader.setCellEditorForColumn(0, editor);
137
			loader.setColumnNames(columnNames);
138
			loader.setColumnWidths(columnSizes);
139
			
140
			table = manager.createPagedTable(loader);
141
			table.showControllerTable(false);
142
			table.showMoveRowsControls(false);
143
		}
144
		return table;
145
	}
146

  
147
	public DataProcess getProcess() throws ProcessException {
148
		DataProcess task = RasterBaseAlgorithmLibrary.getManager().createRasterTask(PrincipalComponentsAlgorithmLibrary.PCS_STATS_PROCESS_LABEL);
149
		List<String> params = task.getRasterTaskInputParameters(PrincipalComponentsAlgorithmLibrary.PCS_STATS_PROCESS_LABEL);
150
		for (int i = 0; i < params.size(); i++) {
151
			String paramName = params.get(i);
152
			Class<?> paramType = task.getParameterTypeByProcess(PrincipalComponentsAlgorithmLibrary.PCS_STATS_PROCESS_LABEL, paramName);
153
			if(paramType == RasterDataStore[].class) {
154
				task.addParam(paramName, new RasterDataStore[]{(RasterDataStore)inputStore});
155
			}
156
			if(paramType == String.class) {
157
				String filename = newLayerPanel.getDirectorySelected() + File.separator + newLayerPanel.getFileSelected();
158
				if(!filename.endsWith(".tif"))
159
					filename += ".tif";
160
				task.addParam(paramName, filename);
161
			}
162
			if(paramType == Boolean[].class) {
163
				boolean[] bands = new boolean[getPagedTable().getRowCount()];
164
				for (int j = 0; j < getPagedTable().getRowCount(); j++) {
165
					Object obj = getPagedTable().getValueAt(j, 0);
166
					if(obj instanceof Boolean)
167
						bands[j] = ((Boolean)obj).booleanValue();
168
				}
169
				task.addParam(paramName, bands);
170
			}
171
		}
172
		return task;
173
	}
174

  
175
	public CreateNewLayerPanel getCreateNewLayerPanel() {
176
		if(newLayerPanel == null) {
177
			newLayerPanel = RasterSwingLocator.getSwingManager().createNewLayerPanel();
178
		}
179
		return newLayerPanel;
180
	}
181

  
182
	public void initialize() {
183
		for (int i = 0; i < bandList; i++) {
184
			getPagedTable().addRow(new Object[]{true, "B" + i});			
185
		}			
186
	}
187

  
188
}
0 189

  
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/java/org/gvsig/raster/principalcomponents/swing/impl/main/ComponentsTableModel.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.raster.principalcomponents.swing.impl.main;
25

  
26
import javax.swing.table.DefaultTableModel;
27

  
28
import org.gvsig.raster.swing.pagedtable.TableModel;
29
/**
30
 * Model for the list of components
31
 * 
32
 * @author Nacho Brodin (nachobrodin@gmail.com)
33
 */
34
public class ComponentsTableModel extends DefaultTableModel implements TableModel {
35
	final private static long serialVersionUID = -3370601314380922368L;
36
	private int               nColumns         = 0;
37

  
38
	public ComponentsTableModel(String[] columnNames) {
39
		super(new Object[0][columnNames.length], columnNames);
40
		this.nColumns = columnNames.length;
41
	}
42

  
43
	public Class<?> getColumnClass(int c) {
44
		return String.class;
45
	}
46

  
47
	public void setValueAt(Object value, int row, int col) {
48
		super.setValueAt(value, row, col);
49
	}
50

  
51
	public void addNew() {
52
		Object[] line = new Object[nColumns];
53
		line[0] = new Boolean(true);
54
		for (int i = 0; i < nColumns; i++)
55
			line[i] = new String("");
56
		super.addRow(line);
57
	}
58

  
59
	public Object[] getNewLine() {
60
		Object[] o = new Object[nColumns];
61
		o[0] = new Boolean(true);
62
		for (int i = 1; i < nColumns; i++)
63
			o[i] = "";
64
		return o;
65
	}
66

  
67
	public void addNewLine() {
68
		// TODO Auto-generated method stub
69
		
70
	}
71
}
0 72

  
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/java/org/gvsig/raster/principalcomponents/swing/impl/main/PCAComponentsListPanelImpl.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.principalcomponents.swing.impl.main;
23

  
24
import java.awt.BorderLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.util.List;
28

  
29
import javax.swing.BorderFactory;
30
import javax.swing.JButton;
31
import javax.swing.JComponent;
32
import javax.swing.JPanel;
33
import javax.swing.JRadioButton;
34

  
35
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
36
import org.gvsig.i18n.Messages;
37
import org.gvsig.raster.algorithm.BaseAlgorithmPanel;
38
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary;
39
import org.gvsig.raster.algorithm.process.DataProcess;
40
import org.gvsig.raster.algorithm.process.ProcessException;
41
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure;
42
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary;
43
import org.gvsig.raster.swing.RasterSwingLocator;
44
import org.gvsig.raster.swing.RasterSwingManager;
45
import org.gvsig.raster.swing.pagedtable.ModelLoader;
46
import org.gvsig.raster.swing.pagedtable.PagedTable;
47

  
48
/**
49
 * @author Nacho Brodin (nachobrodin@gmail.com)
50
 */
51
public class PCAComponentsListPanelImpl extends JPanel implements BaseAlgorithmPanel {
52
	private static final long               serialVersionUID         = 1L;
53
	private Object                          inputStore               = null;
54
	private PagedTable                      table                    = null;
55
	private JRadioButton                    byBandRadioButton        = null;
56
	private JRadioButton                    varCovarRadioButton      = null;
57
	private JRadioButton                    autovectorRadioButton    = null;
58
	private JButton                         generateButton           = null;
59
	private PCStatsDataStructure            stats                    = null;
60
	
61
	public PCAComponentsListPanelImpl(Object inputStore, PCStatsDataStructure stats) {
62
		this.inputStore = inputStore;
63
		this.stats = stats;
64
		init();
65
	}
66
	
67
	private void init() {
68
		setLayout(new GridBagLayout());
69
		
70
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
71
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
72
		gridBagConstraints1.weightx = 1;
73
		gridBagConstraints1.weighty = 1;
74
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 0);
75
		gridBagConstraints1.gridx = 0;
76
		gridBagConstraints1.gridy = 0;
77
		add(getInputsPanel(), gridBagConstraints1);
78
		
79
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
80
		gridBagConstraints1.weighty = 0;
81
		gridBagConstraints1.gridy = 1;
82
		add(getPanelStatistics(), gridBagConstraints1);
83
	}
84
	
85
	public JPanel getPanelStatistics() {
86
		JPanel p = new JPanel();
87
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("statistics")));
88
		p.setLayout(new GridBagLayout());
89
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
90
		gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
91
		gridBagConstraints1.weightx = 1;
92
		gridBagConstraints1.insets = new java.awt.Insets(0, 0, 2, 0);
93
		gridBagConstraints1.gridwidth = 2;
94
		
95
		gridBagConstraints1.gridx = 0;
96
		gridBagConstraints1.gridy = 0;
97
		p.add(getByBandRadioButton(), gridBagConstraints1);
98
		
99
		gridBagConstraints1.gridwidth = 1;
100
		gridBagConstraints1.gridy = 1;
101
		p.add(getVarCovarRadioButton(), gridBagConstraints1);
102
		
103
		gridBagConstraints1.gridwidth = 2;
104
		gridBagConstraints1.gridy = 2;
105
		p.add(getAutovectorRadioButton(), gridBagConstraints1);
106
		
107
		gridBagConstraints1.gridwidth = 1;
108
		gridBagConstraints1.gridx = 1;
109
		gridBagConstraints1.gridy = 1;
110
		p.add(getGenerateButton(), gridBagConstraints1);
111
		
112
		return p;
113
	}
114
	
115
	public JRadioButton getByBandRadioButton() {
116
		if(byBandRadioButton == null)
117
			byBandRadioButton = new JRadioButton(Messages.getText("by_band"));
118
		return byBandRadioButton;
119
	}
120
	
121
	public JRadioButton getVarCovarRadioButton() {
122
		if(varCovarRadioButton == null)
123
			varCovarRadioButton = new JRadioButton(Messages.getText("var_covar"));
124
		return varCovarRadioButton;
125
	}
126
	
127
	public JRadioButton getAutovectorRadioButton() {
128
		if(autovectorRadioButton == null)
129
			autovectorRadioButton = new JRadioButton(Messages.getText("autovector"));
130
		return autovectorRadioButton;
131
	}
132
	
133
	public JButton getGenerateButton() {
134
		if(generateButton == null)
135
			generateButton = new JButton(Messages.getText("generate"));
136
		return generateButton;
137
	}
138
	
139
	private JPanel getInputsPanel() {
140
		JPanel p = new JPanel();
141
		p.setBorder(BorderFactory.createTitledBorder(Messages.getText("components_selection")));
142
		p.setLayout(new BorderLayout());
143
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
144
		gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
145
		gridBagConstraints1.weightx = 1;
146
		gridBagConstraints1.weighty = 1;
147
		gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2);
148
		
149
		gridBagConstraints1.gridx = 0;
150
		gridBagConstraints1.gridy = 0;
151
		p.add(getPagedTable().getComponent(), BorderLayout.CENTER);
152
		
153
		return p;
154
	}
155
	
156
	public JComponent getComponent() {
157
		return this;
158
	}
159
	
160
	public PagedTable getPagedTable() {
161
		if(table == null) {
162
			RasterSwingManager manager = RasterSwingLocator.getSwingManager();
163
			String[] columnNames = {
164
					"", 
165
					"C",
166
					Messages.getText("autovalor"),
167
					"%"};
168
			int[] columnSizes = {30, 35, -1, -1};
169

  
170
			BandTableModel model = new BandTableModel(columnNames);
171
			ModelLoader loader = manager.createModelLoader(model);
172
			CheckBoxColumnRenderer render = new CheckBoxColumnRenderer(null);
173
			CheckBoxColumnEditor editor = new CheckBoxColumnEditor();
174
			loader.setRenderForColumn(0, render);
175
			loader.setCellEditorForColumn(0, editor);
176
			loader.setColumnNames(columnNames);
177
			loader.setColumnWidths(columnSizes);
178
			
179
			table = manager.createPagedTable(loader);
180
			table.showControllerTable(false);
181
			table.showMoveRowsControls(false);
182
		}
183
		return table;
184
	}
185

  
186
	public DataProcess getProcess() throws ProcessException {
187
		DataProcess task = RasterBaseAlgorithmLibrary.getManager().createRasterTask(PrincipalComponentsAlgorithmLibrary.PROCESS_LABEL);
188
		List<String> params = task.getRasterTaskInputParameters(PrincipalComponentsAlgorithmLibrary.PROCESS_LABEL);
189
		for (int i = 0; i < params.size(); i++) {
190
			String paramName = params.get(i);
191
			Class<?> paramType = task.getParameterTypeByProcess(PrincipalComponentsAlgorithmLibrary.PROCESS_LABEL, paramName);
192
			if(paramType == RasterDataStore[].class) {
193
				task.addParam(paramName, new RasterDataStore[]{(RasterDataStore)inputStore});
194
			}
195
			if(paramType == Boolean[].class) {
196
				boolean[] bands = new boolean[getPagedTable().getRowCount()];
197
				for (int j = 0; j < getPagedTable().getRowCount(); j++) {
198
					Object obj = getPagedTable().getValueAt(j, 0);
199
					if(obj instanceof Boolean)
200
						bands[j] = ((Boolean)obj).booleanValue();
201
				}
202
				task.addParam(paramName, bands);
203
			}
204
		}
205
		return task;
206
	}
207

  
208

  
209
	public void initialize() {
210
		double acumulado = 0;
211
		for (int i = 0; i < stats.getAutovalues().length; i++)
212
			acumulado += stats.getAutovalues()[i];
213
		int autova[] = new int[stats.getAutovalues().length];
214
		int cont = stats.getAutovalues().length - 1;
215
		for (int i = 0; i < stats.getAutovalues().length; i++) {
216
			autova[i] = cont;
217
			cont--;
218
		}		
219
		
220
		for (int i = stats.getAutovalues().length-1; i >= 0; i--) {
221
			getPagedTable().addRow(new Object[] {true, 
222
				autova[i],
223
				stats.getAutovalues()[i],
224
				stats.getAutovalues()[i] / acumulado});
225
		}
226
	}
227

  
228
}
0 229

  
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/resources-plugin/org/gvsig/raster/principalcomponents/swing/impl/i18n/text.properties
1
components_selection=Selecci?n de componentes
2
autovalor=Autovalor
3
by_band=Por banda
4
var_covar=Matriz varianza-covarianza
5
autovector=Autovector
6
generate=Generar
7
stats=Estadisticas
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.swing/org.gvsig.raster.principalcomponents.swing.impl/src/main/resources-plugin/org/gvsig/raster/principalcomponents/swing/impl/i18n/text_en.properties
1
components_selection=Component selection
2
autovalor=Eigenvalue
3
by_band=By band
4
var_covar=Matrix variance-covariance
5
autovector=Eigenvector
6
generate=Generate
7
stats=Statistics
org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.app/org.gvsig.raster.principalcomponents.app.client/src/main/java/org/gvsig/raster/principalcomponents/app/PrincipalComponentsExtension.java
20 20
import org.gvsig.raster.algorithm.process.ProcessException;
21 21
import org.gvsig.raster.algorithm.process.ProcessParamsManagement;
22 22
import org.gvsig.raster.fmap.layers.FLyrRaster;
23
import org.gvsig.raster.principalcomponents.algorithm.PCStatsDataStructure;
23 24
import org.gvsig.raster.principalcomponents.algorithm.PrincipalComponentsAlgorithmLibrary;
24 25
import org.gvsig.raster.principalcomponents.swing.PrincipalComponentsSwingLocator;
25 26
import org.gvsig.raster.tools.app.basic.RasterToolsUtil;
......
70 71
    			return;
71 72
    		}
72 73
    		
73
    		panel = PrincipalComponentsSwingLocator.getSwingManager().createPrincipalComponentsPanel(
74
    		panel = PrincipalComponentsSwingLocator.getSwingManager().createPCAMainPanel(
74 75
    				lyr.getDataStore(),
75 76
    				lyr.getName(),
76 77
    				lyr.getDataStore().getBandCount());
......
148 149
		String processName = (String)params.get(ProcessParamsManagement.PROCESS_NAME);
149 150
		if (processName.equals(PrincipalComponentsAlgorithmLibrary.PCS_STATS_PROCESS_LABEL)) {
150 151
			PluginServices.getMDIManager().closeWindow(window);
152
			PCStatsDataStructure stats = (PCStatsDataStructure)params.get("PCStatsDataStructure");
153
			panel = PrincipalComponentsSwingLocator.getSwingManager().createPCAComponentsListPanel(lyr.getDataStore(), stats);
154
			window = new MainWindow(panel.getComponent(), 
155
    				Messages.getText("principal_components"), 
156
    				400, 350, 
157
    				this);
158
    		
159
    		PluginServices.getMDIManager().addCentredWindow(window);
151 160
		}
152 161
		
153 162
		if (processName.equals(PrincipalComponentsAlgorithmLibrary.PROCESS_LABEL)) {

Also available in: Unified diff