The CreateDynamicObject creates a dynamic object with no way points. To put the object in the 3D you must add way point using ITerrainDynamicObject5::AddWaypoint(). More methods for controlling the dynamic object are available using the ITerrainDynamicObject5 interface.
HRESULT CreateDynamicObject(
[in, defaultvalue(1)] DynamicMotionStyle MotionStyle,
[in, defaultvalue(3)] DynamicObjectType ObjectType,
[in, defaultvalue("")] BSTR FileNameOrText,
[in, defaultvalue(1)] double ScaleFactor,
[in, defaultvalue(0)] HeightStyleCode HeightStyle,
[in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrainDynamicObject5** pITerrainDynamicObject5)
Parameters:
MotionStyle – An enum that determines the style of motion of the dynamic object. The following are the possible DynamicMotionStyle values:
MOTION_GROUND_VEHICLE = 0
The object is a ground vehicle.
MOTION_AIRPLANE = 1
The object sets the pitch angles during the flight according to
altitude differences between the waypoints. It also rolls while
turning between the waypoints.
MOTION_HELICOPTER = 2
The object leans forward with a fixed pitch angle of –15 degrees.
It also rolls while turning between the waypoints.
MOTION_HOVER = 3
The object always keeps the pitch and roll angels set to zero.
ObjectType – An enum that determines the type of object to be used for the dynamic object. The following are the possible DynamicObjectType values:
DYNAMIC_3D_MODEL = 0
A 3D model is used.
DYNAMIC_TEXT_LABEL = 1
A text label is used.
DYNAMIC_IMAGE_LABEL = 2
An image label is used.
DYNAMIC_VIRTUAL = 3
A virtual type is used. You can attach any object to the virtual
dynamic object.
FileNameOrText – If the ObjectType value is set to DYNAMIC_TEXT_LABEL, this parameter is the image label text. If ObjectType is set to DYNAMIC_3D_MODEL or DYNAMIC_IMAGE_LABEL, this is the 3D model file, or image label image file, respectively, to be used.
ScaleFactor – If the ObjectType value is set to DYNAMIC_3D_MODEL, this parameter is the scale value of the 3D model. If ObjectType value is set to DYNAMIC_TEXT_LABEL, or DYNAMIC_IMAGE_LABEL, this is the scale of the label.
HeightStyle – An enum determining how the elevation of the dynamic object waypoints is interpreted.
The HeightStyleCode enum can use any of the following values:
HSC_TERRAIN_RELATIVE = 0
The height above the terrain of the dynamic objects’s waypoints, is
determined by the Elevation points in the SafeArrayWaypointStruct
parameter.
HSC_TERRAIN_ABSOLUTE = 3
The height relative to the terrain database vertical datum base
ellipsoid of the dynamic object’s waypoints, is determined by the
Elevation points in the SafeArrayWaypointStruct parameter. Each of
the base vertices lies in the same plane as the object’s pivot.
GroupID – The Information Tree group in which the dynamic object 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.
Find the group, if you know its name, using IInformationTree5::FindItem.
Traverse the Tree using IInformationTree5 methods such as GetNextItem, until you come to the desired GroupID.
Description – The name of the dynamic object as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainDynamicObject5 – An interface pointer to the newly created dynamic 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 IErrorInfo Interface. |
TE_E_NOLICENCE |
Your license does not allow the use of this feature. |