Ac3dDwfNavTree.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. /// <summary>
  11. /// This class describes the interface that must be implemented by the
  12. /// (optional) NavTree Publisher. The NavTree publisher controls what will
  13. /// appear in the navigation tree in the Viewer.
  14. /// If no NavTree publisher is passed in to the Ac3dDwfPublisher, then it
  15. /// will display a "flat" tree listing all the objects with their class names
  16. /// and handles.
  17. ///
  18. /// You must create an object that implements the Ac3dDwfNavTreePublisher interface,
  19. /// i.e. an object that derives from Ac3dDwfNavTreePublisher and implements its functions.
  20. /// You will get called after each entity is done publishing its graphics and properties.
  21. /// Use those calls to build a tree of Ac3dDwfNavTreeNode's, based on the data
  22. /// in the Ac3dDwfEntityHeader. That data includes the "Graphics keys" which are
  23. /// used in the DWF to identify the graphics associated with the entity.
  24. /// When all other publishing is done, the Ac3dDwfPublisher will ask you for that
  25. /// tree by asking for its root node: Ac3dDwfNavTreeNode* root();
  26. ///
  27. /// </summary>
  28. #ifndef AC3DDWFNAVTREE_H
  29. #define AC3DDWFNAVTREE_H
  30. class Ac3dDwfNavTreeNode : public AcRxObject
  31. {
  32. public:
  33. /// <summary>
  34. /// This method is called to get the display name of the tree node
  35. /// </summary>
  36. ///
  37. /// <returns>
  38. /// returns the name of the tree node.
  39. /// </returns>
  40. virtual const AcString& displayName() const = 0;
  41. /// <summary>
  42. /// This method is called to get the graphic identifiers for this tree
  43. /// node
  44. /// </summary>
  45. ///
  46. /// <returns>
  47. /// returns the graphic identifiers for this tree node
  48. /// </returns>
  49. virtual const AcArray<long>& keys() const = 0;
  50. /// <summary>
  51. /// This method is called to get the number of descendants for this
  52. /// tree node. Number of descendants includes children, grandchildren
  53. /// and so on recursively.
  54. /// </summary>
  55. ///
  56. /// <returns>
  57. /// returns the number of descendants in the tree node.
  58. /// </returns>
  59. virtual int nDescendants() const = 0;
  60. /// <summary>
  61. /// This method is called to get the flag to see if this node should
  62. /// be displayed as a group or not. The default implementation appends
  63. /// the number of descendants to the display name
  64. /// </summary>
  65. ///
  66. /// <returns>
  67. /// returns true if tree node is a group.
  68. /// </returns>
  69. virtual bool isGroup() const = 0;
  70. /// <summary>
  71. /// This method is called to get an array of all the tree node children
  72. /// of this tree node.
  73. /// </summary>
  74. ///
  75. /// <returns>
  76. /// returns a array of all the children of this tree node.
  77. /// </returns>
  78. virtual const AcArray<const Ac3dDwfNavTreeNode*>& children() const = 0;
  79. /// <summary>
  80. /// This method is called to get the flag to see if node is grouped
  81. /// by block. If this is true, all the descendants graphics will be grouped
  82. /// together into this tree node, which will have no descendants.
  83. /// </summary>
  84. ///
  85. /// <returns>
  86. /// returns true if node is grouped by block.
  87. /// </returns>
  88. virtual bool isBlock() const = 0;
  89. /// <summary>
  90. /// Call this method to add a child to the root node. When trying to
  91. /// register the Ac3dDwfNavTreeNode root in the AcDMMSheetReactorInfo, only
  92. /// the first client wins. In order for other clients who are registered
  93. /// after the first client, to add or remove children, Clients can choose
  94. /// to implement addChild and removeChild methods.
  95. /// </summary>
  96. ///
  97. /// <param name="root">
  98. /// a pointer to an Ac3dDwfNavTreeNode object that the clients wants
  99. /// to add to the navigation tree.
  100. /// </param>
  101. ///
  102. /// <returns>
  103. /// returns true if successfully adds the Ac3dDwfNavTreeNode node as child
  104. /// to the root node
  105. /// </returns>
  106. ///
  107. virtual bool addChild(const Ac3dDwfNavTreeNode* node) = 0;
  108. /// <summary>
  109. /// Call this method to remoave a child from the root node. When trying to
  110. /// register the Ac3dDwfNavTreeNode root in the AcDMMSheetReactorInfo, only
  111. /// the first client wins. In order for other clients who are registered
  112. /// after the first client, to add or remove children, Clients can choose
  113. /// to implement addChild and removeChild methods.
  114. /// </summary>
  115. ///
  116. /// <param name="root">
  117. /// a pointer to an Ac3dDwfNavTreeNode object that the clients wants
  118. /// to remove from the navigation tree
  119. /// </param>
  120. ///
  121. /// <returns>
  122. /// returns true if successfully removes the Ac3dDwfNavTreeNode node from
  123. /// the navigation tree
  124. /// </returns>
  125. ///
  126. virtual bool removeChild(const Ac3dDwfNavTreeNode* node) = 0;
  127. };
  128. #endif //AC3DDWFNAVTREE_H