Functions for creating, handling and deleting custom (Add-On specific) Element Links. These links can provide associations between two elements. The advantage of using element linking is that the server application automatically tracks changes in the GUIDs, and updates them accordingly.
More...
|
GSErrCode | ACAPI_ElementLink_Link (const API_Guid &guid_linkFrom, const API_Guid &guid_linkTo, GSFlags linkFlags) |
| Links one element to another.
|
|
GSErrCode | ACAPI_ElementLink_Unlink (const API_Guid &guid_linkFrom, const API_Guid &guid_linkTo) |
| Removes the link from the second element to the first.
|
|
GSErrCode | ACAPI_ElementLink_GetLinks (const API_Guid &guid_linkFrom, GS::Array< API_Guid > *guid_linkTo) |
| Returns a list of elements linked to the given element.
|
|
GSErrCode | ACAPI_ElementLink_GetLinkFlags (const API_Guid &guid_linkFrom, const API_Guid &guid_linkTo, GSFlags *linkFlags) |
| Retrieves the link flags associated to the link between the two elements.
|
|
GSErrCode | ACAPI_ElementLink_GetLinkedPropertyObjects (const API_Elem_Head *head, bool *criteria, Int32 *inviduallyLibInd, Int32 **critLibInds, Int32 *nCrits) |
| Retrieves property objects linked to an element or the element default.
|
|
GSErrCode | ACAPI_ElementLink_SetLinkedPropertyObjects (API_Elem_Head *head, bool criteria, Int32 inviduallyLibInd) |
| Link property objects to an element or the element default.
|
|
Functions for creating, handling and deleting custom (Add-On specific) Element Links. These links can provide associations between two elements. The advantage of using element linking is that the server application automatically tracks changes in the GUIDs, and updates them accordingly.
◆ ACAPI_ElementLink_GetLinkedPropertyObjects()
GSErrCode ACAPI_ElementLink_GetLinkedPropertyObjects |
( |
const API_Elem_Head * |
head, |
|
|
bool * |
criteria, |
|
|
Int32 * |
inviduallyLibInd, |
|
|
Int32 ** |
critLibInds, |
|
|
Int32 * |
nCrits |
|
) |
| |
Retrieves property objects linked to an element or the element default.
- Parameters
-
head | [in] Header of the element (only field guid is used). Properties linked to the default element are retrieved when guid is APINULLGuid |
criteria | [out] Determines whether the matching properties by criteria are linked to the element |
inviduallyLibInd | [out] Library index of individually assigned property (value zero means no individual property assigned) |
critLibInds | [out] Aray of the library indices of linked properties matching the criteria |
nCrits | [out] Number of linked properties matching the criteria |
- Returns
- Example
void GetLinkedProperties (
const API_Guid& guid)
{
BNClear (element);
if (err == NoError) {
bool byCrit;
Int32 indivLibInd;
Int32 nCrits;
Int32 *critLibInds;
if (indivLibInd != 0) {
DBPrintf ("Library index of individually linked property is %d.\n", indivLibInd);
}
if (byCrit) {
DBPrintf ("Library indices of linked properties matching criteria are [ ");
for (Int32 i = 0; i < nCrits; ++i) {
DBPrintf ("%d ", critLibInds[i]);
}
DBPrintf ("].\n");
}
BMKillPtr ((GSPtr *) &critLibInds);
}
}
}
GSErrCode ACAPI_Element_Get(API_Element *element, UInt32 mask=0)
Returns information on the main parameters of a given element.
GSErrCode ACAPI_ElementLink_GetLinkedPropertyObjects(const API_Elem_Head *head, bool *criteria, Int32 *inviduallyLibInd, Int32 **critLibInds, Int32 *nCrits)
Retrieves property objects linked to an element or the element default.
API_Guid guid
The globally unique identifier of the element. It is type-independent, and guaranteed to be globally ...
Definition: APIdefs_Elements.h:426
Represents a GS::Guid in the API layer.
Definition: API_Guid.hpp:46
A union collecting all known element types.
Definition: APIdefs_Elements.h:17120
API_Elem_Head header
General element header.
Definition: APIdefs_Elements.h:17126
◆ ACAPI_ElementLink_GetLinkFlags()
GSErrCode ACAPI_ElementLink_GetLinkFlags |
( |
const API_Guid & |
guid_linkFrom, |
|
|
const API_Guid & |
guid_linkTo, |
|
|
GSFlags * |
linkFlags |
|
) |
| |
Retrieves the link flags associated to the link between the two elements.
- Parameters
-
guid_linkFrom | [in] Identifies the element to which the other element was linked. |
guid_linkTo | [in] Identifies the element which was linked to the first element. |
linkFlags | [out] Returns the custom flags assigned to the link with ACAPI_ElementLink_Link. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed linkFlags pointer is nullptr.
- APIERR_BADDATABASE, APIERR_NOTMINE - The function cannot operate on the current database.
◆ ACAPI_ElementLink_GetLinks()
GSErrCode ACAPI_ElementLink_GetLinks |
( |
const API_Guid & |
guid_linkFrom, |
|
|
GS::Array< API_Guid > * |
guid_linkTo |
|
) |
| |
Returns a list of elements linked to the given element.
- Parameters
-
guid_linkFrom | [in] Identifies the element to which the other elements were linked. |
guid_linkTo | [out] Returns the GUIDs of the elements which were linked to the first element. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - The passed guid_linkTo pointer is nullptr.
- APIERR_BADDATABASE, APIERR_NOTMINE - The function cannot operate on the current database.
◆ ACAPI_ElementLink_Link()
GSErrCode ACAPI_ElementLink_Link |
( |
const API_Guid & |
guid_linkFrom, |
|
|
const API_Guid & |
guid_linkTo, |
|
|
GSFlags |
linkFlags |
|
) |
| |
Links one element to another.
- Parameters
-
guid_linkFrom | [in] Identifies the element to which the other element will be linked. |
guid_linkTo | [in] Identifies the element to link to the first element. |
linkFlags | [in] Custom flags to store with the link. |
- Returns
- NoError - The function has completed with success.
- APIERR_NEEDSUNDOSCOPE - The function must be undoable, it wasn't called from an undoable command scope.
- APIERR_BADDATABASE, APIERR_NOTMINE - The function cannot operate on the current database.
- APIERR_BADID - One or both of the passed unique IDs are invalid, or the two IDs are equal.
- APIERR_LINKEXIST - The elements has already been linked together.
◆ ACAPI_ElementLink_SetLinkedPropertyObjects()
GSErrCode ACAPI_ElementLink_SetLinkedPropertyObjects |
( |
API_Elem_Head * |
head, |
|
|
bool |
criteria, |
|
|
Int32 |
inviduallyLibInd |
|
) |
| |
Link property objects to an element or the element default.
- Parameters
-
head | [in] Header of the element (only fields type and guid are used). The setting is applied to element defaults if guid is APINULLGuid. |
criteria | [in] Determines whether the matching properties by criteria need to be linked to the element |
inviduallyLibInd | [in] Library index of individually selected property to be linked to the element (value zero means no individual property is to be assigned) |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - head is nullptr
- APIERR_BADID - Incorrect type was specified, or an element with the specified guid was not found.
- APIERR_MEMFULL - Not enough memory to set the properties
- Example
bool byCrit;
Int32 indivLibInd;
...
ACAPI_CallUndoableCommand ("Create column with properties linked",
[&] () -> GSErrCode {
if (err == NoError) {
defHead.
type = API_ColumnID;
if (err == NoError)
}
return err;
});
GSErrCode ACAPI_Element_GetDefaults(API_Element *element, API_ElementMemo *memo)
Retrieves the actual default settings for the element of type.
GSErrCode ACAPI_Element_Create(API_Element *element, API_ElementMemo *memo)
Places a new element into current database.
GSErrCode ACAPI_ElementLink_SetLinkedPropertyObjects(API_Elem_Head *head, bool criteria, Int32 inviduallyLibInd)
Link property objects to an element or the element default.
API_Coord origoPos
The position of the column.
Definition: APIdefs_Elements.h:3884
double x
Horizontal coordinate.
Definition: APIdefs_Base.h:87
double y
Vertical coordinate.
Definition: APIdefs_Base.h:93
General element header for element types.
Definition: APIdefs_Elements.h:401
API_ElemType type
The type of the element.
Definition: APIdefs_Elements.h:407
API_ColumnType column
Represents a column.
Definition: APIdefs_Elements.h:17139
◆ ACAPI_ElementLink_Unlink()
GSErrCode ACAPI_ElementLink_Unlink |
( |
const API_Guid & |
guid_linkFrom, |
|
|
const API_Guid & |
guid_linkTo |
|
) |
| |
Removes the link from the second element to the first.
- Parameters
-
guid_linkFrom | [in] Identifies the element to which the other element is linked. |
guid_linkTo | [in] Identifies the element which is linked to the first element. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADDATABASE, APIERR_NOTMINE - The function cannot operate on the current database.
- APIERR_NEEDSUNDOSCOPE - The function must be undoable, it wasn't called from an undoable command scope.
- APIERR_LINKNOTEXIST - There isn't any link from the second element to the first.