/// <summary> /// Returns a new envelope that is a copy of this envelope, but modified /// to include the specified coordinate. /// </summary> public static IEnvelope Union(this IEnvelope self, Coordinate coord) { IEnvelope env = self.Copy(); env.ExpandToInclude(coord); return(env); }
/// <summary> /// Expands the given Envelope to include the coordinates in the sequence. /// Does not modify the original envelope, but rather returns a copy of the /// original envelope after being modified. /// </summary> /// <param name="env">The envelope use as the starting point for expansion. This envelope will not be modified.</param> /// <returns>The newly created envelope that is the expanded version of the original.</returns> public IEnvelope ExpandEnvelope(IEnvelope env) { IEnvelope temp = env.Copy(); foreach (Coordinate coord in _internalList) { temp.ExpandToInclude(coord); } return(temp); }
/// <summary> /// Expands the given Envelope to include the coordinates in the sequence. /// Does not modify the original envelope, but rather returns a copy of the /// original envelope after being modified. /// </summary> /// <param name="env">The envelope use as the starting point for expansion. This envelope will not be modified.</param> /// <returns>The newly created envelope that is the expanded version of the original.</returns> public virtual IEnvelope ExpandEnvelope(IEnvelope env) { IEnvelope cEnv = env.Copy(); for (int i = 0; i < _coordinates.Length; i++) { cEnv.ExpandToInclude(_coordinates[i]); } return(cEnv); }
/// <summary> /// Calculates the union of the current box and the given box. /// </summary> public static IEnvelope Union(this IEnvelope self, IEnvelope box) { if (box == null) { return(self.Copy()); } if (box.IsNull) { return(self.Copy()); } if (self == null) { return(box.Copy()); } if (self.IsNull) { return(box.Copy()); } IEnvelope result = self.Copy(); result.ExpandToInclude(box); return(result); }
/// <summary> /// Expands the given Envelope to include the coordinates in the sequence. /// Does not modify the original envelope, but rather returns a copy of the /// original envelope after being modified. /// </summary> /// <param name="env">The envelope use as the starting point for expansion. This envelope will not be modified.</param> /// <returns>The newly created envelope that is the expanded version of the original.</returns> public IEnvelope ExpandEnvelope(IEnvelope env) { IEnvelope temp = env.Copy(); foreach (Coordinate coord in _internalList) { temp.ExpandToInclude(coord); } return temp; }
/// <summary> /// returns only the features that have envelopes that /// intersect with the specified envelope. If in indexMode, this uses the ShapeIndices to create /// features on demand, rather than loading all the features. It is much faster to use selectIndices /// when in index mode. /// </summary> /// <param name="region">The specified region to test for intersect with</param> /// <param name="affectedRegion">This returns the geographic extents that contains the modified contents.</param> /// <returns>A List of the IFeature elements that are contained in this region</returns> public virtual List<IFeature> Select(IEnvelope region, out IEnvelope affectedRegion) { List<IFeature> result = new List<IFeature>(); if(IndexMode) { ShapeRange aoi = new ShapeRange(new Extent(region)); IEnvelope env = region.Copy(); Extent affected = new Extent(); List<ShapeRange> shapes = ShapeIndices; if(shapes != null) { for(int shp = 0; shp < shapes.Count; shp++) { if (!shapes[shp].Intersects(aoi)) continue; IFeature f = GetFeature(shp); affected.ExpandToInclude(shapes[shp].Extent); result.Add(f); } } affectedRegion = affected.ToEnvelope(); return result; } affectedRegion = new Envelope(); foreach (IFeature feature in Features) { if (!feature.Envelope.Intersects(region)) continue; result.Add(feature); affectedRegion.ExpandToInclude(feature.Envelope); } return result; }
/// <summary> /// Constructs a new DrawWindow based on the specified IEnvelope. The envelope becomes /// the GeographicView for this DrawWindow. /// </summary> /// <param name="env"></param> public DrawWindow(IEnvelope env) : base(env) { _geographicView = env.Copy(); }
/// <summary> /// Calculates the union of the current box and the given box. /// </summary> public static IEnvelope Union(this IEnvelope self, IEnvelope box) { if (box == null) return self.Copy(); if (box.IsNull) return self.Copy(); if (self == null) return box.Copy(); if (self.IsNull) return box.Copy(); IEnvelope result = self.Copy(); result.ExpandToInclude(box); return result; }
/// <summary> /// Expands the given Envelope to include the coordinates in the sequence. /// Does not modify the original envelope, but rather returns a copy of the /// original envelope after being modified. /// </summary> /// <param name="env">The envelope use as the starting point for expansion. This envelope will not be modified.</param> /// <returns>The newly created envelope that is the expanded version of the original.</returns> public virtual IEnvelope ExpandEnvelope(IEnvelope env) { IEnvelope cEnv = env.Copy(); for (int i = 0; i < _coordinates.Length; i++) { cEnv.ExpandToInclude(_coordinates[i]); } return cEnv; }