Revision 1308
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.algorithm/org.gvsig.raster.tools.algorithm.maskthreshold/src/main/java/org/gvsig/raster/tools/algorithm/maskthreshold/MaskthresholdProcess.java | ||
---|---|---|
78 | 78 |
* @author Nacho Brodin nachobrodin@gmail.com |
79 | 79 |
*/ |
80 | 80 |
public class MaskthresholdProcess extends RasterProcess { |
81 |
//Possible input parameters |
|
81 | 82 |
public static String RASTER_STORE1 = "RasterStore1"; |
82 | 83 |
public static String RASTER_STORE2 = "RasterStore2"; |
83 | 84 |
public static String RASTER_STORE3 = "RasterStore3"; |
... | ... | |
87 | 88 |
public static String BAND1 = "Band1"; |
88 | 89 |
public static String BAND2 = "Band2"; |
89 | 90 |
public static String BAND3 = "Band3"; |
90 |
|
|
91 | 91 |
public static String THRESHOLD = "Threshold"; |
92 | 92 |
public static String FIXED_VALUE = "FixedValue"; |
93 | 93 |
public static String OPERATION = "Operation"; |
94 | 94 |
public static String SATISFY_METHOD = "Satisfy_Method"; |
95 |
public static String PATH = "Path"; |
|
95 | 96 |
|
96 |
public static String PATH = "Path"; |
|
97 |
//Possible output parameters |
|
98 |
public static String BUFFER = "Buffer"; |
|
97 | 99 |
public static String FILENAME = "FileName"; |
98 | 100 |
public static String TIME = "Time"; |
99 | 101 |
|
... | ... | |
114 | 116 |
private int band3 = 0; //-1 All |
115 | 117 |
private int resultNumBands = 0; |
116 | 118 |
|
117 |
private String filename = null; |
|
119 |
private String filename = null; //If is null only returns a buffer
|
|
118 | 120 |
private double threshold = 0; |
119 | 121 |
private double fixedValue = 0; |
120 | 122 |
private NoData nodata = null; |
... | ... | |
123 | 125 |
private AbstractOperation opNotSatisfy = null; |
124 | 126 |
private long milis = 0; |
125 | 127 |
private int percent = 0; |
128 |
private Buffer resultBuffer = null; |
|
126 | 129 |
|
127 |
|
|
128 | 130 |
public static void registerParameters() { |
129 | 131 |
RASTER_STORE1 = RasterBaseAlgorithmLibrary.registerInputParameter(RASTER_STORE1, RasterDataStore.class); |
130 | 132 |
RASTER_STORE2 = RasterBaseAlgorithmLibrary.registerInputParameter(RASTER_STORE2, RasterDataStore.class); |
... | ... | |
146 | 148 |
|
147 | 149 |
PATH = RasterBaseAlgorithmLibrary.registerInputParameter(PATH, String.class); |
148 | 150 |
FILENAME = RasterBaseAlgorithmLibrary.registerOutputParameter(FILENAME, String.class); |
151 |
BUFFER = RasterBaseAlgorithmLibrary.registerOutputParameter(BUFFER, Buffer.class); |
|
149 | 152 |
} |
150 | 153 |
|
151 | 154 |
/* |
... | ... | |
231 | 234 |
else |
232 | 235 |
checkBuffer(); |
233 | 236 |
|
234 |
Buffer resultBuffer = null; |
|
235 | 237 |
Rectangle2D[] pxBBox = null; |
236 | 238 |
|
237 | 239 |
if(inputStore != null) { |
... | ... | |
262 | 264 |
|
263 | 265 |
write(resultBuffer, pxBBox); |
264 | 266 |
|
265 |
exportRaster(filename, resultBuffer, inputStore.getCellSize(), |
|
266 |
inputStore.getExtent().getULX(), inputStore.getExtent().getULY()); |
|
267 |
|
|
267 |
if(filename != null) |
|
268 |
exportRaster(filename, resultBuffer, inputStore.getCellSize(), |
|
269 |
inputStore.getExtent().getULX(), inputStore.getExtent().getULY()); |
|
270 |
|
|
268 | 271 |
if(result != 0) { |
269 | 272 |
if (incrementableTask != null) { |
270 | 273 |
incrementableTask.processFinalize(); |
... | ... | |
282 | 285 |
if (externalActions != null) { |
283 | 286 |
HashMap<String, Object> map = new HashMap<String, Object>(); |
284 | 287 |
map.put(FILENAME, filename); |
288 |
map.put(BUFFER, resultBuffer); |
|
285 | 289 |
map.put(TIME, new Long(milis)); |
286 | 290 |
externalActions.end(map); |
287 | 291 |
} |
... | ... | |
334 | 338 |
throw new MaskthresholdException("Not valid parameters. Layer method have output data store"); |
335 | 339 |
|
336 | 340 |
if (inputBuffer == null) |
337 |
throw new MaskthresholdException("Layer not valir");
|
|
341 |
throw new MaskthresholdException("Layer not valid");
|
|
338 | 342 |
|
339 | 343 |
if(outputBuffer != null && |
340 | 344 |
((inputBuffer.getWidth() != outputBuffer.getWidth()) || |
... | ... | |
441 | 445 |
public Object getResult() { |
442 | 446 |
HashMap<String, Object> map = new HashMap<String, Object>(); |
443 | 447 |
map.put(FILENAME, filename); |
448 |
map.put(BUFFER, resultBuffer); |
|
444 | 449 |
map.put(TIME, new Long(milis)); |
445 | 450 |
return map; |
446 | 451 |
} |
Also available in: Unified diff