Revision 223 org.gvsig.geoprocess/trunk/org.gvsig.geoprocess/org.gvsig.geoprocess.lib/org.gvsig.geoprocess.lib.sextante/src/main/java/org/gvsig/geoprocess/lib/sextante/AbstractSextanteGeoProcess.java
AbstractSextanteGeoProcess.java | ||
---|---|---|
21 | 21 |
*/ |
22 | 22 |
package org.gvsig.geoprocess.lib.sextante; |
23 | 23 |
|
24 |
import java.util.HashMap; |
|
24 | 25 |
import java.util.Iterator; |
25 | 26 |
|
26 | 27 |
import es.unex.sextante.core.GeoAlgorithm; |
28 |
import es.unex.sextante.core.ITaskMonitor; |
|
29 |
import es.unex.sextante.core.OutputFactory; |
|
27 | 30 |
import es.unex.sextante.core.Sextante; |
28 | 31 |
import es.unex.sextante.dataObjects.IVectorLayer; |
29 | 32 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
... | ... | |
48 | 51 |
GeoProcess { |
49 | 52 |
|
50 | 53 |
protected String[] attrNames = null; |
51 |
private int nSteps = 0;
|
|
54 |
private SimpleTaskStatusDelegated status;
|
|
52 | 55 |
|
56 |
@Override |
|
57 |
public boolean execute(ITaskMonitor task, OutputFactory outputFactory, |
|
58 |
HashMap<String, String> outputMap) |
|
59 |
throws GeoAlgorithmExecutionException { |
|
60 |
status = new SimpleTaskStatusDelegated(m_Task, getGeoProcessName()); |
|
61 |
status.add(); |
|
62 |
boolean result = false; |
|
63 |
try { |
|
64 |
result = super.execute(task, outputFactory, outputMap); |
|
65 |
} finally { |
|
66 |
status.remove(); |
|
67 |
} |
|
68 |
return result; |
|
69 |
} |
|
70 |
|
|
53 | 71 |
/** |
54 | 72 |
* Builds the output FeatureStore |
55 | 73 |
* |
... | ... | |
248 | 266 |
return (getShapeType(store) == Geometry.TYPES.CURVE || getShapeType(store) == Geometry.TYPES.MULTICURVE); |
249 | 267 |
} |
250 | 268 |
|
251 |
public void setProgress(int iStep) {
|
|
252 |
super.setProgress(iStep, nSteps);
|
|
269 |
public String getGeoProcessName() {
|
|
270 |
return getName();
|
|
253 | 271 |
} |
254 | 272 |
|
255 |
public void setTotalNumberOfSteps(int nSteps) { |
|
256 |
this.nSteps = nSteps; |
|
273 |
@Override |
|
274 |
protected void setProgressText(String sText) { |
|
275 |
getStatus().message(sText); |
|
257 | 276 |
} |
258 | 277 |
|
278 |
@Override |
|
279 |
protected boolean setProgress(int iStep, int iTotalNumberOfSteps) { |
|
280 |
SimpleTaskStatusDelegated status = getStatus(); |
|
281 |
status.setRangeOfValues(0, iTotalNumberOfSteps); |
|
282 |
status.setCurValue(iStep); |
|
283 |
return status.isCancelled(); |
|
284 |
} |
|
285 |
|
|
286 |
protected SimpleTaskStatusDelegated getStatus() { |
|
287 |
return status; |
|
288 |
} |
|
289 |
|
|
259 | 290 |
} |
Also available in: Unified diff