Package org.opengis.geometry

Examples of org.opengis.geometry.BoundingBox


        Display display=Display.getCurrent();
        Clipboard cp=new Clipboard(display);
        SimpleFeature[] features = UDIGTestUtil.createDefaultTestFeatures("test", 1); //$NON-NLS-1$
        FilterFactory factory= CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        SimpleFeatureType featureType = features[0].getFeatureType();
        BoundingBox bounds = features[0].getBounds();
        CoordinateReferenceSystem crs= featureType.getCoordinateReferenceSystem();
    BBOX filter = factory.bbox(featureType.getGeometryDescriptor().getName().getLocalPart(), bounds.getMinX(),
            bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY(), CRS.lookupIdentifier(crs, false));
        cp.setContents(new Object[]{filter},new Transfer[]{UDigByteAndLocalTransfer.getInstance()});
        assertSame(filter, cp.getContents(UDigByteAndLocalTransfer.getInstance()));

//        cp.setContents(new Object[]{filter},new Transfer[]{FilterTextTransfer.getInstance()});
//        Filter contents = (Filter) cp.getContents(FilterTextTransfer.getInstance());
View Full Code Here


        Filter filter = factory.id(Collections.EMPTY_SET);
        refFeatureType.setFilter(filter);

        CoordinateReferenceSystem crsNative = CRS
                .parseWKT("PROJCS[\"NAD83 / BC Albers\",GEOGCS[\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],TOWGS84[0,0,0],AUTHORITY[\"EPSG\",\"6269\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"standard_parallel_1\",50],PARAMETER[\"standard_parallel_2\",58.5],PARAMETER[\"latitude_of_center\",45],PARAMETER[\"longitude_of_center\",-126],PARAMETER[\"false_easting\",1000000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3005\"]]");
        BoundingBox nativeBoundingBox = new ReferencedEnvelope(0, 0, 0, 0, crsNative);
        BoundingBox latLonBoundingBox = new ReferencedEnvelope(-180, 180, -90, 90,
                DefaultGeographicCRS.WGS84);

        refFeatureType.setNativeBoundingBox((ReferencedEnvelope) nativeBoundingBox);
        refFeatureType.setLatLonBoundingBox((ReferencedEnvelope) latLonBoundingBox);

        refFeatureType.setStore(dataStore);

        catalog.add(refFeatureType);

        endTransaction();

        startNewTransaction();

        FeatureTypeInfo loadedFeatureType = catalog.getFeatureType(refFeatureType.getId());
        assertNotNull(loadedFeatureType);

        assertFalse(refFeatureType == loadedFeatureType);
        refFeatureType = loadedFeatureType;

        assertEquals("featureType", refFeatureType.getName());
        assertEquals("featureType title", refFeatureType.getTitle());
        assertEquals("featureType description", refFeatureType.getDescription());
        assertEquals("featureType abstract", refFeatureType.getAbstract());
        assertEquals("EPSG:4326", refFeatureType.getSRS());

        BoundingBox box = refFeatureType.getNativeBoundingBox();
        assertNotNull("Native BBox is null", box);
        assertEquals(0d, box.getMinX(), 0d);
        assertEquals(0d, box.getMinY(), 0d);
        assertEquals(0d, box.getMaxX(), 0d);
        assertEquals(0d, box.getMaxY(), 0d);
        assertTrue(CRS.equalsIgnoreMetadata(crsNative, box.getCoordinateReferenceSystem()));

        box = refFeatureType.getLatLonBoundingBox();
        assertNotNull(box);
        assertEquals(-180d, box.getMinX(), 0d);
        assertEquals(-90d, box.getMinY(), 0d);
        assertEquals(180d, box.getMaxX(), 0d);
        assertEquals(90d, box.getMaxY(), 0d);
        assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, box
                .getCoordinateReferenceSystem()));

        assertNotNull(refFeatureType.getNamespace());
        assertEquals(getName(), refFeatureType.getNamespace().getPrefix());
