@Test
  public void testBBox3D() throws Exception {
    BBOX bbox = ff.bbox("location", new ReferencedEnvelope3D(0, 10, 20, 50, 60, 70, null));

    assertTrue(bbox instanceof BBOX3DImpl);
    BBOX3DImpl bbox3d = (BBOX3DImpl) bbox;

    Filter unrolled = (Filter) bbox.accept(visitor, null);

    assertTrue(unrolled instanceof BBOX3DImpl);
    BBOX3DImpl unrolled3d = (BBOX3DImpl) unrolled;
    assertEquals(bbox3d.getMinX(), unrolled3d.getMinX(), 0.0);
    assertEquals(bbox3d.getMaxX(), unrolled3d.getMaxX(), 0.0);
    assertEquals(bbox3d.getMinY(), unrolled3d.getMinY(), 0.0);
    assertEquals(bbox3d.getMaxY(), unrolled3d.getMaxY(), 0.0);
    assertEquals(bbox3d.getMinZ(), unrolled3d.getMinZ(), 0.0);
    assertEquals(bbox3d.getMaxZ(), unrolled3d.getMaxZ(), 0.0);
  }
Ejemplo n.º 2
0
  public Object visit(BBOX filter, Object extraData) throws RuntimeException {
    if (isLooseBBOXEnabled() == false) return super.visit(filter, extraData);

    double minx = filter.getMinX();
    double maxx = filter.getMaxX();
    double miny = filter.getMinY();
    double maxy = filter.getMaxY();
    String propertyName = filter.getPropertyName();
    Integer srid = getSRID(propertyName);

    try {
      out.write("db2gse.EnvelopesIntersect(");
      out.write(escapeName(propertyName));
      out.write("," + minx + ", " + miny + ", " + maxx + ", " + maxy + ", " + srid);
      out.write(") =1 ");
      addSelectivity();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return extraData;
  }
Ejemplo n.º 3
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;
 }