/** * Extend the envelope of the coverage. * * The new envelope of the coverage will contain the old and the given envelope. * * @param envelope * Envelope to add. */ protected void extendEnvelope( Envelope envelope ) { if ( this.envelope == null ) { this.envelope = envelope; } else { this.envelope = this.envelope.merge( envelope ); } }
private Envelope mergeEnvelope( final Envelope existing, final Envelope additional ) { if ( existing == null ) { return additional; } if ( additional == null || additional.getCoordinateDimension() < 2 ) { return existing; } return existing.merge( additional ); }
public WFSFeatureType( QName name, List<LanguageString> titles, List<LanguageString> abstracts, List<String> outputFormats, List<Object> keywords, CRSRef defaultCrs, List<CRSRef> otherCrs, List<Envelope> wgs84BBoxes, List<Object> mdReferences, Object extendedDescription ) { this.name = name; this.titles = titles; this.abstracts = abstracts; this.outputFormats = outputFormats; this.keywords = keywords; this.defaultCrs = defaultCrs; this.otherCrs = otherCrs; this.wgs84BBoxes = wgs84BBoxes; wgs84BBox = wgs84BBoxes.isEmpty() ? null : wgs84BBoxes.get( 0 ); for ( int i = 1; i < wgs84BBoxes.size(); i++ ) { wgs84BBox = wgs84BBox.merge( wgs84BBoxes.get( i ) ); } this.mdReferences = Collections.emptyList(); // this.extendedDescription = extendedDescription; }
@Override public Envelope calcEnvelope() { Envelope fcBBox = null; for ( Feature feature : this ) { Envelope memberBBox = feature.getEnvelope(); if ( memberBBox != null ) { if ( fcBBox != null ) { fcBBox = fcBBox.merge( memberBBox ); } else { fcBBox = memberBBox; } } } return fcBBox; } }
/** * @param srs * @param layers * @return the merged envelope, or null, if none was found */ public Envelope getBoundingBox( String srs, List<String> layers ) { Envelope res = null; for ( String name : layers ) { if ( res == null ) { res = getBoundingBox( srs, name ); } else { res = res.merge( getBoundingBox( srs, name ) ); } } return res; }
/** * @param layers * @return a merged envelope of all the layer's envelopes */ public Envelope getLatLonBoundingBox( List<String> layers ) { Envelope res = null; for ( String name : layers ) { if ( res == null ) { res = getLatLonBoundingBox( name ); } else { res = res.merge( getLatLonBoundingBox( name ) ); } } return res; }
@Override public synchronized Envelope getEnvelope() { if ( env == null ) { if ( exteriorSurface != null ) { env = exteriorSurface.getEnvelope(); } else { for ( Surface interiorSurface : interiorSurfaces ) { Envelope intEnv = interiorSurface.getEnvelope(); if ( env == null ) { env = intEnv; } else { env = env.merge( intEnv ); } } } } return env; } }
/** * @param modelBBox * @return */ private Envelope mergeEnvelopes( Envelope datasetEnv, float[] modelBBox, ICRS baseCRS ) { if ( modelBBox == null ) { return datasetEnv; } int size = modelBBox.length; int dim = size / 2; int index = 0; double[] min = new double[3]; double[] max = new double[3]; min[0] = modelBBox[index++]; min[1] = modelBBox[index++]; min[2] = dim == 3 ? modelBBox[index++] : 0; max[0] = modelBBox[index++]; max[1] = modelBBox[index++]; max[2] = dim == 3 ? modelBBox[index++] : 0; Envelope env = geomFac.createEnvelope( min, max, baseCRS ); if ( datasetEnv == null ) { datasetEnv = geomFac.createEnvelope( min, max, baseCRS ); } return datasetEnv.merge( env ); }
/** * Adds the given branch group to the scene and set the appropriate distance etc. After adding the branch group to * the rotation group which is controlled by the mouse rotator. * * @param b * a list of WorldRenderableObjects, can be <Code>null</Code>. */ public void addDataObjectToScene( WorldRenderableObject b ) { if ( b != null ) { Envelope env = b.getBbox(); if ( env != null ) { if ( isDefaultBBox() ) { bbox = env; } else { bbox = bbox.merge( env ); } } calcViewParameters(); worldRenderableObjects.add( b ); } }
private static BBOX merge( BBOX bbox1, BBOX bbox2 ) { // TODO handle different SRS Envelope env = bbox1.getBoundingBox().merge( bbox2.getBoundingBox() ); Expression expr = bbox1.getParam1(); if ( expr == null || !expr.equals( bbox2.getParam1() ) ) { expr = null; } return new BBOX( expr, env ); }
/** * Add the values from the given info to this info. * * @param info * to get add the values from. */ public void add( ModelBackendInfo info ) { if ( info != null ) { this.ordinateCount += info.ordinateCount; this.textureOrdinateCount += info.textureOrdinateCount; if ( info.getDatasetEnvelope() != null ) { if ( this.datasetEnvelope == null ) { this.datasetEnvelope = info.getDatasetEnvelope(); } else { this.datasetEnvelope = this.datasetEnvelope.merge( info.getDatasetEnvelope() ); } } } }
bbox = oldBBox.merge( bbox );
/** * @param toLocalCRS * @param dsEnvelope * @param sceneEnvelope * @return the merged scene envelope (in realworld coordinates). */ private Envelope mergeGlobalWithScene( double[] toLocalCRS, Envelope dsEnvelope, Envelope sceneEnvelope ) { if ( dsEnvelope != null && ( Math.abs( dsEnvelope.getSpan0() - RenderableDataset.DEFAULT_SPAN ) > 1E-8 ) ) { // convert the global dataset (in wpvs world coordinates) to real world coordinates. double[] min = dsEnvelope.getMin().getAsArray(); double[] max = dsEnvelope.getMax().getAsArray(); double[] tMin = Arrays.copyOf( min, min.length ); double[] tMax = Arrays.copyOf( max, max.length ); tMin[0] += ( -toLocalCRS[0] ); tMin[1] += ( -toLocalCRS[1] ); tMax[0] += ( -toLocalCRS[0] ); tMax[1] += ( -toLocalCRS[1] ); Envelope tEnv = geomFac.createEnvelope( tMin, tMax, dsEnvelope.getCoordinateSystem() ); sceneEnvelope = sceneEnvelope.merge( tEnv ); } return sceneEnvelope; }
Envelope oldBbox = fs.getBBoxCache().get( ftName ); if ( oldBbox != null ) { bbox = oldBbox.merge( bbox );
@Override public Envelope getEnvelope() { if ( env == null ) { // TODO NullEnvelope for emtpy aggregates? or throw an exception? env = get( 0 ).getEnvelope(); for ( Geometry geom : this ) { env = env.merge( geom.getEnvelope() ); } if ( env.getCoordinateSystem() == null ) { env.setCoordinateSystem( crs ); } } return env; }
/** * Merge the passed SpatialMetadata into this SpatialMetadata and returns the merged SpatialMetadata, this and the * passed are not changed! * * @param spatialMetadataToMerge * SpatialMetadata to merge, never <code>null</code> */ public SpatialMetadata merge( SpatialMetadata spatialMetadataToMerge ) { if ( spatialMetadataToMerge == null ) return new SpatialMetadata( this ); List<ICRS> newCoordinateSystems = new ArrayList<ICRS>(); if ( this.coordinateSystems != null ) { newCoordinateSystems.addAll( this.coordinateSystems ); } if ( spatialMetadataToMerge.getCoordinateSystems() != null ) { for ( ICRS crsToMerge : spatialMetadataToMerge.getCoordinateSystems() ) { if ( !newCoordinateSystems.contains( crsToMerge ) ) { newCoordinateSystems.add( crsToMerge ); } } } Envelope newEnvelope = copyEnvelope( this.envelope ); if ( spatialMetadataToMerge.getEnvelope() != null ) { if ( newEnvelope == null ) newEnvelope = copyEnvelope( spatialMetadataToMerge.getEnvelope() ); else newEnvelope = newEnvelope.merge( spatialMetadataToMerge.getEnvelope() ); } return new SpatialMetadata( newEnvelope, newCoordinateSystems ); }
/** * Adds a new tile to the container. * * @param raster * new tile */ public synchronized void addTile( AbstractRaster raster ) { if ( raster != null ) { if ( this.envelope == null ) { this.envelope = raster.getEnvelope(); } else { this.envelope = this.envelope.merge( raster.getEnvelope() ); } if ( this.rasterReference == null ) { this.rasterReference = raster.getRasterReference(); } else { this.rasterReference = RasterGeoReference.merger( this.rasterReference, raster.getRasterReference() ); } if ( this.rdi == null ) { this.rdi = raster.getRasterDataInfo(); } if ( this.resolutionInfo == null ) { this.resolutionInfo = raster.getResolutionInfo(); } tiles.add( raster ); } }
/** * Ignores all errors, tries to aggregate all envelopes of all feature types. * * @param fs * @return null, if none of the feature types had an envelope */ public static Envelope getCombinedEnvelope( FeatureStore fs ) { Envelope env = null; for ( FeatureType ft : fs.getSchema().getFeatureTypes() ) { if ( env == null ) { try { env = fs.getEnvelope( ft.getName() ); } catch ( Throwable e ) { // ignore it } } else { try { Envelope b = fs.getEnvelope( ft.getName() ); if ( b != null ) { env = env.merge( b ); } } catch ( Throwable e ) { // ignore it } } } return env; }
private static Envelope aggregateFromLayer( Layer l, Envelope env, List<ICRS> crs ) { SpatialMetadata smd = l.getMetadata().getSpatialMetadata(); if ( smd == null ) { return env; } if ( smd.getEnvelope() != null ) { if ( env == null ) { env = smd.getEnvelope(); } else { env = env.merge( smd.getEnvelope() ); } } if ( smd.getCoordinateSystems() != null ) { addAllUncontained( crs, smd.getCoordinateSystems() ); } return env; }
private static Envelope aggregateFromTheme( Theme t, Envelope env, List<ICRS> crs ) { aggregateSpatialMetadata( t ); SpatialMetadata smd = t.getLayerMetadata().getSpatialMetadata(); if ( smd.getEnvelope() != null ) { if ( env == null ) { env = smd.getEnvelope(); } else { env = env.merge( smd.getEnvelope() ); } } if ( smd.getCoordinateSystems() != null ) { addAllUncontained( crs, smd.getCoordinateSystems() ); } return env; }