View Full Code Here

    }

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

        BoundingBox box = (BoundingBox) value;
        if (box == null) {
            st.setDouble(index, Double.NaN);
            st.setDouble(index + 1, Double.NaN);
            st.setDouble(index + 2, Double.NaN);
            st.setDouble(index + 3, Double.NaN);
            st.setBlob(index + 4, (Blob) null);
            return;
        }

        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();
            st.setBlob(index + 4, Hibernate.createBlob(crs.toWKT().getBytes()));
        } else {
            st.setBlob(index + 4, (Blob) null);
        }
    }
View Full Code Here

        @Override
        public Object visit(BBOX filter, Object extraData)
        {
            if(filter.getExpression2() instanceof Literal && ((Literal) filter.getExpression2()).getValue() instanceof BoundingBox) {
                BoundingBox expr2 = (BoundingBox) ((Literal) filter.getExpression2()).getValue();

                FilterFactory2 factory = getFactory(extraData);
                return factory.bbox(factory.property(geomName), expr2);

            } else if(filter.getExpression2() instanceof Literal && ((Literal) filter.getExpression2()).getValue() instanceof Polygon) {
                Polygon expr2 = (Polygon) ((Literal) filter.getExpression2()).getValue();

                if (expr2.isRectangle()) {
                    FilterFactory2 factory = getFactory(extraData);
                    BBOX bbox = factory.bbox(factory.property(geomName), JTS.toEnvelope(expr2));

                    return bbox;
                } else {
View Full Code Here

                        public RevFeature apply(final Feature feature) {
                            final RevFeature revFeature = RevFeatureBuilder.build(feature);

                            ObjectId id = revFeature.getId();
                            String name = feature.getIdentifier().getID();
                            BoundingBox bounds = feature.getBounds();
                            FeatureType type = feature.getType();

                            builder.putFeature(id, name, bounds, type);
                            return revFeature;
                        }
View Full Code Here

            throws Exception {
        ReferencedEnvelope bounds = new ReferencedEnvelope(targetCrs);

        for (int i = 0; i < features.length; i++) {
            Feature f = features[i];
            BoundingBox fbounds = f.getBounds();
            if (!CRS.equalsIgnoreMetadata(targetCrs, fbounds)) {
                fbounds = fbounds.toBounds(targetCrs);
            }
            bounds.include(fbounds);
        }
        return bounds;
    }
View Full Code Here

    public Node put(final ObjectId revFeatureId, final Feature feature) {

        final RevTreeBuilder2 treeBuilder = getTreeBuilder(feature);

        String fid = feature.getIdentifier().getID();
        BoundingBox bounds = feature.getBounds();
        FeatureType type = feature.getType();

        final Node node = treeBuilder.putFeature(revFeatureId, fid, bounds, type);
        return node;
    }
View Full Code Here

            throws Exception {
        ReferencedEnvelope bounds = new ReferencedEnvelope(targetCrs);

        for (int i = 0; i < features.length; i++) {
            Feature f = features[i];
            BoundingBox fbounds = f.getBounds();
            if (!CRS.equalsIgnoreMetadata(targetCrs, fbounds)) {
                fbounds = fbounds.toBounds(targetCrs);
            }
            bounds.include(fbounds);
        }
        return bounds;
    }
View Full Code Here

        @Override
        public void endTree(Node left, Node right) {
            String name = left == null ? right.getName() : left.getName();
            if (NodeRef.ROOT.equals(name)) {
                BoundingBox lbounds = new ReferencedEnvelope(this.leftEnv);
                BoundingBox rbounds = new ReferencedEnvelope(this.rightEnv);
                BoundingBox merged;
                if (lbounds.isEmpty()) {
                    merged = rbounds;
                } else if (rbounds.isEmpty()) {
                    merged = lbounds;
                } else {
                    merged = new ReferencedEnvelope(lbounds);
                    merged.include(rbounds);
                }
                this.result = new DiffSummary<BoundingBox, BoundingBox>(lbounds, rbounds, merged);
            }
        }
View Full Code Here

        }

        public DiffSummary<BoundingBox, BoundingBox> getResult() {
            DiffSummary<BoundingBox, BoundingBox> r = this.result;
            if (r == null) {
                BoundingBox empty = new ReferencedEnvelope(crs);
                r = new DiffSummary<BoundingBox, BoundingBox>(empty, empty, empty);
            }
            return r;
        }
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.