ACAPI_​Element_​GetHotspots

Retrieves the hotspots of the given element.

    GSErrCode  ACAPI_Element_GetHotspots (
        const API_Guid&                                guid,
        GS::Array<API_ElementHotspot>*                 hotspotArray
    );

 

Parameters

guid
[in] Identifier of the element.
hotspotArray
[out] Array that contains hotspots (neig and coordinate pairs).

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
hotspotArray parameter is nullptr.
APIERR_BADID
Invalid guid.

 

Remarks

This function is used to retrieve the hotspots of the given element.

The hotspots return in an array of API_ElementHotspot objects which contain neig and coordinate pairs (GS::Pair<API_Neig, API_Coord3D>).

 

Example


GS::Array<API_ElementHotspot>  hotspotArray;
API_Guid    guid = element.header.guid;    /* GUID of an element placed on the floorplan */

GSErrCode err = ACAPI_Element_GetHotspots (guid, &nHotspots, &hotspots);
if (err == NoError && !hotspotArray.IsEmpty ()) {
    BNZeroMemory (&element, sizeof (API_Element));
    element.header.typeID = API_HotspotID;
    err = ACAPI_Element_GetDefaults (&element, nullptr);
    if (err != NoError)
        return;

    short ind;
    for (ind = 0; ind < (short) hotspotArray.GetSize (); ind++) {
        API_Neig    neig;
        API_Coord3D coord;
        hotspotArray[ind].Get (neig, coord);
        element.hotspot.pen = ind;
        element.hotspot.pos.x = coord.x;
        element.hotspot.pos.y = coord.y;
        ACAPI_Element_Create (&element, nullptr);
    }
}

BMKillHandle ((GSHandle*) &hotspots);

 

Requirements

Version: API 18 or later
Header: ACAPinc.h

 

See Also

API_Neig
API_Coord3D
APIAny_NeigToCoordID
API Functions