Revision 202 org.gvsig.toolbox/trunk/org.gvsig.toolbox/org.gvsig.toolbox.algorithm/src/main/java/es/unex/sextante/vectorTools/boundingbox/BoundingBoxAlgorithm.java

View differences:

BoundingBoxAlgorithm.java
15 15
import es.unex.sextante.exceptions.RepeatedParameterNameException;
16 16
import es.unex.sextante.outputs.OutputVectorLayer;
17 17

  
18
import org.gvsig.tools.exception.BaseException;
18 19

  
20

  
19 21
public class BoundingBoxAlgorithm
20 22
         extends
21 23
            GeoAlgorithm {
......
34 36
         layerIn.addFilter(new BoundingBoxFilter(m_AnalysisExtent));
35 37
      }
36 38

  
37
      final IVectorLayer result = getNewVectorLayer(RESULT, Sextante.getText("Bounding Box"), IVectorLayer.SHAPE_TYPE_POLYGON,
38
               layerIn.getFieldTypes(), layerIn.getFieldNames());
39
      int subtype;
40
    try {
41
        subtype = layerIn.getSubType();
42
    } catch (BaseException e) {
43
        subtype = org.gvsig.fmap.geom.Geometry.SUBTYPES.UNKNOWN;
44
    }
45
      IVectorLayer result;
46
        result = getNewVectorLayer(RESULT, Sextante.getText("Bounding Box"), IVectorLayer.SHAPE_TYPE_POLYGON,
47
                   layerIn.getFieldTypes(), layerIn.getFieldNames(), subtype);
39 48

  
40 49
      final IFeatureIterator iter = layerIn.iterator();
41 50
      final int iTotal = layerIn.getShapesCount();
......
60 69
      setUserCanDefineAnalysisExtent(true);
61 70

  
62 71
      try {
63
         m_Parameters.addInputVectorLayer(LAYER, Sextante.getText("Layer"), AdditionalInfoVectorLayer.SHAPE_TYPE_ANY, true);
72
            m_Parameters.addInputVectorLayer(
73
                LAYER,
74
                Sextante.getText("Layer"),
75
                new AdditionalInfoVectorLayer(
76
                    true,
77
                    AdditionalInfoVectorLayer.MASK_SHAPE_TYPE_LINE | AdditionalInfoVectorLayer.MASK_SHAPE_TYPE_POLYGON
78
                )
79
            );
64 80
         addOutputVectorLayer(RESULT, Sextante.getText("Bounding_Box"), OutputVectorLayer.SHAPE_TYPE_POLYGON);
65 81
      }
66 82
      catch (final RepeatedParameterNameException e) {
......
71 87

  
72 88

  
73 89
   private Geometry getBBox(final Geometry geometry) {
74

  
75 90
      return geometry.getEnvelope();
76

  
77 91
   }
78 92

  
79 93
}

Also available in: Unified diff