SizeManager.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. #ifndef SIZEMANAGER_H
  2. #define SIZEMANAGER_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <Common/GraphType.h>
  5. #include <Common/BoostGraphWrapper.h>
  6. #include <Common/ConstantType.h>
  7. /**
  8. This class implements the functionality for adjusting the size in terms of Height, Width
  9. CenterCoordX, CenterCoordY, LeftCoordX, and TopCoordY and calculating space required for the
  10. Graph and all clusters.
  11. */
  12. class GRAPHLAYOUTLIBRARYSHARED_EXPORT SizeManager
  13. {
  14. private:
  15. /**
  16. * Refers to the object of the BoostGraphWrapper
  17. */
  18. BoostGraphWrapper m_boostGraphWrapper;
  19. /**
  20. This function calculates the area of node.
  21. @pre
  22. -# gSubgraph != NULL
  23. @param vVertex
  24. vertex descriptor
  25. @param gSubgraph
  26. reference to graph
  27. @return area of node
  28. @throw none
  29. */
  30. double calculateAreaOfNode(VertexDescriptor vVertex, SubGraph& gSubgraph);
  31. /**
  32. This function calculates the area of cluster.
  33. @pre
  34. -# gSubgraph != NULL
  35. @param gSubgraph
  36. reference to graph
  37. @return area of cluster
  38. @throw none
  39. */
  40. double calculateAreaOfCluster(SubGraph& gSubgraph);
  41. /**
  42. This function calculates maximum radius for every subgraph of cluster iteratively using DFS traversing.
  43. @pre
  44. -# gSubgraph != NULL
  45. @param gSubgraph
  46. reference to graph
  47. @return maximum radius length
  48. @throw MemoryException
  49. -# NULL_POINTER_EXCEPTION if referenced entity is null
  50. @throw LayoutException
  51. -# INVALID_PARAMETER if invalid value is passed
  52. @throw BoostException
  53. -# if exception caused by bost library
  54. */
  55. double calculateGraphMaxRadiusUsingDFS(SubGraph& gSubgraph);
  56. // functionality to calculate Graph size properties as Height, Width, Left X and Top Y
  57. /**
  58. This function calculates the width of cluster.
  59. @pre
  60. -# gSubgraph != NULL
  61. @param gSubgraph
  62. reference to graph
  63. @return width of cluster
  64. @throw none
  65. */
  66. int calculateGraphWidth(SubGraph& gSubgraph);
  67. /**
  68. This function calculates the height of cluster.
  69. @pre
  70. -# gSubgraph != NULL
  71. @param gSubgraph
  72. reference to graph
  73. @return height of cluster
  74. @throw none
  75. */
  76. int calculateGraphHeight(SubGraph& gSubgraph);
  77. public:
  78. /** @name Creators
  79. * The methods under this section are responsible for constructing or
  80. * destructing an instance of type SizeManager.
  81. */
  82. //@{
  83. /**
  84. constructs the object of type SizeManager.
  85. */
  86. SizeManager();
  87. //@}
  88. /** @name Queries
  89. * The methods under this section are responsible for accessing
  90. * an instance of type SizeManager.
  91. */
  92. //@{
  93. /**
  94. This function calculates the diagonal length of the node.
  95. * @brief claculateDiagonalOfNode
  96. * @pre
  97. * -# gSubgraph != NULL
  98. * @param vVertex
  99. * vertex descriptor
  100. * @param gSubgraph
  101. * reference to graph
  102. * @return length of diagonal
  103. *
  104. * @throw BoostException
  105. * -# if exception is thrown by boost library
  106. */
  107. double calculateDiagonalOfNode(VertexDescriptor &vVertex, SubGraph &gSubgraph);
  108. /**
  109. This function calculates the left X coordinate of the node.
  110. @pre
  111. -# gSubgraph != NULL
  112. @param gSubgraph
  113. reference to graph
  114. @param vVertex
  115. vertex descriptor
  116. @return left x coordinate of node
  117. @throw none
  118. */
  119. int calculateNodeLeftXFromCenterX(VertexDescriptor vVertex, SubGraph& gSubgraph);
  120. /**
  121. This function calculates the top Y coordinate of the node.
  122. @pre
  123. -# gSubgraph != NULL
  124. @param gSubgraph
  125. reference to graph
  126. @param vVertex
  127. vertex descriptor
  128. @return top y coordinate of node
  129. @throw none
  130. */
  131. int calculateNodeTopYFromCenterY(VertexDescriptor vVertex, SubGraph& gSubgraph);
  132. /**
  133. This function calculates the center x coordinate of cluster.
  134. @pre
  135. -# gSubgraph != NULL
  136. @param gSubgraph
  137. reference to graph
  138. @return center x coordinate of cluster
  139. @throw none
  140. */
  141. int calculateGraphCenterCoordX(SubGraph& gSubgraph);
  142. /**
  143. This function calculates the center Y coordinate of cluster.
  144. @pre
  145. -# gSubgraph != NULL
  146. @param gSubgraph
  147. reference to graph
  148. @return center y cordinate of cluster
  149. @throw none
  150. */
  151. int calculateGraphCenterCoordY(SubGraph& gSubgraph);
  152. /**
  153. This function calculates the left X coordinate of the cluster.
  154. @pre
  155. -# gSubgraph != NULL
  156. @param gSubgraph
  157. reference to graph
  158. @return left x coordinate of cluster
  159. @throw none
  160. */
  161. int calculateGraphLeftXFromCenterX(SubGraph& gSubgraph);
  162. /**
  163. This function calculates the top y coordinate of the cluster.
  164. @pre
  165. -# gSubgraph != NULL
  166. @param gSubgraph
  167. reference to graph
  168. @return top y coordinate of cluster
  169. @throw none
  170. */
  171. int calculateGraphTopYFromCenterY(SubGraph& gSubgraph);
  172. //@}
  173. /** @name Modifiers
  174. * The methods under this section are responsible for modifying
  175. * an instance of CircularLayoutGenerator.
  176. */
  177. //@{
  178. /**
  179. This function processes the graph and calculates x, y, height and width.
  180. @pre
  181. -# gSubgraph != NULL
  182. @param gSubgraph
  183. reference to graph
  184. @return none
  185. @throw MemoryException
  186. -# NULL_POINTER_EXCEPTION if referenced entity is null
  187. @throw LayoutException
  188. -# INVALID_PARAMETER if invalid value is passed
  189. -# INVALID_ATTRIBUTE_VALUE if invalid value to any entity is passed
  190. @throw BoostException
  191. -# if exception is thrown by boost library function.
  192. */
  193. void processSizeManager(SubGraph& gSubgraph);
  194. //@}
  195. };
  196. #endif // SIZEMANAGER_H