Open
Graph Drawing
Framework

 v.2012.05
 

EdgeInsertionModule.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  
00042 #ifdef _MSC_VER
00043 #pragma once
00044 #endif
00045 
00046 #ifndef OGDF_EDGE_INSERTION_MODULE_H
00047 #define OGDF_EDGE_INSERTION_MODULE_H
00048 
00049 
00050 #include <ogdf/planarity/PlanRepUML.h>
00051 #include <ogdf/basic/Logger.h>
00052 #include <ogdf/basic/Module.h>
00053 #include <ogdf/basic/Timeouter.h>
00054 
00055 
00056 namespace ogdf {
00057 
00063 class OGDF_EXPORT EdgeInsertionModule : public Module, public Timeouter {
00064 public:
00066     enum RemoveReinsertType {
00067         rrNone,        
00068         rrInserted,    
00069         rrMostCrossed, 
00070         rrAll,         
00071         rrIncremental, 
00072         rrIncInserted  
00073     };
00074 
00076     EdgeInsertionModule() { }
00077     // destruction
00078     virtual ~EdgeInsertionModule() { }
00079 
00088     ReturnType call(PlanRep &PG, const List<edge> &origEdges) {
00089         return doCall(PG, origEdges, false, 0, 0, 0);
00090     }
00091 
00102     ReturnType call(PlanRep &PG,
00103         const EdgeArray<int> &costOrig,
00104         const List<edge> &origEdges)
00105     {
00106         return doCall(PG, origEdges, false, &costOrig, 0, 0);
00107     }
00108 
00120     ReturnType call(PlanRep &PG,
00121         const EdgeArray<int> &costOrig,
00122         const List<edge> &origEdges,
00123         const EdgeArray<unsigned int> &edgeSubGraph)
00124     {
00125         return doCall(PG, origEdges, false, &costOrig, 0, &edgeSubGraph);
00126     }
00127 
00140     ReturnType call(PlanRep &PG,
00141         const EdgeArray<bool> &forbidOriginal,
00142         const List<edge> &origEdges)
00143     {
00144         return doCall(PG, origEdges, false, 0, &forbidOriginal, 0);
00145     }
00146 
00161     ReturnType call(PlanRep &PG,
00162         const EdgeArray<int>  &costOrig,
00163         const EdgeArray<bool> &forbidOriginal,
00164         const List<edge> &origEdges)
00165     {
00166         return doCall(PG, origEdges, false, &costOrig, &forbidOriginal, 0);
00167     }
00168 
00169     // inserts all edges in origEdges into PG using edge costs given by costOrig and edgeSubGraph;
00170     // explicitly forbids crossing of those original edges for which
00171     // forbidOriginal[eG] == true; no such edge may be in the list origEdges!
00172     ReturnType call(PlanRep &PG,
00173         const EdgeArray<int>  &costOrig,
00174         const EdgeArray<bool> &forbidOriginal,
00175         const List<edge> &origEdges,
00176         const EdgeArray<unsigned int> &edgeSubGraph)
00177     {
00178         return doCall(PG, origEdges, false, &costOrig, &forbidOriginal, &edgeSubGraph);
00179     }
00180 
00190     ReturnType callForbidCrossingGens(PlanRepUML &PG,
00191         const List<edge> &origEdges)
00192     {
00193         return doCall(PG, origEdges, true, 0, 0, 0);
00194     }
00195 
00207     ReturnType callForbidCrossingGens(PlanRepUML &PG,
00208         const EdgeArray<int> &costOrig,
00209         const List<edge> &origEdges) 
00210     {
00211         return doCall(PG, origEdges, true, &costOrig, 0, 0);
00212     }
00213 
00215     virtual int runsPostprocessing() const {
00216         return 0;
00217     }
00218     
00219 
00220 #ifdef OGDF_DEBUG
00221     bool checkCrossingGens(const PlanRepUML &PG);
00222 #endif
00223 
00224 protected:
00237     virtual ReturnType doCall(PlanRep &PG,
00238         const List<edge> &origEdges,
00239         bool forbidCrossingGens,
00240         const EdgeArray<int>  *costOrig,
00241         const EdgeArray<bool> *forbiddenEdgeOrig,
00242         const EdgeArray<unsigned int>  *edgeSubGraph) = 0;
00243 
00244 
00245     OGDF_MALLOC_NEW_DELETE
00246 };
00247 
00248 } // end namespace ogdf
00249 
00250 #endif