Typedefs | |
typedef int(* | ModifyFunc_EachElement )(MSElementP element, CallbackArgP userArgP, DgnModelRefP modelRef, MSElementDescrP edP, MSElementDescrH newEdPP, DgnPlatform::ModifyElementSource source) |
UserFunction utilized by mdlModify_elementSingle, mdlModify_elementMulti, and mdlModify_elementDescr. More... | |
Functions | |
int | mdlModify_elementDescr (MSElementDescrH elDescr, DgnModelRefP modelRef, int compFlag, ModifyFunc_EachElement eleFunc, CallbackArgP params, long compOffset) |
Modify an element descriptor in memory. More... | |
UInt32 | mdlModify_elementMulti (DgnModelRefP modelRef, UInt32 filePos, int compFlag, int modifyFlags, ModifyFunc_EachElement eleFunc, CallbackArgP params, int doGroups) |
Similar to mdlModify_elementSingle, except that this function also processes selection sets and graphic groups. More... | |
UInt32 | mdlModify_elementSingle (DgnModelRefP modelRef, UInt32 filePos, int compFlag, int modifyFlags, ModifyFunc_EachElement eleFunc, CallbackArgP params, long compOffset) |
Reads an element from the design file and calls a function for each component of that element. More... | |
void | mdlModify_freeGGMap (MdlCopyParams *cp) |
Frees memory after element modification. More... | |
typedef int(* ModifyFunc_EachElement)(MSElementP element, CallbackArgP userArgP, DgnModelRefP modelRef, MSElementDescrP edP, MSElementDescrH newEdPP, DgnPlatform::ModifyElementSource source) |
UserFunction utilized by mdlModify_elementSingle, mdlModify_elementMulti, and mdlModify_elementDescr.
[in,out] | element | Points to the current element to be modified. This element should be modified in place so that when the callback returns, the new element is in element. The calling mdlModify function adjusts the appropriate values in the header element (if element is a component of a complex element). |
[in,out] | userArgP | Is the value that was passed to the calling mdlModify function. Typically points to a structure containing parameters for the callback. |
[in] | modelRef | Model which holds the current element |
[in] | edP | points to the element descriptor for element. The callback should treat the element descriptor pointed to by edP as read-only and never modify it directly. edP rarely needs to be used, except when the callback needs to know the element structure (the header type). |
[out] | newEdPP | points to an element descriptor. This descriptor replaces the current element descriptor if the MODIFY_STATUS_REPLACEDSCR bit is set in the return value of the callback. The calling mdlModify function automatically frees the memory associated with newEdPP. |
[in] | source | The source of the element |
eleFunc return value | Meaning |
---|---|
MODIFY_STATUS_NOCHANGE | The element was not changed. |
MODIFY_STATUS_REPLACE | Replace original element with the new element. |
MODIFY_STATUS_DELETE | Delete the original element. |
MODIFY_STATUS_ABORT | Stop processing component elements. MODIFY_STATUS_ABORT can be used with any of the other values. |
MODIFY_STATUS_FAIL | An error occurred during element modification. Ignore all changes previously made. |
MODIFY_STATUS_REPLACEDSCR | Replace the current element descriptor with a new element descriptor. This is used to replace one or more elements with a (possibly) different number of elements. |
MODIFY_STATUS_ERROR | MODIFY_STATUS_FAIL | MODIFY_STATUS_ABORT |
int mdlModify_elementDescr | ( | MSElementDescrH | elDescr, |
DgnModelRefP | modelRef, | ||
int | compFlag, | ||
ModifyFunc_EachElement | eleFunc, | ||
CallbackArgP | params, | ||
long | compOffset | ||
) |
Modify an element descriptor in memory.
This is the lowest-level function in the mdlModify_... group. mdlModify_elementSingle reads an element descriptor from the design file and calls mdlModify_elementDescr to modify that descriptor. mdlModify_elementDescr is useful when you want to modify an element descriptor but do not want to write the new elements to the file.
[in,out] | elDescr | pointer to a pointer to an element descriptor. Since this function can modify the element descriptor, the value of elmDscrPP can be different before and after the call. |
[in] | modelRef | model to process |
[in] | compFlag | complex elem flags |
[in] | eleFunc | called for each elem |
[in] | params | parameters passed to users eleFunc |
[in] | compOffset | if componentFlag set |
UInt32 mdlModify_elementMulti | ( | DgnModelRefP | modelRef, |
UInt32 | filePos, | ||
int | compFlag, | ||
int | modifyFlags, | ||
ModifyFunc_EachElement | eleFunc, | ||
CallbackArgP | params, | ||
int | doGroups | ||
) |
Similar to mdlModify_elementSingle, except that this function also processes selection sets and graphic groups.
[in] | modelRef | model to process |
[in] | filePos | file position for element |
[in] | compFlag | if true, only do one element |
[in] | modifyFlags | steps for modification |
[in] | eleFunc | function called for each elem |
[in] | params | parameters for eleFunc |
[in] | doGroups | If doGroups is true, mdlModify_elementMulti processes graphic groups. |
UInt32 mdlModify_elementSingle | ( | DgnModelRefP | modelRef, |
UInt32 | filePos, | ||
int | compFlag, | ||
int | modifyFlags, | ||
ModifyFunc_EachElement | eleFunc, | ||
CallbackArgP | params, | ||
long | compOffset | ||
) |
Reads an element from the design file and calls a function for each component of that element.
This function is used when a single element has been identified for modification and an MDL application will change that element.
[in] | modelRef | source modelRef containing the element. If the modelRef is a reference model, the MODIFY_COPY bit in modifyFlags must be set. | ||||||||||||
[in] | filePos | file position of the element | ||||||||||||
[in] | compFlag | indicates when to call eleFunc for complex elements, and can have one of the following values:
| ||||||||||||
[in] | modifyFlags | flags indicating steps for modification. This can be one of the following values:
| ||||||||||||
[in] | eleFunc | user call-back function called for each component element to be modified. eleFunc modifies (in memory) an element passed to it as an argument. mdlModify_elementSingle automatically writes the modified element to the file according to the return status of eleFunc. | ||||||||||||
[in] | params | params typically points to a structure containing parameters for eleFunc. | ||||||||||||
[in] | compOffset | is used in conjunction with componentFlag when MODIFY_REQUEST_ONLYONE is passed, and a specific component offset must be specified. See compFlag, above. |
void mdlModify_freeGGMap | ( | MdlCopyParams * | cp | ) |
Frees memory after element modification.
When the MODIFY_COPY bit is set in the modifyFlags parameter for mdlModify_elementSingle or mdlModify_elementMulti, these functions duplicate elements before modifying them. One of the steps for duplicating an element is assigning it a new graphic group number. To ensure that all elements in the same graphic group are assigned the same new graphic group number, these functions must allocate memory to track the mapping from original graphic group numbers to new graphic group numbers. See the description in mdlModify_elementSingle for further information on this topic. When MDL applications complete their element modifications, they must call mdlModify_freeGGMap once to free this memory.
[in] | cp | the pointer used in the calls to mdlModify_elementSingle and mdlModify_elementMulti. |