Class RectangleShape
This class represents a rectangle, which is defined as an upper left point and a lower right point.
[TypeConverter(typeof(BaseShapeTypeConverter))]
public class RectangleShape : AreaBaseShape
- Inheritance
-
RectangleShape
- Inherited Members
Remarks
None
Constructors
RectangleShape()
This constructor creates a RectangleShape.
public RectangleShape()
Remarks
None
RectangleShape(byte[])
This constructor creates a RectangleShape.
public RectangleShape(byte[] wellKnownBinary)
Parameters
wellKnownBinary
byte[]This parameter is the well-known binary used to build the shape.
Remarks
None
Exceptions
- ArgumentException
Passing invalid well-known binary in the bytes parameter will throw an ArgumentException.
- ArgumentNullException
Passing a null as the bytes parameter will throw an ArgumentNullException.
RectangleShape(double, double, double, double)
This constructor creates a RectangleShape.
public RectangleShape(double minX, double maxY, double maxX, double minY)
Parameters
minX
doubleThis property specifies the minimum X value. This is also the upper left X.
maxY
doubleThis property specifies the maximum Y value. This is also the upper left Y.
maxX
doubleThis property specifies the maximum X value. This is also the lower right X.
minY
doubleThis property specifies the minimum Y value. This is also the lower right Y.
Remarks
None
Exceptions
- ArgumentOutOfRangeException
If you pass in a maxX that is less than the minX, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a maxY that is less than the minY, it will throw a ArgumentOutOfRangeException.
RectangleShape(string)
This constructor creates a RectangleShape.
public RectangleShape(string wellKnownText)
Parameters
wellKnownText
stringThis parameter is the well-known text used to build the shape.
Remarks
None
Exceptions
- ArgumentException
Passing invalid well-known text in the wellKnownText parameter will throw an ArgumentException.
- ArgumentNullException
Passing a null as the wellKnownText parameter will throw an ArgumentNullException.
RectangleShape(PointShape, PointShape)
This constructor creates a RectangleShape.
public RectangleShape(PointShape upperLeftPoint, PointShape lowerRightPoint)
Parameters
upperLeftPoint
PointShapeThis parameter specifies the upper left point of the rectangle.
lowerRightPoint
PointShapeThis parameter specifies the lower right point of the rectangle.
Remarks
None
Exceptions
- ArgumentException
If you pass in a upperLeftPoint that has a X value that is more than the lowerRightPoint's X value, it will throw a ArgumentException.
- ArgumentException
If you pass in a upperLeftPoint that has a Y value that is less than the lowerRightPoint's Y value, it will throw a ArgumentException.
Fields
tolerance
Gets and sets the tolerance when construct the RectangleShape.
protected static double tolerance
Field Value
Properties
Height
This property returns the height of the RectangleShape in the unit of the shape.
public double Height { get; }
Property Value
- double
This property returns the height of the RectangleShape in the unit of the shape.
Remarks
None
LowerLeftPoint
This property returns the PointShape that represents the lower left point of the RectangleShape.
public PointShape LowerLeftPoint { get; }
Property Value
- PointShape
This property returns the PointShape that represents the lower left point of the RectangleShape.
Remarks
None
LowerRightPoint
This property returns or sets the PointShape that represents the lower right point of the RectangleShape.
public PointShape LowerRightPoint { get; set; }
Property Value
- PointShape
This property returns the PointShape that represents the lower right point of the RectangleShape.
Remarks
None
MaxX
The MaxX of the rectangle, equals to LowerRightPoint.X
public double MaxX { get; }
Property Value
MaxY
The MaxY of the rectangle, equals to UpperLeftPoint.Y
public double MaxY { get; }
Property Value
MinX
The MinX of the rectangle, equals to UpperLeftPoint.X
public double MinX { get; }
Property Value
MinY
The MinY of the rectangle, equals to LowerRightPoint.Y
public double MinY { get; }
Property Value
UpperLeftPoint
This property returns or sets the PointShape that represents the upper left point of the RectangleShape.
public PointShape UpperLeftPoint { get; set; }
Property Value
- PointShape
This property returns a PointShape at represents the upper left point of the RectangleShape.
Remarks
None
UpperRightPoint
This property returns the PointShape that represents the upper right point of the RectangleShape.
public PointShape UpperRightPoint { get; }
Property Value
- PointShape
This property returns the PointShape that represents the upper right point of the RectangleShape.
Remarks
None
Width
This property returns the width of the RectangleShape in the unit of the shape.
public double Width { get; }
Property Value
- double
This property returns the width of the RectangleShape in the unit of the shape.
Remarks
None
Methods
CloneDeepCore()
This method returns a complete copy of the shape without any references in common.
protected override BaseShape CloneDeepCore()
Returns
- BaseShape
This method returns a complete copy of the shape without any references in common.
Remarks
When you override this method, you need to ensure that there are no references in common between the original and copy.
ContainsCore(BaseShape)
This method returns if the targetShape lies within the interior of the current shape.
protected override bool ContainsCore(BaseShape targetShape)
Parameters
targetShape
BaseShapeThe shape you wish to compare the current one to.
Returns
- bool
This method returns if the targetShape lies within the interior of the current shape.
Remarks
<br />
<br />
Overriding:
Please ensure that you validate the parameters being passed in and raise the exceptions defined
above.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentException
If you pass in a targetShape which is invalid, we will throw an ArgumentException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
ExpandToInclude(IEnumerable<BaseShape>)
This method will expand the current RectangleShape to include the shapes in the targetShapes parameter.
public void ExpandToInclude(IEnumerable<BaseShape> targetShapes)
Parameters
targetShapes
IEnumerable<BaseShape>This parameter is used to expand the current rectangle.
Remarks
There is also an overload that can expand the RectangleShape using a single shape.
Exceptions
- ArgumentException
If you pass in targetShapes that do not have any points, we will throw an ArgumentException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ExpandToInclude(IEnumerable<Feature>)
This method will expand the current RectangleShape to include the features in the targetFeatures parameter.
public void ExpandToInclude(IEnumerable<Feature> targetFeatures)
Parameters
targetFeatures
IEnumerable<Feature>This parameter is a group of features used to expand the current rectangle.
Remarks
There also is an overload that can expand the RectangleShape using a single feature.
Exceptions
- ArgumentNullException
If you pass in targetFeatures that do not have any points, we will throw an ArgumentException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ExpandToInclude(BaseShape)
This method will expand the current RectangleShape to include the targetShape parameter.
public void ExpandToInclude(BaseShape targetShape)
Parameters
targetShape
BaseShapeThis parameter is used to expand the current rectangle.
Remarks
There is also an overload that can expand the RectangleShape using a list of multiple shapes.
Exceptions
- ArgumentException
If you pass in a targetShape which does not have any points, we will throw an ArgumentException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ExpandToInclude(Feature)
This method will expand the current RectangleShape to include the target feature parameter.
public void ExpandToInclude(Feature targetFeature)
Parameters
targetFeature
FeatureThis parameter is used to expand the current feature.
Remarks
There is also an overload that can expand the RectangleShape using a collection of features.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ExpandToIncludeCore(BaseShape)
This method will expand the current RectangleShape to include the shape in the targetShape parameter.
protected virtual void ExpandToIncludeCore(BaseShape targetShape)
Parameters
targetShape
BaseShapeThis parameter is used to expand the current rectangle.
Remarks
There is also an overload that can expand the RectangleShape using a list of shapes.
Exceptions
- ArgumentException
If you pass in a targetShape which does not have any points, we will throw an ArgumentException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
GetAreaCore(GeographyUnit, AreaUnit)
This method returns the area of the shape (defined as the size of the region enclosed by the figure).
protected override double GetAreaCore(GeographyUnit shapeUnit, AreaUnit returningUnit)
Parameters
shapeUnit
GeographyUnitThis is the GeographyUnit of the shape you are performing the operation on.
returningUnit
AreaUnitThis is the AreaUnit you would like to use as the return value. For example, if you select square miles as your returningUnit, then the distance will be returned in square miles.
Returns
- double
The return unit is based on the AreaUnit you specify in the returningUnit parameter, regardless of the shape's GeographyUnit.
Remarks
You would use this method to find the area inside the shape.
Exceptions
- ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a returningUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
GetBoundingBoxCore()
This method calculates the smallest RectangleShape that encompasses the entire geometry.
protected override RectangleShape GetBoundingBoxCore()
Returns
- RectangleShape
The RectangleShape returned is the smallest RectangleShape that can encompass the entire geometry.
Remarks
The GetBoundingBox method calculates the smallest RectangleShape that can encompass the entire geometry by examining each point in the geometry.
Depending on the number of PointShapes and complexity of the geometry, this
operation can take longer for larger objects.
If the shape is a PointShape, then the bounding box's upper left and lower right
points will be equal. This will create a RectangleShape with no area.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
GetCenterPointCore()
This method returns the center point of the current shape's bounding box.
protected override PointShape GetCenterPointCore()
Returns
- PointShape
A PointShape representing the center point of the current shape's bounding box.
Remarks
This method returns the center point of the current shape's bounding box. It is
important to note that this is the center point of the bounding box. There are numerous
ways to calculate the "center" of a geometry such, as its weighted center, etc. You can
find other centers by examining the various methods of the shape itself.
Overriding:
Please ensure that you validate the parameters being passed in and raise the exceptions defined
above.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
GetClosestPointToCore(BaseShape, GeographyUnit)
This method returns the point of the current shape that is closest to the target shape.
protected override PointShape GetClosestPointToCore(BaseShape targetShape, GeographyUnit shapeUnit)
Parameters
targetShape
BaseShapeThe shape you are trying to find the closest point to.
shapeUnit
GeographyUnitThis is the GeographicUnit of the shape you are performing the operation on.
Returns
- PointShape
A PointShape representing the closest point of the current shape to the targetShape.
Remarks
This method returns the point of the current shape that is closest to the target shape. It is often the case that the point returned is not a point of the object itself. An example would be a line with two points that are far apart from each other. If you set the targetShape to be a point midway between the points but a short distance away from the line, the method would return a point that is on the line but not either of the two points that make up the line.
Exceptions
- ArgumentException
If you pass in a targetShape which does not have any points, we will throw an ArgumentException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
GetCrossingCore(BaseShape)
This method returns the crossing points between the current shape and the passed-in target shape.
protected override MultipointShape GetCrossingCore(BaseShape targetShape)
Parameters
targetShape
BaseShapeThe target shape you wish to get crossing with.
Returns
- MultipointShape
This method returns the crossing points between the current shape and the passed-in target shape.
Remarks
As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
GetDistanceToCore(BaseShape, GeographyUnit, DistanceUnit)
This method computes the distance between the current shape and the targetShape.
protected override double GetDistanceToCore(BaseShape targetShape, GeographyUnit shapeUnit, DistanceUnit distanceUnit)
Parameters
targetShape
BaseShapeThe shape you are trying to find the distance to.
shapeUnit
GeographyUnitThe GeographyUnit of the targetShape.
distanceUnit
DistanceUnitThe DistanceUnit of the returned value.
Returns
- double
The return type is the distance between this shape and the targetShape in the GeographyUnit of the shape.
Overriding:
Please ensure that you validate the parameters being passed in and raise the exceptions defined above.
Remarks
In this method, we compute the closest distance between the two shapes. The returned unit will be in the unit of distance specified.
Exceptions
- ArgumentException
If you pass in a targetShape which does not have any points, we will throw an ArgumentException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a distanceUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
GetIntersection(RectangleShape)
This method returns the intersection of the current RectangleShape and the target shape, defined as the set of all points which lie in both the current shape and the target shape.
public RectangleShape GetIntersection(RectangleShape targetShape)
Parameters
targetShape
RectangleShapeThe shape you are trying to find the intersection with.
Returns
- RectangleShape
The return type is a RectangleShape that contains the set of all points which lie in both the current shape and the target shape.
Remarks
None
Exceptions
- ArgumentException
If you pass in a targetShape which does not have any points, we will throw an ArgumentException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
GetPerimeterCore(GeographyUnit, DistanceUnit)
This method returns the perimeter of the shape (defined as the sum of the lengths of all its sides).
protected override double GetPerimeterCore(GeographyUnit shapeUnit, DistanceUnit returningUnit)
Parameters
shapeUnit
GeographyUnitThis is the GeographyUnit of the shape you are performing the operation on.
returningUnit
DistanceUnitThis is the DistanceUnit you would like to use as the return value. For example, if you select miles as your returningUnit, then the distance will be returned in miles.
Returns
- double
The return unit is based on the LengthUnit you specify in the returningUnit parameter, regardless of the shape's GeographyUnit.
Remarks
You would use this method to find the distance around the area shape.
Exceptions
- ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a returningUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
GetWellKnownBinaryCore(RingOrder, WkbByteOrder)
This method returns a byte array that represents the shape in well-known binary.
protected override byte[] GetWellKnownBinaryCore(RingOrder outerRingOrder, WkbByteOrder byteOrder)
Parameters
outerRingOrder
RingOrderbyteOrder
WkbByteOrderThis parameter specifies whether the byte order is big- or little-endian.
Returns
- byte[]
This method returns a byte array that represents the shape in well-known binary.
Remarks
This method returns a byte array that represents the shape in well-known binary. Well-known binary allows you to describe a geometry as a binary array. Well-known binary is useful when you want to save a geometry in an efficient format using as little space as possible. An alternative to well-known binary is well-known text, which is a textual representation of a geometry object. We have methods that work with well-known text as well.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
If you pass in a ByteOrder that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
GetWellKnownTextCore(RingOrder)
This method returns the well-known text representation of this shape.
protected override string GetWellKnownTextCore(RingOrder outerRingOrder)
Parameters
outerRingOrder
RingOrder
Returns
- string
This method returns a string that represents the shape in well-known text.
Remarks
This method returns a string that represents the shape in well-known text. Well-known text allows you to describe a geometry as a string of text. Well-known text is useful when you want to save a geometry in a format such as a text file, or when you simply want to cut and paste the text between other applications. An alternative to well-known text is well-known binary, which is a binary representation of a geometry object. We have methods that work with well-known binary as well. Below are some samples of what well-known text might look like for various kinds of geometric shapes.
POINT(5 17)
LINESTRING(4 5,10 50,25 80)
POLYGON((2 2,6 2,6 6,2 6,2 2),(3 3,4 3,4 4,3 4,3 3))
MULTIPOINT(3.7 9.7,4.9 11.6)
MULTILINESTRING((4 5,11 51,21 26),(-4 -7,-9 -7,-14 -3))
MULTIPOLYGON(((2 2,6 2,6 6,2 6,2 2),(3 3,4 3,4 4,3 4,3 3)),((4 4,7 3,7 5,4 4)))
Exceptions
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
GetWellKnownTypeCore()
This method returns the well-known type for the shape.
protected override WellKnownType GetWellKnownTypeCore()
Returns
- WellKnownType
This method returns the well-known type for the shape.
Remarks
None
IntersectsCore(BaseShape)
protected override bool IntersectsCore(BaseShape targetShape)
Parameters
targetShape
BaseShape
Returns
IsDisjointedCore(BaseShape)
This method returns whether the current shape and the targetShape have no points in common.
protected override bool IsDisjointedCore(BaseShape targetShape)
Parameters
targetShape
BaseShapeThe shape you wish to compare the current one to.
Returns
- bool
This method returns whether the current shape and the targetShape have no points in common.
Remarks
<br />
<br />
Overriding:
Please ensure that you validate the parameters being passed in and raise the exceptions defined
above.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentException
If you pass in a targetShape which is invalid, we will throw an ArgumentException.
- ArgumentNullException
If you pass a null as the targetShape, we will throw an ArgumentNullException.
LoadFromWellKnownDataCore(byte[])
This method hydrates the current shape with its data from well-known binary.
protected override void LoadFromWellKnownDataCore(byte[] wellKnownBinary)
Parameters
wellKnownBinary
byte[]This parameter is the well-known binary used to populate the shape.
Remarks
This is used when you want to hydrate a shape based on well-known binary. You can
create the shape and then load the well-known binary using this method.
Exceptions
- ArgumentException
Passing invalid well-known binary in the bytes parameter will throw an ArgumentException.
- ArgumentNullException
Passing a null as the bytes parameter will throw an ArgumentNullException.
LoadFromWellKnownDataCore(string)
This method hydrates the current shape with its data from well-known text.
protected override void LoadFromWellKnownDataCore(string wellKnownText)
Parameters
wellKnownText
stringThis parameter is the well-known text you will use to hydrate your object.
Remarks
None
Exceptions
- ArgumentException
Passing invalid well-known text in the wellKnownText parameter will throw an ArgumentException.
- ArgumentNullException
Passing a null as the wellKnownText parameter will throw an ArgumentNullException.
RegisterCore(PointShape, PointShape, DistanceUnit, GeographyUnit)
This method returns a MultipointShape which has been registered from its original coordinate system to another based on two anchor PointShapes.
protected override BaseShape RegisterCore(PointShape fromPoint, PointShape toPoint, DistanceUnit fromUnit, GeographyUnit toUnit)
Parameters
fromPoint
PointShapeThis parameter is the anchor PointShape in the coordinate of origin.
toPoint
PointShapeThis parameter is the anchor PointShape in the coordinate of destination.
fromUnit
DistanceUnitThis parameter is the GeographyUnit of the coordinate of origin.
toUnit
GeographyUnitThis parameter is the GeographyUnit of the coordinate of destination.
Returns
- BaseShape
This method returns a MultipointShape which has been registered from its original coordinate system to another based on two anchor PointShapes.
Remarks
The register method is useful, for example, when a group of points represented by a MultipointShape has been generated in a non-geographic coordinate in meters, and you want to plot the points on a map that is in decimal degrees.
Exceptions
- ArgumentOutOfRangeException
If you pass in a fromUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a toUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ScaleDownCore(double)
This method decreases the size of the area shape by the percentage given in the percentage parameter.
protected override void ScaleDownCore(double percentage)
Parameters
percentage
doubleThis is the percentage by which to decrease the shape's size.
Remarks
None
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will throw an ArgumentOutOfRangeException.
ScaleUpCore(double)
This method increases the size of the area shape by the percentage given in the percentage parameter.
protected override void ScaleUpCore(double percentage)
Parameters
percentage
doubleThis is the percentage by which to increase the shape's size.
Remarks
This method is useful when you would like to increase the size of the shape. Note that a larger percentage will scale the shape up faster, as you are applying the operation multiple times. There is also a ScaleDown method that will shrink the shape.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on a shape which has no points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
Passing an invalid percentage which is less than 0 will throw an ArgumentOutOfRangeException.
ToPolygon()
This method returns the current shape as a PolygonShape.
public PolygonShape ToPolygon()
Returns
- PolygonShape
This method returns the current shape as a PolygonShape.
Remarks
This method is mainly used to convert this GIS non-standard shape to a GIS standard shape.
Exceptions
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
ToString()
This method returns a formatted representation of the UpperLeftPoint.X, UpperLeftPoint.Y, LowerRightPoint.X and LowerRightPoint.Y value.
public override string ToString()
Returns
- string
This method returns a formatted representation of the UpperLeftPoint.X, UpperLeftPoint.Y, LowerRightPoint.X and LowerRightPoint.Y value.
Remarks
The value will be formatted in the standard string format: -180,90,180,-90"
TranslateByDegreeCore(double, double, GeographyUnit, DistanceUnit)
This method moves the shape from one location to another, based on a direction in degrees and distance.
protected override void TranslateByDegreeCore(double distance, double angleInDegrees, GeographyUnit shapeUnit, DistanceUnit distanceUnit)
Parameters
distance
doubleThe distance is the number of units to move the shape in the angle specified. The distance unit will be the same as the GeographyUnit for the shape. The distance must be greater than or equal to 0.
angleInDegrees
doubleA number between 0 and 360 degrees that represents the direction you wish to move the shape, with 0 being up.
shapeUnit
GeographyUnitThis is the GeographicUnit of the shape you are performing the operation on.
distanceUnit
DistanceUnitThis is the DistanceUnit you would like to use as the measure for the move. For example, if you select miles as your distanceUnit, then the xOffsetDistance and yOffsetDistance will be calculated in miles.
Remarks
This method moves the base shape from one location to another, based on an angleInDegrees and distance parameter. With this overload, it is important to note that the distance units are the same GeographicUnit as the shape. For example, if your shape is in decimal degrees and you call this method with a distance of 1, you're going to move this shape 1 decimal degree in direction of the angleInDegrees. In many cases it is more useful to specify the DistanceUnit of movement, such as in miles or yards, so for these scenarios there is another overload you may want to use instead.
If you pass a distance of 0, then the operation is ignored.
Exceptions
- ArgumentOutOfRangeException
Passing an invalid angleInDegrees which is not between 0 and 360 will throw an ArgumentOutOfRangeException.
- InvalidOperationException
In the event you attempt to call this method on this shape which has invalid upper left and lower right points, it will throw an InvalidOperationException.
- ArgumentOutOfRangeException
Passing an invalid distance which is not greater than or equal to 0 will throw an ArgumentOutOfRangeException.
TranslateByOffsetCore(double, double, GeographyUnit, DistanceUnit)
This method moves the base shape from one location to another, based on an X and Y offset distance.
protected override void TranslateByOffsetCore(double xOffsetDistance, double yOffsetDistance, GeographyUnit shapeUnit, DistanceUnit distanceUnit)
Parameters
xOffsetDistance
doubleThis is the number of horizontal units of movement in the DistanceUnit specified as the distanceUnit.
yOffsetDistance
doubleThis is the number of horizontal units of movement in the DistanceUnit specified as the distanceUnit.
shapeUnit
GeographyUnitThis is the GeographicUnit of the shape you are performing the operation on.
distanceUnit
DistanceUnitThis is the DistanceUnit you would like to use as the measure for the move. For example, if you select miles as your distanceUnit, then the xOffsetDistance and yOffsetDistance will be calculated in miles.
Remarks
This method moves the base shape from one location to another, based on an X and Y offset distance. With this overload, it is important to note that the X and Y offset units are based on the distanceUnit parameter. For example, if your shape is in decimal degrees and you call this method with an X offset of 1 and a Y offset of 1, you're going to move this shape 1 unit of the distanceUnit in the horizontal direction and one unit of the distanceUnit in the vertical direction. In this way, you can easily move a shape in decimal degrees five miles to on the X axis and 3 miles on the Y axis.
Exceptions
- ArgumentOutOfRangeException
If you pass in a distanceUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a shapeUnit that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.
- InvalidOperationException
In the event you attempt to call this method from a shape which has no points, it will throw an InvalidOperationException.
ValidateCore(ShapeValidationMode)
This method returns a ShapeValidationResult based on a series of tests.
protected override ShapeValidationResult ValidateCore(ShapeValidationMode validationMode)
Parameters
validationMode
ShapeValidationModeThis parameter determines whether the test is simple or advanced. In some cases, the advanced tests can take some time. The simple test is designed to always be fast.
Returns
- ShapeValidationResult
This method returns a ShapeValidationResult based on a series of tests.
Remarks
We use this method, with the simple enumeration, internally before doing any kind of other methods on the shape. In this way, we are able to verify the integrity of the shape itself. If you wish to test things such as whether a polygon self-intersects, we invite you to call this method with the advanced ShapeValidationMode. One thing to consider is that for complex polygon shapes this operation could take some time, which is why we only run the basic, faster test. If you are dealing with polygon shapes that are suspect, we suggest you run the advanced test.
Exceptions
- ArgumentOutOfRangeException
If you pass in a validationMode that is not defined in the enumeration, it will throw a ArgumentOutOfRangeException.