Table of Contents

Class PointShape

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This class represents a single point.

[TypeConverter(typeof(BaseShapeTypeConverter))]
public class PointShape : PointBaseShape
Inheritance
PointShape
Inherited Members

Remarks

None

Constructors

PointShape()

This constructor creates a PointShape.

public PointShape()

Remarks

None

PointShape(byte[])

This constructor creates the PointShape.

public PointShape(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.

PointShape(double, double)

This constructor create a PointShape.

public PointShape(double x, double y)

Parameters

x double

This parameter represents the X (horizontal) axis.

y double

This parameter represents the Y (vertical) axis.

Remarks

None

PointShape(double, double, double)

This constructor create a PointShape.

public PointShape(double x, double y, double z)

Parameters

x double

This parameter represents the X (horizontal) axis.

y double

This parameter represents the Y (vertical) axis.

z double

This parameter represents the Z (depth) axis.

Remarks

None

PointShape(string)

This constructor creates the PointShape.

public PointShape(string wellKnownText)

Parameters

wellKnownText string

This 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.

PointShape(Vertex)

This overload creates a PointShape by specifying the vertex.

public PointShape(Vertex vertex)

Parameters

vertex Vertex

This parameter represents the vertex that will be used to construct the PointShape.

Properties

X

This property represents the X (horizontal) axis.

public double X { get; set; }

Property Value

double

Remarks

None

Y

This property represents the Y (vertical) axis.

public double Y { get; set; }

Property Value

double

Remarks

None

Z

This property represents the Z (depth) axis.

public double Z { get; set; }

Property Value

double

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 the copy.

Equal2D(Feature)

Compare the current PointShape with the target Point Feature.

public bool Equal2D(Feature targetPointFeature)

Parameters

targetPointFeature Feature

The targetPointFeature to be compared with.

Returns

bool

True if both X and Y coordinates of the current shape are equal to those of the PointShape contained in the target PointFeature.

Equal2D(PointShape)

Compare the current PointShape with the target PointShape.

public bool Equal2D(PointShape targetShape)

Parameters

targetShape PointShape

The targetPointShape to be compared with.

Returns

bool

True if both X and Y coordinates of the current shape are equal to those of the target shape.

GetBoundingBoxCore()

protected override RectangleShape GetBoundingBoxCore()

Returns

RectangleShape

GetCenterPointCore()

protected override PointShape GetCenterPointCore()

Returns

PointShape

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 BaseShape

The shape you are trying to find the closest point to.

shapeUnit GeographyUnit

This 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.

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 BaseShape

The 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 BaseShape

The shape you are trying to find the distance to.

shapeUnit GeographyUnit

This is the GeographyUnit of the shape you are performing the operation on.

distanceUnit DistanceUnit

This is the DistanceUnit you would like to use for the distance parameter. For example, if you select miles as your distanceUnit, then the distance will be measured in miles.

Returns

double

This method returns the distance between the current shape and the targetShape.

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.

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.

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)))

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

GreatCircle(Feature)

This method returns a MultilineShape which represents the shortest line between the current point and the specified feature on the globe.

public MultilineShape GreatCircle(Feature pointFeature)

Parameters

pointFeature Feature

This parameter is the target feature to be measured to.

Returns

MultilineShape

This method returns a MultilineShape which represents the shortest line between the current point and the specified feature on the globe.

Remarks

This method is useful when you want to display on the map the shortest line between two points in decimal degrees. The line will be curved, and possibly disconnected if it is close to travel from the end of the map.

GreatCircle(PointShape)

This method returns a MultilineShape that represents the shortest line between two points on the globe.

public MultilineShape GreatCircle(PointShape pointShape)

Parameters

pointShape PointShape

This parameter is the target point to be measured to.

Returns

MultilineShape

This method returns a MultilineShape that represents the shortest line between two points on the globe.

Remarks

This method is useful when you want to display on the map the shortest line between two points in decimal degrees. The line will be curved, and possibly disconnected if it is close to travel from the end of the map.

IsWithinCore(BaseShape)

protected override bool IsWithinCore(BaseShape targetShape)

Parameters

targetShape BaseShape

Returns

bool

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 string

This 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 BaseShape 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 PointShape

This parameter is the anchor PointShape in the coordinate of origin.

toPoint PointShape

This parameter is the anchor PointShape in the coordinate of destination.

fromUnit DistanceUnit

This parameter is the DistanceUnit of the coordinate of origin.

toUnit GeographyUnit

This parameter is the GeographyUnit of the coordinate of destination.

Returns

BaseShape

This method returns a BaseShape which has been registered from its original coordinate system to another based on two anchor PointShapes.

Remarks

Registering allows you to take a geometric shape generated in a planar system and attach it to the ground in a Geographic Unit.

A common scenario is integrating geometric shapes from external programs (such as CAD software or a modeling system) and placing them onto a map. You may have the schematics of a building in a CAD system and the relationship between all the points of the building are in feet. You want to then take the CAD image and attach it to where it really exists on a map. You would use the register method to do this.

Registering is also useful for scientific modeling, where software models things such as a plume of hazardous materials or the fallout from a volcano. The modeling software typically generates these models in a fictitious planar system. You would then use the register to take the abstract model and attach it to a map with real coordinates.

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 a shape which has no points, it will throw an InvalidOperationException.

ArgumentNullException

Passing a null as the fromPoint parameter will throw an ArgumentNullException.

ArgumentNullException

Passing a null as the toPoint parameter will throw an ArgumentNullException.

RotateCore(PointShape, double)

This method rotates the shape a number of degrees based on a pivot point.

protected override void RotateCore(PointShape pivotPoint, double degreeAngle)

Parameters

pivotPoint PointShape

The pivotPoint represents the center of rotation.

degreeAngle double

The number of degrees of rotation required from 0 to 360.

Remarks

This method rotates the shape by a number of degrees based on a pivot point. By placing the pivot point in the center of the shape, you can achieve in-place rotation. By moving the pivot point outside of the center of the shape, you can translate the shape in a circular motion. Moving the pivot point further outside of the center will make the circular area larger.

Exceptions

ArgumentNullException

If you pass a null as the pivotPoint, we will throw an ArgumentNullException.

ArgumentOutOfRangeException

Passing an invalid degreeAngle which is not between 0 and 360 will throw an ArgumentOutOfRangeException.

InvalidOperationException

In the event you attempt to call this method on a shape which is not valid, it will throw an InvalidOperationException.

ToString()

Override the ToString() API by returning the X, Y , Z

public override string ToString()

Returns

string

The returned string shows the X, Y , Z values.

TranslateByDegreeCore(double, double, GeographyUnit, DistanceUnit)

This method moves the base shape from one location to another, based on a distance and a direction in degrees.

protected override void TranslateByDegreeCore(double distance, double angleInDegrees, GeographyUnit shapeUnit, DistanceUnit distanceUnit)

Parameters

distance double

The 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 double

A number between 0 and 360 degrees that represents the direction you wish to move the shape, with 0 being up.

shapeUnit GeographyUnit

This is the GeographicUnit of the shape you are performing the operation on.

distanceUnit DistanceUnit

This is the DistanceUnit you would like to use for the distance parameter. For example, if you select miles as your distanceUnit, then the distance will be measured 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.

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 double

This is the number of horizontal units of movement in the DistanceUnit specified as the distanceUnit.

yOffsetDistance double

This is the number of horizontal units of movement in the DistanceUnit specified as the distanceUnit.

shapeUnit GeographyUnit

This is the GeographicUnit of the shape you are performing the operation on.

distanceUnit DistanceUnit

This 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 ShapeValidationMode

This 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.