123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- #ifndef SIZEMANAGER_H
- #define SIZEMANAGER_H
- #include <GraphLayoutLibrary_global.h>
- #include <Common/GraphType.h>
- #include <Common/BoostGraphWrapper.h>
- #include <Common/ConstantType.h>
- /**
- This class implements the functionality for adjusting the size in terms of Height, Width
- CenterCoordX, CenterCoordY, LeftCoordX, and TopCoordY and calculating space required for the
- Graph and all clusters.
- */
- class GRAPHLAYOUTLIBRARYSHARED_EXPORT SizeManager
- {
- private:
- /**
- * Refers to the object of the BoostGraphWrapper
- */
- BoostGraphWrapper m_boostGraphWrapper;
- /**
- This function calculates the area of node.
- @pre
- -# gSubgraph != NULL
- @param vVertex
- vertex descriptor
- @param gSubgraph
- reference to graph
- @return area of node
- @throw none
- */
- double calculateAreaOfNode(VertexDescriptor vVertex, SubGraph& gSubgraph);
- /**
- This function calculates the area of cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return area of cluster
- @throw none
- */
- double calculateAreaOfCluster(SubGraph& gSubgraph);
- /**
- This function calculates maximum radius for every subgraph of cluster iteratively using DFS traversing.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return maximum radius length
- @throw MemoryException
- -# NULL_POINTER_EXCEPTION if referenced entity is null
- @throw LayoutException
- -# INVALID_PARAMETER if invalid value is passed
- @throw BoostException
- -# if exception caused by bost library
- */
- double calculateGraphMaxRadiusUsingDFS(SubGraph& gSubgraph);
- // functionality to calculate Graph size properties as Height, Width, Left X and Top Y
- /**
- This function calculates the width of cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return width of cluster
- @throw none
- */
- int calculateGraphWidth(SubGraph& gSubgraph);
- /**
- This function calculates the height of cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return height of cluster
- @throw none
- */
- int calculateGraphHeight(SubGraph& gSubgraph);
- public:
- /** @name Creators
- * The methods under this section are responsible for constructing or
- * destructing an instance of type SizeManager.
- */
- //@{
- /**
- constructs the object of type SizeManager.
- */
- SizeManager();
- //@}
- /** @name Queries
- * The methods under this section are responsible for accessing
- * an instance of type SizeManager.
- */
- //@{
- /**
- This function calculates the diagonal length of the node.
- * @brief claculateDiagonalOfNode
- * @pre
- * -# gSubgraph != NULL
- * @param vVertex
- * vertex descriptor
- * @param gSubgraph
- * reference to graph
- * @return length of diagonal
- *
- * @throw BoostException
- * -# if exception is thrown by boost library
- */
- double calculateDiagonalOfNode(VertexDescriptor &vVertex, SubGraph &gSubgraph);
- /**
- This function calculates the left X coordinate of the node.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @param vVertex
- vertex descriptor
- @return left x coordinate of node
- @throw none
- */
- int calculateNodeLeftXFromCenterX(VertexDescriptor vVertex, SubGraph& gSubgraph);
- /**
- This function calculates the top Y coordinate of the node.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @param vVertex
- vertex descriptor
- @return top y coordinate of node
- @throw none
- */
- int calculateNodeTopYFromCenterY(VertexDescriptor vVertex, SubGraph& gSubgraph);
- /**
- This function calculates the center x coordinate of cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return center x coordinate of cluster
- @throw none
- */
- int calculateGraphCenterCoordX(SubGraph& gSubgraph);
- /**
- This function calculates the center Y coordinate of cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return center y cordinate of cluster
- @throw none
- */
- int calculateGraphCenterCoordY(SubGraph& gSubgraph);
- /**
- This function calculates the left X coordinate of the cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return left x coordinate of cluster
- @throw none
- */
- int calculateGraphLeftXFromCenterX(SubGraph& gSubgraph);
- /**
- This function calculates the top y coordinate of the cluster.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return top y coordinate of cluster
- @throw none
- */
- int calculateGraphTopYFromCenterY(SubGraph& gSubgraph);
- //@}
- /** @name Modifiers
- * The methods under this section are responsible for modifying
- * an instance of CircularLayoutGenerator.
- */
- //@{
- /**
- This function processes the graph and calculates x, y, height and width.
- @pre
- -# gSubgraph != NULL
- @param gSubgraph
- reference to graph
- @return none
- @throw MemoryException
- -# NULL_POINTER_EXCEPTION if referenced entity is null
- @throw LayoutException
- -# INVALID_PARAMETER if invalid value is passed
- -# INVALID_ATTRIBUTE_VALUE if invalid value to any entity is passed
- @throw BoostException
- -# if exception is thrown by boost library function.
- */
- void processSizeManager(SubGraph& gSubgraph);
- //@}
- };
- #endif // SIZEMANAGER_H
|