Package net.opengis.ows11

Examples of net.opengis.ows11.BoundingBoxType


        // we do not check that lower <= higher because in the case of geographic
        // bbox we have to accept the case where the lower coordinate is higher
        // than the high one and handle it as antimeridian crossing, better do that once
        // in the code that handles GetCoverage (the same check must be performed for xml requests)

        BoundingBoxType bbt = Ows11Factory.eINSTANCE.createBoundingBoxType();
        bbt.setCrs(crsName);
        bbt.setLowerCorner(Arrays.asList(lower));
        bbt.setUpperCorner(Arrays.asList(upper));
        return bbt;
    }
View Full Code Here


    private BoundingBoxType parseBoundingBox(InputType it, Wps10Factory factory, IOParam param) {
        try {
            ReferencedEnvelope envelope = (ReferencedEnvelope) new org.geoserver.wfs.kvp.BBoxKvpParser().parse(param.value);
            if(envelope != null) {
                BoundingBoxType bbox = Ows11Factory.eINSTANCE.createBoundingBoxType();
                if(envelope.getCoordinateReferenceSystem() != null) {
                    bbox.setCrs(GML2EncodingUtils.epsgCode(envelope.getCoordinateReferenceSystem()));
                }
                List<Double> min = new ArrayList<Double>(envelope.getDimension());
                List<Double> max = new ArrayList<Double>(envelope.getDimension());
                for (int i = 0; i < envelope.getDimension(); i++) {
                    min.set(i, envelope.getMinimum(i));
View Full Code Here

   
    ReferencedEnvelope toEnvelope(String xml) throws Exception {
        Parser p = new Parser(new OWSConfiguration());
        Object parsed = p.parse(new ByteArrayInputStream(xml.getBytes()));
        assertTrue(parsed instanceof BoundingBoxType);
        BoundingBoxType box = (BoundingBoxType) parsed;
       
        ReferencedEnvelope re;
        if(box.getCrs() != null) {
            re = new ReferencedEnvelope(CRS.decode(box.getCrs()));
        } else {
            re = new ReferencedEnvelope();
        }
       
        re.expandToInclude((Double) box.getLowerCorner().get(0), (Double) box.getLowerCorner().get(1));
        re.expandToInclude((Double) box.getUpperCorner().get(0), (Double) box.getUpperCorner().get(1));
        return re;
    }
View Full Code Here

        return fromTargetType(object);
    }

    BoundingBoxType fromTargetType(Object object) throws WPSException {
        Ows11Factory factory = Ows11Factory.eINSTANCE;
        BoundingBoxType bbox = factory.createBoundingBoxType();
       
        // basic conversion and collect the crs
        CoordinateReferenceSystem crs = null;
        if (object instanceof Envelope) {
            Envelope env = (Envelope) object;
            if(object instanceof ReferencedEnvelope) {
                ReferencedEnvelope re = (ReferencedEnvelope) object;
                crs = re.getCoordinateReferenceSystem();
            }
            bbox.setLowerCorner(Arrays.asList(env.getMinX(), env.getMinY()));
            bbox.setUpperCorner(Arrays.asList(env.getMaxX(), env.getMaxY()));
        } else if (org.opengis.geometry.Envelope.class.isAssignableFrom(getType())) {
            org.opengis.geometry.Envelope env = (org.opengis.geometry.Envelope) object;
            crs = env.getCoordinateReferenceSystem();
            bbox.setLowerCorner(Arrays.asList(env.getLowerCorner().getCoordinate()));
            bbox.setUpperCorner(Arrays.asList(env.getUpperCorner().getCoordinate()));
        } else {
            throw new WPSException("Failed to convert from " + object
                    + " to an OWS 1.1 Bounding box type");
        }
       
        // handle the EPSG code
        if(crs != null) {
            try {
                Integer code = CRS.lookupEpsgCode(crs, false);
                if(code != null) {
                    bbox.setCrs("EPSG:" + code);
                }
            } catch(Exception e) {
                throw new WPSException("Could not lookup epsg code for " + crs, e);
            }
        }
View Full Code Here

        }
    }

    @Test
    public void testNoCrs() throws Exception {
        BoundingBoxType bbox = (BoundingBoxType) parser.parse("10,20,15,30");
        assertEquals(2, bbox.getLowerCorner().size());
        assertEquals(10.0, bbox.getLowerCorner().get(0));
        assertEquals(20.0, bbox.getLowerCorner().get(1));
        assertEquals(2, bbox.getUpperCorner().size());
        assertEquals(15.0, bbox.getUpperCorner().get(0));
        assertEquals(30.0, bbox.getUpperCorner().get(1));
        assertNull(bbox.getCrs());
    }
View Full Code Here

        assertNull(bbox.getCrs());
    }

    @Test
    public void test2DNoCrs() throws Exception {
        BoundingBoxType bbox = (BoundingBoxType) parser.parse("10,20,15,30,EPSG:4326");
        assertEquals(2, bbox.getLowerCorner().size());
        assertEquals(10.0, bbox.getLowerCorner().get(0));
        assertEquals(20.0, bbox.getLowerCorner().get(1));
        assertEquals(2, bbox.getUpperCorner().size());
        assertEquals(15.0, bbox.getUpperCorner().get(0));
        assertEquals(30.0, bbox.getUpperCorner().get(1));
        assertEquals("EPSG:4326", bbox.getCrs());
    }
View Full Code Here

        assertEquals("EPSG:4326", bbox.getCrs());
    }

    @Test
    public void test3DNoCrs() throws Exception {
        BoundingBoxType bbox = (BoundingBoxType) parser.parse("10,20,15,30,40,50,EPSG:4979");
        assertEquals(3, bbox.getLowerCorner().size());
        assertEquals(10.0, bbox.getLowerCorner().get(0));
        assertEquals(20.0, bbox.getLowerCorner().get(1));
        assertEquals(15.0, bbox.getLowerCorner().get(2));
        assertEquals(3, bbox.getUpperCorner().size());
        assertEquals(30.0, bbox.getUpperCorner().get(0));
        assertEquals(40.0, bbox.getUpperCorner().get(1));
        assertEquals(50.0, bbox.getUpperCorner().get(2));
        assertEquals("EPSG:4979", bbox.getCrs());
    }
