The Create3DPolygon method creates a 3-dimensional polygon in the 3D Window.
HRESULT Create3DPolygon (
[in, defaultvalue(0)] VARIANT SafeArrayVertices,
[in, defaultvalue(20)] double ObjectHeight,
[in, defaultvalue(0x0000ff00)] long LineColor,
[in, defaultvalue(FT_NONE)] double FillOpacity,
[in, defaultvalue(0x00646464)] long FillColor,
[in, defaultvalue(0)] HeightStyleCode HeightStyle,
[in, defaultvalue(0)] long GroupID,
[in, defaultvalue("")] BSTR Description,
[out, retval] ITerrain3DPolygon5** pITerrain3DPolygon5)
Parameters:
SafeArrayVertices – An array that contains triplets of doubles. Each triplet is composed of an x-coordinate, a height, and a y-coordinate. Currently this array determines the shape of the lower base of the 3D polygon (TerraExplorer then duplicates this shape for the upper base at ObjectHeight meters above the lower base) The client should set all of the height coordinates in the array to be the same. It is this value that determines the height of the 3D polygon above the ground. 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 Lat-Long format, the Lat-Long values are in decimal Lat-Long. The following is an example in VB Script that returns three vertices, with each vertex set to the same height:
<SCRIPT language="VBSCRIPT">
Function CreateVertArray()
Dim vert(9)
vert(0) = -118.82295
vert(1) = 100.0
vert(2) = 34.15543
vert(3) = -118.82173
vert(4) = 100.0
vert(5) = 34.15387
vert(6) = -118.82284
vert(7) = 100.0
vert(8) = 34.15426
CreateVertArray = vert
End Function
</SCRIPT>
See: “Creating Polyline using safe array of vertices”.
ObjectHeight – The height of the 3-dimensional polygon (in meters).
LineColor – The color of the lines that make up the 3-dimensional polygon. 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.
FillOpacity – Determines the opacity or transparency of the fill of fill of the 3-dimensional polygon. This value can be any value between 0, for transparent, and 1 for opaque.
FillColor – The color with which the 3-dimensional polygon is filled if the FillOpacity value is greater than 0. 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 3-dimensional polygon 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 3-dimensional polygon’s pivot
(the center of its base), is determined by the Elevation points in
the SafeArrayVertices parameter.
HSC_TERRAIN_ABSOLUTE = 3
The height relative to the terrain database vertical datum base
ellipsoid of the 3-dimensional polygon’s pivot (the center of its
base), is determined by the Elevation points in the
SafeArrayVertices parameter.
GroupID – The Information Tree group in which the 3-dimensional polygon 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 3-dimensional polygon as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrain3DPolygon5 – An interface pointer to the newly created 3-dimensional polygon. 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. |