Package org.opengis.geometry

Examples of org.opengis.geometry.BoundingBox


      access.read(new GeoTiffAccess.Read<CoverageResponse>() {
        public CoverageResponse run(GeoTiffReader reader,
            GeoTiffAccess access) throws IOException {

          // get the request elements
          final BoundingBox bbox = request.getGeographicArea();
          final Rectangle rasterArea = request.getRasterArea();
          final MathTransform2D g2w = request
              .getGridToWorldTransform();

          final GridCoverage2D coverage;
          if (g2w != null || rasterArea != null || g2w != null) {
            final ParameterValue<GridGeometry2D> readParameter = AbstractGridFormat.READ_GRIDGEOMETRY2D
                .createValue();
            if (g2w == null) {
              if (rasterArea == null) {
                Info info = getInfo(null );
                readParameter.setValue(new GridGeometry2D(
                    info.getGeometry().getGridRange2D(),
                    new ReferencedEnvelope(bbox)));
              } else {
                readParameter.setValue(new GridGeometry2D(
                    new GridEnvelope2D(rasterArea),
                    new ReferencedEnvelope(bbox)));
              }
            } else {
              readParameter.setValue(new GridGeometry2D(
                  new GridEnvelope2D(rasterArea),
                  PixelInCell.CELL_CENTER, g2w, bbox
                      .getCoordinateReferenceSystem(),
                  null));
            }
            coverage = (GridCoverage2D) reader
                .read(new GeneralParameterValue[] { readParameter });
View Full Code Here


            if(bounds != null) {
                // new ones
                it = diff.getAdded().values().iterator();
                while(it.hasNext()){
                    SimpleFeature feature = (SimpleFeature) it.next();
                    BoundingBox fb = feature.getBounds();
                    if(fb != null) {
                        bounds.expandToInclude(ReferencedEnvelope.reference(fb));
                    }
                }
               
                // modified ones
                it = diff.getModified().values().iterator();
                while(it.hasNext()){
                    SimpleFeature feature = (SimpleFeature) it.next();
                    if(feature != TransactionStateDiff.NULL) {
                        BoundingBox fb = feature.getBounds();
                        if(fb != null) {
                            bounds.expandToInclude(ReferencedEnvelope.reference(fb));
                        }
                    }
                }
View Full Code Here

        assertNull(type.getGeometryDescriptor());
        assertEquals(type.getGeometryDescriptor(), actual.getGeometryDescriptor());
        assertEquals(type, actual);

        BoundingBox b = half.getBounds();
        assertEquals(new ReferencedEnvelope(1, 5, 0, 4,null), b);
    }
View Full Code Here

        assertNull(type.getGeometryDescriptor());
        assertEquals(type.getGeometryDescriptor(), actual.getGeometryDescriptor());
        assertEquals(type, actual);

        BoundingBox b = half.getBounds();
        assertEquals(new ReferencedEnvelope(1, 5, 0, 4, null), b);
    }
View Full Code Here

            while (i.hasNext()) {
                Feature feature = i.next();
                if( feature == null ) continue;
               
                BoundingBox geomBounds = feature.getBounds();
                // IanS - as of 1.3, JTS expandToInclude ignores "null" Envelope
                // and simply adds the new bounds...
                // This check ensures this behavior does not occur.
                if ( geomBounds != null && !geomBounds.isEmpty() ) {
                    bounds.include(geomBounds);
                }
            }
            return bounds;
        }
View Full Code Here

                // //
//                VerticalExtent ve = sd.getVerticalExtent();
//                CoordinateReferenceSystem crs = sd.getCoordinateReferenceSystem();
                TemporalGeometricPrimitive time = sd.getTemporalExtent();
               
                BoundingBox boundingBox = sd.getHorizontalExtent();
//                String referenceID = "";
//                if (crs instanceof CompoundCRS){
//                    List<CoordinateReferenceSystem> list = ((CompoundCRS) crs).getCoordinateReferenceSystems();
//                    if (list!=null && !list.isEmpty()){
//                        for (CoordinateReferenceSystem crsElement : list){
View Full Code Here

        if (sd == null)
            throw new IllegalArgumentException("Provided Slice Descriptor is null");
        final GeneralEnvelope envelope = sd.getGeneralEnvelope().clone();
        envelopesMap.put(coverageName, envelope);
        crsMap.put(coverageName, sd.getCoordinateReferenceSystem());
        final BoundingBox bb = sd.getHorizontalExtent();
        boundingBoxesMap.put(coverageName, bb);
        final GeneralEnvelope coverageEnvelope2D = new GeneralEnvelope(bb);
        coverageEnvelope2DMap.put(coverageName, coverageEnvelope2D);
        spatialReferenceSystem2DMap.put(coverageName, coverageEnvelope2D.getCoordinateReferenceSystem());
        final Envelope2D wgs84BaseEnvelope2D = (Envelope2D) Utilities.getEnvelopeAsWGS84(coverageEnvelope2D, true);
View Full Code Here

   
    public Object visit(BBOX filter, Object extraData) {
        if (filter.getExpression2() instanceof Literal) {
            Literal bboxLiteral = (Literal) filter.getExpression2();
            if (bboxLiteral.getValue() instanceof BoundingBox) {
                BoundingBox bounds = (BoundingBox) bboxLiteral.getValue();
   
                return ff.bbox(filter.getExpression1(), new ReferencedEnvelope(
                        bounds.getMinY(), bounds.getMaxY(), bounds.getMinX(),
                        bounds.getMaxX(), bounds.getCoordinateReferenceSystem()));
            } else if (bboxLiteral.getValue() instanceof Geometry) {
                Geometry geom = (Geometry) bboxLiteral.getValue();
                Envelope geomEnvelope = geom.getEnvelopeInternal();
                return ff.bbox(filter.getExpression1(), new ReferencedEnvelope(
                        geomEnvelope.getMinY(), geomEnvelope.getMaxY(),
View Full Code Here

                FeatureReader<SimpleFeatureType, SimpleFeature> reader;
                reader = dataStore.getFeatureReader(geomQuery, Transaction.AUTO_COMMIT);
                bounds = new ReferencedEnvelope(contentType.getCoordinateReferenceSystem());
                try {
                    BoundingBox featureBounds;
                    // collect size to alleviate #getCount if needed
                    int collectionSize = 0;
                    while (reader.hasNext()) {
                        featureBounds = reader.next().getBounds();
                        bounds.expandToInclude(featureBounds.getMinX(), featureBounds.getMinY());
                        bounds.expandToInclude(featureBounds.getMaxX(), featureBounds.getMaxY());
                        collectionSize++;
                    }
                    if (this.cachedSize == -1) {
                        this.cachedSize = collectionSize;
                    }
View Full Code Here

   
    public Object visit(BBOX filter, Object extraData) {
        if (filter.getExpression2() instanceof Literal) {
            Literal bboxLiteral = (Literal) filter.getExpression2();
            if (bboxLiteral.getValue() instanceof BoundingBox) {
                BoundingBox bounds = (BoundingBox) bboxLiteral.getValue();
   
                return ff.bbox(filter.getExpression1(), new ReferencedEnvelope(
                        bounds.getMinY(), bounds.getMaxY(), bounds.getMinX(),
                        bounds.getMaxX(), bounds.getCoordinateReferenceSystem()));
            } else if (bboxLiteral.getValue() instanceof Geometry) {
                Geometry geom = (Geometry) bboxLiteral.getValue();
                Envelope geomEnvelope = geom.getEnvelopeInternal();
                return ff.bbox(filter.getExpression1(), new ReferencedEnvelope(
                        geomEnvelope.getMinY(), geomEnvelope.getMaxY(),
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.