The CreatePolyline method creates a polyline in the 3D Window.
See: “Polyline” section under the “2D Objects” chapter of the User Manual.
HRESULT CreatePolyline (
[in, defaultvalue(0)] VARIANT SafeArrayVertices,
[in, defaultvalue(0x0000ff00)] long LineColor,
[in, defaultvalue(HSC_TERRAIN_RELATIVE)] HeightStyleCode HeightStyle, [in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrainPolyline5** pITerrainPolyline5)
Parameters:
SafeArrayVertices – An
array that contains triplets of doubles. Each triplet is composed
of an x-coordinate, a height, and a y-coordinate. The COM interface
represents the height in meters while the x- and y-coordinates are
represented in MPT units. You can use the ITerrain interface to
retrieve information about the MPT units. If you are working in a
Lat-Long format, the Lat-Long values are given in decimal degrees.
If this parameter is zero, the object manager creates an empty
polyline to which the client can later add vertices.
See: “Creating a
Polyline Using a Safe Array of Vertices”.
LineColor – The color of the lines that make up the polyline. The color value is used to specify an RGB color. When specifying an explicit RGB color, the color value has the following hexadecimal form: 0x00bbggrr. The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.
HeightStyle – An enum determining how the polyline is placed on the terrain.
The HeightStyleCode enum can use any of the following values:
HSC_TERRAIN_RELATIVE = 0
Each of the polyline’s vertices has a height relative to the
terrain.
HSC_PIVOT_RELATIVE = 1
Each of the vertices has a height relative to the polyline’s
pivot.
HSC_ON_TERRAIN = 2
The vertices are placed on the terrain.
HSC_TERRAIN_ABSOLUTE = 3
Each of the polyline’s vertices has a height relative to the
terrain database vertical datum base ellipsoid.
GroupID – The Information Tree group in which the polyline 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 IInformationTree5::CreateGroup.
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 polyline as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainPolyline5 – An interface pointer to the newly created polyline. 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. |