Postprocessing.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #ifndef POSTPROCESSING_H
  2. #define POSTPROCESSING_H
  3. #include<Common/GraphType.h>
  4. #include<Common/BoostGraphWrapper.h>
  5. #include <ForceBasedLayout/SpringEmbedder.h>
  6. #include "MembershipInitializer.h"
  7. #include <HierarchicalLayoutGenerator/HierarchicalLayouter.h>
  8. #include <Common/LayoutEnum.h>
  9. #include <Common/GraphType.h>
  10. #include <ForceBasedLayout/Reingold.h>
  11. #include <boost/geometry.hpp>
  12. #include <boost/geometry/geometries/segment.hpp>
  13. #include <boost/geometry/algorithms/intersection.hpp>
  14. #include <ForceBasedLayout/Constants.h>
  15. #include<ForceBasedLayout/VertexOverlapRemoval.h>
  16. /**
  17. * @brief The Postprocessing class
  18. *
  19. * The class provides helpers to perform pre and post-processing on a graph layouted with force directed algorithm .
  20. */
  21. class Postprocessing
  22. {
  23. public:
  24. int m_iRecursionIndex = 0; /*!< Number of times cluster overlap removal runs */
  25. int m_iVertexOverlapConter = 0; /*!< Number of times vertex overlap removal runs */
  26. /** @name Creators
  27. * The methods under this section are responsible for constructing
  28. * an instance of type MembershipInitializer. Performs a series of operations after layouting
  29. */
  30. //@{
  31. Postprocessing();
  32. //@}
  33. /** @name Modifiers
  34. * The methods under this section are responsible for modifying
  35. * an instance of Postprocessing.
  36. */
  37. //@{
  38. /** Handles Empty Subgraphs by them placing to some default location after
  39. * Layouting.
  40. @pre
  41. -# gMaingraph != NULL
  42. @param gMaingraph
  43. reference to graph
  44. @return none
  45. @throw boost graph exception
  46. */
  47. void applyPostProcessing(SubGraph& gMaingraph);
  48. /** Handles Empty Subgraphs by addind dummy vertex to them.
  49. @pre
  50. -# gMaingraph != NULL
  51. @param gMaingraph
  52. reference to graph
  53. @return none
  54. @throw none
  55. */
  56. void applyPreProcessing(SubGraph& gMaingraph);
  57. /** A wrapper method to call checkAndFixMembership.
  58. @pre
  59. -# gMaingraph != NULL
  60. @param gMaingraph
  61. reference to graph
  62. @return none
  63. @throw none
  64. */
  65. void membershipFixer(SubGraph& gMaingraph );
  66. /** As a part of post processing Checks whether any vertex of some other
  67. * subgraph has accindentally entered its bound and moves it, if so .
  68. @pre
  69. -# gMaingraph != NULL
  70. @param gMaingraph
  71. reference to graph
  72. @return none
  73. @throw none
  74. */
  75. void checkAndFixMembership(SubGraph& gMaingraph);
  76. /** Check whether two vertices are too close to each other if so moves them
  77. * some constant distance apart.
  78. @pre
  79. -# gMaingraph != NULL
  80. @param gMaingraph
  81. reference to graph
  82. @return none
  83. @throw none
  84. */
  85. void overlapRemoval(SubGraph& gMaingraph);
  86. /** Check whether two clusters overlap each other if so
  87. * calls clusterOverlapRemovalWrapper.
  88. @pre
  89. -# gMaingraph != NULL
  90. @param gMaingraph
  91. reference to graph
  92. @return none
  93. @throw none
  94. */
  95. void checkClusterOverlap(SubGraph& gMaingraph);
  96. //@}
  97. private:
  98. /** Moves overlapping clusters to some distance apart.
  99. @pre
  100. -# gMaingraph != NULL
  101. @param gMaingraph
  102. reference to graph
  103. @return none
  104. @throw none
  105. */
  106. void clusterOverlapRemoval(SubGraph& gChildOne ,SubGraph& gChildSecond);
  107. };
  108. #endif // POSTPROCESSING_H