123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746 |
- #include "BoostGraphWrapper.h"
- BoostGraphWrapper::BoostGraphWrapper()
- {
- //Initialize vertex order values of main graph; m_GRaph
- initGraphVertexOrderValues(m_Graph);
- }
- BoostGraphWrapper::BoostGraphWrapper(SubGraph graph)
- {
- m_Graph = graph;
- //Initialize vertex order values of main graph; m_GRaph
- initGraphVertexOrderValues(m_Graph);
- }
- VertexDescriptor BoostGraphWrapper::addVertex()
- {
- return addVertex(m_Graph);
- }
- VertexDescriptor BoostGraphWrapper::addVertex(VertexDescriptor &vertex)
- {
- return addVertex(vertex,m_Graph);
- }
- VertexDescriptor BoostGraphWrapper::addVertex(SubGraph& subgraph)
- {
- VertexDescriptor newVertex;
- try
- {
- newVertex = add_vertex(subgraph);
- }
- catch(boost::exception& eBoostException)
- {
- //cout<<"Boost AddVertex Error"<<endl;
- std::cerr << *boost::get_error_info<errmsg_info>(eBoostException);
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- setAsOwnVertex(newVertex , subgraph);
- initVertexOrderValue(newVertex,subgraph);
- return newVertex;
- }
- VertexDescriptor BoostGraphWrapper::addVertex(VertexDescriptor& vertex, SubGraph& subgraph)
- {
- VertexDescriptor newVertex = add_vertex(vertex , subgraph);
- //Initialize vertex order
- initVertexOrderValue(newVertex,subgraph);
- return newVertex;
- }
- VertexDescriptor BoostGraphWrapper::addVertex(SubGraph &subgraph, LayoutEnum::NodeType enVertexType)
- {
- VertexDescriptor vNewVertex = addVertex(subgraph);
- //Set vertex type
- setVertexType(vNewVertex , subgraph ,enVertexType);
- //Adding border vertex entry to the graph
- if(enVertexType == LayoutEnum::UpperBorderNode)
- {
- setGraphUpperBorderVertex(vNewVertex , subgraph);
- }
- else if(enVertexType == LayoutEnum::LowerBorderNode)
- {
- setGraphLowerBorderVertex(vNewVertex , subgraph);
- } else { /// huh?
- // XXX fixme
- }
- // XXX #warning "here"
- return vNewVertex;
- }
- EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2)
- {
- return addEdge(vertex1,vertex2,m_Graph);
- }
- EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2, SubGraph &subgraph)
- {
- return add_edge(vertex1,vertex2,subgraph);
- }
- EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2, SubGraph &subgraph, LayoutEnum::EdgeType enEdgeType)
- {
- EdgeBoolPair newEdge = addEdge(vertex1 , vertex2 ,subgraph);
- subgraph[newEdge.first].enEdgeType = enEdgeType;
- return newEdge;
- }
- void BoostGraphWrapper::removeEdge(EdgeDescriptor &eEdge, SubGraph &gGraph)
- {
- remove_edge(eEdge , gGraph);
- }
- void BoostGraphWrapper::removeEdge(EdgeDescriptor &eEdge)
- {
- removeEdge(eEdge , m_Graph);
- }
- void BoostGraphWrapper::removeEdge(VertexDescriptor &vSource, VertexDescriptor &vTarget, SubGraph &gGraph)
- {
- remove_edge(vSource , vTarget , gGraph);
- }
- void BoostGraphWrapper::removeEdge(VertexDescriptor &vSource, VertexDescriptor &vTarget)
- {
- removeEdge(vSource , vTarget , m_Graph);
- }
- void BoostGraphWrapper::printGraph()
- {
- //Print graph
- print_graph(m_Graph);
- }
- void BoostGraphWrapper::printGraph(SubGraph &subgraph)
- {
- print_graph(subgraph);
- }
- int BoostGraphWrapper::numVertices()
- {
- return num_vertices(m_Graph);
- }
- int BoostGraphWrapper::numVertices(SubGraph &gSubgraph)
- {
- return num_vertices(gSubgraph);
- }
- int BoostGraphWrapper::getVertexIndex(VertexDescriptor& vertex)
- {
- return get(vertex_index,m_Graph,vertex);
- }
- SubGraph& BoostGraphWrapper::addSubgraph()
- {
- return addSubgraph(m_Graph);
- }
- SubGraph& BoostGraphWrapper::addSubgraph(SubGraph &subgraph)
- {
- SubGraph& newSubGraph = subgraph.create_subgraph();
- //Initialize vertex order values
- // initGraphVertexOrderValues(newSubGraph);
- // XXX #warning "here fixme"
- return newSubGraph;
- }
- SubGraph& BoostGraphWrapper::getGraph()
- {
- return m_Graph;
- }
- QString BoostGraphWrapper::getVertexId(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].sId;
- }
- QString BoostGraphWrapper::getVertexId(VertexDescriptor &vertex)
- {
- return getVertexId(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexId(VertexDescriptor &vertex, SubGraph &subgraph, QString sId)
- {
- subgraph[vertex].sId = sId;
- }
- void BoostGraphWrapper::setVertexId(VertexDescriptor &vertex, QString sId)
- {
- setVertexId(vertex, m_Graph , sId);
- }
- int BoostGraphWrapper::getVertexHeight(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- try
- {
- return subgraph[vertex].iHeight;
- }catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- int BoostGraphWrapper::getVertexHeight(VertexDescriptor &vertex)
- {
- return getVertexHeight(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexHeight(VertexDescriptor &vertex, SubGraph &subgraph, int iHeight)
- {
- subgraph[vertex].iHeight = iHeight;
- }
- void BoostGraphWrapper::setVertexHeight(VertexDescriptor &vertex, int iHeight)
- {
- setVertexHeight(vertex , m_Graph , iHeight);
- }
- int BoostGraphWrapper::getVertexWidth(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- try{
- return subgraph[vertex].iWidth;
- }catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- int BoostGraphWrapper::getVertexWidth(VertexDescriptor &vertex)
- {
- return getVertexWidth(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexWidth(VertexDescriptor &vertex, SubGraph &subgraph, int iWidth)
- {
- subgraph[vertex].iWidth = iWidth;
- }
- void BoostGraphWrapper::setVertexWidth(VertexDescriptor &vertex, int iWidth)
- {
- setVertexWidth(vertex , m_Graph , iWidth);
- }
- int BoostGraphWrapper::getVertexLeftCoordX(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iLeftCoordX;
- }
- int BoostGraphWrapper::getVertexLeftCoordX(VertexDescriptor &vertex)
- {
- return getVertexLeftCoordX(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexLeftCoordX(VertexDescriptor &vertex, int iLeftCoordX)
- {
- setVertexLeftCoordX(vertex , m_Graph , iLeftCoordX);
- }
- void BoostGraphWrapper::setVertexLeftCoordX(VertexDescriptor &vertex, SubGraph &subgraph, int iLeftCoordX)
- {
- subgraph[vertex].iLeftCoordX = iLeftCoordX;
- }
- int BoostGraphWrapper::getVertexLeftCoordY(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iLeftCoordY;
- }
- int BoostGraphWrapper::getVertexLeftCoordY(VertexDescriptor &vertex)
- {
- return getVertexLeftCoordY(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexLeftCoordY(VertexDescriptor &vertex, SubGraph &subgraph, int iLeftCoordY)
- {
- subgraph[vertex].iLeftCoordY = iLeftCoordY;
- }
- void BoostGraphWrapper::setVertexLeftCoordY(VertexDescriptor &vertex, int iLeftCoordY)
- {
- setVertexLeftCoordY(vertex , m_Graph , iLeftCoordY);
- }
- // Function to get and set Center coodinates of node
- int BoostGraphWrapper::getVertexCenterCoordX(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iCoord_X;
- }
- int BoostGraphWrapper::getVertexCenterCoordX(VertexDescriptor &vertex)
- {
- return getVertexCenterCoordX(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexCenterCoordX(VertexDescriptor &vertex, int iCoordX)
- {
- setVertexCenterCoordX(vertex , m_Graph , iCoordX);
- }
- void BoostGraphWrapper::setVertexCenterCoordX(VertexDescriptor &vertex, SubGraph &subgraph, int iCoordX)
- {
- subgraph[vertex].iCoord_X = iCoordX;
- int iLeftTopX = iCoordX - (subgraph[vertex].iWidth)/2;
- subgraph[vertex].iLeftCoordX = iLeftTopX;
- }
- int BoostGraphWrapper::getVertexCenterCoordY(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iCoord_Y;
- }
- int BoostGraphWrapper::getVertexCenterCoordY(VertexDescriptor &vertex)
- {
- return getVertexCenterCoordY(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexCenterCoordY(VertexDescriptor &vertex, SubGraph &subgraph, int iCoordY)
- {
- subgraph[vertex].iCoord_Y = iCoordY;
- int iLeftTopY = iCoordY - (subgraph[vertex].iHeight)/2;
- subgraph[vertex].iLeftCoordY = iLeftTopY;
- }
- void BoostGraphWrapper::setVertexCenterCoordY(VertexDescriptor &vertex, int iCoordY)
- {
- setVertexCenterCoordY(vertex , m_Graph , iCoordY);
- }
- bool BoostGraphWrapper::getVertexIsInvisible(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].bIsInvisible;
- }
- bool BoostGraphWrapper::getVertexIsInvisible(VertexDescriptor &vertex)
- {
- return getVertexIsInvisible(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexIsInvisible(VertexDescriptor &vertex, SubGraph &subgraph, bool bIsInvisible)
- {
- subgraph[vertex].bIsInvisible = bIsInvisible;
- }
- void BoostGraphWrapper::setVertexIsInvisible(VertexDescriptor &vertex, bool bIsInvisible)
- {
- setVertexIsInvisible(vertex , m_Graph , bIsInvisible);
- }
- bool BoostGraphWrapper::getVertexExpandable(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].bIsExpandable;
- }
- bool BoostGraphWrapper::getVertexExpandable(VertexDescriptor &vertex)
- {
- return getVertexExpandable(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexExpandable(VertexDescriptor &vertex, SubGraph &subgraph, bool bIsExpandable)
- {
- subgraph[vertex].bIsExpandable = bIsExpandable;
- }
- void BoostGraphWrapper::setVertexExpandable(VertexDescriptor &vertex, bool bIsExpandable)
- {
- setVertexExpandable(vertex , m_Graph , bIsExpandable);
- }
- int BoostGraphWrapper::getVertexTreeWidth(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iTreeWidth;
- }
- int BoostGraphWrapper::getVertexTreeWidth(VertexDescriptor &vertex)
- {
- return getVertexTreeWidth(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexTreeWidth(VertexDescriptor &vertex, SubGraph &subgraph, int iTreeWidth)
- {
- subgraph[vertex].iTreeWidth = iTreeWidth;
- }
- void BoostGraphWrapper::setVertexTreeWidth(VertexDescriptor &vertex, int iTreeWidth)
- {
- setVertexTreeWidth(vertex , m_Graph , iTreeWidth);
- }
- int BoostGraphWrapper::getVertexDistanceFromRoot(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iDistanceFromRoot;
- }
- int BoostGraphWrapper::getVertexDistanceFromRoot(VertexDescriptor &vertex)
- {
- return getVertexDistanceFromRoot(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexDistanceFromRoot(VertexDescriptor &vertex, SubGraph &subgraph, int iDistanceFromRoot)
- {
- subgraph[vertex].iDistanceFromRoot = iDistanceFromRoot;
- }
- void BoostGraphWrapper::setVertexDistanceFromRoot(VertexDescriptor &vertex, int iDistanceFromRoot)
- {
- setVertexDistanceFromRoot(vertex , m_Graph , iDistanceFromRoot);
- }
- int BoostGraphWrapper::getVertexRank(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- // XXX obselete
- // Q_ASSERT_X(&subgraph != NULL, "Get Vertex Rank" , "NULL graph");
- return subgraph[vertex].iRank;
- }
- int BoostGraphWrapper::getVertexRank(VertexDescriptor &vertex)
- {
- return getVertexRank(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexRank(VertexDescriptor &vertex, SubGraph &subgraph, int iRank)
- {
- subgraph[vertex].iRank = iRank;
- }
- void BoostGraphWrapper::setVertexRank(VertexDescriptor &vertex, int iRank)
- {
- setVertexRank(vertex , m_Graph , iRank);
- }
- int BoostGraphWrapper::getVertexHorizontalPosition(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iHorizontalPosition;
- }
- int BoostGraphWrapper::getVertexHorizontalPosition(VertexDescriptor &vertex)
- {
- return getVertexHorizontalPosition(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexHorizontalPosition(VertexDescriptor &vertex, SubGraph &subgraph, int iHorizontalPosition)
- {
- subgraph[vertex].iHorizontalPosition = iHorizontalPosition;
- }
- void BoostGraphWrapper::setVertexHorizontalPosition(VertexDescriptor &vertex, int iHorizontalPosition)
- {
- setVertexHorizontalPosition(vertex , m_Graph , iHorizontalPosition);
- }
- double BoostGraphWrapper::getVertexBarryCenter(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].dBarryCenter;
- }
- double BoostGraphWrapper::getVertexBarryCenter(VertexDescriptor &vertex)
- {
- return getVertexBarryCenter(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexBarryCenter(VertexDescriptor &vertex, SubGraph &subgraph, double dBarryCenter)
- {
- subgraph[vertex].dBarryCenter = dBarryCenter;
- }
- void BoostGraphWrapper::setVertexBarryCenter(VertexDescriptor &vertex, double dBarryCenter)
- {
- setVertexBarryCenter(vertex , m_Graph , dBarryCenter);
- }
- int BoostGraphWrapper::getVertexTreeLeftX(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].iTreeLeftX;
- }
- int BoostGraphWrapper::getVertexTreeLeftX(VertexDescriptor &vertex)
- {
- return getVertexTreeLeftX(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexTreeLeftX(VertexDescriptor &vertex, SubGraph &subgraph, int iTreeLeftX)
- {
- subgraph[vertex].iTreeLeftX = iTreeLeftX;
- }
- void BoostGraphWrapper::setVertexTreeLeftX(VertexDescriptor &vertex, int iTreeLeftX)
- {
- setVertexTreeLeftX(vertex , m_Graph , iTreeLeftX);
- }
- LayoutEnum::NodeType BoostGraphWrapper::getVertexType(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- try{
- return subgraph[vertex].enVertexType;
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- LayoutEnum::NodeType BoostGraphWrapper::getVertexType(VertexDescriptor &vertex)
- {
- return getVertexType(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexType(VertexDescriptor &vertex, SubGraph &subgraph, LayoutEnum::NodeType enVertexType)
- {
- subgraph[vertex].enVertexType = enVertexType;
- }
- void BoostGraphWrapper::setVertexType(VertexDescriptor &vertex, LayoutEnum::NodeType enVertexType)
- {
- setVertexType(vertex , m_Graph , enVertexType);
- }
- bool BoostGraphWrapper::getVertexVisited(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].bVisited;
- }
- bool BoostGraphWrapper::getVertexVisited(VertexDescriptor &vertex)
- {
- return getVertexVisited(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexVisited(VertexDescriptor &vertex, SubGraph &subgraph, bool bVisited)
- {
- subgraph[vertex].bVisited = bVisited;
- }
- void BoostGraphWrapper::setVertexVisited(VertexDescriptor &vertex, bool bVisited)
- {
- setVertexVisited(vertex , m_Graph , bVisited);
- }
- int BoostGraphWrapper::getVertexTopologicalOrder(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- // XXX obsellete Q_ASSERT_X(&subgraph != NULL, "Get Vertex TopologicalOrder" , "NULL graph");
- return subgraph[vertex].iTopologicalOrder;
- }
- int BoostGraphWrapper::getVertexTopologicalOrder(VertexDescriptor &vertex)
- {
- return getVertexTopologicalOrder(vertex , m_Graph);
- }
- void BoostGraphWrapper::setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor &vertex, SubGraph &subgraph)
- {
- // XXX #warning "hee"
- // qDebug() <<"Topo Val:"<<iTopologicalOrder;
- subgraph[vertex].iTopologicalOrder = iTopologicalOrder;
- }
- void BoostGraphWrapper::setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor &vertex )
- {
- setVertexTopologicalOrder(iTopologicalOrder , vertex , m_Graph);
- }
- QString BoostGraphWrapper::getEdgeId(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].sId;
- }
- QString BoostGraphWrapper::getEdgeId(EdgeDescriptor &edge)
- {
- return getEdgeId(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeId(EdgeDescriptor &edge, SubGraph &subgraph, QString sId)
- {
- subgraph[edge].sId = sId;
- }
- void BoostGraphWrapper::setEdgeId(EdgeDescriptor &edge, QString sId)
- {
- setEdgeId(edge, m_Graph , sId);
- }
- std::size_t BoostGraphWrapper::getEdgeIndex(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].iEdgeIndex;
- }
- std::size_t BoostGraphWrapper::getEdgeIndex(EdgeDescriptor &edge)
- {
- return getEdgeIndex(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeIndex(EdgeDescriptor &edge, SubGraph &subgraph, std::size_t iEdgeIndex)
- {
- subgraph[edge].iEdgeIndex = iEdgeIndex;
- }
- void BoostGraphWrapper::setEdgeIndex(EdgeDescriptor &edge, std::size_t iEdgeIndex)
- {
- setEdgeIndex(edge, m_Graph , iEdgeIndex);
- }
- bool BoostGraphWrapper::getEdgeBidirectional(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].bBidirectional;
- }
- bool BoostGraphWrapper::getEdgeBidirectional(EdgeDescriptor &edge)
- {
- return getEdgeBidirectional(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeBidirectional(EdgeDescriptor &edge, SubGraph &subgraph, bool bBidirectional)
- {
- subgraph[edge].bBidirectional = bBidirectional;
- }
- void BoostGraphWrapper::setEdgeBidirectional(EdgeDescriptor &edge, bool bBidirectional)
- {
- setEdgeBidirectional(edge , m_Graph , bBidirectional);
- }
- bool BoostGraphWrapper::getEdgeIsInvisible(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].bIsInvisible;
- }
- bool BoostGraphWrapper::getEdgeIsInvisible(EdgeDescriptor &edge)
- {
- return getEdgeIsInvisible(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeIsInvisible(EdgeDescriptor &edge, SubGraph &subgraph, bool bIsInvisible)
- {
- subgraph[edge].bIsInvisible = bIsInvisible;
- }
- void BoostGraphWrapper::setEdgeIsInvisible(EdgeDescriptor &edge, bool bIsInvisible)
- {
- setEdgeIsInvisible(edge , m_Graph , bIsInvisible);
- }
- bool BoostGraphWrapper::getEdgeVisited(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].bVisited;
- }
- bool BoostGraphWrapper::getEdgeVisited(EdgeDescriptor &edge)
- {
- return getEdgeVisited(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeVisited(EdgeDescriptor &edge, SubGraph &subgraph, bool bVisited)
- {
- subgraph[edge].bVisited = bVisited;
- }
- void BoostGraphWrapper::setEdgeVisited(EdgeDescriptor &edge, bool bVisited)
- {
- setEdgeVisited(edge, m_Graph , bVisited);
- }
- bool BoostGraphWrapper::getEdgeReversed(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].bReversed;
- }
- bool BoostGraphWrapper::getEdgeReversed(EdgeDescriptor &edge)
- {
- return getEdgeReversed(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeReversed(EdgeDescriptor &edge, SubGraph &subgraph, bool bReversed)
- {
- subgraph[edge].bReversed = bReversed;
- }
- void BoostGraphWrapper::setEdgeReversed(EdgeDescriptor &edge, bool bReversed)
- {
- setEdgeReversed(edge, m_Graph , bReversed);
- }
- bool BoostGraphWrapper::getEdgeIsConflicted(EdgeDescriptor &edge, SubGraph &subgraph)
- {
- return subgraph[edge].bIsConflicted;
- }
- bool BoostGraphWrapper::getEdgeIsConflicted(EdgeDescriptor &edge)
- {
- return getEdgeIsConflicted(edge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeIsConflicted(EdgeDescriptor &edge, SubGraph &subgraph, bool bIsConflicted)
- {
- subgraph[edge].bIsConflicted = bIsConflicted;
- }
- void BoostGraphWrapper::setEdgeIsConflicted(EdgeDescriptor &edge, bool bIsConflicted)
- {
- setEdgeIsConflicted(edge , m_Graph , bIsConflicted);
- }
- LayoutEnum::EdgeType BoostGraphWrapper::getEdgeType(EdgeDescriptor eEdge, SubGraph &gGraph)
- {
- try{
- return gGraph[eEdge].enEdgeType;
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- LayoutEnum::EdgeType BoostGraphWrapper::getEdgeType(EdgeDescriptor eEdge)
- {
- return getEdgeType(eEdge , m_Graph);
- }
- void BoostGraphWrapper::setEdgeType(EdgeDescriptor eEdge, SubGraph &subgraph, LayoutEnum::EdgeType enEdgeType)
- {
- subgraph[eEdge].enEdgeType = enEdgeType;
- }
- void BoostGraphWrapper::setEdgeType(EdgeDescriptor eEdge, LayoutEnum::EdgeType enEdgeType)
- {
- setEdgeType(eEdge, m_Graph, enEdgeType);
- }
- std::pair<IteratorQVectorBendPoints, IteratorQVectorBendPoints> BoostGraphWrapper::edgeBendPointsIter(EdgeDescriptor& eEdge, SubGraph &gSubgraph)
- {
- // get the values bend points iterator
- IteratorQVectorBendPoints iterBendPointsStart = gSubgraph[eEdge].vecBendPoints.begin();
- IteratorQVectorBendPoints iterBendPointsEnd = gSubgraph[eEdge].vecBendPoints.end();
- // prepare pair for the iterartors
- std::pair<IteratorQVectorBendPoints, IteratorQVectorBendPoints> pairIteratorBendPoints;
- // get data into pair
- pairIteratorBendPoints.first = iterBendPointsStart;
- pairIteratorBendPoints.second = iterBendPointsEnd;
- // return pair of iterators
- return pairIteratorBendPoints;
- }
- void BoostGraphWrapper::addBendPoint(BendPoints *bendPointRef, EdgeDescriptor eEdge, SubGraph &gGraph)
- {
- gGraph[eEdge].vecBendPoints.push_back(bendPointRef);
- }
- QString BoostGraphWrapper::getGraphId(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].sId;
- }
- // XXX #warning "crash"
- // changed adding var gid
- QString BoostGraphWrapper::getGraphId()
- {
- QString gid;
- gid = getGraphId(m_Graph);
- return gid;
- }
- void BoostGraphWrapper::setGraphId(QString sId, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].sId = sId;
- }
- void BoostGraphWrapper::setGraphId(QString sId)
- {
- setGraphId(sId , m_Graph);
- }
- size_t BoostGraphWrapper::getGraphDummyNodeIndex(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iDummyNodeIndex;
- }
- size_t BoostGraphWrapper::getGraphDummyNodeIndex()
- {
- return getGraphDummyNodeIndex(m_Graph);
- }
- void BoostGraphWrapper::setGraphDummyNodeIndex(size_t iDummyNodeIndex, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iDummyNodeIndex = iDummyNodeIndex;
- }
- void BoostGraphWrapper::setGraphDummyNodeIndex(size_t iDummyNodeIndex)
- {
- setGraphDummyNodeIndex(iDummyNodeIndex , m_Graph);
- }
- int BoostGraphWrapper::getGraphLeftTopCoordX(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iLeftTopCoordX;
- }
- int BoostGraphWrapper::getGraphLeftTopCoordX()
- {
- return getGraphLeftTopCoordX(m_Graph);
- }
- void BoostGraphWrapper::setGraphLeftTopCoordX(int iLeftTopCoordX, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iLeftTopCoordX = iLeftTopCoordX;
- }
- void BoostGraphWrapper::setGraphLeftTopCoordX(int iLeftTopCoordX)
- {
- setGraphLeftTopCoordX(iLeftTopCoordX , m_Graph);
- }
- int BoostGraphWrapper::getGraphLeftTopCoordY(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iLeftTopCoordY;
- }
- int BoostGraphWrapper::getGraphLeftTopCoordY()
- {
- return getGraphLeftTopCoordY(m_Graph);
- }
- void BoostGraphWrapper::setGraphLeftTopCoordY(int iLeftTopCoordY, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iLeftTopCoordY = iLeftTopCoordY;
- }
- void BoostGraphWrapper::setGraphLeftTopCoordY(int iLeftTopCoordY)
- {
- setGraphLeftTopCoordY(iLeftTopCoordY , m_Graph);
- }
- int BoostGraphWrapper::getGraphCenterCoordX(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iCenterCoordX;
- }
- int BoostGraphWrapper::getGraphCenterCoordX()
- {
- return getGraphCenterCoordX(m_Graph);
- }
- void BoostGraphWrapper::setGraphCenterCoordX(int iCenterCoordX, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iCenterCoordX = iCenterCoordX;
- }
- void BoostGraphWrapper::setGraphCenterCoordX(int iCenterCoordX)
- {
- setGraphCenterCoordX(iCenterCoordX , m_Graph);
- }
- int BoostGraphWrapper::getGraphCenterCoordY(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iCenterCoordY;
- }
- int BoostGraphWrapper::getGraphCenterCoordY()
- {
- return getGraphCenterCoordY(m_Graph);
- }
- void BoostGraphWrapper::setGraphCenterCoordY(int iCenterCoordY, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iCenterCoordY = iCenterCoordY;
- }
- void BoostGraphWrapper::setGraphCenterCoordY(int iCenterCoordY)
- {
- setGraphCenterCoordY(iCenterCoordY , m_Graph);
- }
- double BoostGraphWrapper::getGraphRadius(SubGraph &gSubgraph)
- {
- try{
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].dRadius;
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- double BoostGraphWrapper::getGraphRadius()
- {
- return getGraphRadius(m_Graph);
- }
- void BoostGraphWrapper::setGraphRadius(double dRadius, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].dRadius = dRadius;
- }
- void BoostGraphWrapper::setGraphRadius(double dRadius)
- {
- setGraphRadius(dRadius, m_Graph);
- }
- int BoostGraphWrapper::getGraphHeight(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iHeight;
- }
- int BoostGraphWrapper::getGraphHeight()
- {
- return getGraphHeight(m_Graph);
- }
- void BoostGraphWrapper::setGraphHeight(int iHeight, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iHeight = iHeight;
- }
- void BoostGraphWrapper::setGraphHeight(int iHeight)
- {
- setGraphHeight(iHeight , m_Graph);
- }
- int BoostGraphWrapper::getGraphWidth(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iWidth;
- }
- int BoostGraphWrapper::getGraphWidth()
- {
- return getGraphWidth(m_Graph);
- }
- void BoostGraphWrapper::setGraphWidth(int iWidth, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iWidth = iWidth;
- }
- void BoostGraphWrapper::setGraphWidth(int iWidth)
- {
- setGraphWidth(iWidth , m_Graph);
- }
- int BoostGraphWrapper::getGraphCoordX(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iCoordX;
- }
- int BoostGraphWrapper::getGraphCoordX()
- {
- return getGraphCoordX(m_Graph);
- }
- void BoostGraphWrapper::setGraphCoordX(int iCoordX, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iCoordX = iCoordX;
- }
- void BoostGraphWrapper::setGraphCoordX(int iCoordX)
- {
- setGraphCoordX(iCoordX , m_Graph);
- }
- int BoostGraphWrapper::getGraphCoordY(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iCoordY;
- }
- int BoostGraphWrapper::getGraphCoordY()
- {
- return getGraphCoordY(m_Graph);
- }
- void BoostGraphWrapper::setGraphCoordY(int iCoordY, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iCoordY = iCoordY;
- }
- void BoostGraphWrapper::setGraphCoordY(int iCoordY)
- {
- setGraphCoordY(iCoordY , m_Graph);
- }
- int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordX(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iXDistanceFromDummyNodeCentroid;
- }
- int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordX()
- {
- return getGraphDistanceBetweenCentoidAndCenterCoordX(m_Graph);
- }
- void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iXDistanceFromDummyNodeCentroid = iDistanceCoordX;
- }
- void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX)
- {
- setGraphDistanceBetweenCentoidAndCenterCoordX(iDistanceCoordX , m_Graph);
- }
- int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordY(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iYDistanceFromDummyNodeCentroid;
- }
- int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordY()
- {
- return getGraphDistanceBetweenCentoidAndCenterCoordY(m_Graph);
- }
- void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY, SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iYDistanceFromDummyNodeCentroid = iDistanceCoordY;
- }
- void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY)
- {
- setGraphDistanceBetweenCentoidAndCenterCoordY(iDistanceCoordY , m_Graph);
- }
- void BoostGraphWrapper::setAsOwnVertex(VertexDescriptor vVertex, SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- mapGraphProp[&gGraph].vectOwnVertices.push_back(vVertex);
- }
- bool BoostGraphWrapper::isOwnVertex(VertexDescriptor vVertex, SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- return mapGraphProp[&gGraph].vectOwnVertices.contains(vVertex);
- }
- std::pair<IteratorQVectorUInt, IteratorQVectorUInt> BoostGraphWrapper::ownVerticesIter(SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- IteratorQVectorUInt iterOwnVerticesBegin = mapGraphProp[&gGraph].vectOwnVertices.begin();
- IteratorQVectorUInt iterOwnVerticesEnd = mapGraphProp[&gGraph].vectOwnVertices.end();
- std::pair<IteratorQVectorUInt, IteratorQVectorUInt> pairOwnVerticesIters;
- pairOwnVerticesIters.first = iterOwnVerticesBegin;
- pairOwnVerticesIters.second = iterOwnVerticesEnd;
- return pairOwnVerticesIters;
- }
- int BoostGraphWrapper::getCountOfOwnVertices(SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- int iNumOwnVertices = (mapGraphProp[&gGraph].vectOwnVertices).size();
- return iNumOwnVertices;
- }
- std::size_t BoostGraphWrapper::getGraphUpperBorderVertex(SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- return mapGraphProp[&gGraph].vUpperBorderVertex;
- }
- std::size_t BoostGraphWrapper::getGraphUpperBorderVertex()
- {
- return getGraphUpperBorderVertex(m_Graph);
- }
- void BoostGraphWrapper::setGraphUpperBorderVertex(std::size_t vUpperBorderVertex, SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- mapGraphProp[&gGraph].vUpperBorderVertex = vUpperBorderVertex;
- }
- void BoostGraphWrapper::setGraphUpperBorderVertex(std::size_t vUpperBorderVertex)
- {
- setGraphUpperBorderVertex(vUpperBorderVertex , m_Graph);
- }
- std::size_t BoostGraphWrapper::getGraphLowerBorderVertex(SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- return mapGraphProp[&gGraph].vLowerBorderVertex;
- }
- std::size_t BoostGraphWrapper::getGraphLowerBorderVertex()
- {
- return getGraphLowerBorderVertex(m_Graph);
- }
- void BoostGraphWrapper::setGraphLowerBorderVertex(std::size_t vLowerBorderVertex, SubGraph &gGraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
- mapGraphProp[&gGraph].vLowerBorderVertex = vLowerBorderVertex;
- }
- void BoostGraphWrapper::setGraphLowerBorderVertex(std::size_t vLowerBorderVertex)
- {
- setGraphLowerBorderVertex(vLowerBorderVertex , m_Graph);
- }
- VertexDescriptor BoostGraphWrapper::getEdgeTarget(EdgeDescriptor edge, SubGraph &subgraph)
- {
- return target(edge , subgraph);
- }
- VertexDescriptor BoostGraphWrapper::getEdgeTarget(EdgeDescriptor edge)
- {
- return getEdgeTarget(edge , m_Graph);
- }
- VertexDescriptor BoostGraphWrapper::getEdgeSource(EdgeDescriptor edge, SubGraph &subgraph)
- {
- return source(edge , subgraph);
- }
- VertexDescriptor BoostGraphWrapper::getEdgeSource(EdgeDescriptor edge)
- {
- return getEdgeSource(edge , m_Graph);
- }
- VertexIterPair BoostGraphWrapper::getVertices()
- {
- return vertices(m_Graph);
- }
- VertexIterPair BoostGraphWrapper::getVertices(SubGraph &subgraph)
- {
- return vertices(subgraph);
- }
- ChildrenIterPair BoostGraphWrapper::getChildren()
- {
- return m_Graph.children();
- }
- ChildrenIterPair BoostGraphWrapper::getChildren(SubGraph &subgraph)
- {
- return subgraph.children();
- }
- InEdgeIterPair BoostGraphWrapper::getInEdges(VertexDescriptor& vertex)
- {
- return getInEdges(vertex,m_Graph);
- }
- InEdgeIterPair BoostGraphWrapper::getInEdges(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return in_edges(vertex,subgraph);
- }
- OutEdgeIterPair BoostGraphWrapper::getOutEdges(VertexDescriptor &vertex)
- {
- return getOutEdges(vertex,m_Graph);
- }
- OutEdgeIterPair BoostGraphWrapper::getOutEdges(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- return out_edges(vertex,subgraph);
- }
- // XXX #warning "here2"
- void BoostGraphWrapper::getChildrenVector(SubGraph &gSubgraph, VectorSubgraphRefs& vecChildSubgraphs)
- {
- ChildrenIterator itrChild, itrChildEnd;
- for(boost::tie(itrChild,itrChildEnd) = gSubgraph.children();
- itrChild != itrChildEnd;
- ++itrChild)
- {
- vecChildSubgraphs.push_back(&(*itrChild));
- qDebug() << "Graph in PGL Iterator:\n";
- print_graph(*vecChildSubgraphs.back());
- }
- }
- bool BoostGraphWrapper::isValidOrder(std::size_t order)
- {
- bool bValidOrder = false;
- if(order>0)
- {
- bValidOrder = true;
- }
- return bValidOrder;
- }
- int BoostGraphWrapper::getVertexOrder(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- try{
- VertexDescriptor vGlobalVertex = subgraph.local_to_global(vertex);
- SubGraph &gRootGraph = subgraph.root();
- int iOrder = gRootGraph[vGlobalVertex].iOrder;
- return iOrder;
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- bool BoostGraphWrapper::isValidShift(std::size_t iOrderSource, MapOrderVertex &mapOrderVertex, int iShiftBy, ShiftDirection enDirection)
- {
- bool isValidShift = false;
- int iCounter = iShiftBy;
- //check if iOrderSource is valid key in mapOrderVertex
- if(mapOrderVertex.contains(iOrderSource))
- {
- //iOrderSource is valid key in mapOrderVertex
- //Check shifting is valid or not
- if(iShiftBy==0)
- {
- isValidShift=false;
- }
- else
- {
- MapOrderVertex::const_iterator iter1;
- iter1=mapOrderVertex.find(iOrderSource);
- if(enDirection==LeftDirection)
- {
- while(iter1!=mapOrderVertex.constBegin())
- {
- iCounter--;
- iter1--;
- }
- if(iCounter<=0)
- {
- //cout<<"I am left";
- isValidShift=true;
- }
- }
- else if(enDirection==RightDirection)
- {
- while(iter1!=mapOrderVertex.constEnd())
- {
- iCounter--;
- iter1++;
- }
- if(iCounter<=-1)
- {
- //cout<<"I am right";
- isValidShift=true;
- }
- }
- }
- }
- else
- {
- //iOrderSource is not a valid order value in map 'mapOrderVertex'
- cout << directionEnumString(enDirection).toStdString();
- //cout<< " shift not possible. Invalid order: " << iOrderSource << "." << endl;
- // XXX #warning "this"
- }
- return isValidShift;
- }
- void BoostGraphWrapper::initGraphVertexOrderValues(SubGraph &subgraph)
- {
- //Remove later
- cout << "Initializing graph vertex order" << endl;
- try{
- // Get root graph
- SubGraph& gMaingraph = subgraph.root();
- //Create a map for vertex to iOrder property
- PGL_MAP_VERTEX_ORDER(mapGlobalVertexOrder,subgraph)
- //Initialize vertex iOrder value
- BGL_FORALL_VERTICES(vertex,subgraph,SubGraph)
- {
- //Convert local to global vertex descriptor
- VertexDescriptor globalVertex = subgraph.local_to_global(vertex);
- mapGlobalVertexOrder[globalVertex] = PGL_VERTEX_INDEX(globalVertex,gMaingraph) + 1;
- cout << mapGlobalVertexOrder[globalVertex] << " ";
- }
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- }
- void BoostGraphWrapper::getMinMaxVertexOrder(SubGraph &gSubgraph, int& iMinVertexOrder, int& iMaxVertexOrder)
- {
- // XXX oissbl undefined
- Q_UNUSED(iMinVertexOrder);
- Q_UNUSED(iMaxVertexOrder);
- PGL_MAP_VERTEX_ORDER(mapVertexOrder,gSubgraph);
- MapOrderVertex mapOrderVertex;
- mapOrderVertex = getMapOrderedVertices(gSubgraph, mapVertexOrder);
- IteratorMapOrderVertex mapIter(mapOrderVertex);
- bool bFirstTime = true;
- while(mapIter.hasNext())
- {
- mapIter.next();
- std::size_t key = mapIter.key();
- if(bFirstTime == true)
- {
- iMinVertexOrder = key;
- bFirstTime = false;
- }
- else
- {
- iMaxVertexOrder = key;
- }
- }
- // XXX possible undefined values cout<<"mapIter() Min Max Value : "<<iMinVertexOrder<<" "<<iMaxVertexOrder<<endl;
- }
- void BoostGraphWrapper::getMinMaxVertices(SubGraph &gSubgraph, VertexDescriptor& vMinVertex, VertexDescriptor& vMaxVertex)
- {
- PGL_MAP_VERTEX_ORDER(mapVertexOrder,gSubgraph);
- MapOrderVertex mapOrderVertex;
- mapOrderVertex = getMapOrderedVertices(gSubgraph, mapVertexOrder);
- int iMaxOrder;
- int iMinOrder;
- getMinMaxVertexOrder(gSubgraph, iMinOrder, iMaxOrder);
- vMinVertex = mapOrderVertex.value(iMinOrder);
- vMaxVertex = mapOrderVertex.value(iMaxOrder);
- cout<< "Min - Max Vertices : "<<vMinVertex<<" "<<vMaxVertex<<endl;
- // XXX #warning "this3"
- }
- VertexDescriptor BoostGraphWrapper::addDummyVertexForChildGraph(SubGraph &gParentGraph, SubGraph &gChildGraph)
- {
- /*
- This function adds the dummy nodes to graph and set dummy node
- index in the corresponding subgraph for which it is created
- */
- // XXX obselete Q_ASSERT_X(&gParentGraph != NULL,
- // "Add dummy vertx",
- // "Trying to ad dummy node in the empty graph");
- // XXX obselete Q_ASSERT_X(&gChildGraph != NULL,
- // "Ad dummy vertex",
- // "Treing to add dummy vertex in the empty graph");
- // add vertex and set own vertex
- VertexDescriptor vVertex = addVertex(gParentGraph, LayoutEnum::DummyNode);
- // get index
- size_t iDummyNodeIndex = getVertexIndex(vVertex);
- // setDummy node index
- setGraphDummyNodeIndex(iDummyNodeIndex, gChildGraph);
- return vVertex;
- }
- // Private Functionality
- void BoostGraphWrapper::initVertexOrderValue(VertexDescriptor &vertex, SubGraph &subgraph)
- {
- //Assert:check vertex with same index is not present in global graph
- VertexDescriptor globalVertex = subgraph.local_to_global(vertex);
- SubGraph &gRootGraph = subgraph.root();
- //Check if order value is assigned already or not (0= not assigned)
- if(gRootGraph[globalVertex].iOrder==0)
- {
- gRootGraph[globalVertex].iOrder = PGL_VERTEX_INDEX(globalVertex,gRootGraph) + 1;
- qDebug() << "Vertex order set\n";
- }
- else
- {
- qDebug() << "order is set already"<< endl;
- }
- // XXX #warning "hhtht"
- }
- QString BoostGraphWrapper::directionEnumString(ShiftDirection enDirection)
- {
- QString sDirection;
- if(enDirection==LeftDirection)
- {
- sDirection = "Left";
- }
- else if(enDirection==RightDirection)
- {
- sDirection = "Right";
- }
- return sDirection;
- }
- QString BoostGraphWrapper::edgeToQString(EdgeDescriptor eEdge , SubGraph gGraph)
- {
- QString sEdge = "";
- sEdge.append(QString::number(getEdgeSource(eEdge , gGraph)));
- sEdge.append(" , ");
- sEdge.append(QString::number(getEdgeTarget(eEdge , gGraph)));
- return sEdge;
- }
- // Getting edge x and y coordinates
- int BoostGraphWrapper::getEdgeSourceX(EdgeDescriptor eEdge, SubGraph& subGraph)
- {
- VertexDescriptor sourceVertex = source(eEdge,subGraph);
- return subGraph[sourceVertex].iCoord_X;
- }
- int BoostGraphWrapper::getEdgeSourceY(EdgeDescriptor eEdge, SubGraph& subGraph)
- {
- VertexDescriptor sourceVertex = source(eEdge, subGraph);
- return subGraph[sourceVertex].iCoord_Y;
- }
- int BoostGraphWrapper::getEdgeTargetX(EdgeDescriptor eEdge, SubGraph& subGraph)
- {
- VertexDescriptor targetVertex = target(eEdge, subGraph);
- return subGraph[targetVertex].iCoord_X;
- }
- int BoostGraphWrapper::getEdgeTargetY(EdgeDescriptor eEdge, SubGraph& subGraph)
- {
- VertexDescriptor targetVertex = target(eEdge, subGraph);
- return subGraph[targetVertex].iCoord_Y;
- }
- int BoostGraphWrapper::getEdgeCrossingCount(SubGraph &gGraph)
- {
- // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,LayoutMemoryException(__FUNCTION__,LayoutExceptionEnum::NULL_POINTER_EXCEPTION, "Graph"));
- int iIntersectCount = 0;
- BGL_FORALL_EDGES(eFirstEdge,gGraph,SubGraph)
- {
- BGL_FORALL_EDGES(eSecondEdge,gGraph,SubGraph)
- {
- if(eFirstEdge == eSecondEdge)
- {
- break;
- }
- else
- {
- try
- {
- // check intersection of two edges
- bool bIsIntersecting = GeometryHelper::isIntersectingEdges(eFirstEdge,eSecondEdge,gGraph);
- if(bIsIntersecting == true)
- {
- VertexDescriptor vFirstSource = source(eFirstEdge, gGraph);
- VertexDescriptor vFirstTarget = target(eFirstEdge, gGraph);
- VertexDescriptor vSecondSource = source(eSecondEdge, gGraph);
- VertexDescriptor vSecondTarget = target(eSecondEdge, gGraph);
- if((vFirstSource == vSecondSource) || (vFirstSource == vSecondTarget))
- {
- /* intersecting at the end (at the node position)
- then it should not be considered as intersection.
- */
- }
- else if((vFirstTarget == vSecondSource) || (vFirstTarget == vSecondTarget))
- {
- /* intersecting at the end (at the node position)
- then it should not be considered as intersection.
- */
- }
- else
- {
- // Count only real intersection between the edges.
- iIntersectCount++;
- }
- }
- }
- catch(...)
- {
- throw;
- }
- }
- }
- }
- return iIntersectCount;
- }
- /* This function will provide ordering to vertices
- *on the basis of connected components
- */
- void BoostGraphWrapper::applyConnectedComponent(SubGraph &gGraph, MapOrderVertex& mapOrderVertex)
- {
- // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,LayoutException(__FUNCTION__
- // , LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
- // , "gGraph"
- // , ""));
- std::vector<int> vecConnectedComponent(num_vertices(gGraph));
- int iConnectedComponentCount = connected_components(gGraph, &vecConnectedComponent[0]);
- std::cout<<"Number of connected components : "<<iConnectedComponentCount<<endl;
- // initialize the vertex order TO DO : Shift this step at end of import
- //initGraphVertexOrderValues(gGraph);
- // XXX #warning "p9"
- VectorVertexOrder vecVertexOrder;
- PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
- std::size_t iOrder;
- for(int iComponentId = 0 ; iComponentId < iConnectedComponentCount ; iComponentId++)
- {
- BGL_FORALL_VERTICES(vVertex, gGraph, SubGraph)
- {
- // get order of vertex
- if(iComponentId == vecConnectedComponent[vVertex])
- {
- iOrder = mapVertexOrder[vVertex];
- vecVertexOrder.push_back(iOrder);
- }
- }
- }
- // Sorting the vertices according to order which we found through Topological ordering
- sortVerticesByOrderList(vecVertexOrder, gGraph);
- mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
- }
- /* This function will provide ordering to vertices
- on the basis of Smallest degree last order.
- */
- void BoostGraphWrapper::applyTopologicalVertexOrdering(SubGraph &gGraph, MapOrderVertex &mapOrderVertex)
- {
- // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,
- // LayoutMemoryException(__FUNCTION__,
- // LayoutExceptionEnum::NULL_POINTER_EXCEPTION,
- // GRAPH));
- std::deque<int> deqVertexTopologicalOrder(num_vertices(gGraph));
- try
- {
- topological_sort(gGraph, front_inserter(deqVertexTopologicalOrder));
- }
- catch(boost::exception& eBoostException)
- {
- throw *boost::get_error_info<errmsg_info>(eBoostException);
- }
- // //cout<<"Topological Order :- "<<endl;
- // for(int iItrOrder = 0 ; iItrOrder < deqVertexTopologicalOrder.size()/2 ; iItrOrder++)
- // {
- // //cout<<" "<<deqVertexTopologicalOrder[iItrOrder];
- // }
- // XXX #warning "ppp"
- VectorVertexOrder vecVertexOrder;
- PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
- std::size_t iOrder;
- int iDequeSize = deqVertexTopologicalOrder.size()/2;
- for(int iItrOrder = 0 ; iItrOrder < iDequeSize ; iItrOrder++)
- {
- iOrder = mapVertexOrder[deqVertexTopologicalOrder[iItrOrder]];
- vecVertexOrder.push_back(iOrder);
- }
- // Sorting the vertices according to order which we found through connected components
- // //cout<<"Before sorting vertices order: "<<endl;
- sortVerticesByOrderList(vecVertexOrder, gGraph);
- // //cout<<"After sorting vertices order : "<<endl;
- mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
- // //cout<<"Afetr getMapOrderedVertices : "<<endl;
- }
- /* This function will sort the vertex descriptors according to the order which we are taking
- input as a parameter */
- void BoostGraphWrapper::sortVerticesByOrderList(VectorVertexOrder vecVertexOrder, SubGraph &gGraph)
- {
- // XXX obslete LAYOUT_ASSERT(&gGraph != NULL,
- // LayoutMemoryException(__FUNCTION__,
- // LayoutExceptionEnum::NULL_POINTER_EXCEPTION,
- // GRAPH));
- // XXX obselete LAYOUT_ASSERT(!vecVertexOrder.empty(),
- // LayoutException(__FUNCTION__,
- // LayoutExceptionEnum::EMPTY_CONTAINER,
- // EMPTY,VECTOR_CONTENTS));
- // Valid VectorVertexOrder
- int iVectorSize = vecVertexOrder.size();
- for(int iOrderIndex = 0 ; iOrderIndex < iVectorSize ; iOrderIndex++)
- {
- // if(!isValidOrder(vecVertexOrder[iOrderIndex]))
- // {
- // cout<<"iOrder Index : "<<iOrderIndex<<" Vertex : "<<vecVertexOrder[iOrderIndex]<<endl;
- // printGraph(gGraph);
- // }
- LAYOUT_ASSERT(isValidOrder(vecVertexOrder[iOrderIndex]),LayoutException(__FUNCTION__
- , LayoutExceptionEnum::INVALID_PARAMETER
- , "in vector vecVertexOrder"
- , "vertex order"));
- }
- //Create map
- PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
- MapOrderVertex mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
- // Bubble Sort
- for(int iIter = 0 ; iIter < iVectorSize ; iIter++)
- {
- for(int iSeek = 0 ; iSeek < iVectorSize-1 ; iSeek++)
- {
- if( vecVertexOrder[iSeek] < vecVertexOrder[iSeek + 1])
- {
- //Swap original order values
- swapVertexOrderByOrder(vecVertexOrder[iSeek], vecVertexOrder[iSeek + 1],
- mapOrderVertex, mapVertexOrder);
- //Swap
- swap(vecVertexOrder[iSeek] , vecVertexOrder[iSeek + 1]);
- }
- }
- }
- }
- // Force Directed Props
- void BoostGraphWrapper::setVertXDisp(double iDispX,VertexDescriptor verDis, SubGraph& l_graph )
- {
- l_graph[verDis].iVertXDisp = iDispX;
- }
- void BoostGraphWrapper::setVertYDisp(double iDispY,VertexDescriptor verDis, SubGraph& l_graph )
- {
- l_graph[verDis].iVertYDisp = iDispY;
- }
- int BoostGraphWrapper :: getVertXDisp(VertexDescriptor verDis, SubGraph &l_graph)
- {
- return l_graph[verDis].iVertXDisp;
- }
- int BoostGraphWrapper :: getVertYDisp(VertexDescriptor verDis, SubGraph &l_graph)
- {
- return l_graph[verDis].iVertYDisp;
- }
- void BoostGraphWrapper::setVertexLock(VertexDescriptor verDis, SubGraph &l_graph)
- {
- l_graph[verDis].bIsVertexLocked = true;
- }
- bool BoostGraphWrapper::getIsVertexLocked(VertexDescriptor verDis, SubGraph &l_graph)
- {
- return l_graph[verDis].bIsVertexLocked;
- }
- void BoostGraphWrapper::setVertexClusterID(int iClusterID, VertexDescriptor vDisc, SubGraph& gSubgraph )
- {
- gSubgraph[vDisc].iClusterIdentifier = iClusterID;
- }
- int BoostGraphWrapper::getVertexClusterID(VertexDescriptor vDisc, SubGraph& gSubgraph )
- {
- return gSubgraph[vDisc].iClusterIdentifier;
- }
- int BoostGraphWrapper::getGraphClusterID(SubGraph &gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iClusterID;
- }
- void BoostGraphWrapper::setGraphClusterID(int iClusterID, SubGraph& gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iClusterID = iClusterID;
- }
- bool BoostGraphWrapper::setIsVirtualNode(VertexDescriptor vertex, SubGraph &subgraph)
- {
- subgraph[vertex].bIsVirtualNode = true;
- // XXX must return something - fixed
- return true;
- }
- bool BoostGraphWrapper::getIsVirtualNode(VertexDescriptor vertex, SubGraph &subgraph)
- {
- return subgraph[vertex].bIsVirtualNode ;
- }
- int BoostGraphWrapper::getClusterXDisplacement(SubGraph& gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iClusterXDisplacement;
- }
- void BoostGraphWrapper::setClusterXDisplacement(SubGraph& gSubgraph,int iDisp)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iClusterXDisplacement = iDisp;
- }
- int BoostGraphWrapper::getClusterYDisplacement(SubGraph& gSubgraph)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- return mapGraphProp[&gSubgraph].iClusterYDisplacement;
- }
- void BoostGraphWrapper::setClusterYDisplacement(SubGraph& gSubgraph,int iDisp)
- {
- PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
- mapGraphProp[&gSubgraph].iClusterYDisplacement = iDisp;
- }
|