Shape Class Reference

A shape object represents a geometric shape which can be added to a shapefile which is displayed in the map. More...

Collaboration diagram for Shape:
Collaboration graph

Public Member Functions

int AddPoint (double x, double y)
 Adds a point to the shape. More...
 
Shape Boundary ()
 Generates a shape which represents a boundary of the current shape. More...
 
Shape Buffer (double distance, int nQuadSegments)
 Builds a buffer of the specified distance around the shape. More...
 
Shape BufferWithParams (double distance, int numSegments=30, bool singleSided=false, tkBufferCap capStyle=tkBufferCap.bcROUND, tkBufferJoin joinStyle=tkBufferJoin.bjROUND, double mitreLimit=5)
 Returns a new shape which constitutes a buffer around original one. More...
 
void Clear ()
 Removes all the points and parts. More...
 
Shape Clip (Shape shape, tkClipOperation operation)
 Performs clipping operation with 2 shapes. More...
 
Shape Clone ()
 Creates a deep copy of this object with the same type, parts and points. More...
 
Shape ClosestPoints (Shape shape2)
 Calculates closest points of the 2 shapes More...
 
bool Contains (Shape shape)
 Tests a "contains" relation between 2 shapes. More...
 
Shape ConvexHull ()
 Builds a convex hull around the current shape. More...
 
bool CopyFrom (Shape sourceShape)
 Creates a deep copy of shape to another instance, including points and parts. More...
 
bool CoveredBy (Shape shape)
 Tests a 'covered by' relation between 2 shapes. More...
 
bool Covers (Shape shape)
 Tests a 'covers' relation between 2 shapes. More...
 
bool Create (ShpfileType shpType)
 Creates a new shape of the specified type. More...
 
bool CreateFromString (string serialized)
 Initializes the Shape object and fills it with the geometry defined by the input string. More...
 
bool Crosses (Shape shape)
 Tests a "crosses" relation between 2 shapes. More...
 
bool DeletePart (int partIndex)
 Deletes a part from a shape. More...
 
bool DeletePoint (int pointIndex)
 Deletes a point in the shape. More...
 
bool Disjoint (Shape shape)
 Tests a "disjoint" relation between 2 shapes. More...
 
double Distance (Shape shape)
 Calculates the distance between 2 shapes. More...
 
bool Equals (Shape shape)
 Tests an "equals" relation between 2 shapes. More...
 
bool Explode (ref object results)
 Splits multipart shape into simple shapes. More...
 
bool ExportToBinary (ref object bytesArray)
 Returns binary representation of the shape data. More...
 
string ExportToWKT ()
 Exports shape data to WKT format. More...
 
void FixUp (out Shape retval)
 Fixes the shape in case it is not valid. More...
 
Shape FixUp2 (tkUnitsOfMeasure units)
 Fixes the shape in case it is not valid. More...
 
int get_EndOfPart (int partIndex)
 Returns the index of the last point in the part. More...
 
string get_ErrorMsg (int errorCode)
 Retrieves the error message associated with the specified error code. More...
 
bool get_M (int pointIndex, out double m)
 Gets M value for specified point. More...
 
int get_Part (int partIndex)
 Gets or sets the first point index in the specified part. More...
 
Shape get_PartAsShape (int partIndex)
 Returns part of the shape as a new shape. More...
 
bool get_PartIsClockWise (int partIndex)
 Returns a boolean value which indicates whether points of the shape part are placed in the clockwise order. More...
 
Point get_Point (int pointIndex)
 Gets or sets the specified point in the shape. More...
 
bool get_XY (int pointIndex, ref double x, ref double y)
 Gets the coordinates of the specified point. More...
 
bool get_Z (int pointIndex, out double z)
 Gets M value for specified point. More...
 
bool GetIntersection (Shape shape, ref object results)
 Calculates the intersection of 2 shapes. More...
 
bool ImportFromBinary (object bytesArray)
 Restores the state of the shape from binary representation obtained by Shape.ExportToBinary. More...
 
bool ImportFromWKT (string serialized)
 Imports shape data from WKT format. More...
 
bool InsertPart (int pointIndex, ref int partIndex)
 Inserts a part into the shape. More...
 
bool InsertPoint (Point newPoint, ref int pointIndex)
 Inserts the specified point object into the shape using the desired point index if possible. More...
 
