In TerraExplorer, a location is defined as a point of interest (X, Y, Height). The camera is given a direction and distance from which this point of interest is viewed. For example, if you chose the White House as your point of interest, you would need to find the x- and y-coordinates of the White House and pass those coordinates to the CreateLocation() method. To accompany the location, you could also place a label above the location signifying that it sits atop the White House.
HRESULT CreateLocation (
[in] double X,
[in] double Y,
[in] double Elevation,
[in] double Yaw,
[in] double Pitch,
[in] double Distance,
[in, defaultvalue(0)] HeightStyleCode HeightStyle,
[in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrainLocation5** pITerrainLocation5)
Parameters:
X – The West-East coordinate of the location of interest represented 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.
Y – The North-South coordinate of the location of interest represented 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.
Elevation – The elevation of the location of interest relative to the terrain.
Yaw – The Yaw angle between the viewer and the point of interest.
Pitch – The Pitch angle between the viewer and the point of interest.
Distance – The distance from the camera to the location’s point of interest (in meters).
HeightStyle – An enum determining how the location elevation parameter is interpreted.
The HeightStyleCode enum can use any of the following values:
HSC_TERRAIN_RELATIVE = 0
The height above the terrain of the location, is determined by the
Elevation points in the SafeArrayVertices parameter. Each of the
base vertices lies in the same plane as the object’s pivot.
HSC_TERRAIN_ABSOLUTE = 3
The height relative to the terrain database vertical datum base
ellipsoid of the location, is determined by the Elevation points in
the SafeArrayVertices parameter. Each of the base vertices lies in
the same plane as the object’s pivot.
GroupID – The Information Tree group in which the location 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 the IInformationTree5::CreateGroup method.
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 location as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainLocation5 – An interface pointer to the newly created location. 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. |