本文整理汇总了C++中AcDbDictionary::wblockClone方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDictionary::wblockClone方法的具体用法?C++ AcDbDictionary::wblockClone怎么用?C++ AcDbDictionary::wblockClone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDictionary
的用法示例。
在下文中一共展示了AcDbDictionary::wblockClone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acdbOpenObject
// AsdkNODEdReactor is derived from AcEditorReactor
//
void
AsdkNODEdReactor::beginDeepCloneXlation(
AcDbIdMapping& idMap,
Acad::ErrorStatus* pRetStat)
{
Acad::ErrorStatus es;
AcDbObjectId dictId;
if ( idMap.deepCloneContext() != AcDb::kDcWblock
&& idMap.deepCloneContext() != AcDb::kDcInsert)
return;
// Get the "from" and "to" databases.
//
AcDbDatabase *pFrom, *pTo;
idMap.origDb(pFrom);
idMap.destDb(pTo);
// See if the "from" database has our dictionary, and
// open it. If it doesn't have one, we are done.
//
AcDbDictionary *pSrcNamedObjDict;
pFrom->getNamedObjectsDictionary(pSrcNamedObjDict,
AcDb::kForRead);
es = pSrcNamedObjDict->getAt(kpDictionary, dictId);
pSrcNamedObjDict->close();
if (es == Acad::eKeyNotFound)
return;
AcDbDictionary *pSrcDict;
acdbOpenObject(pSrcDict, dictId, AcDb::kForRead);
AcDbObject *pClone;
switch (idMap.deepCloneContext()) {
case AcDb::kDcWblock:
// WBLOCK clones all, or part of a drawing into a
// newly created drawing. This means that the
// NamedObject Dictionary is always cloned, and
// its AcDbObjectIds are in flux. Therefore, you
// cannot use getAt() or setAt() on the dictionary
// in the new database. This is because the
// cloned dictionary references all refer to the
// original objects. During Deep Clone translation,
// all cloned entries will be translated to the
// new objects, and entries not cloned will be
// "removed" by getting "translated" to NULL.
//
// The cloning of entries in our own dictionary are
// not handled here. If all are to be cloned, then
// call setTreatElementsAsHard(Adesk::kTrue) on the
// dictionary. Otherwise, only those entries which
// are refered to by hard references in other
// wblocked objects, will have been cloned via
// those references.
// In this example, we will always write out all of
// the records. Since TreatElementsAsHard is not
// currently persistent, we reset it here each time.
//
pSrcDict->upgradeOpen();
pSrcDict->setTreatElementsAsHard(Adesk::kTrue);
pClone = NULL;
pSrcDict->wblockClone(pTo, pClone, idMap,
Adesk::kFalse);
if (pClone != NULL)
pClone->close();
break;
case AcDb::kDcInsert:
// In INSERT, an entire drawing is cloned, and
// "merged" into a pre-existing drawing. This
// means that the destination drawing may already
// have our dictionary - in which case we have to
// merge our entries into the destination
// dictionary. So, first we must find out if
// the destination NamedObjects dictionary has
// our dictionary.
//
AcDbDictionary *pDestNamedDict;
pTo->getNamedObjectsDictionary(pDestNamedDict,
AcDb::kForWrite);
// Since INSERT does not clone the destination
// NamedObjects dictionary, we can use getAt()
// on it.
//
es = pDestNamedDict->getAt(kpDictionary, dictId);
// If our dictionary does not yet exist in the
// NamedObjects dictionary, which is not itself
// cloned, we have to both clone and add our
// dictionary to it. Since dictionary entries are
//.........这里部分代码省略.........