Revision 2127 org.gvsig.raster.principalcomponents/trunk/org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.algorithm/src/main/java/org/gvsig/raster/principalcomponents/algorithm/PrincipalComponentsProcess.java
PrincipalComponentsProcess.java | ||
---|---|---|
10 | 10 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
11 | 11 |
import org.gvsig.fmap.dal.coverage.exception.CloneException; |
12 | 12 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
13 |
import org.gvsig.fmap.dal.coverage.exception.ROIException; |
|
13 | 14 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
14 | 15 |
import org.gvsig.i18n.Messages; |
15 | 16 |
import org.gvsig.raster.algorithm.process.DataProcess; |
... | ... | |
30 | 31 |
public static final String BUFFERS = "BUFFERS"; |
31 | 32 |
public static final String SELECTEDPCS = "SELECTEDPCS"; |
32 | 33 |
public static final String PCSTATISTICS = "PCSTATISTICS"; |
33 |
public static final String DATAROI = "DATAROI";
|
|
34 |
public static final String ROI_EPSG = "ROI_EPSG";
|
|
34 | 35 |
public static final String EXTENT = "EXTENT"; |
35 | 36 |
public static final String GRAPHIC_DATA = "GRAPHIC_DATA"; |
36 | 37 |
public static final String BANDS = "BANDS"; |
... | ... | |
40 | 41 |
|
41 | 42 |
private PCStatsDataStructure pcStatistics = null; |
42 | 43 |
private List<ROI> rois = null; |
44 |
private String roiEPSG = null; |
|
43 | 45 |
private Extent extentResult = null; |
44 | 46 |
private boolean[] selectedPCs = null; |
45 | 47 |
private boolean[] bands = null; |
... | ... | |
51 | 53 |
registerInputParameter(RASTER_STORE, RasterDataStore.class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
52 | 54 |
registerInputParameter(PCSTATISTICS, PCStatsDataStructure.class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
53 | 55 |
registerInputParameter(PATH, String.class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
54 |
registerInputParameter(DATAROI, List.class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL);
|
|
56 |
registerInputParameter(ROI_EPSG, String.class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL);
|
|
55 | 57 |
registerInputParameter(SELECTEDPCS, Boolean[].class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
56 | 58 |
registerInputParameter(BANDS, Boolean[].class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
57 | 59 |
|
... | ... | |
59 | 61 |
registerOutputParameter(GRAPHIC_DATA, Double[].class, PrincipalComponentsAlgorithmLibrary.PC_PROCESS_LABEL); |
60 | 62 |
} |
61 | 63 |
|
62 |
@SuppressWarnings("unchecked") |
|
63 | 64 |
public void init() { |
64 | 65 |
store = getParam(RASTER_STORE) != null ? (RasterDataStore)getParam(RASTER_STORE) : null; |
65 | 66 |
filename = getStringParam(PATH); |
66 | 67 |
selectedPCs = (boolean[]) getParam(SELECTEDPCS); |
67 | 68 |
bands = (boolean[]) getParam(BANDS); |
68 | 69 |
pcStatistics = (PCStatsDataStructure) getParam(PCSTATISTICS); |
69 |
rois = getParam(DATAROI) != null ? (List<ROI>) getParam(DATAROI) : null;
|
|
70 |
roiEPSG = getStringParam(ROI_EPSG);
|
|
70 | 71 |
} |
71 | 72 |
|
72 | 73 |
|
... | ... | |
89 | 90 |
if (store == null) |
90 | 91 |
throw new PrincipalComponentsException(Messages.getText("need_a_input")); |
91 | 92 |
|
93 |
if(roiEPSG != null) { |
|
94 |
try { |
|
95 |
rois = store.getRois(roiEPSG); |
|
96 |
} catch (ROIException e2) { |
|
97 |
logger.error(Messages.getText("error_getting_rois"), e2); |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
92 | 101 |
try { |
93 | 102 |
store = ((RasterDataStore)store).cloneDataStore(); |
94 | 103 |
} catch (CloneException e) { |
95 | 104 |
new PrincipalComponentsException("Error cloning the input DataStore", e); |
96 | 105 |
} |
97 | 106 |
|
98 |
extentResult = getExtentResult(rois, store); |
|
107 |
extentResult = getExtentResult(null, rois, store);
|
|
99 | 108 |
Rectangle2D sourcePxBBox = getSourcePxBox(extentResult); |
100 | 109 |
|
101 | 110 |
double cellSize = store.getCellSize(); |
Also available in: Unified diff