明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1872|回复: 1

[事件] 请问dwgInFields()函数有什么的作用?

[复制链接]
发表于 2011-2-14 18:15:14 | 显示全部楼层 |阅读模式
有谁知道dwgInFields()函数有什么作用、怎么用的、什么时候用么?
大牛们帮解释下哦
发表于 2011-2-15 15:42:14 | 显示全部楼层
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.

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 22:48 , Processed in 0.211387 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表