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

CreateRectangle

CreateRectangle creates a rectangle in the 3D Window.

 

JavaScript

 

CreateRectangle(

      Position,

      ObjectWidth,

      ObjectDepth,

      LineColor ,

      FillColor ,

      GroupID ,

      Description )

 

C#

 

ITerrainRectangle6 CreateRectangle(

      IPosition6 Position,

      double ObjectWidth,

      double ObjectDepth,

      object LineColor = -16711936,

      object FillColor = -10197916,

      int GroupID = 0,

      string Description = "")

 

C++

 

HRESULT CreateRectangle(

      IPosition6* Position,

      double ObjectWidth,

      double ObjectDepth,

      VARIANT LineColor,

      VARIANT FillColor,

      LONG_PTR GroupID,

      BSTR Description,

      ITerrainRectangle6** pITerrainRectangle6)

 

Parameters:

Position

An IPosition6 representing the position and orientation of the rectangle on the terrain. .

ObjectWidth

The width of the rectangle in meters.

ObjectDepth

The depth of the rectangle in meters.

LineColor

The color of the lines that make up the rectangle. 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 rectangle 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.

GroupID

The Project Tree group in which the rectangle 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 rectangle as it appears in the Project Tree. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.

Return Value

pITerrainRectangle6

An ITerrainRectangle6, representing the newly created rectangle.

Exceptions

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

Remarks

The rectangle is initially created with its orientation aligned with the north. The client can then change its orientation using the IPosition6 interface.