Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.Function.evaluate()


        assertEquals(env.getMinX(), 5.0, 0);
        assertEquals(env.getMinY(), env.getMaxY(), 0);
        assertEquals(env.getMinY(), 2.5, 0);
        // Option 2 (1D Envelope with crsname): <OCQL>ToEnvelope(minx,maxx,crsname)</OCQL>
        function = ff.function("toEnvelope", pointOne, pointTwo, ff.literal("EPSG:4283"));
        value = function.evaluate(feature);
        assertTrue(value instanceof ReferencedEnvelope);
        ReferencedEnvelope refEnv = (ReferencedEnvelope) value;
        assertEquals(refEnv.getMinX(), refEnv.getMaxX(), 0);
        assertEquals(refEnv.getMinX(), 5.0, 0);
        assertEquals(refEnv.getMinY(), refEnv.getMaxY(), 0);
View Full Code Here


        assertEquals(refEnv.getMinY(), refEnv.getMaxY(), 0);
        assertEquals(refEnv.getMinY(), 2.5, 0);
        assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283");
        // Option 3 (2D Envelope) : <OCQL>ToEnvelope(minx,maxx,miny,maxy)</OCQL>
        function = ff.function("toEnvelope", pointTwo, pointOne, pointTwo, pointOne);
        value = function.evaluate(feature);
        assertTrue(value instanceof Envelope);
        env = (Envelope) value;
        assertEquals(env.getMinX(), 2.5, 0);
        assertEquals(env.getMaxX(), 5.0, 0);
        assertEquals(env.getMinY(), 2.5, 0);
View Full Code Here

        assertEquals(env.getMaxY(), 5.0, 0);
        assertEquals(CRS.toSRS(refEnv.getCoordinateReferenceSystem()), "EPSG:4283");
        // Option 4 (2D Envelope with crsname): <OCQL>ToEnvelope(minx,maxx,miny,maxy,crsname)</OCQL>
        function = ff.function("toEnvelope", pointTwo, pointOne, pointTwo, pointOne,
                ff.literal("EPSG:4283"));
        value = function.evaluate(feature);
        assertTrue(value instanceof ReferencedEnvelope);
        refEnv = (ReferencedEnvelope) value;
        assertEquals(refEnv.getMinX(), 2.5, 0);
        assertEquals(refEnv.getMaxX(), 5.0, 0);
        assertEquals(refEnv.getMinY(), 2.5, 0);
View Full Code Here

    /**
     * Test ToLineString with EPSG SRS.
     */
    public void testToLineStringEPSG() {
        Function function = ff.function("toLineString", ff.literal("EPSG:9902"), pointOne, pointTwo);
        Object value = function.evaluate(feature);
        assertTrue(value instanceof LineString);
        LineString linestring = (LineString) value;
        assertEquals(linestring.getDimension(), 1);
        // 1D SRS should be created
        CoordinateReferenceSystem crs = (CoordinateReferenceSystem) linestring.getUserData();
View Full Code Here

     * Test ToLineString with non EPSG SRS.
     */
    public void testToLineStringCustomSRS() {
        String customSRS = "#borehole.GA.1";
        Function function = ff.function("toLineString", ff.literal(customSRS), pointOne, pointTwo);
        Object value = function.evaluate(feature);
        assertTrue(value instanceof LineString);
        LineString linestring = (LineString) value;
        assertEquals(linestring.getDimension(), 1);
        // 1D SRS should be created
        CoordinateReferenceSystem crs = (CoordinateReferenceSystem) linestring.getUserData();
View Full Code Here

     * Test ToLineString with null parameters.
     */
    public void testToLineStringNullParams() {
        Function function = ff.function("toLineString", null, null);
        try {
            function.evaluate(feature);
            fail();
        } catch (IllegalArgumentException e) {
            String msg = "Invalid parameters for toLineString function: [null, null]. Usage: toLineString(srsName, point 1, point 2)";
            assertEquals(msg, e.getMessage());
        }
View Full Code Here

     * Test ToLineString with invalid parameters.
     */
    public void testToLineStringInvalidParams() {
        Function function = ff.function("toLineString", ff.literal("#GA.borehole.100"), Literal.NIL, ff.literal("something"));
        try {
            function.evaluate(feature);
            fail();
        } catch (IllegalArgumentException e) {
            String msg = "Error converting the parameters for toLineString function: [#GA.borehole.100, Expression.NIL, something]. Usage: toLineString(srsName, point 1, point 2)";
            assertEquals(msg, e.getMessage());
            assertTrue(e.getCause() instanceof NumberFormatException);
View Full Code Here

       
        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",
                value);
    }
View Full Code Here

    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

            assertEquals("Number of arguments, ", 1, ceil.getFunctionName().getArgumentCount());

            Function ceilFunction = ff.function("ceil", literal_1);
            double good0 = Math.ceil(1.0);
            if (Double.isNaN(good0)) {
                assertTrue("ceil of (1.0):", Double.isNaN(((Double) ceilFunction
                        .evaluate(null)).doubleValue()));
            } else {
                assertEquals("ceil of (1.0):", (double) Math.ceil(1.0),
                        ((Double) ceilFunction.evaluate(null)).doubleValue(),
                        0.00001);
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.