示例#1
0
 /**
  * It retrieves the features falling into the query condition. If the filter is not changed from
  * the previous filter and the layer is not marked to be forcibly refreshed, it does not ask for
  * features from the server, but it returns the former ones
  *
  * @param query The query (geotools) used to filter features
  * @return
  * @throws IOException
  */
 @Override
 public PojoFeatureCollection getFeatures(Query query) throws IOException {
   Filter filter = query.getFilter();
   if (filter == null) {
     throw new UnsupportedOperationException(GisMessage.GENERAL_EXCEPTION_FILTER_NOTFOUND);
   }
   if (!(filter instanceof org.opengis.filter.spatial.BBOX)) {
     throw new UnsupportedOperationException(GisMessage.GENERAL_EXCEPTION_TYPE_NOTSUPPORTED);
   }
   org.opengis.filter.spatial.BBOX bboxFilter = (org.opengis.filter.spatial.BBOX) filter;
   org.geotools.filter.LiteralExpressionImpl literalExpression =
       (org.geotools.filter.LiteralExpressionImpl) bboxFilter.getExpression2();
   Geometry filteringGeometry = (Geometry) literalExpression.getValue();
   Envelope boundingBox = (Envelope) filteringGeometry.getEnvelopeInternal();
   double west = boundingBox.getMinX();
   double east = boundingBox.getMaxX();
   double south = boundingBox.getMinY();
   double north = boundingBox.getMaxY();
   this.ModifyFeatureCollection(west, south, east, north);
   return this.collection;
 }