Class Envelope
Defines a rectangular region of the 2D coordinate plane.
Inherited Members
Namespace: NetTopologySuite.Geometries
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public class Envelope : IComparable<Envelope>, IIntersectable<Envelope>, IExpandable<Envelope>
  Remarks
It is often used to represent the bounding box of a Geometry,
e.g. the minimum and maximum x and y values of the Coordinates.
Note that Envelopes support infinite or half-infinite regions, by using the values of
Double.PositiveInfinity and Double.NegativeInfinity.
When Envelope objects are created or initialized,
the supplied extent values are automatically sorted into the correct order.
Constructors
| Edit this page View SourceEnvelope()
Creates a null Envelope.
Declaration
public Envelope()
  Envelope(Coordinate)
Creates an Envelope for a region defined by a single Coordinate.
Declaration
public Envelope(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | The Coordinate.  | 
      
Envelope(Coordinate, Coordinate)
Creates an Envelope for a region defined by two Coordinates.
Declaration
public Envelope(Coordinate p1, Coordinate p2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p1 | The first Coordinate.  | 
      
| Coordinate | p2 | The second Coordinate.  | 
      
Envelope(CoordinateSequence)
Creates an Envelope for a region defined by a CoordinateSequences.
Declaration
public Envelope(CoordinateSequence sequence)
  Parameters
| Type | Name | Description | 
|---|---|---|
| CoordinateSequence | sequence | The   | 
      
Envelope(Envelope)
Create an Envelope from an existing Envelope.
Declaration
public Envelope(Envelope env)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | env | The Envelope to initialize from.  | 
      
Envelope(IEnumerable<Coordinate>)
Creates an Envelope for a region defined by an enumeration of Coordinates.
Declaration
public Envelope(IEnumerable<Coordinate> pts)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<Coordinate> | pts | The   | 
      
Envelope(double, double, double, double)
Creates an Envelope for a region defined by maximum and minimum values.
Declaration
public Envelope(double x1, double x2, double y1, double y2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x1 | The first x-value.  | 
      
| double | x2 | The second x-value.  | 
      
| double | y1 | The first y-value.  | 
      
| double | y2 | The second y-value.  | 
      
Properties
| Edit this page View SourceArea
Gets the area of this envelope.
Declaration
public double Area { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The area of the envelope, or 0.0 if envelope is null  | 
      
Centre
Computes the coordinate of the centre of this envelope (as long as it is non-null).
Declaration
public Coordinate Centre { get; }
  Property Value
| Type | Description | 
|---|---|
| Coordinate | The centre coordinate of this envelope,
or   | 
      
Diameter
Gets the length of the diameter (diagonal) of the envelope.
Declaration
public double Diameter { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The diameter length  | 
      
Height
Returns the difference between the maximum and minimum y values.
Declaration
public double Height { get; }
  Property Value
| Type | Description | 
|---|---|
| double | max y - min y, or 0 if this is a null   | 
      
IsNull
Returns true if this Envelope is a "null" envelope.
Declaration
public bool IsNull { get; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
  | 
      
MaxExtent
Gets the maximum extent of this envelope across both dimensions.
Declaration
public double MaxExtent { get; }
  Property Value
| Type | Description | 
|---|---|
| double | 
MaxX
Returns the Envelopes maximum x-value. min x > max x
indicates that this is a null Envelope.
Declaration
public double MaxX { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The maximum x-coordinate.  | 
      
MaxY
Returns the Envelopes maximum y-value. min y > max y
indicates that this is a null Envelope.
Declaration
public double MaxY { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The maximum y-coordinate.  | 
      
MinExtent
Gets the minimum extent of this envelope across both dimensions.
Declaration
public double MinExtent { get; }
  Property Value
| Type | Description | 
|---|---|
| double | 
MinX
Returns the Envelopes minimum x-value. min x > max x
indicates that this is a null Envelope.
Declaration
public double MinX { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The minimum x-coordinate.  | 
      
MinY
Returns the Envelopes minimum y-value. min y > max y
indicates that this is a null Envelope.
Declaration
public double MinY { get; }
  Property Value
| Type | Description | 
|---|---|
| double | The minimum y-coordinate.  | 
      
Width
Returns the difference between the maximum and minimum x values.
Declaration
public double Width { get; }
  Property Value
| Type | Description | 
|---|---|
| double | max x - min x, or 0 if this is a null   | 
      
Methods
| Edit this page View SourceCompareTo(Envelope)
Compares two envelopes using lexicographic ordering. The ordering comparison is based on the usual numerical comparison between the sequence of ordinates. Null envelopes are less than all non-null envelopes.
Declaration
public int CompareTo(Envelope env)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | env | An envelope  | 
      
Returns
| Type | Description | 
|---|---|
| int | 
CompareTo(object)
Compares two envelopes using lexicographic ordering. The ordering comparison is based on the usual numerical comparison between the sequence of ordinates. Null envelopes are less than all non-null envelopes.
Declaration
public int CompareTo(object o)
  Parameters
| Type | Name | Description | 
|---|---|---|
| object | o | An envelope  | 
      
Returns
| Type | Description | 
|---|---|
| int | 
Contains(Coordinate)
Tests if the given point lies in or on the envelope.
Declaration
public bool Contains(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | the point which this   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Remarks
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
Contains(Envelope)
Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary).
Declaration
public bool Contains(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | 
Returns
| Type | Description | 
|---|---|
| bool | true if   | 
      
Remarks
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
Contains(double, double)
Tests if the given point lies in or on the envelope.
Declaration
public bool Contains(double x, double y)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x | the x-coordinate of the point which this   | 
      
| double | y | the y-coordinate of the point which this   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Remarks
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
ContainsProperly(Envelope)
Tests if an envelope is properly contained in this one. The envelope is properly contained if it is contained by this one but not equal to it.
Declaration
public bool ContainsProperly(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | The envelope to test  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Copy()
Creates a deep copy of the current envelope.
Declaration
public Envelope Copy()
  Returns
| Type | Description | 
|---|---|
| Envelope | 
Covers(Coordinate)
Tests if the given point lies in or on the envelope.
Declaration
public bool Covers(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | the point which this   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Covers(Envelope)
Tests if the Envelope other lies wholely inside this Envelope (inclusive of the boundary).
Declaration
public bool Covers(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | the   | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if this   | 
      
Covers(double, double)
Tests if the given point lies in or on the envelope.
Declaration
public bool Covers(double x, double y)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x | the x-coordinate of the point which this   | 
      
| double | y | the y-coordinate of the point which this   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Disjoint(Envelope)
Tests if the region defined by other
is disjoint from the region of this Envelope.
Declaration
public bool Disjoint(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | The   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
See Also
| Edit this page View SourceDistance(Envelope)
Computes the distance between this and another
Envelope.
The distance between overlapping Envelopes is 0.  Otherwise, the
distance is the Euclidean distance between the closest points.
Declaration
public double Distance(Envelope env)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | env | 
Returns
| Type | Description | 
|---|---|
| double | The distance between this and another   | 
      
Equals(Envelope)
Declaration
public bool Equals(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | 
Returns
| Type | Description | 
|---|---|
| bool | 
Equals(object)
Declaration
public override bool Equals(object o)
  Parameters
| Type | Name | Description | 
|---|---|---|
| object | o | 
Returns
| Type | Description | 
|---|---|
| bool | 
Overrides
| Edit this page View SourceExpandBy(double)
Expands this envelope by a given distance in all directions. Both positive and negative distances are supported.
Declaration
public void ExpandBy(double distance)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | distance | The distance to expand the envelope.  | 
      
ExpandBy(double, double)
Expands this envelope by a given distance in all directions. Both positive and negative distances are supported.
Declaration
public void ExpandBy(double deltaX, double deltaY)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | deltaX | The distance to expand the envelope along the the X axis.  | 
      
| double | deltaY | The distance to expand the envelope along the the Y axis.  | 
      
ExpandToInclude(Coordinate)
Enlarges this Envelope so that it contains
the given Coordinate.
Has no effect if the point is already on or within the envelope.
Declaration
public void ExpandToInclude(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | The Coordinate.  | 
      
ExpandToInclude(Envelope)
Enlarges this Envelope so that it contains
the other Envelope.
Has no effect if other is wholly on or
within the envelope.
Declaration
public void ExpandToInclude(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | the   | 
      
ExpandToInclude(double, double)
Enlarges this Envelope so that it contains
the given Coordinate.
Declaration
public void ExpandToInclude(double x, double y)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x | The value to lower the minimum x to or to raise the maximum x to.  | 
      
| double | y | The value to lower the minimum y to or to raise the maximum y to.  | 
      
Remarks
Has no effect if the point is already on or within the envelope.
ExpandedBy(Envelope)
Enlarges this Envelope so that it contains
the other Envelope.
Has no effect if other is wholly on or
within the envelope.
Declaration
public Envelope ExpandedBy(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | the   | 
      
Returns
| Type | Description | 
|---|---|
| Envelope | 
GetHashCode()
Declaration
public override int GetHashCode()
  Returns
| Type | Description | 
|---|---|
| int | 
Overrides
| Edit this page View SourceInit()
Initialize to a null Envelope.
Declaration
public void Init()
  Init(Coordinate)
Initialize an Envelope for a region defined by a single Coordinate.
Declaration
public void Init(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | The Coordinate.  | 
      
Init(Coordinate, Coordinate)
Initialize an Envelope for a region defined by two Coordinates.
Declaration
public void Init(Coordinate p1, Coordinate p2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p1 | The first Coordinate.  | 
      
| Coordinate | p2 | The second Coordinate.  | 
      
Init(Envelope)
Initialize an Envelope from an existing Envelope.
Declaration
public void Init(Envelope env)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | env | The Envelope to initialize from.  | 
      
Init(double, double, double, double)
Initialize an Envelope for a region defined by maximum and minimum values.
Declaration
public void Init(double x1, double x2, double y1, double y2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x1 | The first x-value.  | 
      
| double | x2 | The second x-value.  | 
      
| double | y1 | The first y-value.  | 
      
| double | y2 | The second y-value.  | 
      
Intersection(Envelope)
Computes the intersection of two Envelopes.
Declaration
public Envelope Intersection(Envelope env)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | env | The envelope to intersect with  | 
      
Returns
| Type | Description | 
|---|---|
| Envelope | A new Envelope representing the intersection of the envelopes (this will be the null envelope if either argument is null, or they do not intersect  | 
      
Intersects(Coordinate)
Check if the point p overlaps (lies inside) the region of this Envelope.
Declaration
public bool Intersects(Coordinate p)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p | the   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Intersects(Coordinate, Coordinate)
Tests if the extent defined by two extremal points
intersects the extent of this Envelope.
Declaration
public bool Intersects(Coordinate a, Coordinate b)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | a | A point  | 
      
| Coordinate | b | Another point  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Intersects(Coordinate, Coordinate, Coordinate)
Test the point q to see whether it intersects the Envelope defined by p1-p2.
Declaration
public static bool Intersects(Coordinate p1, Coordinate p2, Coordinate q)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p1 | One extremal point of the envelope.  | 
      
| Coordinate | p2 | Another extremal point of the envelope.  | 
      
| Coordinate | q | Point to test for intersection.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Intersects(Coordinate, Coordinate, Coordinate, Coordinate)
Tests whether the envelope defined by p1-p2 and the envelope defined by q1-q2 intersect.
Declaration
public static bool Intersects(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Coordinate | p1 | One extremal point of the envelope Point.  | 
      
| Coordinate | p2 | Another extremal point of the envelope Point.  | 
      
| Coordinate | q1 | One extremal point of the envelope Q.  | 
      
| Coordinate | q2 | Another extremal point of the envelope Q.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Intersects(Envelope)
Check if the region defined by other
intersects the region of this Envelope.
Declaration
public bool Intersects(Envelope other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Envelope | other | The   | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Intersects(double, double)
Check if the point (x, y) overlaps (lies inside) the region of this Envelope.
Declaration
public bool Intersects(double x, double y)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | x | the x-ordinate of the point.  | 
      
| double | y | the y-ordinate of the point.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
Parse(string)
Method to parse an envelope from its ToString() value
Declaration
public static Envelope Parse(string envelope)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | envelope | The envelope string  | 
      
Returns
| Type | Description | 
|---|---|
| Envelope | The envelope  | 
      
SetToNull()
Makes this Envelope a "null" envelope..
Declaration
public void SetToNull()
  ToString()
Function to get a textual representation of this envelope
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| string | A textual representation of this envelope  | 
      
Overrides
| Edit this page View SourceTranslate(double, double)
Translates this envelope by given amounts in the X and Y direction.
Declaration
public void Translate(double transX, double transY)
  Parameters
| Type | Name | Description | 
|---|---|---|
| double | transX | The amount to translate along the X axis.  | 
      
| double | transY | The amount to translate along the Y axis.  |