dbgroup.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. //
  13. // AcDbGroup
  14. //
  15. // Maintains an ordered collection of database objects with a related iterator.
  16. // An iterator can be obtained via an existing AcDbGroup object with
  17. // the newIterator() method. See below for class descriptions for both
  18. // AcDbGroup and AcDbGroupIterator.
  19. //
  20. // AcDbGroup objects are contained in a special group table (actually a
  21. // dictionary). This dictionary can be obtained like this:
  22. //
  23. // AcDbDictionary* pGrpDict =
  24. // acdbHostApplicationServices()->workingDatabase()->groupTable();
  25. //
  26. // The AcDbGroup constructor does not add the group to the group dictionary;
  27. // this must be done explicitly, using the AcDbDictionary protocol.
  28. //
  29. // When an entity is erased, it is automatically removed from
  30. // the groups that contain it.
  31. #ifndef ACDB_DBGROUP_H
  32. #define ACDB_DBGROUP_H
  33. #include "dbmain.h"
  34. #include "dbapserv.h"
  35. #pragma pack(push, 8)
  36. class AcDbGroupIterator;
  37. class AcDbGroup: public AcDbObject
  38. {
  39. public:
  40. ACDB_DECLARE_MEMBERS(AcDbGroup);
  41. AcDbGroup();
  42. AcDbGroup(const ACHAR * grpDesc, bool selectable = true);
  43. virtual ~AcDbGroup();
  44. AcDbGroupIterator* newIterator();
  45. const ACHAR * description() const;
  46. Acad::ErrorStatus setDescription(const ACHAR * grpDesc);
  47. bool isSelectable() const;
  48. Acad::ErrorStatus setSelectable(bool selectable);
  49. const ACHAR * name() const; //deprecated. New code should use getName.
  50. Acad::ErrorStatus getName(ACHAR *& name) const;
  51. Acad::ErrorStatus setName(const ACHAR * newName);
  52. bool isNotAccessible() const;
  53. bool isAnonymous() const;
  54. Acad::ErrorStatus setAnonymous();
  55. Acad::ErrorStatus append(AcDbObjectId id);
  56. Acad::ErrorStatus append(AcDbObjectIdArray ids);
  57. Acad::ErrorStatus prepend(AcDbObjectId id);
  58. Acad::ErrorStatus prepend(AcDbObjectIdArray ids);
  59. Acad::ErrorStatus insertAt(Adesk::UInt32 idx, AcDbObjectId id);
  60. Acad::ErrorStatus insertAt(Adesk::UInt32 idx, AcDbObjectIdArray ids);
  61. Acad::ErrorStatus remove(AcDbObjectId id);
  62. Acad::ErrorStatus removeAt(Adesk::UInt32 idx);
  63. Acad::ErrorStatus remove(AcDbObjectIdArray ids);
  64. Acad::ErrorStatus removeAt(Adesk::UInt32 idx, AcDbObjectIdArray ids);
  65. Acad::ErrorStatus replace(AcDbObjectId oldId, AcDbObjectId newId);
  66. Acad::ErrorStatus transfer(Adesk::UInt32 fromIndex,
  67. Adesk::UInt32 toIndex,
  68. Adesk::UInt32 numItems);
  69. Acad::ErrorStatus clear();
  70. Adesk::UInt32 numEntities() const;
  71. bool has(const AcDbEntity* pEntity) const;
  72. Adesk::UInt32 allEntityIds(AcDbObjectIdArray& ids) const;
  73. Acad::ErrorStatus getIndex(AcDbObjectId id, Adesk::UInt32& idx) const;
  74. Acad::ErrorStatus reverse();
  75. Acad::ErrorStatus setColor(const AcCmColor& color);
  76. Acad::ErrorStatus setColorIndex(Adesk::UInt16 color);
  77. Acad::ErrorStatus setLayer(const ACHAR * newVal);
  78. Acad::ErrorStatus setLayer(AcDbObjectId newVal);
  79. Acad::ErrorStatus setLinetype(const ACHAR * newVal);
  80. Acad::ErrorStatus setLinetype(AcDbObjectId newVal);
  81. Acad::ErrorStatus setLinetypeScale(double newval);
  82. Acad::ErrorStatus setVisibility(AcDb::Visibility newVal);
  83. Acad::ErrorStatus setHighlight(bool newVal);
  84. Acad::ErrorStatus setMaterial(const ACHAR * newVal);
  85. Acad::ErrorStatus setMaterial(AcDbObjectId newVal);
  86. // Overridden methods from AcDbObject
  87. //
  88. virtual Acad::ErrorStatus applyPartialUndo(AcDbDwgFiler* undoFiler,
  89. AcRxClass* classObj);
  90. virtual Acad::ErrorStatus subClose();
  91. virtual Acad::ErrorStatus subErase(Adesk::Boolean erasing = true);
  92. virtual void erased(const AcDbObject* dbObj,
  93. Adesk::Boolean erasing = true);
  94. virtual void goodbye(const AcDbObject* dbObj);
  95. virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
  96. virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
  97. virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* pFiler);
  98. virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
  99. protected:
  100. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  101. };
  102. // The group iterator class.
  103. //
  104. class ADESK_NO_VTABLE AcDbGroupIterator: public AcRxObject
  105. {
  106. public:
  107. ACRX_DECLARE_MEMBERS(AcDbGroupIterator);
  108. virtual ~AcDbGroupIterator() {}
  109. virtual Acad::ErrorStatus getObject(AcDbObject*& pObject,
  110. AcDb::OpenMode) = 0;
  111. virtual AcDbObjectId objectId () const = 0;
  112. virtual bool done () const = 0;
  113. virtual bool next () = 0;
  114. protected:
  115. AcDbGroupIterator() {}
  116. };
  117. #pragma pack(pop)
  118. #endif