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

CreateLabel

The CreateLabel method creates a label in the 3D Window. The method offers an optimization point in the LabelInfo parameter. The parameter allows the client to set all of the label’s style properties at the label creation time. When creating a large numbers of labels at once, the use of ILabelStyle6 avoids unnecessary round-trips between the client and TerraExplorer and therefore gains in performance.

Note:    If no text is being added to the label, it is preferable to use the CreateImageLabel method rather than the generic CreateLabel method.

 

 

JavaScript

 

CreateLabel(

      Position,

      Text,

      ImageFileName,

      LabelStyle ,

      GroupID ,

      Description )

 

C#

 

ITerrainLabel6 CreateLabel(

      IPosition6     Position,

      string         Text,

      string         ImageFileName,

      ILabelStyle6   LabelStyle = 0,

      int            GroupID = 0,

      string         Description = "")

 

C++

 

HRESULT CreateLabel(

       IPosition6* Position,

       BSTR Text,

       BSTR ImageFileName,

       ILabelStyle6 LabelStyle,

       LONG_PTR GroupID,

       BSTR Description,

       ITerrainLabel6** pITerrainLabel6)

Parameters

Position

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

Text

The label text.

ImageFileName

A full pathname or a URL to the image file that appears in the label. Passing null in this parameter creates a text label only.

LabelStyle

An ILabelStyle6 representing the label style (e.g. color, font and viewing distance properties).

GroupID

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

Return Value

pITerrainLabel6

An ITerrainLabel6, representing the newly created label. This parameter must not be Null.

Exceptions

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

Remarks

After this method call returns, the label is not yet visible on the terrain. The client must first set either ITerrainLabel6.Text or ITerrainLabel6.ImageFileName(or both) properties.