MapRectangle Class |
For geographical use cases, the type Rect is insufficient for different reasons. Especially the convention, the top value contains a lower coordinate value compared to the bottom value, often leads to implementing issues. Therefore, this class provides the compass directions as bounding properties directly.
Another aspect is the paradigm of a center based reference point (compared to the edge-based format of type Rect).
Namespace: Ptv.XServer.Controls.Map
The MapRectangle type exposes the following members.
Name | Description | |
---|---|---|
MapRectangle |
Initializes a new instance of the MapRectangle class, by setting all boundaries to an empty state.
This approach is helpful, when Point objects are inserted by the Union methods.
| |
MapRectangle(IEnumerablePoint) |
Initializes a new instance of the MapRectangle class. The resulting object represents the smallest rectangle
containing all points provided by the point enumeration, i.e. the new object represents the minimal bounding rectangle
of the point collection. The ordering of the points inside the enumeration has no influence on the result.
| |
MapRectangle(Point) | ||
MapRectangle(Rect) |
Initializes a new instance of the MapRectangle class, by transforming the location and size of parameter
rect into boundaries of the new instance.
| |
MapRectangle(MapRectangle) |
Initializes a new instance of the MapRectangle class, by copying the boundaries of parameter
originalRectangle.
| |
MapRectangle(Point, Point) |
Initializes a new instance of the MapRectangle class. The resulting object represents the smallest rectangle
containing both points, i.e. both points define the boundaries directly. The ordering of the parameters has no influence on the result.
| |
MapRectangle(Point, Size) |
Initializes a new instance of the MapRectangle class. The resulting object is defined by the center
and sizeparameter.
| |
MapRectangle(Double, Double, Double, Double) |
Initializes a new instance of the MapRectangle class, by setting the boundaries directly. No checks are made
for avoiding a lower east value compared to the west value. The same is true for the
north/south pair.
|
Name | Description | |
---|---|---|
Center |
Gets or sets the center of the rectangle. If the rectangle is empty, the point (Double.NaN, Double.NaN) is returned.
If the center is set to an empty rectangle, the value becomes the new center, the width and height of the rectangle are
set to 0. If the rectangle was not empty, the center is changed, but the width and height remain unchanged.
| |
East | ||
Height |
Gets or sets the height of the rectangle. If the height is set, the rectangle's center remains the same.
| |
IsEmpty |
Gets a value indicating whether the rectangle is empty. This is true,
if the width or height value is lower 0.
| |
North | ||
NorthEast |
Gets the NorthEast point of the rectangle.
| |
NorthWest |
Gets the NorthWest point of the rectangle.
| |
South | ||
SouthEast |
Gets the SouthEast point of the rectangle.
| |
SouthWest |
Gets the SouthWest point of the rectangle.
| |
West | ||
Width |
Gets or sets the width of the rectangle. If the width is set, the rectangle's center remains the same.
|
Name | Description | |
---|---|---|
Contains(Point) |
Checks whether the point parameter is within the rectangle, inclusive its edges.
| |
Contains(MapRectangle) |
Checks whether the rect parameter is located completely within the rectangle, inclusive its edges.
| |
Equals(Object) |
Compares this rectangle with the passed in object.
(Overrides ObjectEquals(Object).) | |
Equals(MapRectangle) |
Compares this Rect with the passed in object.
| |
Equals(MapRectangle, MapRectangle) |
Compares two MapRectangle instances for object equality.
| |
GetHashCode |
Returns the HashCode for this object.
(Overrides ObjectGetHashCode.) | |
Inflate(Double) |
Inflates the object horizontally and vertically by specifying one single factor, applied to both dimensions.
The width and height of the rectangle is multiplied by this factor.
| |
Inflate(Double, Double) |
Inflates the object horizontally and vertically by specifying two different factors for each dimension.
The width and height of the rectangle is multiplied by these factors.
| |
InflateHorizontally |
Inflates the object horizontally by specifying a factor. The width of the rectangle is multiplied by this factor.
| |
InflateVertically |
Inflates the object vertically by specifying a factor. The height of the rectangle is multiplied by this factor.
| |
Intersect |
Updates this rectangle to be the intersection of this and parameter rect.
If either this or rect are empty, the result is empty as well.
| |
IntersectsWith |
Checks whether the parameter rect intersects with this rectangle.
If one edge is coincident, it is considered an intersection.
| |
Translate |
Translates the rectangle horizontally and vertically, if it is not empty. All boundaries are changed.
| |
TranslateHorizontally | ||
TranslateVertically | ||
Union(Point) |
Updates this rectangle to be the union of this and parameter point. I.e. the rectangle boundaries and the point
itself are included in the new boundaries.
If point has Double.IsNaN coordinates, the boundaries remain unchanged.
If this is empty, the boundaries are adapted to the point's coordinates (width and height will be 0).
| |
Union(MapRectangle) |
Updates this rectangle to be the union of this and parameter rect. I.e. the rectangle boundaries of this
and rect are included in the new boundaries.
If rect is empty, the boundaries remain unchanged.
If this is empty, the new boundaries are adapted to the rect's boundaries.
|
Name | Description | |
---|---|---|
Addition |
Translates the rectangle parameter rect horizontally and vertically, if it is not empty. All its boundaries are changed.
| |
BitwiseAnd |
Calculates the result of the intersection of rect1 and rect2.
If one of them is empty, the result is empty as well.
| |
BitwiseOr(MapRectangle, MapRectangle) |
Unifies both rectangles rect1 and rect2.
| |
BitwiseOr(MapRectangle, Point) |
Unifies the rectangle rect and point.
If point has Double.IsNaN coordinates, the resulting rectangle has the same values as rect.
If rect is empty, the boundaries of the resulting rectangle are adapted to the point's coordinates (width and height will be 0).
| |
Equality |
Compares two rectangle instances for exact equality.
| |
Inequality |
Compares two rectangle instances for exact inequality.
| |
Multiply |
Inflates the object horizontally and vertically by specifying two different factors for each dimension.
The width and height of the rectangle is multiplied by these factors.
|
Name | Description | |
---|---|---|
ToJson | Converts an object to a JSON string representation. (Defined by JSONWriter.) |