CreatePolygonFromArray

Creates a polygon from an array of points.

Note:    To polygonize the resulting polygon (in order to find and resolve any intersecting lines) call StartEdit() followed by EndEdit().

 

JavaScript

 

CreatePolygonFromArray(

       verticesArray,

       LineColor,

       FillColor,

       AltitudeType,

       GroupID,

       Description)

 

C#

 

ITerrainPolygon80 CreatePolygonFromArray(

       object verticesArray,

       object        LineColor = -16711936,

       object        FillColor = -10197916,

       AltitudeTypeCode AltitudeType = AltitudeTypeCode.ATC_ON_TERRAIN,

       string GroupID = "",

       string Description = "")

 

C++

 

HRESULT CreatePolygonFromArray(

       VARIANT verticesArray,

       VARIANT LineColor,

       VARIANT FillColor,

       AltitudeTypeCode AltitudeType,

       BSTR GroupID,

       BSTR Description,

       ITerrainPolygon80** pITerrainPolygon80)

Parameters

verticesArray

An array that contains triplets of doubles. Each triplet is composed of an x-coordinate, a y-coordinate, and a height.

LineColor

The color of the lines that make up the polygon. The color value is used to specify color and transparency values. This parameter can be any of the following:

·          An IColor80 object.

·          A number which represents the color in ABGR format (0xAABBGGRR). The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; the third byte contains a value for blue. The high-order byte contains a value for alpha.

·          A string that represents HTML color format (“#RRGGBB”).

FillColor

The color which fills the polygon, if the alpha value is greater than zero. The color value is used to specify color and transparency values. This parameter can be any of the following:

·          An IColor80 object.

·          A number which represents the color in ABGR format (0xAABBGGRR). The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; the third byte contains a value for blue. The high-order byte contains a value for alpha.

·          A string that represents HTML color format (“#RRGGBB”).

AltitudeType

An enum that determines the altitude type to be used by the polygon. The following are the possible values:

·          ATC_TERRAIN_RELATIVE = 0
Places the polygon’s pivot point at a specified altitude above the ground.

·          ATC_ON_TERRAIN = 2
Creates the polygon on the terrain itself.

·          ATC_TERRAIN_ABSOLUTE = 3
Places the polygon’s pivot point at a specified altitude above the terrain database vertical datum base ellipsoid.

GroupID

The Project Tree group in which the polygon is created. If it is set to an empty string, the object is created under the root. You can obtain the GroupID by one of the following methods:

·          Create the group using IProjectTree80.CreateGroup.

·          Find the group, if you know the name, using IProjectTree80.FindItem.

·          Traverse the Tree using IProjectTree80 methods such as GetNextItem, until you come to the desired GroupID.

Description

The name of the polygon as it appears in the Project Tree. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.

Return Value

pITerrainPolygon80

An ITerrainPolygon80, representing the newly created polygon.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.