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

CreateBuilding

The CreateBuilding method creates a building in the 3D Window.

 

JavaScript

 

CreateBuilding(

      pIGeometry,

      RoofHeight ,

      AltitudeType ,

      GroupID ,

      Description )

 

C#

 

ITerrainBuilding6 CreateBuilding(

      IGeometry pIGeometry,

      double RoofHeight = 20,

      AltitudeTypeCode AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE,

      int GroupID = 0,

      string Description = "")

 

C++

 

HRESULT CreateBuilding(

       IGeometry *           pIGeometry,

       double                RoofHeight,

       AltitudeTypeCode      AltitudeType,

       LONG_PTR              GroupID,

       BSTR                  Description,

       ITerrainBuilding6 **  pITerrainBuilding6 )

 

Parameters

pIGeometry

An IGeometry representing the geometric properties and behavior of the building.

RoofHeight

The height of the building roof in meters.

AltitudeType

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

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

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

GroupID

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

Return Value

pITerrainBuilding6

An ITerrainBuilding6, representing the newly created building.

Exceptions

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