The AddWaypoint method adds a new waypoint to the end of the route. It allows the client to specify a message that appears at that waypoint.
HRESULT AddWaypoint(
[in] double X,
[in] double Height,
[in] double Y,
[in] double Yaw,
[in] double Pitch,
[in] double Roll,
[in] double CameraDeltaYaw,
[in] double CameraDeltaPitch,
[in] double Speed,
[in] BSTR MessageID)
Parameters:
X – The West-East coordinate of the waypoint 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.
Height – The height of the waypoint, in meters. The way this parameter is interpreted depends on the HeightRelativeToGround property.
Y – The North-South coordinate of the waypoint 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.
Yaw – The yaw orientation
of the plane at the waypoint. This value is 360 - X, where X is the
value for the yaw, in degrees, as used in other parts of the
API.
See: “Yaw,
Pitch and Roll Angles”.
Pitch – The pitch orientation of the plane at that waypoint. See: “Yaw, Pitch and Roll Angles”.
Roll – The roll orientation of the plane at that waypoint. See: “Yaw, Pitch and Roll Angles”.
CameraDeltaYaw – The offset between the camera yaw and the plane yaw.
CameraDeltaPitch – The offset between the camera pitch and the plane pitch.
Speed – The speed of the plane in meters per second at that waypoint. The plane’s speed adjusts in between waypoints to reach the speed of its next waypoint.
MessageID – The ID of the message object that appears at the new waypoint.
Return Values:
The return value obtained from the returned HRESULT is one of the following:
Return value |
Meaning |
S_OK |
Success. |
E_FAIL |
Catastrophic failure. |
TE_E_TEOBJECT_NOLONGEREXIST |
The object you are trying to access no longer exists. This may have occurred because, while keeping an interface to the object, the user deleted it from TerraExplorer (via the TE user interface). Without the object, the interface cannot be used. Therefore, you should release the interface. |
TE_E_INTERNAL |
TerraExplorer was unable to create the object. To get more information about this error use the IErrorInfo Interface. |
Remarks:
Usually, the best results for the route are received when the Yaw, Pitch and Roll parameters of the waypoint are such that they make the plane at that waypoint to point to the next waypoint. The CameraDeltaYaw and the CameraDeltePitch parameters decide where the camera actually faces at that waypoint.