@Override public Object getProperty(Object object, QName name) throws Exception { BBOX box = (BBOX) object; if (FES.ValueReference.equals(name)) { return box.getExpression1(); } return null; }
@Override public Object visit(BBOX filter, Object notUsed) { nestedAttributes.clear(); int i = preStack.size(); if (filter.getExpression1() instanceof PropertyName) { PropertyName bboxProperty = (PropertyName) filter.getExpression1(); if (!bboxProperty.getPropertyName().isEmpty()) { Object ret = this.visit(bboxProperty, notUsed); if (preStack.size() == i + 1) { preStack.pop(); } if (nestedAttributes.size() == 1) { nestedAttributeSanityCheck(filter); } else if (nestedAttributes.size() > 1) { // encoding bbox on multiple nested attributes is not supported postStack.push(filter); return ret; } } } return super.visit(filter, notUsed); }
public Object accept(FilterVisitor visitor, Object context) { Object result = visitor.visit(this, context); if (!(result instanceof BBOX)) return result; BBOX clone = (BBOX) result; if (clone.getExpression1().equals(getExpression1()) && clone.getExpression2().equals(getExpression2())) return new FastBBOX(property, envelope, factory); return result; }
public Object visit(final BBOX filter, Object data) { data = filter.getExpression1().accept(this, data); data = filter.getExpression2().accept(this, data); return data; }
@Override public Object visit(final BBOX filter, Object data) { data = geom(filter.getExpression1(), data); data = geom(filter.getExpression2(), data); return data; }
public Object visit(final BBOX filter, Object data) { data = filter.getExpression1().accept(this, data); if (found(data)) return data; data = filter.getExpression2().accept(this, data); return data; }
public void testResolveEmptyName() { // We use a geometry filter here to test that expression1 does not get filled with the // default geometry BBOX f = factory.bbox("", 0.0, 0.0, 1.0, 1.0, DefaultGeographicCRS.WGS84.toString()); assertEquals("", f.getExpression1().toString()); f = (BBOX) f.accept(new PropertyNameResolvingVisitor(featureType), null); assertEquals("", f.getExpression1().toString()); } }
public Object visit(BBOX filter, Object extraData) { // grab the original envelope data BoundingBox boundaries = filter.getBounds(); // parse the srs, it might be a code or a WKT definition CoordinateReferenceSystem crs = boundaries.getCoordinateReferenceSystem(); // if no srs is specified we can't transform anyways if (crs == null) return super.visit(filter, extraData); // grab the property data PropertyName propertyName = null; // get the expression as is to preserve namespace context if (filter.getExpression1() instanceof PropertyName) { propertyName = (PropertyName) filter.getExpression1(); } else if (filter.getExpression2() instanceof PropertyName) { propertyName = (PropertyName) filter.getExpression2(); } CoordinateReferenceSystem targetCrs = findPropertyCRS(propertyName); // if there is a mismatch, reproject and replace if (crs != null && targetCrs != null && !CRS.equalsIgnoreMetadata(crs, targetCrs)) { ReferencedEnvelope envelope = ReferencedEnvelope.reference(boundaries); try { envelope = envelope.transform(targetCrs, true); } catch (TransformException e) { throw new RuntimeException(e); } catch (FactoryException e) { throw new RuntimeException(e); } boundaries = envelope; } return getFactory(extraData).bbox(propertyName, boundaries); }
public Object visit(BBOX filter, Object extraData) { // if no srs is specified we can't transform anyways String srs = filter.getSRS(); if (srs != null && !"".equals(srs.trim())) return super.visit(filter, extraData); if (defaultCrs == null || filter.getBounds() == null || defaultCrs.getCoordinateSystem().getDimension() == filter.getBounds().getDimension()) { return getFactory(extraData) .bbox( filter.getExpression1(), ReferencedEnvelope.create(filter.getBounds(), defaultCrs)); } else { try { SingleCRS horizontalCRS = CRS.getHorizontalCRS(defaultCrs); ReferencedEnvelope bounds = ReferencedEnvelope.create(filter.getBounds(), horizontalCRS); return getFactory(extraData).bbox(filter.getExpression1(), bounds); } catch (Exception e) { throw new RuntimeException("Could not decode srs '" + srs + "'", e); } } }
/** Expands the BBOX in the Filter. */ @SuppressWarnings("deprecation") @Override public Object visit(BBOX filter, Object extraData) { // no need to change the property name Expression propertyName = filter.getExpression1(); /** Using the deprecated methods since they are too useful... */ double minx = filter.getMinX(); double miny = filter.getMinY(); double maxx = filter.getMaxX(); double maxy = filter.getMaxY(); String srs = filter.getSRS(); return getFactory(extraData) .bbox( propertyName, minx - expandMinX, miny - expandMaxX, maxx + expandMinY, maxy + expandMaxY, srs); } }
public Object visit(BBOX filter, Object extraData) { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); final String type = "BBOX"; start(type); left.accept(this, extraData); if (right instanceof Literal) { Literal literal = (Literal) right; Envelope bbox = literal.evaluate(null, Envelope.class); if (bbox != null) { geometryEncoder.encode(bbox); } else { right.accept(this, extraData); } } else { right.accept(this, extraData); } end(type); return extraData; }
filter.getExpression1(), new ReferencedEnvelope( bounds.getMinY(), filter.getExpression1(), new ReferencedEnvelope( geomEnvelope.getMinY(),
@Override public Object visit(BBOX filter, Object extraData) { // rename if necessary Expression e1 = filter.getExpression1(); if (e1 instanceof PropertyName) { PropertyName pname = (PropertyName) e1; String name = pname.getPropertyName(); if (name != null && name.equals(source)) { e1 = ff.property(target); } } // duplicate preserving fast bbox filters if (filter instanceof FastBBOX && e1 instanceof PropertyName) { FastBBOX fbox = (FastBBOX) filter; return new FastBBOX((PropertyName) e1, fbox.getEnvelope(), getFactory(extraData)); } else { double minx = filter.getMinX(); double miny = filter.getMinY(); double maxx = filter.getMaxX(); double maxy = filter.getMaxY(); String srs = filter.getSRS(); return getFactory(extraData).bbox(e1, minx, miny, maxx, maxy, srs); } } }
public Object visit(BBOX filter, Object extraData) { Expression propertyName = visit(filter.getExpression1(), extraData); if (!(filter instanceof BBOX3D)) { double minx = filter.getMinX(); double miny = filter.getMinY(); double maxx = filter.getMaxX(); double maxy = filter.getMaxY(); String srs = filter.getSRS(); return getFactory(extraData) .bbox(propertyName, minx, miny, maxx, maxy, srs, filter.getMatchAction()); } return getFactory(extraData).bbox(propertyName, filter.getBounds()); }
@Override public Object visit(BBOX filter, Object extraData) { BasicDBObject output = asDBObject(extraData); // TODO: handle swapping of operands Object e1 = filter.getExpression1().accept(this, Geometry.class); Envelope envelope = filter.getExpression2().evaluate(null, Envelope.class); DBObject geometryDBObject = geometryBuilder.toObject(envelope); addCrsToGeometryDBObject(geometryDBObject); DBObject dbo = BasicDBObjectBuilder.start() .push("$geoIntersects") .add("$geometry", geometryDBObject) .get(); output.put((String) e1, dbo); return output; }
public void testPreservedNamespaceContext() { // set GEOT-3756 NamespaceSupport nsContext = new NamespaceSupport(); nsContext.declarePrefix("f", "http://feature.example.org"); Expression geometry = fac.property("f:name", nsContext); BBOX bbox = fac.bbox(geometry, 0, 0, 1, 1, "EPSG:4326"); DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor(fac); BBOX clone = (BBOX) bbox.accept(visitor, null); assertEquals(bbox, clone); assertNotSame(bbox, clone); assertSame(nsContext, ((PropertyName) clone.getExpression1()).getNamespaceContext()); }
public Object visit(BBOX filter, Object extraData) { Envelope bbox = null; Expression leftGeometry = filter.getExpression1(); Expression rightGeometry = filter.getExpression2(); boolean clipped = false;
public Object visit( final BBOX filter, Object data ) { data = filter.getExpression1().accept( this, data ); if( found(data)) return data; data = filter.getExpression2().accept( this, data ); return data; }
@Override public Filter[] visit(BBOX filter, Object extraData) { Expression metaProperty = toBoundsExpression(filter.getExpression1(), false); BBOX bbox = ff.bbox(metaProperty, filter.getBounds()); return tuple(bbox, INCLUDE); }
public Object visit(BBOX filter, Object extraData) { Expression propertyName = visit(filter.getExpression1(), extraData); double minx=filter.getMinX(); double miny=filter.getMinY(); double maxx=filter.getMaxX(); double maxy=filter.getMaxY(); String srs=filter.getSRS(); return getFactory(extraData).bbox(propertyName, minx, miny, maxx, maxy, srs); }