## Utils

**Summary**

Utils provides a collection of methods ranging from file
conversion to finding a point on a shape.

**Structures**

PartBounds |
A short structure with an integer of a part index and the first
and last point in a shape. The values are inclusive, so both begPoint and endPoint are in the part. |

**Functions**

Area |
Computes the area of a polygon. For multi-part polygons, assume
holes are counter-clockwise. This function has two overloaded
versions. |

AreaOfPart |
Calculates the area of a part, without taking into
consideration any other aspects of the polygon. |

Centroid |
This function returns a MapWinGIS.Point that represents
the mathematical "center of mass" for the MapWinGIS.Shape polygon. Currently, shapes with multiple parts are supported, but treated as island chains, not as shapes with holes. Shapes with holes or shapes with self-intersecting parts will still return a value, but it is not likely to be the correct value. |

CentroidOfPart |
This function will calculate the centroid for a specific part
of a Mapwinshape. If the shape has only one part, the integer value PartIndex will be ignored, and the centroid for the entire shape will be calculated. |

PointOnLine |
Finds if a point lies on a line or not. |

AddPointToShape |
Not Implemented Adds a given point to the line or polygon at the specified location. |

RemovePointFromShape |
Not Implemented Removes a point at ptLocation from the line or polygon shape. |

FindNearestPointAndLoc |
Finds where the test point is closest to on a line or polygon
shape and returns the corresonding point and location and distance. |

GridToShapefile |
Not Implemented, use MapWinGIS::Utils::GridToShapefile Converts a grid to a shapefile. |

ShapefileToGrid |
Converts a shapefile to a grid. This function has 3
overloads. |

PointInPolygon |
Determines if a point lies within a polygon. |

IsLeft |
on|right of an infinite line. See: the January 2001 Algorithm "Area of 2D and 3D Triangles and Polygons" at http://softsurfer.com/Archive/algorithm_0101/algorithm_0101.htm |

wn_PnPoly |
Winding number test for point in polygon |

PartIsSelfIntersecting |
Tests a specific part to ascertain if any two segements in the
part intersect each other. |

GetPartBounds |
This function verifies that PartIndex references a valid part
in 'polygon' and returns a structure containing the integer part index, beginning point index for and ending point index for the part specified by PartIndex. It also tests polygon to make sure that it is not null and is a polygon shapetype. |

CheckPolygon |
Checks a shape object to ensure that it is a valid
polygon. Errors will throw exceptions. |