The CreateBuilding method creates a building in the 3D Window.
HRESULT CreateBuilding (
[in, defaultvalue(0)] VARIANT SafeArrayVertices,
[in, defaultvalue(20)] double RoofHeight,
[in, defaultvalue(BS_STRETCH_TERRAIN)] BuildingStyleCode BuildingStyle,
[in, defaultvalue(0)] HeightStyleCode HeightStyle,
[in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrainBuilding5** pITerrainBuilding5)
Parameters:
SafeArrayVertices – An array of points defining the base shape of the building. An array that contains triplets of doubles. Each triplet is composed of an x-coordinate, a height, and a y-coordinate. The height of the building is determined by the ObjectHeight parameter. All of the height coordinates in the array are currently ignored. The COM interface represents the height in meters while the x- and y-coordinates are represented in MPT units. You can use the ITerrain interface to retrieve information about the MPT units. If you are working in Lat-Long format, the Lat-Long values are in decimal Lat-Long.
See: “Creating a
Polyline Using a Safe Array of Vertices” for an example of how
to create and use a safe array of vertices.
RoofHeight – The height of the building roof(in meters).
BuildingStyle – An enum, specifying whether the building is stretched from the terrain or is composed of polygons. Can be one of the following values:
BS_STRETCH_TERRAIN = 0
A building with this style is stretched out of the terrain having
the same texture for its roof as the terrain had at that location.
TerraExplorer renders a building with this style more
efficiently.
BS_POLYGONS = 1
A building with this style is composed of polygons and can
accept user-defined textures for its roof and walls.
HeightStyle – An enum determining how the building is placed on the terrain.
The HeightStyleCode enum can use any of the following values:
HSC_TERRAIN_RELATIVE = 0
The base and roof altitudes are above the terrain.
HSC_TERRAIN_ABSOLUTE = 3
The base and roof altitude are relative to the terrain database
vertical datum base ellipsoid.
GroupID – The Information 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 the IInformationTree5::CreateGroup.
If you know the name of the group, find it using IInformationTree5::FindItem.
Traverse the Tree using IInformationTree5 methods such as GetNextItem, until you come to the desired GroupID.
Description – The name of the building as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainBuilding5 – An interface pointer to the newly created building. This parameter must not be Null.
Return Values:
The return value obtained from the returned HRESULT can be one of the following:
Return value |
Meaning |
S_OK |
Success. |
E_FAIL |
Catastrophic failure. |
TE_E_MPTNOTLOADED |
An MPT file must be loaded in TerraExplorer for this method to work. |
TE_E_INFOTREE_PARENTNOTGROUP |
The group ID entered does not represent a valid group in the information tree. |
TE_E_INTERNAL |
TerraExplorer was unable to create the object. To get more information about this error use the IErrorInfo Interface. |
Your license does not allow the use of this feature. |