The AttachTo() method attaches an object to another object by using the other object’s ID which is given in the first argument (the latter object is referred to as the leading object). When attaching two objects, the attached object follows the leader object at the given offsets. This method can be used to create a formation of objects that move in a group using the path of the leading object as their path. Passing an empty string detaches the object from the object it is attached to.
HRESULT AttachTo(
[in] BSTR TerrainObjectID,
[in] double DX,
[in] double DY,
[in] double DHeight)
Parameters:
TerrainObjectID – The ID of the object that the current object attaches to. This must be a valid ID of an object that was derived from ITerrainObject5 Or ITerrainObject. Passing an empty string detaches the object from the object it is attached to.
DX – The distance between the x-coordinates of the attached objects. This number stays consistent while the objects are attached. A positive DX places this object to the left of the leading object.
DY – The distance between the y-coordinates of the attached objects. This number stays consistent while the objects are attached. A positive DY places this object behind the leading object.
DHeight – The distance between the heights of the attached objects. This number stays consistent while the objects are attached. A positive DHeight places this object above the leading object.
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_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. |