请问dwgInFields()函数有什么的作用?
有谁知道dwgInFields()函数有什么作用、怎么用的、什么时候用么?大牛们帮解释下哦
This function is called by dwgIn(). Its purpose is to allow the object to read in its data.
There is a fixed set of steps that should be followed when implementing your own version of this function:
Call assertWriteEnabled().
Call the parent class's dwgInFields() passing it pFiler. If this returns Acad::eOk, then continue; otherwise, immediately return whatever the parent class's dwgInFields() returned.
Use pFiler to call the appropriate AcDbDwgFiler methods to read in the object's data items. It is essential that the same number of data items be read in, and in the same order, as those that are written out via dwgOutFields().
Following these steps results in all base classes having their implementations of this function called as well, thus reading in all the object's data in class hierarchical order.
The actual AcDbObject::dwgInFields() implementation takes care of reading in the object's handle as well as its persistent reactor, extension dictionary, and xdata information.
This function should return Acad::eOk if successful. In your own custom class implementations of this function, it's easiest to just return pFiler->filerStatus().
Note
The designer of an application class may want to have the RECOVER and AUDIT commands fix the data in a custom class, in cases where its data is corrupted, or objects referred to from the custom object are invalid. If this is desired, then the dwgInFields() method for the custom class should be tolerant to invalid data (for example, null objectIds where non-null data is expected), and not return an error status when it is possible to recover from the errors. During RECOVER and AUDIT, the audit() method subsequently are called for the object, giving it an opportunity to fix its data and return to a reasonable state.
Exercise care in this decision, as currently there exists no flag to inform dwgInFields() whether it is being called during RECOVER, or during another process; for example, OPEN. This implies that a too tolerant version of dwgInFields() may allow an invalid object to be read in, that may or may not be audited later.
页:
[1]