Home > Working with SGWorld > Creator (ICreator6) > CreatePolygonFromArray

CreatePolygonFromArray

Creates a polygon from an array of points.

 

JavaScript

 

CreatePolygonFromArray(

      verticesArray,

      LineColor = -16711936,

      FillColor = -10197916,

      AltitudeType = AltitudeTypeCode.ATC_ON_TERRAIN,

      GroupID = 0,

      Description = "")

 

C#

 

ITerrainPolygon6 CreatePolygonFromArray(

      object verticesArray,

      object LineColor = -16711936,

      object FillColor = -10197916,

      AltitudeTypeCode AltitudeType = AltitudeTypeCode.ATC_ON_TERRAIN,

      int GroupID = 0,

      string Description = "")

 

C++

 

HRESULT CreatePolygonFromArray(

      VARIANT verticesArray,

      VARIANT LineColor,

      VARIANT FillColor,

      AltitudeTypeCode AltitudeType,

      LONG_PTR GroupID,

      BSTR Description,

      ITerrainPolygon6** pITerrainPolygon6)

Parameters

verticesArray

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

LineColor

The color for the lines that make up the olygon. The color value is used to specify an RGB color. When specifying an explicit RGB color, the color value has the following hexadecimal form: 0x00bbggrr. The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

FillColor

The color with which the olygon is filled if the alpha value is greater than 0. The color value is used to specify an RGB color. When specifying an explicit RGB color, the color value has the following hexadecimal form: 0x00bbggrr. The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

AltitudeType

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

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

·         ATC_PIVOT_RELATIVE = 1
Places each point of the polygon at a specified altitude above the pivot point altitude, defined by its Point Altitude. The pivot is located at the center of the polygon.

·         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.

·         ATC_DEFAULT = 999

GroupID

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

§   Create the group using IProjectTree6.CreateGroup.

§  Find the group, if you know the name, using IProjectTree6.FindItem.

§  Traverse the Tree using IProjectTree6 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

pITerrainPolygon6

An ITerrainPolygon6, representing the newly created polygon.

Exceptions

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