The AddPolygon method adds a new area or spline area. Returns an Area object.
Syntax
object.AddPolygon( bSpline, Vertices, UnitType )
Parameter |
Type |
Description |
bSpline |
Boolean |
required; true to add a spline area |
Vertices |
Array of Doubles |
required; array containing each vertex in the area |
UnitType |
optional; unit type, default is mvCoordDisplayUnitPageUnits |
Remarks
Use page units in the array. Vertices is an array containing alternating XY page coordinates. This assumes the entire array is used. VB users can use ReDim to set the array size to the used size if necessary or use AddPolygon2. See Coordinate Arrays for more information about creating arrays in MapViewer.
Example
This example demonstrates how to create an area using an array of doubles named Coordinates. The even numbered elements within the Coordinates array represent X values, while the odd numbered elements represent their corresponding Y values.
Dim Polygon As Object
Dim Coordinates(5) As Double
Coordinates(0) = 4: Coordinates(1) = 1
Coordinates(2) = 7: Coordinates(3) = 3
Coordinates(4) = 2: Coordinates(5) = 6
Set Polygon = Map Shapes.AddPolygon(bSpline:=False, Vertices:=Coordinates)
Used by: Shapes collection