Home > Working with SGWorld > ProjectTree (IProjectTree6) > GetLayer

GetLayer

The GetLayer method returns an interface to the ILayer6 object based on the ItemID. Use IProjectTree6.IsLayer to make sure the ItemID is of a feature layer object.

 

JavaScript

 

GetLayer(GroupID)

 

C#

 

ILayer6 GetLayer(

      int GroupID)

 

C++

 

HRESULT GetLayer(

      LONG_PTR GroupID,

      ILayer6 ** pILayer) 

Parameters:

GroupID

The ID of the layer item requested. You can obtain the group ID by any 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.

Return Value

pILayer 

An ILayer6 representing the layer object.

Exceptions

HRESULT can return any of the values listed in the HRESULT Return Values list, as well as the following values:

TE_E_INFOTREE_PARENTNOTGROUP

The group ID entered does not represent a valid group in the project tree.

TE_E_INFOTREE_ITEMNOTGROUP

The item entered is not a group and therefore cannot be used as a group.

TE_E_INFOTREE_CANTUSEROOT

Can not use tree root for this operation

TE_E_INFOTREE_ITEMISGROUP

ItemID is a group so an object cannot be retrieved.