Package org.opengis.geometry

Examples of org.opengis.geometry.BoundingBox


    }

    public void nullSafeSet(PreparedStatement st, Object value, int index)
            throws HibernateException, SQLException {

        BoundingBox box = (BoundingBox) value;
        if (box == null) {
            //set to null
            st.setDouble(index, 1);
            st.setDouble(index + 1, 1);
            st.setDouble(index + 2, -1);
            st.setDouble(index + 3, -1);
            st.setNull(index + 4, Types.VARCHAR);
            //st.setBlob(index + 4, (Blob) null);
            return;
        }

        //TODO: check for isNull() and set the minx,maxx accordingly
        st.setDouble(index, box.getMinX());
        st.setDouble(index + 1, box.getMinY());
        st.setDouble(index + 2, box.getMaxX());
        st.setDouble(index + 3, box.getMaxY());

        if (box.getCoordinateReferenceSystem() != null) {
            CoordinateReferenceSystem crs = box.getCoordinateReferenceSystem();
            if (storeCRSAsWKT) {
                st.setString(index+4, crs.toWKT());
            }
            else {
                try {
View Full Code Here


    }

    public void nullSafeSet(PreparedStatement st, Object value, int index)
            throws HibernateException, SQLException {

        BoundingBox box = (BoundingBox) value;
        if (box == null) {
            //set to null
            st.setDouble(index, 1);
            st.setDouble(index + 1, 1);
            st.setDouble(index + 2, -1);
            st.setDouble(index + 3, -1);
            st.setNull(index + 4, Types.VARCHAR);
            //st.setBlob(index + 4, (Blob) null);
            return;
        }

        //TODO: check for isNull() and set the minx,maxx accordingly
        st.setDouble(index, box.getMinX());
        st.setDouble(index + 1, box.getMinY());
        st.setDouble(index + 2, box.getMaxX());
        st.setDouble(index + 3, box.getMaxY());

        if (box.getCoordinateReferenceSystem() != null) {
            CoordinateReferenceSystem crs = box.getCoordinateReferenceSystem();
            if (storeCRSAsWKT) {
                st.setString(index+4, crs.toWKT());
            }
            else {
                try {
View Full Code Here

        List<Object> elements = getElements(request);
        if (elements==null) return null;

        try {
            BoundingBox result = new ReferencedEnvelope(monitorConfig.getBboxCrs());
            for(Object e : elements){
                e = unwrapElement(e);

                //first ask for a bounding box directly
                ReferencedEnvelope bbox = getBBoxFromElement(e);
                if (bbox == null) {
                    // try to infer it from a filter of the request
                    // This is the default CRS for the layer being queried
                    CoordinateReferenceSystem defaultCrs = getCrsFromElement(e);
                    if (defaultCrs == null) {
                        continue;
                    }

                    Filter f = OwsUtils.has(e, "filter") ? (Filter) OwsUtils.get(e, "filter") : null;
                    if(f != null) {
                        ReferencedEnvelope startingBbox = new ReferencedEnvelope(defaultCrs);
                        bbox = (ReferencedEnvelope) f.accept(visitor, startingBbox);
                    }
                }

                if (bbox != null) {
                    result.include(bbox.toBounds(monitorConfig.getBboxCrs()));
                }
            }
            return result;
        } catch (TransformException ex) {
            LOGGER.warning("Could not Transform bounds to desired CRS");
View Full Code Here

                }
            }

            //go through all the features and aggregate the bounding boxes
            for (Feature f : (List<Feature>)OwsUtils.get(element, "feature")) {
                BoundingBox fbbox = f.getBounds();
                if (fbbox == null) {
                    continue;
                }

                if (bbox == null) {
View Full Code Here

       
        CoordinateReferenceSystem crs = CRS.decode("EPSG:3348", false);
        CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false);
        GeneralEnvelope env = new GeneralEnvelope(new double[]{5988504.35, 851278.90}, new double[]{7585113.55,1950872.01});
        env.setCoordinateReferenceSystem(crs);
        BoundingBox bbox = new ReferencedEnvelope(42.2802, 53.73, -95.1193, -71.295, logCrs);

        spatialSubset.getEnvelope().clear();
        spatialSubset.getEnvelope().add(env);
        net.opengis.wcs10.DomainSubsetType domainSubset = Wcs10Factory.eINSTANCE.createDomainSubsetType();
        domainSubset.setSpatialSubset(spatialSubset);
View Full Code Here

        net.opengis.wcs11.GetCoverageType gc = Wcs11Factory.eINSTANCE.createGetCoverageType();
        //xMin,yMin 5988504.35,851278.90 : xMax,yMax 7585113.55,1950872.01
        //xMin,yMin -95.1193,42.2802 : xMax,yMax -71.295,53.73
       
        CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false);
        BoundingBox bbox = new ReferencedEnvelope(42.2802, 53.73, -95.1193, -71.295, logCrs);
        net.opengis.ows11.BoundingBoxType wcsBbox = net.opengis.ows11.Ows11Factory.eINSTANCE.createBoundingBoxType();
        wcsBbox.setLowerCorner(Arrays.asList(5988504.35d,851278.90d));
        wcsBbox.setUpperCorner(Arrays.asList(7585113.55d,1950872.01d));
        wcsBbox.setCrs("urn:ogc:def:crs:EPSG:3348");
        net.opengis.wcs11.DomainSubsetType domainSubset = Wcs11Factory.eINSTANCE.createDomainSubsetType();
View Full Code Here

        gm.setBbox(env);
        gm.setCrs(crs);
        callback.operationDispatched(new Request(), op("GetMap", "WMS", "1.1.1", gm));
       
        CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false);
        BoundingBox bbox = new ReferencedEnvelope(42.2802, 53.73, -95.1193, -71.295, logCrs);
       
        assertEquals("acme:foo", data.getResources().get(0));
        BBoxAsserts.assertEqualsBbox(bbox, data.getBbox(), 0.1);
    }
View Full Code Here

            List<Envelope> envelopes = (List<Envelope>) OwsUtils.get(spatialSubset, "envelope");
       
        // According to the WCS spec there should be exactly one
        Envelope env = envelopes.get(0);
       
        BoundingBox result=null;
        // Turn into a class that implements BoundingBox
        try{
            result=new ReferencedEnvelope(env).toBounds(monitorConfig.getBboxCrs());
        } catch(TransformException e) {
            LOGGER.log(Level.WARNING, "Could not transform bounding box to logging CRS", e);
View Full Code Here

        Operation op = op("GetFeature", "WFS", "1.0.0", gf);
        callback.operationDispatched(new Request(), op);
       
        assertEquals("acme:foo", data.getResources().get(0));
        assertEquals("acme:bar", data.getResources().get(1));
        BoundingBox expected = new ReferencedEnvelope(53.73,40, -60,-95.1193,CRS.decode("EPSG:4326"));
        // xMin,yMin -95.1193,40 : xMax,yMax -60,53.73
        BBoxAsserts.assertEqualsBbox(expected, data.getBbox(), 0.01);
    }
View Full Code Here

        Operation op = op("Transaction", "WFS", "1.1.0", t);
        callback.operationDispatched(new Request(), op);
       
        assertEquals("acme:foo", data.getResources().get(0));
        assertEquals("acme:bar", data.getResources().get(1));
        BoundingBox expected = new ReferencedEnvelope(53.73,40, -60,-95.1193,CRS.decode("EPSG:4326"));
        // xMin,yMin -95.1193,40 : xMax,yMax -60,53.73       
        BBoxAsserts.assertEqualsBbox(expected, data.getBbox(), 0.01);
    }
View Full Code Here

TOP

Related Classes of org.opengis.geometry.BoundingBox

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.