This method returns an indication of whether a specified terrain coordinate falls in the 3D Window. If it does, the screen coordinates of a specified point are given.
Implemented only in IRender4.
HRESULT WorldToScreen(
[in] double WorldX,
[in] double WorldHeight,
[in] double WorldY,
[out] VARIANT* doubleScreenX,
[out] VARIANT* doubleScreenY,
[in] int Mode,
[out] VARIANT* boolInScreen,
[out, retval] long* pVal)
Parameters:
WorldX – The terrain X-coordinate whose corresponding screen coordinate you are seeking.
WorldHeight – The terrain height value whose corresponding screen coordinate you are seeking.
WorldY – The terrain Y-coordinate whose corresponding screen coordinate you are seeking.
doubleScreenX – The X-coordinate of the point that corresponds to the given terrain coordinate. The coordinates are given in screen coordinates, with the origin in the top-left corner of the 3D Window.
doubleScreenY – The Y-coordinate of the point that corresponds to the given terrain coordinate. The coordinates are given in screen coordinates, with the origin in the top-left corner of the 3D Window.
Mode – Determines if the method takes obstructions into account. This affects the return value of the method that identifies if the world point is visible. This parameter can be one of the following values:
0 – Visibility check is made only for the world point. If the point is in the view and obstructed by other objects or by the terrain the result is TRUE.
1 – Visibility check is made only for the world point with regards to other objects and all the terrain. If the point is in the view and obstructed by other objects or by the terrain the result is FALSE.
boolInScreen – Returns TRUE if the given world coordinate falls in the 3D view.
pVal – Once the method call is returned, pVAl contains the Boolean return value that indicates whether or nor the given world coordinate is visible in the current 3D Window. The visibility check is done according to the mode defined by the Mode parameter.
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. |