HierarchicalLayoutGenerator.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #ifndef HIERARCHICALLAYOUTGENERATOR_H
  2. #define HIERARCHICALLAYOUTGENERATOR_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <Common/BoostGraphWrapper.h>
  5. #include <Common/LayoutUtility.h>
  6. #include <Common/GraphCycleHandler.h>
  7. /**
  8. * @brief The HierarchicalLayoutGenerator class
  9. *
  10. * The class provides helpers to manage hierarchical lyout of a graph.
  11. */
  12. class GRAPHLAYOUTLIBRARYSHARED_EXPORT HierarchicalLayoutGenerator
  13. {
  14. BoostGraphWrapper *boostGraphWrapper; /*!< Pointer to boost graph wrapper object >*/
  15. int m_iHorizontalStep; /*!< Horizontal step counter >*/
  16. int m_iVerticalStep; /*!< Verical step counter >*/
  17. int m_iTreeDepth; /*!< Tree Depth >*/
  18. int m_iTreeWidth; /*!< Tree Width >*/
  19. LayoutCompartment m_mainCompartment;
  20. public:
  21. /** @name Creators
  22. * The methods under this section are responsible for constructing
  23. * an instance of type HierarchicalLayoutGenerator.
  24. */
  25. //@{
  26. /**
  27. Constructs new object of type HierarchicalLayoutGenerator.
  28. @pre none
  29. @param none
  30. @return none
  31. @throw none
  32. */
  33. HierarchicalLayoutGenerator();
  34. //@}
  35. void test();
  36. /** @name Modifiers
  37. * The methods under this section are responsible for modifying
  38. * an instance of HierarchicalLayoutGenerator.
  39. */
  40. //@{
  41. /** Applies Hierarchical Layout
  42. @pre
  43. -# gMaingraph != NULL
  44. @param gMaingraph
  45. reference to graph
  46. @return none
  47. @throw none
  48. */
  49. void applyHierarchicalLayout(SubGraph& gMainGraph);
  50. /** Applies X and Y coordinates to verices from position and rank
  51. @pre
  52. -# gMaingraph != NULL
  53. @param gMaingraph
  54. reference to graph
  55. @param iVerticleStep
  56. Vertical Step
  57. @param iHorizontalStep
  58. Horizontal Step
  59. @return none
  60. @throw none
  61. */
  62. void applyCoordinatesFromPositionAndRank(SubGraph& gMainGraph, int iVerticleStep, int iHorizontalStep);
  63. //@}
  64. private:
  65. /** Sets tree width by traversing subgraph
  66. @pre
  67. -# &subgraph != NULL
  68. @param subgraph
  69. reference to subgraph
  70. @param iDistanceFromRoot
  71. Distance from root
  72. @param rootVertex
  73. Root vertex
  74. @return none
  75. @throw none
  76. */
  77. int setTreeWidth(VertexDescriptor& rootVertex , int iDistanceFromRoot, SubGraph &subgraph);
  78. void setCoordinates(VertexDescriptor& vRootVertex , SubGraph& gSubgraph);
  79. };
  80. #endif // HIERARCHICALLAYOUTGENERATOR_H