"addPointToPolygon"
Adds a point to a polygon.
Synopsis
void addPointToPolygon(string strLayer, int iPolygonIndex,
int iIndex, double dX, double dY);
Parameters
Parameter | Description |
---|---|
strLayer | The Layer the point will be added to. |
iPolygonIndex | The index of the polygon that was added to a layer. The return value of the function "addPolygonToLayer". |
iIndex | The index refers to the points in the polygon and starts at 0. |
dX | The x coordinate. The coordinate should fit the coordinate system of the map being displayed. |
dY | The y coordinate. The coordinate should fit the coordinate system of the map being displayed. |
Description
Adds a point to a polygon.
Example
A polygon with four points is added to a layer.
main()
{
int i;
GisViewer_ewo1.addEmptyLayer("POL");
GisViewer_ewo1.setLayerFillColor("POL","blue");
i = GisViewer_ewo1.addPolygonToLayer("POL","POLI", 4);
GisViewer_ewo1.addPointToPolygon("POL", i, 0, 25, 60); /*Add the first point to the polygon*/
GisViewer_ewo1.addPointToPolygon("POL", i, 1, 26, 61); /*Add the second point to the polygon*/
GisViewer_ewo1.addPointToPolygon("POL", i, 2, 24, 62);
GisViewer_ewo1.addPointToPolygon("POL", i, 3, 25, 60);
}
The code above adds a polygon above Helsinki, Finland.
The layer the polygon will be added to must be a layer that was added using the function "addEmptyLayer". The function addPolygonToLayer() is not supported on an existing 'normal' layer.
Assignment
GIS Viewer