Adds a vertex to an existing polyline.
When adding multiple vertexes in sequence to create a polyline, it is advised to use the Flags value DONT_REDRAW. This is especially relevant for an ITerrainBuilding5 object, which is derived from ITerrainPolyline5, since otherwise a corrupted building might be created.
HRESULT AddVertex (
[in] double X,
[in] double Height,
[in] double Y,
[in, defaultvalue(0)] long Flags)
Parameters:
X – The West-East coordinate of the vertex to be added. 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.
Height – The height of the vertex in meters.
Y – The North-South coordinate of the vertex to be added. 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.
Flags – Determine precisely how the new vertex is positioned. It can, for example, be positioned relative to the previous vertex. Below are the valid flags (from which you can form different combinations) for this method.
NEW_ELEVATION_RELATIVE_TO_CURRENT_ELEVATION = 64
The height of this vertex is the value of the Height parameter plus
the height of the previous vertex.
Note: This flag must never be used for the first vertex of the
polyline.
NEW_POS_RELATIVE_TO_CURRENT_POS =
128
The coordinates of this vertex are determined by adding the values
of the coordinates of the previous vertex to the values of the X
and Y parameters.
DONT_REDRAW = 512
When adding several vertices in a row, it is more efficient
(performance-wise) to redraw the polyline only after the last
vertex has been added. In this case, all of the AddVertex() calls
but the last, should have this flag set.
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. |