Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.Contains


        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LinearRing shell = gf.createLinearRing(sf.create(new double[] { 2, -1, 2, 5, 4, 5, 4, -1,
                2, -1 }, 2));
        Polygon polygon = gf.createPolygon(shell, null);
        Contains cs = ff.contains(ff.literal(polygon), ff.property(aname("geom")));

        SimpleFeatureType roadSchema = dataStore.getSchema("road");
        originalSchema = dataStore.getDatabaseSchema();
        dataStore.setDatabaseSchema("schema");
        dialect.handleSelectHints(sql1, roadSchema, new Query("road", cs));
View Full Code Here


        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LinearRing shell = gf.createLinearRing(sf.create(new double[] { 2, -1, 2, 5, 4, 5, 4, -1,
                2, -1 }, 2));
        Polygon polygon = gf.createPolygon(shell, null);
        Contains cs = ff.contains(ff.literal(polygon), ff.property(aname("geom")));

       
        SimpleFeatureType roadSchema = dataStore.getSchema("road");
        dialect.handleSelectHints(sql, roadSchema, new Query("road", cs));
        return sql;
View Full Code Here

    }

    public void testContainsParse() throws Exception {
        FilterMockData.contains(document, document);

        Contains contains = (Contains) parse();

        assertNotNull(contains.getExpression1());
        assertNotNull(contains.getExpression2());
    }
View Full Code Here

    }

    public void testContainsParse() throws Exception {
        FilterMockData.contains(document, document);

        Contains contains = (Contains) parse();

        assertNotNull(contains.getExpression1());
        assertNotNull(contains.getExpression2());
    }
View Full Code Here

        String encoded = encoder.encodeToString(bbox);
        assertEquals("WHERE SDO_FILTER(\"GEOM\", ?, 'mask=anyinteract querytype=WINDOW') = 'TRUE' ", encoded);
    }

    public void testContainsFilter() throws Exception {
        Contains contains = ff.contains(ff.property("SHAPE"), ff.literal(gf
                .createPoint(new Coordinate(10.0, -10.0))));
        String encoded = encoder.encodeToString(contains);
        assertEquals("WHERE SDO_RELATE(\"SHAPE\", ?, 'mask=contains querytype=WINDOW') = 'TRUE' ",
                encoded);
    }
View Full Code Here

        init("not-active");
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        Polygon ls = gf.createPolygon(sf.create(new double[] { 2, 2, 3, 2, 3, 3, 2, 3, 2, 2 }, 2));
        Contains f = ff.contains(ff.property("geo"), ff.literal(ls));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
        SimpleFeatureIterator fsi = features.features();
        assertTrue(fsi.hasNext());
        assertEquals(fsi.next().getID(), "not-active.12");
View Full Code Here

      GeometryFactory gf = new GeometryFactory(new PrecisionModel());
      Polygon geom = gf.createPolygon(gf.createLinearRing(coords), new LinearRing[0]);
        Literal expr1 = new LiteralExpressionImpl(geom);
        PropertyName expr2 = new AttributeExpressionImpl(testSchema, "testGeometry");
       
        Contains filter = fac.contains(expr1, expr2);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));

        Function function = new GeometryFunction(geom);
        filter = fac.contains(expr1, function);
        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));

        filter = fac.contains(expr2, expr1);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));

        coords = new Coordinate[] {
          new Coordinate(2, 2),
          new Coordinate(6, 0),
              new Coordinate(6, 7),
              new Coordinate(0, 7),
              new Coordinate(2, 2)
      };
        geom = gf.createPolygon(gf.createLinearRing(coords), new LinearRing[0]);
        expr1 = new LiteralExpressionImpl(geom);
        filter = fac.contains(expr1, expr2);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));
       
        filter = fac.contains(new LiteralExpressionImpl(null), expr2);

        LOGGER.finer( filter.toString());           
        LOGGER.finer( "contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));

  }
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LinearRing shell = gf.createLinearRing(sf.create(new double[] { 2, -1, 2, 5, 4, 5, 4, -1,
                2, -1 }, 2));
        Polygon polygon = gf.createPolygon(shell, null);
        Contains cs = ff.contains(ff.literal(polygon), ff.property(aname("geom")));
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(cs);
        checkSingleResult(features, "r2");
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.spatial.Contains

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.