Revision 251 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 | ||
---|---|---|
26 | 26 |
import java.util.HashMap; |
27 | 27 |
import java.util.Iterator; |
28 | 28 |
|
29 |
import es.unex.sextante.core.GeoAlgorithm; |
|
30 |
import es.unex.sextante.core.ITaskMonitor; |
|
31 |
import es.unex.sextante.core.OutputFactory; |
|
32 |
import es.unex.sextante.core.Sextante; |
|
33 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
34 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
35 |
import es.unex.sextante.exceptions.UnsupportedOutputChannelException; |
|
36 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
37 |
|
|
38 | 29 |
import org.gvsig.fmap.dal.exception.DataException; |
39 | 30 |
import org.gvsig.fmap.dal.exception.ReadException; |
40 | 31 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
32 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
41 | 33 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
42 | 34 |
import org.gvsig.fmap.dal.feature.FeatureType; |
43 | 35 |
import org.gvsig.fmap.geom.Geometry; |
36 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
37 |
import org.gvsig.fmap.geom.GeometryManager; |
|
38 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
39 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
40 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
41 |
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsEnvelopeEvaluator; |
|
44 | 42 |
import org.gvsig.geoprocess.lib.api.GeoProcess; |
45 | 43 |
import org.gvsig.geoprocess.lib.api.GeoProcessLocator; |
46 | 44 |
import org.gvsig.geoprocess.lib.api.GeoProcessManager; |
47 | 45 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FlyrVectIVectorLayer; |
48 | 46 |
|
47 |
import es.unex.sextante.core.AnalysisExtent; |
|
48 |
import es.unex.sextante.core.GeoAlgorithm; |
|
49 |
import es.unex.sextante.core.ITaskMonitor; |
|
50 |
import es.unex.sextante.core.OutputFactory; |
|
51 |
import es.unex.sextante.core.Sextante; |
|
52 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
53 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
54 |
import es.unex.sextante.exceptions.UnsupportedOutputChannelException; |
|
55 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
56 |
|
|
49 | 57 |
/** |
50 | 58 |
* Base implementation for Sextante based {@link GeoProcess} objects. |
51 | 59 |
* |
52 | 60 |
* @author gvSIG Team |
53 | 61 |
* @version $Id$ |
54 | 62 |
*/ |
55 |
public abstract class AbstractSextanteGeoProcess extends GeoAlgorithm implements |
|
56 |
GeoProcess { |
|
63 |
public abstract class AbstractSextanteGeoProcess extends GeoAlgorithm implements GeoProcess { |
|
64 |
protected String[] attrNames = null; |
|
65 |
private SimpleTaskStatusDelegated status = null; |
|
66 |
protected GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
57 | 67 |
|
58 |
protected String[] attrNames = null; |
|
59 |
private SimpleTaskStatusDelegated status; |
|
60 |
|
|
61 | 68 |
@Override |
62 | 69 |
public boolean execute(ITaskMonitor task, OutputFactory outputFactory, |
63 | 70 |
HashMap<String, String> outputMap) |
... | ... | |
323 | 330 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
324 | 331 |
return null; |
325 | 332 |
} |
333 |
|
|
334 |
/** |
|
335 |
* Gets a feature query using the analysis bounding box |
|
336 |
* @param e |
|
337 |
* @param store |
|
338 |
* @return |
|
339 |
* @throws CreateEnvelopeException |
|
340 |
* @throws DataException |
|
341 |
*/ |
|
342 |
public FeatureQuery getQueryFromAnalysisExtent(AnalysisExtent e, FeatureStore store) throws CreateEnvelopeException, DataException { |
|
343 |
Envelope analysisEnvelope = geomManager.createEnvelope(e.getXMin(), e.getYMin(), e.getXMax(), e.getYMax(), SUBTYPES.GEOM2D); |
|
344 |
String geomName = store.getDefaultFeatureType().getDefaultGeometryAttributeName(); |
|
345 |
FeatureQuery query = store.createFeatureQuery(); |
|
346 |
IntersectsEnvelopeEvaluator filter = new IntersectsEnvelopeEvaluator( |
|
347 |
analysisEnvelope, |
|
348 |
store.getDefaultFeatureType().getDefaultSRS(), |
|
349 |
store.getDefaultFeatureType(), |
|
350 |
geomName); |
|
351 |
query.setFilter(filter); |
|
352 |
return query; |
|
353 |
} |
|
354 |
|
|
326 | 355 |
} |
Also available in: Unified diff