Point InterpolatePoint (Point startPoint, double distance, bool normalized)
 Return a point at the specified distance (or percentage) along the specified line More...
 
bool Intersects (Shape shape)
 Tests an "intersects" relation between 2 shapes. More...
 
void Move (double xOffset, double yOffset)
 Moves shape at specified offset. More...
 
bool Overlaps (Shape shape)
 Tests an "overlaps" relation between 2 shapes. More...
 
bool PointInThisPoly (Point pt)
 Performs a test to find out whether a given point lies within the polygon. More...
 
double ProjectDistanceTo (Shape referenceShape)
 Return a distance along the current line to a Point nearest another Shape More...
 
bool put_M (int pointIndex, double m)
 Puts M value for specified point. More...
 
bool put_XY (int pointIndex, double x, double y)
 Sets the coordinates of the specified point. More...
 
bool put_Z (int pointIndex, double z)
 Puts Z value for specified point. More...
 
bool Relates (Shape shape, tkSpatialRelation relation)
 Tests the specified relation between 2 shapes. More...
 
bool ReversePointsOrder (int partIndex)
 Changes the order of points within shape part to the opposite. More...
 
void Rotate (double originX, double originY, double angle)
 Rotates shape around specified point. More...
 
string SerializeToString ()
 Provides a string representing the shape's geometry. More...
 
void set_Part (int partIndex, int pVal)
 Sets the index of the first point in part. More...
 
void set_Point (int pointIndex, Point pVal)
 Replaces the point with the specified index with new one. More...
 
bool SplitByPolyline (Shape polyline, ref object results)
 Splits shape with a provided polyline. More...
 
bool Touches (Shape shape)
 Tests a "touches" relation between 2 shapes. More...
 
bool Within (Shape shape)
 Tests a "within" relation between 2 shapes. More...
 

Properties

double Area [get]
 Calculates the area of the shape. For non-polygon shapes this property will return 0.0. More...
 
Point Center [get]
 Calculates a center of the shape's bounding box. More...
 
Point Centroid [get]
 Calculates a centroid (center of mass) of the shape. More...
 
Extents Extents [get]
 Gets the extents of the shape. More...
 
ICallback GlobalCallback [get, set]
 Gets or sets a callback object for reporting about the errors. More...
 
Point InteriorPoint [get]
 Calculates the interior point of the shape. Is applicable for polygon shapes only. More...
 
bool IsEmpty [get]
 Returns true if the shape doesn't have any points. More...
 
bool IsValid [get]
 Returns a boolean value which indicates whether a shape is valid. More...
 
string IsValidReason [get]
 Returns the string with the description of reason why shape was considered invalid. More...
 
string Key [get, set]
 The key may be used by the programmer to store any string data associated with the object. More...
 
int LastErrorCode [get]
 Retrieves the last error generated in the object. More...
 
double Length [get]
 Calculates the length of polyline shape. More...
 
int NumParts [get]
 Gets the number of parts contained in the shape. More...
 
int NumPoints [get]
 Gets the number of points contained in the shape. More...
 
double Perimeter [get]
 Calculates the perimeter of shape. Is applicable for polygon shapes only. More...
 
ShpfileType ShapeType [get, set]
 Gets or sets the type of the shape. More...
 
ShpfileType ShapeType2D [get]
 Gets "flattened" shape type, i.e. Z and M components will be ignored. More...
 

Detailed Description

Member Function Documentation

◆ AddPoint()

int Shape.AddPoint ( double  x,
double  y 
)

Adds a point to the shape.

Parameters
xThe x coordinate of the point.
yThe y coordinate of the point.
Returns
The index of the new point.
New API 4.9.0:
Added in version 4.9.0
Examples
Segmentation.cs.

◆ Boundary()

Shape Shape.Boundary ( )

Generates a shape which represents a boundary of the current shape.

Returns
The reference to the resulting shape or NULL on failure.
New API 4.8:
Added in version 4.8

◆ Buffer()

Shape Shape.Buffer ( double  distance,
int  nQuadSegments 
)

Builds a buffer of the specified distance around the shape.

Parameters
distanceThe buffer distance in map units.
nQuadSegmentsThe number of segments use to approximate a circle buffer.
Returns
The reference to the resulting shape which holds the buffer or NULL reference on failure.
New API 4.8:
Added in version 4.8

◆ BufferWithParams()

