A shape object represents a geometric shape which can be added to a shapefile which is displayed in the map. More...
Public Member Functions | |
| int | AddPoint (double x, double y) |
| Adds a point to the shape. | |
| Shape | Boundry () |
| Generates a shape which represents a boundry of the current shape. | |
| Shape | Buffer (double Distance, int nQuadSegments) |
| Builds a buffer of the specified distance around the shape. | |
| Shape | Clip (Shape Shape, tkClipOperation Operation) |
| Performs clipping operation with 2 shapes. | |
| Shape | Clone () |
| Creates a deep copy of this object with the same type, parts and points. | |
| bool | Contains (Shape Shape) |
| Tests a "contains" relation between 2 shapes. | |
| Shape | ConvexHull () |
| Builds a convex hull around the currnet shape. | |
| bool | Create (ShpfileType ShpType) |
| Creates a new shape of the specified type. | |
| bool | CreateFromString (string Serialized) |
| Initializes the Shape object and fills it with the geometry defined by the input string. | |
| bool | Crosses (Shape Shape) |
| Tests a "crosses" relation between 2 shapes. | |
| bool | DeletePart (int PartIndex) |
| Deletes a part from a shape. | |
| bool | DeletePoint (int PointIndex) |
| Deletes a point in the shape. | |
| bool | Disjoint (Shape Shape) |
| Tests a "disjoint" relation between 2 shapes. | |
| double | Distance (Shape Shape) |
| Calcualtes the distance between 2 shapes. | |
| bool | Equals (Shape Shape) |
| Tests an "equals" relation between 2 shapes. | |
| bool | Explode (ref object Results) |
| Splits multipart shape into simple shapes. | |
| bool | ExportToBinary (ref object bytesArray) |
| Returns binary representation of the shape data. | |
| void | FixUp (out Shape retval) |
| Fixes the shape in case it is not valid. | |
| int | get_EndOfPart (int PartIndex) |
| Returns the index of the last pont in the part. | |
| string | get_ErrorMsg (int ErrorCode) |
| Retrieves the error message associated with the specified error code. | |
| int | get_Part (int PartIndex) |
| Gets or sets the first point index in the specified part. | |
| Shape | get_PartAsShape (int PartIndex) |
| Returns part of the shape as a new shape. | |
| bool | get_PartIsClockWise (int PartIndex) |
| Returns a boolean value which indicates whether points of the shape part are placed in the clockwise order. | |
| Point | get_Point (int PointIndex) |
| Gets or sets the specified point in the shape. | |
| bool | get_XY (int PointIndex, ref double x, ref double y) |
| Gets the coordinates of the specified point. | |
| bool | GetIntersection (Shape Shape, out object Results) |
| Calculates the intersection of 2 shapes. | |
| bool | ImportFromBinary (object bytesArray) |
| Restores the state of the shape from binary representation obtained by Shape.ExportToBinary. | |
| bool | InsertPart (int PointIndex, ref int PartIndex) |
| Inserts a part into the shape. | |
| bool | InsertPoint (Point NewPoint, ref int PointIndex) |
| Inserts the specified point object into the shape using the desired point index if possible. | |
| bool | Intersects (Shape Shape) |
| Tests an "intersects" relation between 2 shapes. | |
| bool | Overlaps (Shape Shape) |
| Tests an "overlaps" relation between 2 shapes. | |
| bool | PointInThisPoly (Point pt) |
| Performs a test to find out whether a given point lies within the polygon. | |
| bool | put_XY (int PointIndex, double x, double y) |
| Sets the coordinates of the specified point. | |
| bool | Relates (Shape Shape, tkSpatialRelation Relation) |
| Tests the specified relation between 2 shapes. | |
| bool | ReversePointsOrder (int PartIndex) |
| Changes the order of points within shape part to the opposite. | |
| string | SerializeToString () |
| Provides a string representing the shape's geometry. | |
| void | set_Part (int PartIndex, int pVal) |
| Sets the index of the first point in part. | |
| void | set_Point (int PointIndex, Point pVal) |
| Replaces the point with the specified index with new one. | |
| bool | Touches (Shape Shape) |
| Tests a "touches" relation between 2 shapes. | |
| bool | Within (Shape Shape) |
| Tests a "within" relation between 2 shapes. | |
Properties | |
| double | Area [get] |
| Calcualtes the area of the shape. For non-polygon shapes this property will return 0.0. | |
| Point | Center [get] |
| Calculates a center of the shape's bounding box. | |
| Point | Centroid [get] |
| Calculates a centroid (center of mass) of the shape. | |
| Extents | Extents [get] |
| Gets the extents of the shape. | |
| ICallback | GlobalCallback [get, set] |
| Gets or sets a callback object for reporting about the errors. | |
| Point | InteriorPoint [get] |
| Calculates the interior point of the shape. Is applicable for polygon shapes only. | |
| bool | IsValid [get] |
| Returns a boolean value which indicates whether a shape is valid. | |
| string | IsValidReason [get] |
| Returns the string with the description of reason why shape was considered invalid. | |
| string | Key [get, set] |
| The key may be used by the programmer to store any string data associated with the object. | |
| int | LastErrorCode [get] |
| Retrieves the last error generated in the object. | |
| double | Length [get] |
| Calculates the length of polyline shape. | |
| int | NumParts [get] |
| Gets the number of parts contained in the shape. | |
| int | numPoints [get] |
| Gets the number of points contained in the shape. | |
| double | Perimeter [get] |
| Calculates the perimeter of shape. Is applicable for polygon shapes only. | |
| ShpfileType | ShapeType [get, set] |
| Gets or sets the type of the shape. | |
A shape object represents a geometric shape which can be added to a shapefile which is displayed in the map.
Here is a diagram for the Shape class.
| int Shape.AddPoint | ( | double | x, |
| double | y | ||
| ) |
Adds a point to the shape.
| x | The x coordinate of the point. |
| y | The y coordinate of the point. |
| Shape Shape.Boundry | ( | ) |
Generates a shape which represents a boundry of the current shape.
| Shape Shape.Buffer | ( | double | Distance, |
| int | nQuadSegments | ||
| ) |
Builds a buffer of the specified distance around the shape.
| Distance | The buffer distance in map units. |
| nQuadSegments | The number of segments use to approximate a circle buffer. |
| Shape Shape.Clip | ( | Shape | Shape, |
| tkClipOperation | Operation | ||
| ) |
Performs clipping operation with 2 shapes.
The available operation are:
Note that clClip operation will yield the same result as intersection.
| Shape | The second shape for the operation. |
| Operation | The operation to perform. |
| Shape Shape.Clone | ( | ) |
Creates a deep copy of this object with the same type, parts and points.
| bool Shape.Contains | ( | Shape | Shape | ) |
Tests a "contains" relation between 2 shapes.
| Shape | The second shape. |
Builds a convex hull around the currnet shape.
| bool Shape.Create | ( | ShpfileType | ShpType | ) |
Creates a new shape of the specified type.
| ShpType | The type of the shape to be created. |
| bool Shape.CreateFromString | ( | string | Serialized | ) |
Initializes the Shape object and fills it with the geometry defined by the input string.
The input string should be in the serialized string format as produced by the function Shape.SerializeToString.
| Serialized | The serialized string to load. |
| bool Shape.Crosses | ( | Shape | Shape | ) |
Tests a "crosses" relation between 2 shapes.
| Shape | The second shape. |
| bool Shape.DeletePart | ( | int | PartIndex | ) |
Deletes a part from a shape.
| PartIndex | The index of the part to be deleted. |
| bool Shape.DeletePoint | ( | int | PointIndex | ) |
Deletes a point in the shape.
| PointIndex | The index of the point in the shape to be deleted. |
| bool Shape.Disjoint | ( | Shape | Shape | ) |
Tests a "disjoint" relation between 2 shapes.
| Shape | The second shape. |
| double Shape.Distance | ( | Shape | Shape | ) |
Calcualtes the distance between 2 shapes.
| Shape | The second shape. |
| bool Shape.Equals | ( | Shape | Shape | ) |
Tests an "equals" relation between 2 shapes.
| Shape | The second shape. |
| bool Shape.Explode | ( | ref object | Results | ) |
Splits multipart shape into simple shapes.
Holes of the polygon will not be considered as separate shapes. However if a polygon holds several not nested rings they will be passed to ouput as individual polygons.
| Results | The array of Shape type with the resulting shapes. |
| bool Shape.ExportToBinary | ( | ref object | bytesArray | ) |
Returns binary representation of the shape data.
The binary data will have the same format as disk representation of the shapefile.
| bytesArray | The byte array with shape data. |
| void Shape.FixUp | ( | out Shape | retval | ) |
Fixes the shape in case it is not valid.
Converts the data to GEOS geometry and builds a small buffer. Call Shape.IsValid to find out the invalid shapes.
| retval | The fixed shape. |
| int Shape.get_EndOfPart | ( | int | PartIndex | ) |
Returns the index of the last pont in the part.
| PartIndex | The index of the part. |
| string Shape.get_ErrorMsg | ( | int | ErrorCode | ) |
Retrieves the error message associated with the specified error code.
| ErrorCode | The error code for which the error message is required. |
| int Shape.get_Part | ( | int | PartIndex | ) |
Gets or sets the first point index in the specified part.
| PartIndex | The index of the part for which the first point index is required. |
| Shape Shape.get_PartAsShape | ( | int | PartIndex | ) |
Returns part of the shape as a new shape.
The initial shape and the returned one doesn't shape any common memory.
| PartIndex | The index of part to return. |
| bool Shape.get_PartIsClockWise | ( | int | PartIndex | ) |
Returns a boolean value which indicates whether points of the shape part are placed in the clockwise order.
| PartIndex | The index of part. |
| Point Shape.get_Point | ( | int | PointIndex | ) |
Gets or sets the specified point in the shape.
| PointIndex | The index of the point which is to be accessed in the shape. |
| bool Shape.get_XY | ( | int | PointIndex, |
| ref double | x, | ||
| ref double | y | ||
| ) |
Gets the coordinates of the specified point.
It's highly recommended to use this property rather than Shape.get_Point, for considerable performance boost when Shapefile.FastMode is set to true.
| PointIndex | The index of point. |
| x | The x coordinate. |
| y | The y coordinate. |
| bool Shape.GetIntersection | ( | Shape | Shape, |
| out object | Results | ||
| ) |
Calculates the intersection of 2 shapes.
In comparison with Shape.Clip this function returns all the results of intersection even if they have different shape type. For example the intersection of 2 polygons can hold: new polygons, polylines and points simultaneously.
| bool Shape.ImportFromBinary | ( | object | bytesArray | ) |
Restores the state of the shape from binary representation obtained by Shape.ExportToBinary.
| bytesArray | The byte array with the state of shape. |
| bool Shape.InsertPart | ( | int | PointIndex, |
| ref int | PartIndex | ||
| ) |
Inserts a part into the shape.
Parts are used to create polygons with holes. Parts with points ordered in a clockwise direction are filled. Parts with points ordered in a counter-clockwise direction are cut out. Only clockwise parts should be used to define the outer-most regions of a shape.
| PointIndex | The index of the first point in the part to be inserted. |
| PartIndex | The part index desired. This value may be modified if it is not possible to use the desired part index. |
| bool Shape.InsertPoint | ( | Point | NewPoint, |
| ref int | PointIndex | ||
| ) |
Inserts the specified point object into the shape using the desired point index if possible.
| NewPoint | The point object to be inserted into the shape. |
| PointIndex | Reference parameter. The index where the point will be placed if possible. If the desired index cannot be used, the actual index will be returned. |
| bool Shape.Intersects | ( | Shape | Shape | ) |
Tests an "intersects" relation between 2 shapes.
| Shape | The second shape. |
| bool Shape.Overlaps | ( | Shape | Shape | ) |
Tests an "overlaps" relation between 2 shapes.
| Shape | The second shape. |
| bool Shape.PointInThisPoly | ( | Point | pt | ) |
Performs a test to find out whether a given point lies within the polygon.
| pt | The point to test. |
| bool Shape.put_XY | ( | int | PointIndex, |
| double | x, | ||
| double | y | ||
| ) |
Sets the coordinates of the specified point.
It's hightly recommended to use this poperty rather than Shape.get_Point, for considerable performance boost when Shapefile.FastMode is set to true.
| PointIndex | The index of point. |
| x | The x coordinate. |
| y | The y coordinate. |
| bool Shape.Relates | ( | Shape | Shape, |
| tkSpatialRelation | Relation | ||
| ) |
Tests the specified relation between 2 shapes.
This method works the same as individual overloads like Shape.Intersects, Shape.Overlaps, etc.
| Shape | The second shape. |
| Relation | The relation to test. |
| bool Shape.ReversePointsOrder | ( | int | PartIndex | ) |
Changes the order of points within shape part to the opposite.
The property can be useful to to ensure proper topology for polygons. The points of outer ring of polygon must have clockwise order, while the points of its holes must be specified in counter-clockwise order.
| PartIndex | The index of part to reverse the order of points. |
| string Shape.SerializeToString | ( | ) |
Provides a string representing the shape's geometry.
The string will be in the serialized string format and can be reloaded with Shape.CreateFromString.
| void Shape.set_Part | ( | int | PartIndex, |
| int | pVal | ||
| ) |
Sets the index of the first point in part.
| PartIndex | The index of part. |
| pVal | The index of point. |
| void Shape.set_Point | ( | int | PointIndex, |
| Point | pVal | ||
| ) |
Replaces the point with the specified index with new one.
| PointIndex | The index of point to replace. |
| pVal | The new point. |
| bool Shape.Touches | ( | Shape | Shape | ) |
Tests a "touches" relation between 2 shapes.
| Shape | The second shape. |
| bool Shape.Within | ( | Shape | Shape | ) |
Tests a "within" relation between 2 shapes.
| Shape | The second shape. |
double Shape.Area [get] |
Calcualtes the area of the shape. For non-polygon shapes this property will return 0.0.
The area will always be returned in current map units. No corrections are made to take into account the curved shape of Earth.
Point Shape.Center [get] |
Calculates a center of the shape's bounding box.
Point Shape.Centroid [get] |
Calculates a centroid (center of mass) of the shape.
Extents Shape.Extents [get] |
Gets the extents of the shape.
ICallback Shape.GlobalCallback [get, set] |
Gets or sets a callback object for reporting about the errors.
Point Shape.InteriorPoint [get] |
Calculates the interior point of the shape. Is applicable for polygon shapes only.
The algorithm works as following:
bool Shape.IsValid [get] |
Returns a boolean value which indicates whether a shape is valid.
Shapes is considered to be valid when it meets specific topological rules for particular shape type.
string Shape.IsValidReason [get] |
Returns the string with the description of reason why shape was considered invalid.
string Shape.Key [get, set] |
The key may be used by the programmer to store any string data associated with the object.
int Shape.LastErrorCode [get] |
Retrieves the last error generated in the object.
double Shape.Length [get] |
Calculates the length of polyline shape.
The length will always be returned in current map units. No corrections are made to take into account the curved shape of the Earth.
int Shape.NumParts [get] |
Gets the number of parts contained in the shape.
A polygon shape may have several parts. An example of this would be a doughnut shape. The outermost perimeter would be one part, and the hole cut out of the center making up the innermost perimeter would be the second part. The outermost perimeter would be specified by a series of points arranged in clockwise order, meaning that this part will be filled. The innermost perimeter would be specified by a series of points arranged in counter-clockwise order, meaning that this part will not be filled.
int Shape.numPoints [get] |
Gets the number of points contained in the shape.
double Shape.Perimeter [get] |
Calculates the perimeter of shape. Is applicable for polygon shapes only.
The length will always be returned in current map units. No corrections are made to take into account the curved shape of the Earth.
ShpfileType Shape.ShapeType [get, set] |
Gets or sets the type of the shape.
The shape's type must match the type of the shapefile the shape is to be added to except for shapes of type SHP_NULLSHAPE.
1.7.6.1