APIAny_​DeleteSubPolyID

Deletes a whole subpolygon (hole) from a polygon.

    GSErrCode ACAPI_Goodies (
        APIAny_DeleteSubPolyID,
        API_ElementMemo*     elementMemo,
        Int32*               subPolyIndex
    );

 

Parameters

elementMemo
[in/out] The polygon data.
subPolyIndex
[in] subpolygon index to delete

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
any of the parameters are nullptr or invalid subPolyIndex passed
APIERR_MEMFULL
low memory condition
APIERR_IRREGULARPOLY
Input polygon is irregular.

For other common API errors see the API Errors document.

 

Remarks

This function is used to delete a whole subpolygon (hole) from a polygon passed in an API_ElementMemo structure.

Refer to the API_Polygon structure to have more details on the polygon data structure. The coords, pends, parcs and vertexIDs handles in the API_ElementMemo structure must be initialized.

Note that other memo handles are not touched. In the case the polygon belongs to a roof with side angles initialized, it must be aligned manually.

 

Example


GSErrCode DeleteSubPoly (const API_Guid& guid)
{
    API_ElementMemo   memo;
    Int32             lastSubPoly;
    GSErrCode         err;

    err = ACAPI_Element_GetMemo (guid, &memo);
    if (err) {
        lastSubPoly = BMGetHandleSize ((GSHandle) memo.pends) / sizeof (Int32) - 1;
        if (lastSubPoly > 1)
            err = ACAPI_Goodies (APIAny_DeleteSubPolyID, &memo, &lastSubPoly);
    }
    return err;
}

 

Requirements

Version: API 4.1 or later
Header: APIdefs_Goodies.h

 

See Also

API_Polygon, API_ElementMemo,
APIAny_InsertPolyNodeID, APIAny_DeletePolyNodeID, APIAny_InsertSubPolyID,
ACAPI_Goodies, API Functions