Shape Shape.BufferWithParams ( double  distance,
int  numSegments = 30,
bool  singleSided = false,
tkBufferCap  capStyle = tkBufferCap.bcROUND,
tkBufferJoin  joinStyle = tkBufferJoin.bjROUND,
double  mitreLimit = 5 
)

Returns a new shape which constitutes a buffer around original one.

Parameters
distanceBuffer width (same units as shape coordinates are set with).
numSegmentsNumber of segments to approximate curves.
singleSidedTrue if buffer if single sided buffer is needed (works for polylines only).
capStyleType of caps.
joinStyleType of joins.
mitreLimitMitre limit.
Returns
New buffered shape on success or null on failure.
New API 4.9.3:
Added in version 4.9.3

◆ Clear()

void Shape.Clear ( )

Removes all the points and parts.

New API 4.9.4:
Added in version 4.9.4

◆ Clip()

Shape Shape.Clip ( Shape  shape,
tkClipOperation  operation 
)

Performs clipping operation with 2 shapes.

The available operation are:

  • difference;
  • intersection;
  • symmetrical difference;
  • union;

Note that clClip operation will yield the same result as intersection.

Parameters
shapeThe second shape for the operation.
operationThe operation to perform.
Returns
The reference to the resulting shape or NULL reference on failure.
New API 4.8:
Added in version 4.8
Examples
IntersectionLength.cs, and Segmentation.cs.

◆ Clone()

Shape Shape.Clone ( )

Creates a deep copy of this object with the same type, parts and points.

Returns
The copy of the shape.
New API 4.8:
Added in version 4.8

◆ ClosestPoints()

Shape Shape.ClosestPoints ( Shape  shape2)

Calculates closest points of the 2 shapes

Parameters
shape2Second shape
Returns
Polyline shape with 2 points, the first one - closest point of this shape, the second one - closest point of parameter shape.

Uses GEOS implementation, works for all shape types. For any point lying within polygon the closest point between it and polygon will be the point itself.

New API 4.9.1:
Added in version 4.9.1

◆ Contains()

bool Shape.Contains ( Shape  shape)

Tests a "contains" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape contains the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ ConvexHull()

Shape Shape.ConvexHull ( )

Builds a convex hull around the current shape.

Returns
A new shape with convex hull of the current shape or NULL reference on failure.
New API 4.8:
Added in version 4.8

◆ CopyFrom()

bool Shape.CopyFrom ( Shape  sourceShape)

Creates a deep copy of shape to another instance, including points and parts.

Parameters
sourceShapeSource shape to copy from.
Returns
True on success.
New API 4.9.1:
Added in version 4.9.1

◆ CoveredBy()

bool Shape.CoveredBy ( Shape  shape)

Tests a 'covered by' relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape is covered by the second shape and false if it is not.
New API 5.2:
Added in version 5.2

◆ Covers()

bool Shape.Covers ( Shape  shape)

Tests a 'covers' relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape covers the second shape and false if it is not.
New API 5.2:
Added in version 5.2

◆ Create()

bool Shape.Create ( ShpfileType  shpType)

Creates a new shape of the specified type.

Parameters
shpTypeThe type of the shape to be created.
Returns
A boolean value representing the success or failure of creating the new shape.
Examples
CreatePointShapefile.cs, CreatePolygonShapefile.cs, LinePattern.cs, MarkPoints.cs, and Segmentation.cs.

◆ CreateFromString()

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.

Parameters
serializedThe serialized string to load.
Returns
A boolean value representing the success or failure of loading the shape.

◆ Crosses()

bool Shape.Crosses ( Shape  shape)

Tests a "crosses" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape crosses the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ DeletePart()

bool Shape.DeletePart ( int  partIndex)

Deletes a part from a shape.

Parameters
partIndexThe index of the part to be deleted.
Returns
A boolean value representing the success or failure of deleting the part.

◆ DeletePoint()

bool Shape.DeletePoint ( int  pointIndex)

Deletes a point in the shape.

Parameters
pointIndexThe index of the point in the shape to be deleted.
Returns
A boolean value representing the success or failure of deleting the point in the shape.

◆ Disjoint()

bool Shape.Disjoint ( Shape  shape)

Tests a "disjoint" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape is disjoint from the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ Distance()

double Shape.Distance ( Shape  shape)

