Open
Graph Drawing
Framework

 v.2012.05
 

SimpleIncNodeInserter.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  
00049 #ifdef _MSC_VER
00050 #pragma once
00051 #endif
00052 
00053 
00054 #ifndef OGDF_SIMPLE_INC_NODE_INSERTER_H
00055 #define OGDF_SIMPLE_INC_NODE_INSERTER_H
00056 
00057 
00058 #include <ogdf/planarity/PlanRepInc.h>
00059 #include <ogdf/basic/UMLGraph.h>
00060 #include <ogdf/basic/GraphAttributes.h>
00061 #include <ogdf/basic/GraphObserver.h>
00062 #include <ogdf/basic/IncNodeInserter.h>
00063 
00064 namespace ogdf {
00065 
00066 
00067 //===============================================
00068 //main function(s):
00069 //
00070 
00071 //===============================================
00072 
00073 
00074 class OGDF_EXPORT SimpleIncNodeInserter : public IncNodeInserter
00075 {
00076 public:
00077     //creates inserter on PG
00078     SimpleIncNodeInserter(PlanRepInc &PG);
00079     virtual ~SimpleIncNodeInserter();
00080 
00081     //insert copy in m_planRep for original node v
00082     void insertCopyNode(node v, CombinatorialEmbedding &E,
00083         Graph::NodeType vTyp);
00084 
00085     //insert copy without respecting embedding
00086     void insertCopyNode(node v, Graph::NodeType vTyp);
00087 
00088 protected:
00089     //insertAfterAdj will be filled with adjEntries for the 
00090     //(new) edges around the copy of v to be inserted after.
00091     //sorted in the order of the edge around v
00092     face getInsertionFace(node v, CombinatorialEmbedding &E);
00093 
00094     //constructs a dual graph on the copy PlanRep,
00095     //vCopy is the node to be inserted
00096     void constructDual(const Graph &G, const CombinatorialEmbedding &E, 
00097         bool forbidCrossings = true);
00098 
00099     void insertFaceEdges(node v, node vCopy, face f, CombinatorialEmbedding &E,
00100         adjEntry &adExternal);
00101     void insertCrossingEdges(node v, node vCopy, CombinatorialEmbedding &E, adjEntry &adExternal);
00102     void findShortestPath(const CombinatorialEmbedding &E, node s,
00103         node t, Graph::EdgeType eType, SList<adjEntry> &crossed);
00104     void insertEdge(CombinatorialEmbedding &E, edge eOrig,
00105         const SList<adjEntry> &crossed, bool forbidCrossingGens);
00106 
00107 private:
00108     //dual graph for the edge insertion
00109     Graph m_dual;
00110     FaceArray<node> m_nodeOf;      // node in dual corresponding to
00111                                    // to face in primal
00112     NodeArray<bool> m_insertFaceNode; //node lies at border of insertionface
00113     NodeArray<bool> m_vAdjNodes; //node is adjacent to insertion node
00114     NodeArray< List<edge>* > m_incidentEdges; //original edges(insertionnode) 
00115                                               //incident to original(node)
00116     EdgeArray<adjEntry> m_primalAdj; //copy adj for edges in dual graph
00117     EdgeArray<bool>     m_primalIsGen; // true iff corresponding primal edge
00118                                        // is a generalization
00119     bool m_forbidCrossings; //should generalization crossings be avoided
00120     node m_vS; //source and sink in the dual graph for edge insertion
00121     node m_vT; 
00122 
00123 }; //simpleincnodeinserter
00124 
00125 } //end namespace ogdf
00126 
00127 #endif