CFx SDK Documentation  2023 SP0
DbObject.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 #ifndef _ODDBXOBJECT_INCLUDED_
28 #define _ODDBXOBJECT_INCLUDED_
30 #include "TD_PackPush.h"
31 
32 #include "Gi/GiDrawable.h"
33 #include "DbObjectId.h"
34 #include "OdString.h"
35 #include "DbObjectReactor.h"
36 #include "IdArrays.h"
37 #include "ResBuf.h"
38 #include "DebugStuff.h"
39 
40 class OdDbFiler;
41 class OdDbDwgFiler;
42 class OdDbDxfFiler;
43 class OdGiDrawableTraits;
44 class OdGiWorldDraw;
45 class OdGiViewportDraw;
46 class OdGsCache;
47 class OdDbObjectImpl;
48 class OdDbEntity;
49 class OdDbDatabase;
50 class OdDbIdMapping;
51 class OdDbAuditInfo;
52 class OdGeMatrix3d;
53 class OdDbObjStorage;
54 class OdString;
55 class OdGePoint3d;
56 class OdBinaryData;
57 class OdDbIdPair;
58 class OdDbField;
59 class OdDbDictionary;
60 class OdDbXrecord;
61 
69 
80 #define ODDB_DECLARE_MEMBERS(ClassName)\
81 protected: \
82  ClassName(OdDbObjectImpl* pImpl); \
83 public: \
84 ODRX_DECLARE_MEMBERS (ClassName)
85 
94 #define DBOBJECT_CONSTR(ClassName) OdSmartPtr<ClassName> (new ClassName, kOdRxObjAttach)
95 
96 
105 {
106 public:
110  const OdDbObjectId& objectId);
111 };
112 
113 
118 namespace OdDb
119 {
126  {
127  kDrcNotApplicable = 0, // Not applicable to the object.
128  kDrcIgnore = 1, // If a duplicate record exists, use the existing record
129  // in the *database*, and ignore the clone.
130  kDrcReplace = 2, // If a duplicate record exists, replace it with the cloned record.
131  kDrcXrefMangleName = 3, // Incoming record names are mangled with <Xref>$0$<name>
132  kDrcMangleName = 4, // Incoming record names are mangled with $0$<name>
133  kDrcUnmangleName = 5, // Unmangle the names mangled by kDrcMangleName, then default to kDrcIgnore.
134  // Typically used by RefEdit when checking records into the original *database*.
135  kDrcMax = kDrcUnmangleName // The maximum value of this enum.
136  };
137 
144  {
146  kVisible = 0
147  };
148 
149  enum SaveType
150  {
151  kDwg = 0, // Save as .dwg file
152  kDxf = 1, // Save as .dxf file
153  kDxb = 2, // Save as binary .dxf file
154  kUnknown = -1 // Database was created from scratch
155  };
156 }
157 
158 
211 {
212 public:
214 
215 protected:
217 public:
219 
223  void addRef();
224 
230  void release();
231 
235  long numRefs() const;
236 
244 
249 
254  { return getDbHandle (); }
255 
270 
286  virtual void setOwnerId(
287  OdDbObjectId ownerId);
288 
293 
304 
313 
321 
322  // Opens/creates/unerases Xdictionary, and retrieves/creates Xrecord for the given name
323  //
324 
339  const OdString& xrecordName,
341 
345  void upgradeOpen();
346 
354 
355  //FELIX_CHANGE_BEGIN
359  void cancel();
360  //FELIX_CHANGE_END
361 
391  virtual OdResult subOpen(
392  OdDb::OpenMode mode);
393 
394 
414  virtual void subClose();
415 
427  bool eraseIt = true);
428 
460  bool erasing);
461 
484  OdDbObject* pNewObject,
485  bool keepXData = true, bool
486  keepExtDict = true);
487 
515  virtual void subHandOverTo(
516  OdDbObject* pNewObject);
517 
533  OdDbObjectId otherId,
534  bool swapXdata = false,
535  bool swapExtDict = false);
536 
560  virtual void subSwapIdWith(
561  const OdDbObjectId& otherId,
562  bool swapXdata = false,
563  bool swapExtDict = false);
564 
576  virtual void audit(
577  OdDbAuditInfo* pAuditInfo);
578 
588  void dwgIn(
589  OdDbDwgFiler* pFiler);
590 
600  void dwgOut(
601  OdDbDwgFiler* pFiler) const;
602 
614  virtual OdResult dxfIn(
615  OdDbDxfFiler* pFiler);
616 
626  virtual void dxfOut(
627  OdDbDxfFiler* pFiler) const;
628 
649  OdDbDwgFiler* pFiler);
650 
667  virtual void dwgOutFields(
668  OdDbDwgFiler* pFiler) const;
669 
690  OdDbDxfFiler* pFiler);
691 
708  virtual void dxfOutFields(
709  OdDbDxfFiler* pFiler) const;
710 
730  OdDbDxfFiler* pFiler);
731 
749  virtual void dxfOutFields_R12(
750  OdDbDxfFiler* pFiler) const;
751 
756 
772  const OdString& regappName = OdString::kEmpty) const;
773 
774 
791  virtual void setXData(
792  const OdResBuf* pRb);
793 
797  bool isEraseStatusToggled() const;
798 
802  bool isErased() const;
803 
807  bool isReadEnabled() const;
808 
812  bool isWriteEnabled() const;
813 
817  bool isNotifyEnabled() const;
818 
823  bool isModified() const;
824 
827 // void setModified (bool bModified);
828 
832  bool isModifiedXData() const;
833 
846  bool isModifiedGraphics() const;
847 
851  bool isNewObject() const;
852 
856  bool isNotifying() const;
857 
861  bool isUndoing() const;
862 
863 // bool isCancelling() const;
864 
872  bool isReallyClosing() const;
873 
877  bool isDBRO() const;
878 
892  void assertReadEnabled() const;
893 
914  bool autoUndo = true,
915  bool recordModified = true);
916 
930  void assertNotifyEnabled() const;
931 
942  bool disable);
943 
944  //FELIX_CHANGE_BEGIN
946  //FELIX_CHANGE_END
947 
964 
992  virtual void applyPartialUndo(
993  OdDbDwgFiler* pUndoFiler,
994  OdRxClass* pClassObj);
995 
1005  OdDbObjectReactor* pReactor) const;
1006 
1016  OdDbObjectReactor* pReactor) const;
1017 
1031  virtual void addPersistentReactor(
1032  const OdDbObjectId& objId);
1033 
1043  const OdDbObjectId& objId);
1044 
1051  const OdDbObjectId& objId) const;
1052 
1057 
1062 
1078  virtual void recvPropagateModify(
1079  const OdDbObject* pSubObj);
1080 
1104  virtual void xmitPropagateModify() const;
1105 
1125  ODRX_SEALED_VIRTUAL OdDbObjectPtr deepClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary = true) const ODRX_SEALED;
1126 
1148  ODRX_SEALED_VIRTUAL OdDbObjectPtr wblockClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary = true) const ODRX_SEALED;
1149 
1150 
1170  virtual void appendToOwner(
1171  OdDbIdPair& idPair,
1172  OdDbObject* pOwnerObject,
1173  OdDbIdMapping& ownerIdMap);
1174 
1181  void setOdDbObjectIdsInFlux();
1182 
1187  bool isOdDbObjectIdsInFlux() const;
1188 
1199  virtual void copied(
1200  const OdDbObject* pObject,
1201  const OdDbObject* pNewObject);
1202 
1203 
1214  virtual void erased(
1215  const OdDbObject* pObject,
1216  bool erasing = true);
1217 
1229  virtual void goodbye(
1230  const OdDbObject* pObject);
1231 
1241  virtual void openedForModify(
1242  const OdDbObject* pObject);
1243 
1255  virtual void modified(
1256  const OdDbObject* pObject);
1257 
1275  virtual void subObjModified(
1276  const OdDbObject* pObject,
1277  const OdDbObject* pSubObj);
1278 
1292  virtual void modifyUndone(
1293  const OdDbObject* pObject);
1294 
1309  virtual void modifiedXData(
1310  const OdDbObject* pObject);
1311 
1325  virtual void unappended(
1326  const OdDbObject* pObject);
1327 
1328 
1340  virtual void reappended(
1341  const OdDbObject* pObject);
1342 
1346  bool isAProxy() const;
1347 
1357  virtual void objectClosed(
1358  const OdDbObjectId& objectId);
1359 
1360 
1386  virtual void modifiedGraphics(
1387  const OdDbObject* pObject);
1388 
1404  virtual void copyFrom(
1405  const OdRxObject* pSource);
1406 
1411  bool hasSaveVersionOverride() const;
1412 
1422  void setHasSaveVersionOverride(
1423  bool hasSaveVersionOverride);
1424 
1437  virtual OdDb::DwgVersion getObjectSaveVersion(
1438  const OdDbFiler* pFiler,
1439  OdDb::MaintReleaseVer* pMaintVer = 0) const;
1440 
1463  virtual OdDbObjectPtr decomposeForSave(
1464  OdDb::DwgVersion ver,
1465  OdDbObjectId& replaceId,
1466  bool& exchangeXData);
1467 
1491  virtual OdDbObjectPtr decomposeForSave(
1492  OdDb::SaveType format,
1493  OdDb::DwgVersion ver,
1494  OdDbObjectId& replaceId,
1495  bool& exchangeXData);
1496 
1506  void convertForSave(OdDb::DwgVersion ver);
1507 
1528  virtual void composeForLoad(OdDb::SaveType format, OdDb::DwgVersion version, OdDbAuditInfo* pAuditInfo);
1529 
1533  virtual OdGiDrawable* drawable();
1534 
1549  virtual OdUInt32 subSetAttributes(
1550  OdGiDrawableTraits* pTraits) const;
1551 
1552  virtual bool subWorldDraw(
1553  OdGiWorldDraw* pWd) const;
1554 
1555  virtual void subViewportDraw(
1556  OdGiViewportDraw* pVd) const;
1557 
1566  virtual bool isPersistent() const;
1567 
1570  virtual OdDbStub* id() const;
1571 
1580  ODRX_SEALED_VIRTUAL OdResult getClassID(void* pClsid) const ODRX_SEALED;
1581 
1582  // Override of OdGiDrawable
1583 
1589  void setGsNode(OdGsCache* pNode);
1590 
1591  // Override of OdGiDrawable
1592 
1596  OdGsCache* gsNode() const;
1597 
1598  /*
1599  void upgradeFromNotify (bool& wasWritable);
1600  void downgradeToNotify (bool wasWritable);
1601  OdResult closeAndPage (bool onlyWhenClean = true);
1602  virtual void swapReferences (const OdDbIdMapping& idMap);
1603  virtual OdGiDrawable* drawable ();
1604  OdDbObjPtrArray* reactors ();
1605  virtual OdRxObjectPtr clone (OdDbIdMapping& ownerIdMap) const;
1606  */
1607 
1631  void xDataTransformBy(
1632  const OdGeMatrix3d& xfm);
1633 
1637  bool hasFields() const;
1638 
1644  OdDbObjectId getField(
1645  const OdString& fieldName) const;
1646 
1653  OdDbObjectPtr getField(
1654  const OdString& fieldName,
1655  OdDb::OpenMode mode) const;
1656 
1666  virtual OdDbObjectId setField(
1667  const OdString& fieldName,
1668  OdDbField* pField);
1669 
1678  virtual OdResult removeField(
1679  OdDbObjectId fieldId);
1680 
1689  virtual OdDbObjectId removeField(
1690  const OdString& fieldName);
1691 
1695  OdDbObjectId getFieldDictionary() const;
1696 
1701  OdDbObjectPtr getFieldDictionary(
1702  OdDb::OpenMode mode) const;
1703 
1704 
1710  virtual OdRxClass* saveAsClass(
1711  OdRxClass* pClass) const;
1712 
1713 protected: // overridables
1714  virtual OdResult subGetClassID(void* pClsid) const;
1715  virtual OdDbObjectPtr subDeepClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary) const;
1716  virtual OdDbObjectPtr subWblockClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary) const;
1717 
1718  friend class OdDbSystemInternals;
1719  friend class OdDbObjectOverrule;
1721  friend class OdDbObjectImpl;
1722  OdDbObjectImpl* m_pImpl;
1723 };
1724 
1733 
1734 
1755 TOOLKIT_EXPORT OdResBufPtr oddbEntGet( const OdDbObject* pObj, const OdString& regapps = OdString::kEmpty );
1756 
1757 inline OdResBufPtr oddbEntGet( const OdDbObjectId& id, const OdString& regapps = OdString::kEmpty )
1758 {
1759  return oddbEntGet(id.safeOpenObject(), regapps);
1760 }
1761 
1762 
1778 
1779 inline OdResult oddbEntMod( const OdDbObjectId& id, OdResBuf* pRb )
1780 {
1781  return oddbEntMod(id.safeOpenObject(OdDb::kForWrite), pRb);
1782 }
1783 
1786 
1789 
1790 
1791 
1792 #include "TD_PackPop.h"
1793 
1794 #endif //_ODDBXOBJECT_INCLUDED_
1795 
1796 
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
TOOLKIT_EXPORT OdResult oddbEntMake(OdDbDatabase *pDb, OdResBuf *pRb, OdDbObjectPtr &pObj)
OdSmartPtr< OdDbXrecord > OdDbXrecordPtr
Definition: DbObject.h:60
TOOLKIT_EXPORT OdResult oddbEntMod(OdDbObject *pObj, OdResBuf *pRb)
TOOLKIT_EXPORT OdDbObjectId oddbEntLast(OdDbDatabase *db)
TOOLKIT_EXPORT OdResBufPtr oddbEntGet(const OdDbObject *pObj, const OdString &regapps=OdString::kEmpty)
TOOLKIT_EXPORT OdResult oddbEntMakeX(OdDbDatabase *pDb, OdResBuf *pRb, OdDbObjectPtr &pObj)
TOOLKIT_EXPORT OdDbObjectId oddbEntNext(OdDbObjectId id, OdDbDatabase *db)
true
Definition: DimVarDefs.h:2046
unsigned int OdUInt32
#define ODRX_SEALED_VIRTUAL
#define ODRX_SEALED
OdResult
Definition: OdResult.h:29
void swapIdWith(OdDbObjectId otherId, bool swapXdata=false, bool swapExtDict=false)
virtual void subSwapIdWith(const OdDbObjectId &otherId, bool swapXdata=false, bool swapExtDict=false)
bool isReallyClosing() const
void disableUndoRecording(bool disable)
virtual void applyPartialUndo(OdDbDwgFiler *pUndoFiler, OdRxClass *pClassObj)
OdDbObjectIdArray getPersistentReactors() const
OdDbObjectId objectId() const
bool isDBRO() const
OdDbHandle handle() const
Definition: DbObject.h:253
virtual void xmitPropagateModify() const
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
long numRefs() const
bool isNotifyEnabled() const
void dwgIn(OdDbDwgFiler *pFiler)
bool isModifiedXData() const
ODRX_SEALED_VIRTUAL OdDbObjectPtr deepClone(OdDbIdMapping &ownerIdMap, OdDbObject *pOwner, bool bPrimary=true) const ODRX_SEALED
OdDbHandle getDbHandle() const
virtual OdResult subOpen(OdDb::OpenMode mode)
OdDbDwgFiler * undoFiler()
bool isUndoing() const
bool isUndoRecordingDisabled() const
bool isEraseStatusToggled() const
virtual void addPersistentReactor(const OdDbObjectId &objId)
void addRef()
OdDbObjectId extensionDictionary() const
void assertWriteEnabled(bool autoUndo=true, bool recordModified=true)
void handOverTo(OdDbObject *pNewObject, bool keepXData=true, bool keepExtDict=true)
bool isNewObject() const
bool isReadEnabled() const
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual OdDb::DuplicateRecordCloning mergeStyle() const
void addReactor(OdDbObjectReactor *pReactor) const
void cancel()
virtual OdResBufPtr xData(const OdString &regappName=OdString::kEmpty) const
void upgradeOpen()
OdResult erase(bool eraseIt=true)
ODDB_DECLARE_MEMBERS(OdDbObject)
void removeReactor(OdDbObjectReactor *pReactor) const
void dwgOut(OdDbDwgFiler *pFiler) const
bool isNotifying() const
virtual void removePersistentReactor(const OdDbObjectId &objId)
virtual OdResult dxfInFields_R12(OdDbDxfFiler *pFiler)
bool hasPersistentReactor(const OdDbObjectId &objId) const
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
bool releaseExtensionDictionary()
OdDbXrecordPtr createXrecord(const OdString &xrecordName, OdDb::DuplicateRecordCloning style=OdDb::kDrcIgnore)
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
virtual void subHandOverTo(OdDbObject *pNewObject)
virtual void recvPropagateModify(const OdDbObject *pSubObj)
virtual OdResult dxfIn(OdDbDxfFiler *pFiler)
virtual void setXData(const OdResBuf *pRb)
OdDbObjectReactorArray getTransientReactors() const
void release()
virtual OdResult subErase(bool erasing)
virtual void dxfOutFields_R12(OdDbDxfFiler *pFiler) const
virtual void audit(OdDbAuditInfo *pAuditInfo)
void downgradeOpen()
OdDbDatabase * database() const
virtual void dxfOut(OdDbDxfFiler *pFiler) const
bool isWriteEnabled() const
virtual void subClose()
virtual void setOwnerId(OdDbObjectId ownerId)
bool isModifiedGraphics() const
void assertReadEnabled() const
bool isErased() const
bool isModified() const
OdDbObjectId ownerId() const
void assertNotifyEnabled() const
void createExtensionDictionary()
OdError_XdataSizeExceeded(const OdDbObjectId &objectId)
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gles2_ext.h:111
DwgVersion
Definition: OdaDefs.h:46
MaintReleaseVer
Definition: OdaDefs.h:107
DuplicateRecordCloning
Definition: DbObject.h:126
@ kDrcUnmangleName
Definition: DbObject.h:133
@ kDrcIgnore
Definition: DbObject.h:128
@ kDrcXrefMangleName
Definition: DbObject.h:131
@ kDrcReplace
Definition: DbObject.h:130
@ kDrcMangleName
Definition: DbObject.h:132
@ kDrcNotApplicable
Definition: DbObject.h:127
@ kDrcMax
Definition: DbObject.h:135
SaveType
Definition: DbObject.h:150
@ kDwg
Definition: DbObject.h:151
@ kDxb
Definition: DbObject.h:153
@ kUnknown
Definition: DbObject.h:154
@ kDxf
Definition: DbObject.h:152
Visibility
Definition: DbObject.h:144
@ kInvisible
Definition: DbObject.h:145
@ kVisible
Definition: DbObject.h:146
OpenMode
Definition: DbObjectId.h:54
@ kForWrite
Definition: DbObjectId.h:57
@ version
Definition: Tf.h:335