The CreateModel method imports an object from a file and places it in the 3D Window. Currently, TerraExplorer supports X and FLT formats (*.X, *.XPC, *.FLT, *.FPC).
HRESULT CreateModel (
[in] double X,
[in] double Y,
[in] double Elevation,
[in] BSTR FileName,
[in, defaultvalue(0)] double Yaw,
[in, defaultvalue(0)] double Pitch,
[in, defaultvalue(0)] double Roll,
[in, defaultvalue(1)] double Scale,
[in, defaultvalue(0)] HeightStyleCode HeightStyle,
[in, defaultvalue(0)] ModelTypeCode ModelType,
[in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrainModel5** pITerrainModel5)
Parameters:
X – The West-East coordinate of the center of the model 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 center of the model 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 model relative to the terrain.
FileName – A full path name or a URL to the model that you would like to import to the terrain.
Yaw – The Yaw angle of the model. See: “Yaw, Pitch and Roll Angles”.
Pitch – The Pitch angle of the model. See: “Yaw, Pitch and Roll Angles”.
Roll – The Roll angle of the model. See: “Yaw, Pitch and Roll Angles”.
Scale – The scale factor for the model.
HeightStyle – An enum determining how the model is placed on the terrain.
The HeightStyleCode enum can use any of the following values:
HSC_TERRAIN_RELATIVE = 0
The height above the terrain of the model’s pivot, is determined by
the Elevation parameter.
HSC_TERRAIN_ABSOLUTE = 3
The height relative to the terrain database vertical datum base
ellipsoid of the model’s pivot, is determined by the Elevation
parameter.
ModelType – An enum that indicates the model type. The following are the possible ModelTypeCode enumeration values for thie code:
MT_NORMAL = 0
Regular model.
MT_ANIMATION = 1
Direct X animation model.
MT_PROGRESSIVE = 2
Reserved.
GroupID – The Information Tree group in which the model 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.
If you know the name of the group, find it using IInformationTree5::FindItem.
Traverse the Tree using IInformationTree5 methods such as GetNextItem, until you come to the desired GroupID.
Description – The name of the model as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainModel5 – An interface pointer to the newly created model. 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. |