CircularLayoutGenerator.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #ifndef CIRCULARLAYOUTGENERATOR_H
  2. #define CIRCULARLAYOUTGENERATOR_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <Common/BoostGraphWrapper.h>
  5. #include <CircularLayout/CircleLayouter.h>
  6. #include <CircularLayout/SpaceUtilizer.h>
  7. #include <LayoutUtilities/CommonLayoutConstants.h>
  8. #include <Common/LayoutEnum.h>
  9. #include <Common/ConstantType.h>
  10. #include <qfile.h>
  11. /**
  12. * @brief The CircularLayoutGenerator class
  13. *
  14. * The class provides circular layout of a graph.
  15. */
  16. class GRAPHLAYOUTLIBRARYSHARED_EXPORT CircularLayoutGenerator
  17. {
  18. private:
  19. /**
  20. * X co-ordinate of the center point of the circle used for circular layout
  21. */
  22. int m_iCenterX;
  23. /**
  24. * Y co-ordinate of the center point of the circle used for circular layout
  25. */
  26. int m_iCenterY;
  27. /**
  28. * Radius of the circle used for circular layout
  29. */
  30. double m_dRadius;
  31. /**
  32. * Vector containing subgraphs
  33. */
  34. vector<SubGraph*> m_vecSubgraphContainer;
  35. /**
  36. * Vector containing the subgraphs in BFS order
  37. */
  38. vector<SubGraph*> m_vecBFSOrderedSubgraphs;
  39. /**
  40. * Object of BoostGraphWrapper to perform various subgraph related operations.
  41. */
  42. BoostGraphWrapper m_boostGraphWrapper;
  43. /**
  44. * object of SizeManager to process the size of subgraphs.
  45. */
  46. SizeManager m_sizeManager;
  47. /**
  48. * object of SpaceUtilizer to process the space occupied by the subgraphs.
  49. */
  50. SpaceUtilizer m_spaceUtilizer;
  51. LayoutEnum::VertexOrderCriteria enVertexOrder;
  52. QString m_sExecutionLogFileName;
  53. /**
  54. This function iterates the childs of graph upto deep level.
  55. @pre
  56. -# subgraphQueue != NULL
  57. @param subgraphQueue
  58. referece to vector of subgraph pointers
  59. @return none
  60. @throw LayoutException
  61. -# EMPTY_CONTAINER if empty vector without containing subgraphs is passed
  62. @throw BoostException
  63. -# if exception caused by bost library
  64. */
  65. void iterateChildrenGraphs(vector<SubGraph *> &subgraphQueue);
  66. /**
  67. This function calculates the radius using side of the node.
  68. * @brief calculateRadius
  69. * @pre
  70. * -# gSubgraph != NULL
  71. * @param gSubgraph
  72. * reference to input graph
  73. *
  74. * @return radius value
  75. *
  76. * @throw MemoryException
  77. -# NULL_POINTER_EXCEPTION if referenced entity is null
  78. @throw LayoutException
  79. -# INVALID_PARAMETER if invalid value is passed
  80. @throw BoostException
  81. -# if exception caused by bost library
  82. */
  83. double calculateRadius(SubGraph &gSubgraph);
  84. public:
  85. /** @name Creators
  86. * The methods under this section are responsible for constructing or
  87. * destructing an instance of type CircularLayoutGenerator.
  88. */
  89. //@{
  90. /**
  91. Constructs the object of type CircularLayoutGenerator.
  92. */
  93. CircularLayoutGenerator();
  94. //@}
  95. /** @name Modifiers
  96. * The methods under this section are responsible for modifying
  97. * an instance of CircularLayoutGenerator.
  98. */
  99. //@{
  100. /**
  101. This functions processes the graph to apply circle layout. The function assigns new position to 'gInputGraph' vertices.
  102. @pre
  103. -# gInputGraph != NULL
  104. @param gInputGraph
  105. referece to input graph
  106. @param enVertexOrder
  107. enum value specifying the order in which subgraph vertices should be arranged
  108. @return none
  109. @throw MemoryException
  110. -# if violating any type mismatch from memoryexception
  111. @throw LayoutException
  112. -# if violating any type mismatch from layoutexception
  113. @throw BoostException
  114. -# if exception caused by bost library
  115. */
  116. void applyCircularLayout(SubGraph& gInputGraph, LayoutEnum::VertexOrderCriteria enVertexOrder);
  117. /**
  118. This function adds edges between dummy node coressponding to subgraph and all nodes of subgraph.
  119. @pre
  120. -# gSubgraph != NULL
  121. @param gSubgraph
  122. reference to graph
  123. @return none
  124. @throw none
  125. */
  126. void addDummyEdgesForTopologicalOrder(SubGraph& gSubgraph);
  127. //@}
  128. };
  129. #endif // CIRCULARLAYOUTGENERATOR_H