Package org.opengis.filter.expression

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


     */
    public void testToDirectPosition() throws Exception {
        // 2 points with SRS
        Function function = ff.function("toDirectPosition", ToDirectPositionFunction.SRS_NAME,
                ff.literal("EPSG:4326"), pointOne, pointTwo);
        Object value = function.evaluate(feature);
        assertTrue(value instanceof DirectPosition);
        DirectPosition pos = (DirectPosition) value;
        assertEquals(CRS.toSRS(pos.getCoordinateReferenceSystem()), "EPSG:4326");
        assertEquals(pos.getDimension(), 2);
        assertEquals(pos.getOrdinate(0), 5.0, 0);
View Full Code Here


        assertEquals(pos.getOrdinate(0), 5.0, 0);
        assertEquals(pos.getOrdinate(1), 2.5, 0);

        // 1 point, no SRS
        function = ff.function("toDirectPosition", pointOne);
        value = function.evaluate(feature);
        assertTrue(value instanceof DirectPosition);
        pos = (DirectPosition) value;
        assertNull(pos.getCoordinateReferenceSystem());
        assertEquals(pos.getDimension(), 1);
        assertEquals(pos.getOrdinate(0), 5.0, 0);
View Full Code Here

        assertEquals(pos.getOrdinate(0), 5.0, 0);
        // invalid CRS
        try {
            function = ff.function("toDirectPosition", ToDirectPositionFunction.SRS_NAME,
                    ff.literal("1"), pointOne, pointTwo);
            function.evaluate(feature);
            fail("Shouldn't get this far with invalid SRS name: '1'");
        } catch (Throwable e) {
            LOGGER.info("Testing exception: " + e.toString());
        }
        // too many of points
View Full Code Here

            LOGGER.info("Testing exception: " + e.toString());
        }
        // too many of points
        try {
            function = ff.function("toDirectPosition", pointOne, pointTwo, pointOne);
            function.evaluate(feature);
            fail("Shouldn't get this far with too many parameters: " + pointOne.toString() + ", "
                    + pointTwo.toString() + ", " + pointOne.toString());
        } catch (Throwable e) {
            LOGGER.info("Testing exception: " + e.toString());
        }
View Full Code Here

        }
        // no points
        try {
            function = ff.function("toDirectPosition", ToDirectPositionFunction.SRS_NAME,
                    ff.literal("EPSG:WGS84"));
            function.evaluate(feature);
            fail("Shouldn't get this far with too many parameters: " + pointOne.toString() + ", "
                    + pointTwo.toString() + ", " + pointOne.toString());
        } catch (Throwable e) {
            LOGGER.info("Testing exception: " + e.toString());
        }
View Full Code Here

     */
    public void testToPoint() throws NoSuchAuthorityCodeException, FactoryException {
        // 2 points with SRS name and gml:id
        Function function = ff.function("toPoint", ToDirectPositionFunction.SRS_NAME,
                ff.literal("EPSG:4283"), pointOne, pointTwo, ff.literal("1"));
        Object value = function.evaluate(feature);
        assertTrue(value instanceof Point);
        Point pt = (Point) value;
        assertEquals(pt.getDimension(), 0);
        assertEquals(pt.getCoordinate().x, 5.0, 0);
        assertEquals(pt.getCoordinate().y, 2.5, 0);
View Full Code Here

        assertEquals(userData.get("gml:id"), "1");
        assertEquals(userData.get(CoordinateReferenceSystem.class), CRS.decode("EPSG:4283"));

        // 2 points with no SRS name
        function = ff.function("toPoint", pointOne, pointTwo);
        value = function.evaluate(feature);
        assertTrue(value instanceof Point);
        pt = (Point) value;
        assertEquals(pt.getDimension(), 0);
        assertEquals(pt.getCoordinate().x, 5.0, 0);
        assertEquals(pt.getCoordinate().y, 2.5, 0);
View Full Code Here

        assertEquals(pt.getCoordinate().y, 2.5, 0);
        assertNull(pt.getUserData());
        // 1 point
        function = ff.function("toPoint", pointOne);
        try {
            value = function.evaluate(feature);
            fail("Shouldn't get this far with not enough parameters :" + pointOne.toString());
        } catch (Throwable e) {
            LOGGER.info("Testing exception: " + e.toString());
        }
        // 3 points
View Full Code Here

        }
        // 3 points
        function = ff.function("toPoint", ToDirectPositionFunction.SRS_NAME, ff.literal("1"),
                pointOne, pointTwo, pointOne);
        try {
            function.evaluate(feature);
            fail("Shouldn't get this far with too many parameters: " + pointOne.toString() + ", "
                    + pointTwo.toString() + ", " + pointOne.toString());
        } catch (Throwable e) {
            LOGGER.info("Testing exception: " + e.toString());
        }
View Full Code Here

     * Test toEnvelope function
     */
    public void testToEnvelope() {
        // Option 1 (1D Envelope) : <OCQL>ToEnvelope(minx,maxx)</OCQL>
        Function function = ff.function("toEnvelope", pointOne, pointTwo);
        Object value = function.evaluate(feature);
        assertTrue(value instanceof Envelope);
        Envelope env = (Envelope) value;
        assertEquals(env.getMinX(), env.getMaxX(), 0);
        assertEquals(env.getMinX(), 5.0, 0);
        assertEquals(env.getMinY(), env.getMaxY(), 0);
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.