The CreateTerrainModifier method creates a Modify Terrain object in the 3D Window.
See: “Modify Terrain” section under the “Terrain Objects” chapter of the User Manual.
HRESULT CreateTerrainModifier(
[in, optional, defaultvalue(0)] VARIANT SafeArrayVertices,
[in, optional, defaultvalue(0)] ElevationBehaviorMode Mode,
[in, optional, defaultvalue(1)] long Flat,
[in, optional, defaultvalue(0)] double Feather,
[in, optional, defaultvalue(0)] long GroupID,
[in, optional, defaultvalue("")] BSTR Description,
[out, retval] ITerrainModifier5** pITerrainModifier5)
Parameters:
SafeArrayVertices – An
array that contains triplets of doubles. Each triplet is composed
of an x-coordinate, a height, and a y-coordinate. The x-coordinate
and y-coordinate define the modify terrain points, while the height
value is applied to the respective point on the feather line. When
the feather is set to zero, these points fall exactly above the
respective X and Y coordinates. 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 a Lat-Long
format, the Lat-Long values are given in decimal degrees. If the
parameter is zero, the object manager creates an empty modified
terrain object to which the client can later add vertices.
See: “Creating a
Polyline Using a Safe Array of Vertices”.
Mode – An enum determining the elevation behavior mode.
The ElevationBehaviorMode enum can use any of the following values:
EB_REPLACE = 0
Replaces the area defined by the polygon with the selected
elevation value.
EB_BELOW = 1
Replaces all elevation values that are lower than the selected
elevation value with the selected elevation value
EB_ABOVE = 2
Replaces all elevation values that are higher than the selected
elevation value with the selected elevation value
Flat – A Boolean that determines if the modified terrain creates a flat surface.
Feather – The size, in meters, of the feather radius.
GroupID – The Information Tree group in which the modify terrain 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 IInformationTree5::CreateGroup.
Find the group if you know the name of the group using IInformationTree5::FindItem.
Traverse the Tree using IInformationTree5 methods such as GetNextItem(), until you come to the desired GroupID.
Description – The name of the modify terrain as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainModifier5 – An interface pointer to the newly created terrain modify object. 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. |
TE_E_NOLICENCE |
Your license does not allow the use of this feature. |