MapWinGIS:AxMap DrawPolygon
From MapWindow GIS
DrawPolygon
Draws a polygon to the last drawing layer created using NewDrawing.
See also NewDrawing
VB.NET Usage
Sub DrawPolygon(xPts() As Double, yPts() As Double, numPoints As Integer, color As System.UInt32, fill As Boolean)
Parameters
|
xPts | An array containing x-coordinates for each point in the polygon. |
| yPts | An array containing y-coordiniates for each point in the polygon. |
| numPoints | The number of points in the polygon. |
| color | The color to use when drawing the polygon. This is a UInt32 representation of an RGB color. |
| fill | A boolean value representing whether the polygon is drawn with a fill or not. |
Sample Code
Private Sub DrawPolygon()
Dim draw_hndl As Integer, num_points As Integer
Dim x1(6) As Double, y1(6) As Double
'Set x coordinates for the 6 points of the polygon
x1(0) = 300
x1(1) = 200
x1(2) = 300
x1(3) = 100
x1(4) = 100
x1(5) = 300
'Set y coordinates for the 6 points in the polygon
y1(0) = 300
y1(1) = 200
y1(2) = 100
y1(3) = 100
y1(4) = 300
y1(5) = 300
'Set number of points used to draw polygon as 6
num_points = 6
'Create new drawing layer on map
draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
'Draw red polygon on map using the 6 points defined in the x1 and y1 arrays
Map1.DrawPolygon(x1, y1, num_points, System.Convert.ToUInt32(RGB(255, 0, 0)), False)
End Sub
'VB 6 Usage
'Sub DrawPolygon(xPts() As Double, yPts() As Double, numPoints As Long, color As OLE_COLOR, fill As Boolean)
Parameters
|
xPts | An array containing x-coordinates for each point in the polygon. |
| yPts | An array containing y-coordiniates for each point in the polygon. |
| numPoints | The number of points in the polygon. |
| color | The color to use when drawing the polygon. |
| fill | A boolean value representing whether the polygon is drawn with a fill or not. |
Sample Code
Private Sub DrawPolygon()
Dim draw_hndl As Long, num_points As Long
Dim x1(6) As Double, y1(6) As Double
Dim col As OLE_COLOR
'Set color for polygon to red
col = RGB(255, 0, 0)
'Set x coordinates for the 6 points of the polygon
x1(0) = 300
x1(1) = 200
x1(2) = 300
x1(3) = 100
x1(4) = 100
x1(5) = 300
'Set y coordinates for the 6 points in the polygon
y1(0) = 300
y1(1) = 200
y1(2) = 100
y1(3) = 100
y1(4) = 300
y1(5) = 300
'Set number of points used to draw polygon as 6
num_points = 6
'Create new drawing layer on map
draw_hndl = Map1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList)
'Draw red polygon on map using the 6 points defined in the x1 and y1 arrays
Map1.DrawPolygon x1, y1, num_points, col, False
End Sub
