Calculates the distance between 2 shapes.

Parameters
shapeThe second shape.
Returns
The calculated distance.
New API 4.8:
Added in version 4.8
Examples
MinimalDistance.cs, and SelectByDistance.cs.

◆ Equals()

bool Shape.Equals ( Shape  shape)

Tests an "equals" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape is equal to the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ Explode()

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 output as individual polygons.

Parameters
resultsThe array of Shape type with the resulting shapes.
Returns
The on success and false otherwise.
New API 4.8:
Added in version 4.8

◆ ExportToBinary()

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.

Parameters
bytesArrayThe byte array with shape data.
Returns
True on success and false otherwise.
New API 4.8:
Added in version 4.8

◆ ExportToWKT()

string Shape.ExportToWKT ( )

Exports shape data to WKT format.

Returns
String in WKT format with shape data.
New API 4.9.0:
Added in version 4.9.0

◆ FixUp()

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.

Parameters
retvalThe fixed shape.
New API 4.8:
Added in version 4.8

◆ FixUp2()

Shape Shape.FixUp2 ( tkUnitsOfMeasure  units)

Fixes the shape in case it is not valid.

Parameters
unitsThe units of measure of the coordinate system.
Returns
The fixed shape.
New API 4.9.4:
Added in version 4.9.4

◆ get_EndOfPart()

int Shape.get_EndOfPart ( int  partIndex)

Returns the index of the last point in the part.

Parameters
partIndexThe index of the part.
Returns
The index of the point.
New API 4.8:
Added in version 4.8

◆ get_ErrorMsg()

string Shape.get_ErrorMsg ( int  errorCode)

Retrieves the error message associated with the specified error code.

Parameters
errorCodeThe error code for which the error message is required.
Returns
The error message description for the specified error code.

◆ get_M()

bool Shape.get_M ( int  pointIndex,
out double  m 
)

Gets M value for specified point.

Parameters
pointIndexIndex of point.
mM value.
Returns
True in case there are M values for current shape type.
New API 4.9.1:
Added in version 4.9.1

◆ get_Part()

int Shape.get_Part ( int  partIndex)

Gets or sets the first point index in the specified part.

Parameters
partIndexThe index of the part for which the first point index is required.
Returns
The index of the first point in the specified part.

◆ get_PartAsShape()

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.

Parameters
partIndexThe index of part to return.
Returns
The reference to the new shape and NULL reference on failure.
New API 4.8:
Added in version 4.8

◆ get_PartIsClockWise()

bool Shape.get_PartIsClockWise ( int  partIndex)

Returns a boolean value which indicates whether points of the shape part are placed in the clockwise order.

Parameters
partIndexThe index of part.
Returns
True for the clockwise order, and false for counter-clockwise.
New API 4.8:
Added in version 4.8

◆ get_Point()

Point Shape.get_Point ( int  pointIndex)

Gets or sets the specified point in the shape.

Parameters
pointIndexThe index of the point which is to be accessed in the shape.
Returns
The specified point in the shape.

◆ get_XY()

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.

Parameters
pointIndexThe index of point.
xThe x coordinate.
yThe y coordinate.
Returns
True on successful retrieval and false on wrong index of point.
New API 4.8:
Added in version 4.8
Examples
ShapefileToDrawingLayer.cs, TrackCars.cs, and Tracking.cs.

◆ get_Z()

bool Shape.get_Z ( int  pointIndex,
out double  z 
)

Gets M value for specified point.

Parameters
pointIndexIndex of point.
zZ value.
Returns
True in case there are Z values for current shape type.
New API 4.9.1:
Added in version 4.9.1

◆ GetIntersection()

