ScreenToWorld

 

This method returns the terrain coordinates of a specified pixel on the screen. If the selected pixel is part of an object, and not terrain, its object type and ObjectID is returned. This method should be used in most cases instead of the previous IRender4::ScreenToTerrain().

 

HRESULT ScreenToWorld(

 [in] long ScreenX,

 [in] long ScreenY,

 [in, out] VARIANT* longObjectType,

 [out] VARIANT*doubleWorldX,

 [out] VARIANT*doubleWorldHeight,

 [out] VARIANT*doubleWorldY,

 [out] VARIANT*bstrObjectID)

Parameters:

Note: The OBJ_TYPE_TERRAIN (0) parameter is used in any combination you select. If you click on the terrain the OBJ_TYPE_TERRAIN value is returned for this parameter and the  bstrObjectID parameter is returned with empty value.

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.