View Full Code Here

        assertEquals("EPSG:4979", bbox.getCrs());
    }

    @Test
    public void testWgs84FullExtent() throws Exception {
        BoundingBoxType bbox = (BoundingBoxType) parser
                .parse("-180,-90,180,90,urn:ogc:def:crs:EPSG:4326");
        assertEquals(2, bbox.getLowerCorner().size());
        assertEquals(-180.0, bbox.getLowerCorner().get(0));
        assertEquals(-90.0, bbox.getLowerCorner().get(1));
        assertEquals(2, bbox.getUpperCorner().size());
        assertEquals(180.0, bbox.getUpperCorner().get(0));
        assertEquals(90.0, bbox.getUpperCorner().get(1));
        assertEquals("urn:ogc:def:crs:EPSG:4326", bbox.getCrs());
    }
View Full Code Here

        return fromTargetType(object);
    }

    BoundingBoxType fromTargetType(Object object) throws WPSException {
        Ows11Factory factory = Ows11Factory.eINSTANCE;
        BoundingBoxType bbox = factory.createBoundingBoxType();
       
        // basic conversion and collect the crs
        CoordinateReferenceSystem crs = null;
        if (object instanceof Envelope) {
            Envelope env = (Envelope) object;
            if(object instanceof ReferencedEnvelope) {
                ReferencedEnvelope re = (ReferencedEnvelope) object;
                crs = re.getCoordinateReferenceSystem();
            }
            bbox.setLowerCorner(Arrays.asList(env.getMinX(), env.getMinY()));
            bbox.setUpperCorner(Arrays.asList(env.getMaxX(), env.getMaxY()));
        } else if (org.opengis.geometry.Envelope.class.isAssignableFrom(getType())) {
            org.opengis.geometry.Envelope env = (org.opengis.geometry.Envelope) object;
            crs = env.getCoordinateReferenceSystem();
            bbox.setLowerCorner(Arrays.asList(env.getLowerCorner().getCoordinate()));
            bbox.setUpperCorner(Arrays.asList(env.getUpperCorner().getCoordinate()));
        } else {
            throw new WPSException("Failed to convert from " + object
                    + " to an OWS 1.1 Bounding box type");
        }
       
        // handle the EPSG code
        if(crs != null) {
            try {
                Integer code = CRS.lookupEpsgCode(crs, false);
                if(code != null) {
                    bbox.setCrs("EPSG:" + code);
                }
            } catch(Exception e) {
                throw new WPSException("Could not lookup epsg code for " + crs, e);
            }
        }
View Full Code Here

            // raw response, let's see what the output is
            ExecuteResponseType response = (ExecuteResponseType) value;
            OutputDataType result = (OutputDataType) response
                    .getProcessOutputs().getOutput().get(0);
            LiteralDataType literal = result.getData().getLiteralData();
            BoundingBoxType bbox = result.getData().getBoundingBoxData();
            if (literal != null) {
                writeLiteral(output, literal);
            } else if(bbox != null) {
                writeBBox(output, bbox);
            } else {
View Full Code Here

TOP

Related Classes of net.opengis.ows11.BoundingBoxType

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.