Open
Graph Drawing
Framework

 v.2012.05
 

CPlanarEdgeInserter.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00048 #ifdef _MSC_VER
00049 #pragma once
00050 #endif
00051 
00052 
00053 #ifndef OGDF_CPLANAR_EDGE_INSERTER_H
00054 #define OGDF_CPLANAR_EDGE_INSERTER_H
00055 
00056 
00057 #include <ogdf/cluster/ClusterPlanRep.h>
00058 
00059 namespace ogdf {
00060 
00061 class NodePair 
00062 {
00063 public:
00064     node m_src, m_tgt;
00065 };
00066 
00067 class OGDF_EXPORT CPlanarEdgeInserter
00068 {
00069     //postprocessing options
00070     enum PostProcessType {ppNone, ppRemoveReinsert};
00071 
00072 public:
00073 
00074     CPlanarEdgeInserter() {}
00075 
00076     virtual ~CPlanarEdgeInserter() {}
00077 
00078     void call(ClusterPlanRep& CPR, 
00079               CombinatorialEmbedding& E,
00080               Graph& G,
00081               const List<NodePair>& origEdges,
00082               List<edge>& newEdges);
00083 
00084     void setPostProcessing(PostProcessType p)
00085     {
00086         m_ppType = p;
00087     }
00088     PostProcessType getPostProcessing() {return m_ppType;}
00089 
00090 protected:
00091 
00092     void constructDualGraph(ClusterPlanRep& CPR,
00093                             CombinatorialEmbedding& E, 
00094                             EdgeArray<edge>& arcRightToLeft,
00095                             EdgeArray<edge>& arcLeftToRight,
00096                             FaceArray<node>& nodeOfFace,
00097                             //NodeArray<face>& faceOfNode,
00098                             EdgeArray<edge>& arcTwin);
00099     void findShortestPath(const CombinatorialEmbedding &E,
00100                           node s, //edge startpoint
00101                           node t,   //edge endpoint
00102                           node sDummy, //representing s in network
00103                           node tDummy, //representing t in network
00104                           SList<adjEntry> &crossed,
00105                           FaceArray<node>& nodeOfFace);
00106     edge insertEdge(ClusterPlanRep &CPR,
00107                     CombinatorialEmbedding &E,
00108                     const NodePair& np,
00109                     FaceArray<node>& nodeOfFace,
00110                     EdgeArray<edge>& arcRightToLeft,
00111                     EdgeArray<edge>& arcLeftToRight,
00112                     EdgeArray<edge>& arcTwin,
00113                     NodeArray<cluster>& clusterOfFaceNode,
00114                     const SList<adjEntry> &crossed);
00115     void setArcStatus(edge eArc, 
00116                       node oSrc, 
00117                       node oTgt, 
00118                       const ClusterGraph& CG,
00119                       NodeArray<cluster>& clusterOfFaceNode,
00120                       EdgeArray<edge>& arcTwin);
00121 
00122     //use heuristics to improve the result if possible
00123     void postProcess();
00124 
00125 private:
00126 
00127     Graph* m_originalGraph;
00128     Graph m_dualGraph;
00129     EdgeArray<int> m_eStatus; //status of dual graph arcs
00130     EdgeArray<adjEntry> m_arcOrig; //original edges adj entry 
00131     PostProcessType m_ppType; //defines which kind of postprocessing to use
00132 
00133     //compute for every face the cluster that surrounds it
00134     void deriveFaceCluster(ClusterPlanRep& CPR, 
00135                            CombinatorialEmbedding& E,
00136                            const ClusterGraph& CG,
00137                            FaceArray<node>& nodeOfFace,
00138                            NodeArray<cluster>& clusterOfFaceNode);
00139 
00140 
00141     //debug
00142     void writeDual(const char *fileName);
00143     void writeGML(ostream &os, const Layout &drawing);
00144 };//class CPlanarEdgeInserter
00145 
00146 } // end namespace ogdf
00147 
00148 
00149 #endif