RandomLayoutGenerator.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef RANDOMLAYOUTGENERATOR_H
  2. #define RANDOMLAYOUTGENERATOR_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <Common/BoostGraphWrapper.h>
  5. #include <ForceBasedLayout/Reingold.h>
  6. #include <boost/graph/random_layout.hpp>
  7. #include <math.h>
  8. /**
  9. * @brief The RandomLayoutGenerator class
  10. *
  11. * The class provides helpers to apply ramdom layout to graphs.
  12. */
  13. class GRAPHLAYOUTLIBRARYSHARED_EXPORT RandomLayoutGenerator
  14. {
  15. private:
  16. BoostGraphWrapper m_boostGraphWrapper; /*!< Wrapper for boost graph object */
  17. LayoutCompartment m_mainCompartment; /*!< Current main compartment */
  18. struct Point
  19. {
  20. int iXCoord;
  21. int iYCoord;
  22. }; /*!< Struct of X and Y Cordinate */
  23. public:
  24. /** @name Creators
  25. * The methods under this section are responsible for constructing
  26. * an instance of type RandomLayoutGenerator.
  27. */
  28. //@{
  29. /**
  30. Constructs new object of type RandomLayoutGenerator.
  31. @pre none
  32. @param none
  33. @return none
  34. @throw none
  35. */
  36. RandomLayoutGenerator();
  37. //@}
  38. /** @name Modifiers
  39. * The methods under this section are responsible for modifying
  40. * an instance of RandomLayoutGenerator.
  41. */
  42. //@{
  43. /** Applies Random Layout to main graph instance
  44. @pre
  45. -# gMaingraph != NULL
  46. @param gMaingraph
  47. reference to graph
  48. @return none
  49. @throw none
  50. */
  51. void applyRandomLayout(SubGraph& gMainGraph);
  52. /** Applies Random Layout to a clustered subgraph instance
  53. @pre
  54. -# gInputGraph != NULL
  55. @param gInputGraph
  56. reference to input graph
  57. @param gRootGraph
  58. reference to root graph
  59. @return none
  60. @throw none
  61. */
  62. void applyRandomLayoutForClusteredGraph(SubGraph & gInputGraph, SubGraph &gRootGraph);
  63. /** Calculates the amount of offset in rows and column a point (node) needs to be displaced
  64. @pre none
  65. @param iBlockCount
  66. number of blocks
  67. @param iMaxHeight
  68. max height of node
  69. @param iMaxWidth
  70. max width of node
  71. @param oOffsetOfBlock
  72. Vector of offset blocks
  73. @return none
  74. @throw none
  75. */
  76. void calculateBlockOffsets(int &iBlockCount, int iMaxHeight, int iMaxWidth, std::vector<Point> &oOffsetOfBlock);
  77. //@}
  78. };
  79. #endif // RANDOMLAYOUTGENERATOR_H