Class BoundingBox
Represents a bounding box with lower-left and upper-right coordinate.
Inheritance
System.Object
BoundingBox
Implements
System.IComparable<BoundingBox>
NetTopologySuite.Geometries.IIntersectable<BoundingBox>
NetTopologySuite.Geometries.IExpandable<BoundingBox>
System.IEquatable<BoundingBox>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Mars.Interfaces.Environments
Assembly: Mars.Interfaces.dll
Syntax
[MessagePackObject(false)]
public class BoundingBox : IComparable<BoundingBox>, IIntersectable<BoundingBox>, IExpandable<BoundingBox>, IEquatable<BoundingBox>
Constructors
| Improve this Doc View SourceBoundingBox()
Creates a null
Envelope
.
Declaration
public BoundingBox()
BoundingBox(BoundingBox)
Create an
Envelope
from an existing bounding box.
Declaration
public BoundingBox(BoundingBox env)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | env | The Envelope to initialize from. |
BoundingBox(Position, Position)
Creates a new BoundingBox with the lower left
and upper right corner to span out the box.
Declaration
public BoundingBox(Position lowerLeft, Position upperRight)
Parameters
Type | Name | Description |
---|---|---|
Position | lowerLeft | The lower left corner of the box (minX/Lon, minY/Lat). |
Position | upperRight | The upper right corner of the box (maxX/Lon, maxY/Lat). |
BoundingBox(Position)
Creates an
Envelope
for a region defined by a single Coordinate.
Declaration
public BoundingBox(Position p)
Parameters
Type | Name | Description |
---|---|---|
Position | p | The Coordinate. |
BoundingBox(Envelope)
Create an
Envelope
from an existing NetTopologySuite.Geometries.Envelope.
Declaration
public BoundingBox(Envelope env)
Parameters
Type | Name | Description |
---|---|---|
NetTopologySuite.Geometries.Envelope | env | The Envelope to initialize from. |
BoundingBox(Double, Double, Double, Double)
Creates an
Envelope
for a region defined by maximum and minimum values.
Declaration
[SerializationConstructor]
public BoundingBox(double minX, double minY, double maxX, double maxY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | minX | The first x-value. |
System.Double | minY | The first y-value. |
System.Double | maxX | The second x-value. |
System.Double | maxY | The second y-value. |
BoundingBox(Double, Double, Double)
Creates an
Envelope
for a region defined by a single
coordinate and expand it to the given distance.
Declaration
public BoundingBox(double x, double y, double distance)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | The x coordinate component. |
System.Double | y | The y coordinate component. |
System.Double | distance | The distance to expand to. |
BoundingBox(Double, Double)
Creates an
Envelope
for a region defined by a single Coordinate.
Declaration
public BoundingBox(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | The x coordinate component. |
System.Double | y | The y coordinate component. |
Properties
| Improve this Doc View SourceArea
Gets the area of this envelope.
Declaration
[IgnoreMember]
[JsonIgnore]
public double Area { get; }
Property Value
Type | Description |
---|---|
System.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
[IgnoreMember]
[JsonIgnore]
public Position Centre { get; }
Property Value
Type | Description |
---|---|
Position |
The centre coordinate of this envelope,
or null if the envelope is null.
|
Diameter
Gets the length of the diameter (diagonal) of the envelope.
Declaration
[IgnoreMember]
[JsonIgnore]
public double Diameter { get; }
Property Value
Type | Description |
---|---|
System.Double | The diameter length |
Height
Returns the difference between the maximum and minimum y values.
Declaration
[IgnoreMember]
[JsonIgnore]
public double Height { get; }
Property Value
Type | Description |
---|---|
System.Double | max y - min y, or 0 if this is a null Envelope . |
IsNull
Returns
true
if this Envelope
is a "null" envelope.
Declaration
[IgnoreMember]
[JsonIgnore]
public bool IsNull { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
true if this Envelope is uninitialized
or is the envelope of the empty point.
|
LowerLeft
Gets the lower right corner coordinate of this box.
Declaration
[IgnoreMember]
[JsonIgnore]
public Position LowerLeft { get; }
Property Value
Type | Description |
---|---|
Position |
LowerRight
Gets the lower right corner coordinate of this box.
Declaration
[IgnoreMember]
[JsonIgnore]
public Position LowerRight { get; }
Property Value
Type | Description |
---|---|
Position |
MaxX
Returns the
Envelope
s maximum x-value. min x > max x
indicates that this is a null Envelope
.
Declaration
[Key(2)]
[JsonProperty("maxX")]
public double MaxX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The maximum x-coordinate. |
MaxY
Returns the
Envelope
s maximum y-value. min y > max y
indicates that this is a null Envelope
.
Declaration
[Key(3)]
[JsonProperty("maxY")]
public double MaxY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The maximum y-coordinate. |
Midpoint
Gets the central coordinate of this box.
Declaration
[IgnoreMember]
[JsonIgnore]
public Position Midpoint { get; }
Property Value
Type | Description |
---|---|
Position |
MinX
Returns the
Envelope
s minimum x-value. min x > max x
indicates that this is a null Envelope
.
Declaration
[Key(0)]
[JsonProperty("minX")]
public double MinX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The minimum x-coordinate. |
MinY
Returns the
Envelope
s minimum y-value. min y > max y
indicates that this is a null Envelope
.
Declaration
[Key(1)]
[JsonProperty("minY")]
public double MinY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The minimum y-coordinate. |
UpperLeft
Gets the upper left corner coordinate of this box.
Declaration
[IgnoreMember]
[JsonIgnore]
public Position UpperLeft { get; }
Property Value
Type | Description |
---|---|
Position |
UpperRight
Gets the upper right corner coordinate of this box.
Declaration
[IgnoreMember]
[JsonIgnore]
public Position UpperRight { get; }
Property Value
Type | Description |
---|---|
Position |
Width
Returns the difference between the maximum and minimum x values.
Declaration
[IgnoreMember]
[JsonIgnore]
public double Width { get; }
Property Value
Type | Description |
---|---|
System.Double | max x - min x, or 0 if this is a null Envelope . |
Methods
| Improve this Doc View SourceCompareTo(BoundingBox)
Compares two bounding boxes 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(BoundingBox env)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | env | An envelope |
Returns
Type | Description |
---|---|
System.Int32 |
Contains(BoundingBox)
Tests if the
Envelope other
lies completely inside this bounding box
(inclusive of the boundary).
Declaration
public bool Contains(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other |
Returns
Type | Description |
---|---|
System.Boolean | true if other is contained in this Envelope |
Remarks
Note that this is not the same definition as the SFS contains,
which would exclude the envelope boundary.
|
Improve this Doc
View Source
Contains(Coordinate)
Tests if the given point lies in or on the envelope.
Declaration
public bool Contains(Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
NetTopologySuite.Geometries.Coordinate | p | the point which this Envelope is being checked for containing |
Returns
Type | Description |
---|---|
System.Boolean | true if the point lies in the interior or on the boundary of this Envelope . |
Remarks
Note that this is not the same definition as the SFS contains,
which would exclude the envelope boundary.
|
Improve this Doc
View Source
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 |
---|---|---|
System.Double | x | the x-coordinate of the point which this Envelope is being checked for containing |
System.Double | y | the y-coordinate of the point which this Envelope is being checked for containing |
Returns
Type | Description |
---|---|
System.Boolean |
true if (x, y) lies in the interior or on the boundary of this Envelope .
|
Remarks
Note that this is not the same definition as the SFS contains, which would exclude the envelope boundary.
|
Improve this Doc
View Source
Copy()
Creates a deep copy of the current envelope.
Declaration
public BoundingBox Copy()
Returns
Type | Description |
---|---|
BoundingBox |
CreateGeoBoundingBox(Double, Double, Double, Double)
Represents a bounding box with lower-left and upper-right coordinate.
Declaration
public static BoundingBox CreateGeoBoundingBox(double longitude, double latitude, double distanceLongitude, double distanceLatitude)
Parameters
Type | Name | Description |
---|---|---|
System.Double | longitude | |
System.Double | latitude | |
System.Double | distanceLongitude | |
System.Double | distanceLatitude |
Returns
Type | Description |
---|---|
BoundingBox |
Disjoint(BoundingBox)
Tests if the region defined by
other
is disjoint from the region of this Envelope
.
Declaration
public bool Disjoint(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | The Envelope being checked for disjointness |
Returns
Type | Description |
---|---|
System.Boolean | true if the Envelope s are disjoint |
See Also
| Improve this Doc View SourceDistance(BoundingBox)
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(BoundingBox env)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | env |
Returns
Type | Description |
---|---|
System.Double | The distance between this and another BoundingBox . |
Equals(BoundingBox)
Represents a bounding box with lower-left and upper-right coordinate.
Declaration
public bool Equals(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Represents a bounding box with lower-left and upper-right coordinate.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
ExpandBy(Double, Double)
Expands this envelope by a given distance in all directions.
Both positive and negative distances are supported.
Declaration
public BoundingBox ExpandBy(double deltaX, double deltaY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | deltaX | The distance to expand the envelope along the the X axis. |
System.Double | deltaY | The distance to expand the envelope along the the Y axis. |
Returns
Type | Description |
---|---|
BoundingBox |
ExpandBy(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 |
---|---|---|
System.Double | distance | The distance to expand the envelope. |
ExpandedBy(BoundingBox)
Enlarges this
Envelope
so that it contains
the other
Envelope.
Has no effect if other
is wholly on or
within the envelope.
Declaration
public BoundingBox ExpandedBy(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | the Envelope to expand to include. |
Returns
Type | Description |
---|---|
BoundingBox |
ExpandToInclude(BoundingBox)
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(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | the Envelope to expand to include. |
ExpandToInclude(Envelope)
Represents a bounding box with lower-left and upper-right coordinate.
Declaration
public void ExpandToInclude(Envelope envelope)
Parameters
Type | Name | Description |
---|---|---|
NetTopologySuite.Geometries.Envelope | envelope |
ExpandToInclude(Double, Double)
Enlarges this
Envelope
so that it contains
the given NetTopologySuite.Geometries.Coordinate.
Declaration
public void ExpandToInclude(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | The value to lower the minimum x to or to raise the maximum x to. |
System.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.
|
Improve this Doc
View Source
GetHashCode()
Represents a bounding box with lower-left and upper-right coordinate.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
Init()
Initialize to a null
Envelope
.
Declaration
public void Init()
Intersection(BoundingBox)
Computes the intersection of two BoundingBoxs.
Declaration
public BoundingBox Intersection(BoundingBox env)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | env | The envelope to intersect with |
Returns
Type | Description |
---|---|
BoundingBox | 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(BoundingBox)
Check if the region defined by
other
intersects the region of this Envelope
.
Declaration
public bool Intersects(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | The Envelope which this Envelope is
being checked for intersecting.
|
Returns
Type | Description |
---|---|
System.Boolean |
true if the Envelope s intersect.
|
Intersects(Position, Position)
Tests if the extent defined by two extremal points
intersects the extent of this
Envelope
.
Declaration
public bool Intersects(Position a, Position b)
Parameters
Type | Name | Description |
---|---|---|
Position | a | A point |
Position | b | Another point |
Returns
Type | Description |
---|---|
System.Boolean | true if the extents intersect |
Intersects(Position)
Check if the position
(x, y)
overlaps (lies inside) the region of this BoundingBox
.
Declaration
public bool Intersects(Position position)
Parameters
Type | Name | Description |
---|---|---|
Position | position | that may or may not lie within the bounding box. |
Returns
Type | Description |
---|---|
System.Boolean | true if the position intersects this BoundingBox . |
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 |
---|---|---|
System.Double | x | the x-ordinate of the point. |
System.Double | y | the y-ordinate of the point. |
Returns
Type | Description |
---|---|
System.Boolean | true if the point overlaps this Envelope . |
Overlaps(BoundingBox)
Tests if the
Envelope other
lies wholely inside this Envelope
(inclusive of the boundary).
Declaration
public bool Overlaps(BoundingBox other)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | other | the Envelope to check |
Returns
Type | Description |
---|---|
System.Boolean | true if this Envelope covers the other |
Overlaps(Double, Double)
Tests if the given point lies in or on the envelope.
Declaration
public bool Overlaps(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | the x-coordinate of the point which this Envelope is being checked for containing |
System.Double | y | the y-coordinate of the point which this Envelope is being checked for containing |
Returns
Type | Description |
---|---|
System.Boolean | true if (x, y) lies in the interior or on the boundary of this Envelope . |
Parse(String)
Method to parse an envelope from its ToString() value
Declaration
public static BoundingBox Parse(string envelope)
Parameters
Type | Name | Description |
---|---|---|
System.String | envelope | The envelope string |
Returns
Type | Description |
---|---|
BoundingBox | The envelope |
ToEnvelope()
Transforms the bounding box to a NetTopologySuite.Geometries.Envelope
Declaration
public Envelope ToEnvelope()
Returns
Type | Description |
---|---|
NetTopologySuite.Geometries.Envelope | An envelope with the same spatial extent. |
ToString()
Function to get a textual representation of this envelope
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A textual representation of this envelope |
Overrides
System.Object.ToString()
|
Improve this Doc
View Source
Translate(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 |
---|---|---|
System.Double | transX | The amount to translate along the X axis. |
System.Double | transY | The amount to translate along the Y axis. |
Implements
System.IComparable<T>
NetTopologySuite.Geometries.IIntersectable<T>
NetTopologySuite.Geometries.IExpandable<T>
System.IEquatable<T>