public Object visit(Intersects filter, Object data) { data = filter.getExpression1().accept(this, data); data = filter.getExpression2().accept(this, data); return data; }
public Object visit(Intersects filter, Object extraData) { Expression geometry1 = visit(filter.getExpression1(), extraData); Expression geometry2 = visit(filter.getExpression2(), extraData); return getFactory(extraData).intersects(geometry1, geometry2, filter.getMatchAction()); }
public void testIntersectsWithFunction() throws Exception { Function function = new GeometryFunction(); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(ff.property("geom"), function); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
@Test public void testGeometryFilter() throws Exception { mapping = createSampleDerivedAttributeMappings(); visitor = new UnmappingFilterVisitor(mapping); targetDescriptor = mapping.getTargetFeature(); targetType = (FeatureType) targetDescriptor.getType(); Expression literalGeom = ff.literal(new GeometryFactory().createPoint(new Coordinate(1, 1))); Intersects gf = ff.intersects(ff.property("areaOfInfluence"), literalGeom, MatchAction.ALL); Filter unrolled = (Filter) gf.accept(visitor, null); assertTrue(unrolled instanceof Intersects); assertNotSame(gf, unrolled); assertEquals(MatchAction.ALL, ((Intersects) unrolled).getMatchAction()); Intersects newFilter = (Intersects) unrolled; Expression left = newFilter.getExpression1(); Expression right = newFilter.getExpression2(); assertSame(right, literalGeom); assertTrue(left instanceof Function); Function fe = (Function) left; assertEquals("buffer", fe.getName()); Expression arg0 = (Expression) fe.getParameters().get(0); assertTrue(arg0 instanceof PropertyName); assertEquals("location", ((PropertyName) arg0).getPropertyName()); }
/** {@inheritDoc} */ @Override public Object visit(Intersects filter, Object userData) { String finalName = parsePropertyName(geomName, userData); return SpatialRestrictions.intersects(finalName, asGeometry(getLiteralValue(filter.getExpression2()))); }
public Object visit(Intersects filter, Object extraData) { checkLeftExpressionIsProperty(filter.getExpression1()); return FilterToTextUtil.buildBinarySpatialOperator("INTERSECTS", filter, extraData); }
public Object visit(Intersects filter, Object arg1) { Expression[][] exps = visitBinarySpatialOp(filter); List combinedFilters = new ArrayList(exps.length); for (int i = 0; i < exps.length; i++) { Expression left = exps[i][0]; Expression right = exps[i][1]; Filter unrolled = ff.intersects(left, right, filter.getMatchAction()); combinedFilters.add(unrolled); } Filter unrolled = combineOred(combinedFilters); return unrolled; }
@Test public void testIntersects() { ff.intersects(ff.property("geom"), ff.literal(null)).accept(visitor, null); assertTrue(visitor.hasSpatialFilter); }
public void testIntersectsReproject(Expression geom) throws FactoryException { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326")); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(geom, ff.literal(ls)); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) ((Literal) isClone.getExpression2()).getValue(); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
@Test public void testGeometryFilter() throws Exception { mapping = createSampleDerivedAttributeMappings(); visitor = new UnmappingFilterVisitor(mapping); targetDescriptor = mapping.getTargetFeature(); targetType = (FeatureType) targetDescriptor.getType(); Expression literalGeom = ff .literal(new GeometryFactory().createPoint(new Coordinate(1, 1))); Intersects gf = ff.intersects(ff.property("areaOfInfluence"), literalGeom, MatchAction.ALL); Filter unrolled = (Filter) gf.accept(visitor, null); assertTrue(unrolled instanceof Intersects); assertNotSame(gf, unrolled); assertEquals(MatchAction.ALL, ((Intersects) unrolled).getMatchAction()); Intersects newFilter = (Intersects) unrolled; Expression left = newFilter.getExpression1(); Expression right = newFilter.getExpression2(); assertSame(right, literalGeom); assertTrue(left instanceof Function); Function fe = (Function) left; assertEquals("buffer", fe.getName()); Expression arg0 = (Expression) fe.getParameters().get(0); assertTrue(arg0 instanceof PropertyName); assertEquals("location", ((PropertyName) arg0).getPropertyName()); }
@Override public Object visit(Intersects filter, Object data) { Envelope2D envelope = (Envelope2D) data; Geometry polygon= ((Geometry)((Literal)filter.getExpression2()).getValue()); org.opengis.geometry.Geometry polygon2 = JTSUtils.jtsToGo1(polygon, envelope.getCoordinateReferenceSystem()); envelope.setBounds(new Envelope2D(polygon2.getEnvelope())); return super.visit(filter, data); }
public Object visit(Intersects filter, Object extraData) { checkLeftExpressionIsProperty(filter.getExpression1()); return FilterToTextUtil.buildBinarySpatialOperator("INTERSECTS", filter, extraData); } public Object visit(Overlaps filter, Object extraData) {
public Object visit(Intersects filter, Object arg1) { Expression[][] exps = visitBinarySpatialOp(filter); List combinedFilters = new ArrayList(exps.length); for (int i = 0; i < exps.length; i++) { Expression left = exps[i][0]; Expression right = exps[i][1]; Filter unrolled = ff.intersects(left, right, filter.getMatchAction()); combinedFilters.add(unrolled); } Filter unrolled = combineOred(combinedFilters); return unrolled; }
public void testIntersectsUnreferencedGeometry() throws Exception { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls)); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); assertEquals(original, clone); }
public Object visit(Intersects filter, Object data) { data = filter.getExpression1().accept(this, data); data = filter.getExpression2().accept(this, data); return data; }
public void testIntersectsReferencedGeometry() throws Exception { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326")); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(ff.property("line"), ff.literal(ls)); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
public Object visit(Intersects filter, Object extraData) { Expression geometry1 = visitBinaryChild(filter.getExpression1(), extraData, 0); Expression geometry2 = visitBinaryChild(filter.getExpression2(), extraData, 1); return getFactory(extraData).intersects(geometry1, geometry2, filter.getMatchAction()); }
public Object visit(Intersects filter, Object data) { filter.getExpression1().accept(this, data); if (found) return found; filter.getExpression2().accept(this, data); return found; }
public Object visit(Intersects filter, Object data) { data = filter.getExpression1().accept(this, data); if (found(data)) return data; data = filter.getExpression2().accept(this, data); return data; }
public Object visit(Intersects filter, Object extraData) { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); final String type = "Intersects"; start(type); left.accept(this, extraData); right.accept(this, extraData); end(type); return extraData; }