public Object getProperty(Object object, QName name) throws Exception { BinarySpatialOperator operator = (BinarySpatialOperator) object; return OGCUtils.property(operator.getExpression1(), operator.getExpression2(), name); }
@Override public Filter replaceExpressions( BinarySpatialOperator filter, Expression expression1, Expression expression2) { try { return (Filter) method.invoke(ff, expression1, expression2, filter.getMatchAction()); } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public Expression getExpression2(BinarySpatialOperator filter) { return filter.getExpression2(); }
@Override public Expression getExpression1(BinarySpatialOperator filter) { return filter.getExpression1(); }
public List getProperties(Object object) throws Exception { // special hack for Functions, while not mandated by the spec we handle it // here BinarySpatialOperator operator = (BinarySpatialOperator) object; if (operator.getExpression2() instanceof Function) { ArrayList props = new ArrayList(); props.add(new Object[] {OGC.Function, operator.getExpression2()}); return props; } return super.getProperties(object); } }
.getExpression1() instanceof Literal, extraData);
/** * Visits filter.getExpression1(),filter.getExpression2() if an expression visitor has been set. */ protected Object visit(BinarySpatialOperator filter, Object data) { if (expressionVisitor != null) { if (filter.getExpression1() != null) { filter.getExpression1().accept(expressionVisitor, data); } if (filter.getExpression2() != null) { filter.getExpression2().accept(expressionVisitor, data); } } return filter; }
public List getProperties(Object object) throws Exception { //special hack for Functions, while not mandated by the spec we handle it // here BinarySpatialOperator operator = (BinarySpatialOperator) object; if ( operator.getExpression2() instanceof Function ) { ArrayList props = new ArrayList(); props.add( new Object[]{ OGC.Function, operator.getExpression2() } ); return props; } return super.getProperties(object); }
filter.getExpression1() instanceof Literal, extraData);
static Expression getProperty(BinarySpatialOperator op, QName name) { return getProperty(op.getExpression1(), op.getExpression2(), name); }
public List getProperties(Object object) throws Exception { //special hack for Functions, while not mandated by the spec we handle it // here BinarySpatialOperator operator = (BinarySpatialOperator) object; if (operator.getExpression2() instanceof Function) { ArrayList props = new ArrayList(); props.add(new Object[] { OGC.Function, operator.getExpression2() }); return props; } return super.getProperties(object); } }
public SpatialOperation(BinarySpatialOperator op) { this.op = op; for (Class<?> iface : op.getClass().getInterfaces()) { if (SPATIAL_OPERATIONS.contains(iface)) { operation = iface; break; } } if (op.getExpression1() instanceof Literal) { geometry = op.getExpression1().evaluate(null, Geometry.class); } else if (op.getExpression2() instanceof Literal) { geometry = op.getExpression2().evaluate(null, Geometry.class); } else { throw new IllegalArgumentException( "Cannot find literal geometry in the spatial filter"); } } }
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, Object extraData) { Expression ex1 = filter.getExpression1(); Expression ex2 = filter.getExpression2(); PropertyName pn = null; if (ex1 instanceof PropertyName && ex2 instanceof Literal) { pn = (PropertyName) ex1; } else if (ex1 instanceof Literal && ex2 instanceof PropertyName) { pn = (PropertyName) ex2; } if (pn != null) { String name = pn.getPropertyName(); if (spatialProperties.containsKey(name)) { Integer count = spatialProperties.get(name); spatialProperties.put(name, count + 1); } else { spatialProperties.put(name, 1); } } return null; } }
public Expression[][] visitBinarySpatialOp(BinarySpatialOperator filter) { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); List leftExpressions = (List) left.accept(this, null); List rightExpressions = (List) right.accept(this, null); if (leftExpressions.size() == 0) { throw new IllegalStateException(left + " mapping not found"); } if (rightExpressions.size() == 0) { throw new IllegalStateException(right + " mapping not found"); } Expression[][] product = buildExpressionsMatrix(leftExpressions, rightExpressions); return product; }
protected Envelope extractBboxForSpatialIndexQuery(BinarySpatialOperator filter) { org.opengis.filter.expression.Expression leftGeom = filter.getExpression1(); org.opengis.filter.expression.Expression rightGeom = filter.getExpression2(); Geometry g; if (leftGeom instanceof org.opengis.filter.expression.Literal) { g = (Geometry) ((org.opengis.filter.expression.Literal) leftGeom).getValue(); } else { g = (Geometry) ((org.opengis.filter.expression.Literal) rightGeom).getValue(); } return g.getEnvelopeInternal(); }
public static Object buildBinarySpatialOperator( String spatialOperator, BinarySpatialOperator filter, Object extraData, ExpressionToText visitor) { LOGGER.finer("exporting " + spatialOperator); StringBuilder output = asStringBuilder(extraData); output.append(spatialOperator).append("("); Expression expr = filter.getExpression1(); expr.accept(visitor, output); output.append(", "); filter.getExpression2().accept(visitor, output); output.append(")"); return output; }
Object transform(final BinarySpatialOperator filter, Object extraData) { // check working assumptions, first expression is a property final CoordinateReferenceSystem propertyCrs; if (filter.getExpression1() instanceof BoundedByFunction) { propertyCrs = featureType.getCoordinateReferenceSystem(); } else { if (!(filter.getExpression1() instanceof PropertyName)) { throw new IllegalArgumentException( "Binary geometry filter, but first expression " + "is not a property name? (it's a " + filter.getExpression1().getClass() + ")"); } propertyCrs = findPropertyCRS((PropertyName) filter.getExpression1()); } if (propertyCrs == null) return cloneFilter(filter, extraData); // "transformed" expressions Expression ex1 = (Expression) filter.getExpression1() .accept(ReprojectingFilterVisitor.this, extraData); Expression ex2 = reproject(filter.getExpression2(), propertyCrs, true); return cloneFilter(filter, extraData, ex1, ex2); }
Expression e1 = op.getExpression1(); Expression e2 = op.getExpression2(); e1 = (PropertyName) op.getExpression2(); e2 = (Literal) op.getExpression1(); (PropertyName) e1, (Literal) e2, filter.getExpression1() instanceof Literal, extraData); } else {
leftGeometry = ((BinarySpatialOperator) filter).getExpression1(); rightGeometry = ((BinarySpatialOperator) filter).getExpression2();
leftGeometry = ((BinarySpatialOperator) filter).getExpression1(); rightGeometry = ((BinarySpatialOperator) filter).getExpression2();