bool Shape.GetIntersection ( Shape  shape,
ref 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.

Parameters
shapeThe second shape.
resultsThe array of Shape type with the results of intersection.
Returns
True in case at least one shape is returned and false otherwise.
New API 4.8:
Added in version 4.8

◆ ImportFromBinary()

bool Shape.ImportFromBinary ( object  bytesArray)

Restores the state of the shape from binary representation obtained by Shape.ExportToBinary.

Parameters
bytesArrayThe byte array with the state of shape.
Returns
True on success and false otherwise.
New API 4.8:
Added in version 4.8

◆ ImportFromWKT()

bool Shape.ImportFromWKT ( string  serialized)

Imports shape data from WKT format.

Parameters
serializedShape data in WKT format.
Returns
True on success and false otherwise.
New API 4.9.1:
Added in version 4.9.1

◆ InsertPart()

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.

Parameters
pointIndexThe index of the first point in the part to be inserted.
partIndexThe part index desired. This value may be modified if it is not possible to use the desired part index.
Returns
A boolean value representing the success or failure of inserting the part into the shape.

◆ InsertPoint()

bool Shape.InsertPoint ( Point  newPoint,
ref int  pointIndex 
)

Inserts the specified point object into the shape using the desired point index if possible.

Parameters
newPointThe point object to be inserted into the shape.
pointIndexReference parameter. The index where the point will be placed if possible. If the desired index cannot be used, the actual index will be returned.
Returns
A boolean value representing the success or failure of inserting the point into the shape.
Examples
CreatePointShapefile.cs, CreatePolygonShapefile.cs, LinePattern.cs, and MarkPoints.cs.

◆ InterpolatePoint()

Point Shape.InterpolatePoint ( Point  startPoint,
double  distance,
bool  normalized 
)

Return a point at the specified distance (or percentage) along the specified line

Parameters
startPointStarting point along this line (specify Point[0] for beginning of line)
distanceDistance along this line (or percentage of line length; if a percentage, specify a number between 0.0 and 1.0)
normalizedOptional value; if FALSE, 'distance' is actual distance; if TRUE, distance is percentage of length; defaults to FALSE
Returns
Returns a Point class representing the point along the sourceLine that is the specified distance (or percentage) along the line.

Only applies to a Polyline Shape. If 'distance' is greater than the the line length, the line's endpoint is returned.

'startPoint' does not have to be on the line. If not on the line, actual starting point will be the nearest point to 'startPoint' that is on the line.

See also
Utils.LineInterpolatePoint
New API 5.0:
Added in version 5.0.0

◆ Intersects()

bool Shape.Intersects ( Shape  shape)

Tests an "intersects" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape intersects the second shape and false if it is not.
New API 4.8:
Added in version 4.8
Examples
IntersectionLength.cs, and Segmentation.cs.

◆ Move()

void Shape.Move ( double  xOffset,
double  yOffset 
)

Moves shape at specified offset.

Parameters
xOffsetX component of offset.
yOffsetY component of offset.
New API 4.9.3:
Added in version 4.9.3

◆ Overlaps()

bool Shape.Overlaps ( Shape  shape)

Tests an "overlaps" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape overlaps the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ PointInThisPoly()

bool Shape.PointInThisPoly ( Point  pt)

Performs a test to find out whether a given point lies within the polygon.

Parameters
ptThe point to test.
Returns
True if points lies within polygon and false otherwise.

◆ ProjectDistanceTo()

double Shape.ProjectDistanceTo ( Shape  referenceShape)

Return a distance along the current line to a Point nearest another Shape

Parameters
referenceShapeAnother Shape of any Shapetype
Returns
Returns the distance along this line to the point nearest the specified Shape.

Only applies to a Polyline Shape. Returned Distance is measured from Point[0]. If resulting 'distance' would be greater than the length of the line, the line's length is returned.

See also
Utils.LineProjectDistanceTo
New API 5.0:
Added in version 5.0.0

◆ put_M()

bool Shape.put_M ( int  pointIndex,
double  m 
)

Puts M value for specified point.

Parameters
pointIndexIndex of point.
mM value.
Returns
True on success.
New API 4.9.1:
Added in version 4.9.1

◆ put_XY()

bool Shape.put_XY ( int  pointIndex,
double  x,
double  y 
)

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

Parameters
pointIndexThe index of point.
xThe x coordinate.
yThe y coordinate.
Returns
True on success and false on the invalid index.
New API 4.8:
Added in version 4.8

◆ put_Z()

bool Shape.put_Z ( int  pointIndex,
double  z 
)

Puts Z value for specified point.

Parameters
pointIndexIndex of point.
zZ value.
Returns
True on success.
New API 4.9.1:
Added in version 4.9.1

◆ Relates()

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.

Parameters
shapeThe second shape.
relationThe relation to test.
Returns
True in case this relation is actually takes place and false if it is not.
New API 4.8:
Added in version 4.8

◆ ReversePointsOrder()

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.

Parameters
partIndexThe index of part to reverse the order of points.
Returns
True on success and false otherwise.
New API 4.8:
Added in version 4.8

◆ Rotate()

void Shape.Rotate ( double  originX,
double  originY,
double  angle 
)

Rotates shape around specified point.

Parameters
originXX coordinate to rotate shape around.
originYY coordinate to rotate shape around.
angleAngle in degrees.
New API 4.9.3:
Added in version 4.9.3

◆ SerializeToString()

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.

Returns
A string representing the shape geometry.

◆ set_Part()

void Shape.set_Part ( int  partIndex,
int  pVal 
)

Sets the index of the first point in part.

Parameters
partIndexThe index of part.
pValThe index of point.

◆ set_Point()

void Shape.set_Point ( int  pointIndex,
Point  pVal 
)

Replaces the point with the specified index with new one.

Parameters
pointIndexThe index of point to replace.
pValThe new point.

◆ SplitByPolyline()

bool Shape.SplitByPolyline ( Shape  polyline,
ref object  results 
)

Splits shape with a provided polyline.

Parameters
polylinePolyline shape to split with.
resultsAn array of Shape type.
Returns
True on success.
New API 4.9.3:
Added in version 4.9.3

◆ Touches()

bool Shape.Touches ( Shape  shape)

Tests a "touches" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape touches the second shape and false if it is not.
New API 4.8:
Added in version 4.8

◆ Within()

bool Shape.Within ( Shape  shape)

Tests a "within" relation between 2 shapes.

Parameters
shapeThe second shape.
Returns
True if this shape lies within the second shape and false if it is not.
New API 4.8:
Added in version 4.8

Property Documentation

◆ Area

double Shape.Area
get

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

New API 4.8:
Added in version 4.8
Examples
CalculateArea.cs, and Segmentation.cs.

◆ Center

Point Shape.Center
get

Calculates a center of the shape's bounding box.

New API 4.8:
Added in version 4.8

◆ Centroid

Point Shape.Centroid
get

Calculates a centroid (center of mass) of the shape.

New API 4.8:
Added in version 4.8
Examples
GenerateLabelsManually.cs.

◆ Extents

Extents Shape.Extents
get

Gets the extents of the shape.

Examples
CreatePolygonShapefile.cs, and SelectByDistance.cs.

◆ GlobalCallback

ICallback Shape.GlobalCallback
getset

Gets or sets a callback object for reporting about the errors.

Deprecated:
v4.9.3 Use GlobalSettings.ApplicationCallback instead.

◆ InteriorPoint

Point Shape.InteriorPoint
get

Calculates the interior point of the shape. Is applicable for polygon shapes only.

The algorithm works as following:

  • a line is defined which crosses the bounding box of the polygon horizontally in its center;
  • the intersection of this line and polygon is calculated which can be represented by single segment or by a number of segments;
  • the longest segment is then chosen and the point on it's center is returned.
    New API 4.8:
    Added in version 4.8

◆ IsEmpty

bool Shape.IsEmpty
get

Returns true if the shape doesn't have any points.

New API 4.9.3:
Added in version 4.9.3

◆ IsValid

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.

New API 4.8:
Added in version 4.8

◆ IsValidReason

string Shape.IsValidReason
get

Returns the string with the description of reason why shape was considered invalid.

See also
Shape.IsValid.
New API 4.8:
Added in version 4.8

◆ Key

string Shape.Key
getset

The key may be used by the programmer to store any string data associated with the object.

◆ LastErrorCode

int Shape.LastErrorCode
get

Retrieves the last error generated in the object.

◆ Length

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.

Examples
IntersectionLength.cs, TrackCars.cs, and Tracking.cs.

◆ NumParts

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.

Examples
ShapefileToDrawingLayer.cs.

◆ NumPoints

int Shape.NumPoints
get

Gets the number of points contained in the shape.

There was a confusion with name casing for this property. Since version 5.4 this is corrected.

New API 5.4:
Updated in version 5.4

◆ Perimeter

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.

New API 4.8:
Added in version 4.8

◆ ShapeType

ShpfileType Shape.ShapeType
getset

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.

Examples
ShapefileToDrawingLayer.cs.

◆ ShapeType2D

ShpfileType Shape.ShapeType2D
get

Gets "flattened" shape type, i.e. Z and M components will be ignored.

New API 4.9.3:
Added in version 4.9.3