Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory2.function()


    }

    private org.opengis.filter.Filter createGeometryTypeFilter( String geomName, String type )
            throws IllegalFilterException {
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        Function function = ff.function("geometryType", ff.property(geomName));
        return ff.equal(function, ff.literal(type)); //$NON-NLS-1$
    }

    private boolean writeToShapefile(SimpleFeatureCollection fc, SimpleFeatureType type, File file ) throws IOException {
       
View Full Code Here


        StyleBuilder sb = new StyleBuilder();
        Mark mark = sb.createMark("square");
        mark.setStroke(null);
        Graphic graphic = sb.createGraphic(null, mark, null);
        FilterFactory2 ff = sb.getFilterFactory();
        graphic.setSize(ff.function("env", ff.literal("test")));
        PointSymbolizer ps = sb.createPointSymbolizer(graphic);
        Style style = sb.createStyle(ps);

        try {
            EnvFunction.setGlobalValue("test", 10);
View Full Code Here

        // setup a point layer with the right geometry trnasformation
        Style style = SLD.createPointStyle("circle", Color.BLUE, Color.BLUE, 1f, 10f);
        PointSymbolizer ps = (PointSymbolizer) style.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0);
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        ps.setGeometry(ff.function("convert", ff.property("wkt"), ff.literal(Point.class)));

        // setup the map
        MapContent map = new MapContent();
        Layer layer = new FeatureLayer(features, style);
        map.addLayer(layer);
View Full Code Here

    public void testVocabFunction() {
        URL file = getClass().getResource("/test-data/minoc_lithology_mapping.properties");
        assertNotNull(file);
       
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        Function function = ff.function("Vocab", ff.literal("1LIST"), ff.literal(DataUtilities
                .urlToFile(file).getPath()));

        Object value = function.evaluate(null);
        assertEquals(
                "urn:cgi:classifier:CGI:SimpleLithology:2008:calcareous_carbonate_sedimentary_rock",
View Full Code Here

    }

    @Test
    public void testNoVocabFunction() {
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        Function function = ff.function("Vocab", ff.literal("a"), ff.literal("urn:1234"));

        try {
            function.evaluate(null);
            fail("Should not be able to get this far");
        } catch (Throwable expected) {
View Full Code Here

        store.addFeatures(features);
        SimpleFeatureCollection featureCollection = store.getFeatureSource("polygons").getFeatures();

        // Test the Function
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        Function exp = ff.function("mincircle", ff.property("geom"));
        SimpleFeatureIterator iter = featureCollection.features();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Geometry geom = (Geometry) feature.getDefaultGeometry();
            Geometry circle = new MinimumBoundingCircle(geom).getCircle();
View Full Code Here

        store.addFeatures(features);
        SimpleFeatureCollection featureCollection = store.getFeatureSource("polygons").getFeatures();

        // Test the Function
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        Function exp = ff.function("minrectangle", ff.property("geom"));
        SimpleFeatureIterator iter = featureCollection.features();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Geometry geom = (Geometry) feature.getDefaultGeometry();
            Geometry rectangle = new MinimumDiameter(geom).getMinimumRectangle();
View Full Code Here

        store.addFeatures(features);
        SimpleFeatureCollection featureCollection = store.getFeatureSource("polygons").getFeatures();

        // Test the Function
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        Function exp = ff.function("minimumdiameter", ff.property("geom"));
        SimpleFeatureIterator iter = featureCollection.features();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Geometry geom = (Geometry) feature.getDefaultGeometry();
            Geometry minimumDiameter = new MinimumDiameter(geom).getDiameter();
View Full Code Here

        store.addFeatures(features);
        SimpleFeatureCollection featureCollection = store.getFeatureSource("polygons").getFeatures();

        // Test the Function
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        Function exp = ff.function("octagonalenvelope", ff.property("geom"));
        SimpleFeatureIterator iter = featureCollection.features();
        while (iter.hasNext()) {
            SimpleFeature feature = iter.next();
            Geometry geom = (Geometry) feature.getDefaultGeometry();
            Geometry octagonalEnvelope = new OctagonalEnvelope(geom).toGeometry(geom.getFactory());
View Full Code Here

    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    // expressionExamples start
    Expression propertyAccess = ff.property("THE_GEOM");
    Expression literal = ff.literal(geometry);
    Expression math = ff.add(ff.literal(1), ff.literal(2));
    Expression function = ff.function("length", ff.property("CITY_NAME"));
    // expressionExamples end
}

private static void functionList() {
    // functionList start
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.