AddComplexPolygon

The AddComplexPolygon method adds a new complex area. Returns an Area object.

 

Syntax

object.AddComplexPolygon( Vertices, PolyCounts, UnitType )

 

Parameter

Type

Description

Vertices

Array of Doubles

required; array containing each vertex in the complex area

PolyCounts

Array of Longs

required; number of vertices in each sub area

UnitType

MVCoordDisplayUnits

optional; unit type, default is mvCoordDisplayUnitPageUnits

 

Remarks

Page units are used in the arrays. 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 you can use AddComplexPolygon2. The number of vertices in Vertices should equal the sum of all the counts in the PolyCounts array. See Coordinate Arrays for more information about creating arrays in MapViewer.

 

Complex areas consist of one or more areas. For example, consider an outer square and an inner triangle. The square would consist of four vertices: x1,y1 x2,y2 x3,y3 x4,y4 and the triangle would consist of three vertices: x5,y5 x6,y6 x7,y7. The square has a vertex count of four and the triangle has a vertex count of three. The arrays appear as follows:

 

Vertices: x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7

PolyCounts: 4,3

 

Example

AddComplexPolygon allows areas with included and excluded regions to be created. This example demonstrates how to create a complex area, consisting of three sub areas, using an array of doubles named Coordinates and an array of longs named NumPolygons. The even numbered elements within the Coordinates array represent X values, while the odd numbered elements represent their corresponding Y values. The elements within the NumPolygons array represent the simple areas defined within the complex area; their values indicating the number of coordinate pairs needed to create them.

 

Dim ComplexPolygon As Object

 

Dim Coordinates(23) As Double

Coordinates(0) = 3.44: Coordinates(1) = 4.06

Coordinates(2) = 1.10: Coordinates(3) = 6.39

Coordinates(4) = 3.44: Coordinates(5) = 8.73

Coordinates(6) = 5.75: Coordinates(7) = 6.39

Coordinates(8) = 3.36: Coordinates(9) = 8.07

Coordinates(10) = 5.01: Coordinates(11) = 6.42

Coordinates(12) = 3.36: Coordinates(13) = 4.75

Coordinates(14) = 1.71: Coordinates(15) = 6.42

Coordinates(16) = 1.71: Coordinates(17) = 8.07

Coordinates(18) = 5.01: Coordinates(19) = 8.07

Coordinates(20) = 5.01: Coordinates(21) = 4.75

Coordinates(22) = 1.71: Coordinates(23) = 4.75

 

Dim NumPolygons(2) As Long

 

NumPolygons(0) = 4

NumPolygons(1) = 4

NumPolygons(2) = 4

 

Set ComplexPolygon = Map Shapes.AddComplexPolygon(Vertices:=Coordinates, PolyCounts:= NumPolygons)

 

Used by: Shapes collection