BoostGraphWrapper.cpp 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746
  1. #include "BoostGraphWrapper.h"
  2. BoostGraphWrapper::BoostGraphWrapper()
  3. {
  4. //Initialize vertex order values of main graph; m_GRaph
  5. initGraphVertexOrderValues(m_Graph);
  6. }
  7. BoostGraphWrapper::BoostGraphWrapper(SubGraph graph)
  8. {
  9. m_Graph = graph;
  10. //Initialize vertex order values of main graph; m_GRaph
  11. initGraphVertexOrderValues(m_Graph);
  12. }
  13. VertexDescriptor BoostGraphWrapper::addVertex()
  14. {
  15. return addVertex(m_Graph);
  16. }
  17. VertexDescriptor BoostGraphWrapper::addVertex(VertexDescriptor &vertex)
  18. {
  19. return addVertex(vertex,m_Graph);
  20. }
  21. VertexDescriptor BoostGraphWrapper::addVertex(SubGraph& subgraph)
  22. {
  23. VertexDescriptor newVertex;
  24. try
  25. {
  26. newVertex = add_vertex(subgraph);
  27. }
  28. catch(boost::exception& eBoostException)
  29. {
  30. //cout<<"Boost AddVertex Error"<<endl;
  31. std::cerr << *boost::get_error_info<errmsg_info>(eBoostException);
  32. throw *boost::get_error_info<errmsg_info>(eBoostException);
  33. }
  34. setAsOwnVertex(newVertex , subgraph);
  35. initVertexOrderValue(newVertex,subgraph);
  36. return newVertex;
  37. }
  38. VertexDescriptor BoostGraphWrapper::addVertex(VertexDescriptor& vertex, SubGraph& subgraph)
  39. {
  40. VertexDescriptor newVertex = add_vertex(vertex , subgraph);
  41. //Initialize vertex order
  42. initVertexOrderValue(newVertex,subgraph);
  43. return newVertex;
  44. }
  45. VertexDescriptor BoostGraphWrapper::addVertex(SubGraph &subgraph, LayoutEnum::NodeType enVertexType)
  46. {
  47. VertexDescriptor vNewVertex = addVertex(subgraph);
  48. //Set vertex type
  49. setVertexType(vNewVertex , subgraph ,enVertexType);
  50. //Adding border vertex entry to the graph
  51. if(enVertexType == LayoutEnum::UpperBorderNode)
  52. {
  53. setGraphUpperBorderVertex(vNewVertex , subgraph);
  54. }
  55. else if(enVertexType == LayoutEnum::LowerBorderNode)
  56. {
  57. setGraphLowerBorderVertex(vNewVertex , subgraph);
  58. } else { /// huh?
  59. // XXX fixme
  60. }
  61. // XXX #warning "here"
  62. return vNewVertex;
  63. }
  64. EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2)
  65. {
  66. return addEdge(vertex1,vertex2,m_Graph);
  67. }
  68. EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2, SubGraph &subgraph)
  69. {
  70. return add_edge(vertex1,vertex2,subgraph);
  71. }
  72. EdgeBoolPair BoostGraphWrapper::addEdge(VertexDescriptor &vertex1, VertexDescriptor &vertex2, SubGraph &subgraph, LayoutEnum::EdgeType enEdgeType)
  73. {
  74. EdgeBoolPair newEdge = addEdge(vertex1 , vertex2 ,subgraph);
  75. subgraph[newEdge.first].enEdgeType = enEdgeType;
  76. return newEdge;
  77. }
  78. void BoostGraphWrapper::removeEdge(EdgeDescriptor &eEdge, SubGraph &gGraph)
  79. {
  80. remove_edge(eEdge , gGraph);
  81. }
  82. void BoostGraphWrapper::removeEdge(EdgeDescriptor &eEdge)
  83. {
  84. removeEdge(eEdge , m_Graph);
  85. }
  86. void BoostGraphWrapper::removeEdge(VertexDescriptor &vSource, VertexDescriptor &vTarget, SubGraph &gGraph)
  87. {
  88. remove_edge(vSource , vTarget , gGraph);
  89. }
  90. void BoostGraphWrapper::removeEdge(VertexDescriptor &vSource, VertexDescriptor &vTarget)
  91. {
  92. removeEdge(vSource , vTarget , m_Graph);
  93. }
  94. void BoostGraphWrapper::printGraph()
  95. {
  96. //Print graph
  97. print_graph(m_Graph);
  98. }
  99. void BoostGraphWrapper::printGraph(SubGraph &subgraph)
  100. {
  101. print_graph(subgraph);
  102. }
  103. int BoostGraphWrapper::numVertices()
  104. {
  105. return num_vertices(m_Graph);
  106. }
  107. int BoostGraphWrapper::numVertices(SubGraph &gSubgraph)
  108. {
  109. return num_vertices(gSubgraph);
  110. }
  111. int BoostGraphWrapper::getVertexIndex(VertexDescriptor& vertex)
  112. {
  113. return get(vertex_index,m_Graph,vertex);
  114. }
  115. SubGraph& BoostGraphWrapper::addSubgraph()
  116. {
  117. return addSubgraph(m_Graph);
  118. }
  119. SubGraph& BoostGraphWrapper::addSubgraph(SubGraph &subgraph)
  120. {
  121. SubGraph& newSubGraph = subgraph.create_subgraph();
  122. //Initialize vertex order values
  123. // initGraphVertexOrderValues(newSubGraph);
  124. // XXX #warning "here fixme"
  125. return newSubGraph;
  126. }
  127. SubGraph& BoostGraphWrapper::getGraph()
  128. {
  129. return m_Graph;
  130. }
  131. QString BoostGraphWrapper::getVertexId(VertexDescriptor &vertex, SubGraph &subgraph)
  132. {
  133. return subgraph[vertex].sId;
  134. }
  135. QString BoostGraphWrapper::getVertexId(VertexDescriptor &vertex)
  136. {
  137. return getVertexId(vertex , m_Graph);
  138. }
  139. void BoostGraphWrapper::setVertexId(VertexDescriptor &vertex, SubGraph &subgraph, QString sId)
  140. {
  141. subgraph[vertex].sId = sId;
  142. }
  143. void BoostGraphWrapper::setVertexId(VertexDescriptor &vertex, QString sId)
  144. {
  145. setVertexId(vertex, m_Graph , sId);
  146. }
  147. int BoostGraphWrapper::getVertexHeight(VertexDescriptor &vertex, SubGraph &subgraph)
  148. {
  149. try
  150. {
  151. return subgraph[vertex].iHeight;
  152. }catch(boost::exception& eBoostException)
  153. {
  154. throw *boost::get_error_info<errmsg_info>(eBoostException);
  155. }
  156. }
  157. int BoostGraphWrapper::getVertexHeight(VertexDescriptor &vertex)
  158. {
  159. return getVertexHeight(vertex , m_Graph);
  160. }
  161. void BoostGraphWrapper::setVertexHeight(VertexDescriptor &vertex, SubGraph &subgraph, int iHeight)
  162. {
  163. subgraph[vertex].iHeight = iHeight;
  164. }
  165. void BoostGraphWrapper::setVertexHeight(VertexDescriptor &vertex, int iHeight)
  166. {
  167. setVertexHeight(vertex , m_Graph , iHeight);
  168. }
  169. int BoostGraphWrapper::getVertexWidth(VertexDescriptor &vertex, SubGraph &subgraph)
  170. {
  171. try{
  172. return subgraph[vertex].iWidth;
  173. }catch(boost::exception& eBoostException)
  174. {
  175. throw *boost::get_error_info<errmsg_info>(eBoostException);
  176. }
  177. }
  178. int BoostGraphWrapper::getVertexWidth(VertexDescriptor &vertex)
  179. {
  180. return getVertexWidth(vertex , m_Graph);
  181. }
  182. void BoostGraphWrapper::setVertexWidth(VertexDescriptor &vertex, SubGraph &subgraph, int iWidth)
  183. {
  184. subgraph[vertex].iWidth = iWidth;
  185. }
  186. void BoostGraphWrapper::setVertexWidth(VertexDescriptor &vertex, int iWidth)
  187. {
  188. setVertexWidth(vertex , m_Graph , iWidth);
  189. }
  190. int BoostGraphWrapper::getVertexLeftCoordX(VertexDescriptor &vertex, SubGraph &subgraph)
  191. {
  192. return subgraph[vertex].iLeftCoordX;
  193. }
  194. int BoostGraphWrapper::getVertexLeftCoordX(VertexDescriptor &vertex)
  195. {
  196. return getVertexLeftCoordX(vertex , m_Graph);
  197. }
  198. void BoostGraphWrapper::setVertexLeftCoordX(VertexDescriptor &vertex, int iLeftCoordX)
  199. {
  200. setVertexLeftCoordX(vertex , m_Graph , iLeftCoordX);
  201. }
  202. void BoostGraphWrapper::setVertexLeftCoordX(VertexDescriptor &vertex, SubGraph &subgraph, int iLeftCoordX)
  203. {
  204. subgraph[vertex].iLeftCoordX = iLeftCoordX;
  205. }
  206. int BoostGraphWrapper::getVertexLeftCoordY(VertexDescriptor &vertex, SubGraph &subgraph)
  207. {
  208. return subgraph[vertex].iLeftCoordY;
  209. }
  210. int BoostGraphWrapper::getVertexLeftCoordY(VertexDescriptor &vertex)
  211. {
  212. return getVertexLeftCoordY(vertex , m_Graph);
  213. }
  214. void BoostGraphWrapper::setVertexLeftCoordY(VertexDescriptor &vertex, SubGraph &subgraph, int iLeftCoordY)
  215. {
  216. subgraph[vertex].iLeftCoordY = iLeftCoordY;
  217. }
  218. void BoostGraphWrapper::setVertexLeftCoordY(VertexDescriptor &vertex, int iLeftCoordY)
  219. {
  220. setVertexLeftCoordY(vertex , m_Graph , iLeftCoordY);
  221. }
  222. // Function to get and set Center coodinates of node
  223. int BoostGraphWrapper::getVertexCenterCoordX(VertexDescriptor &vertex, SubGraph &subgraph)
  224. {
  225. return subgraph[vertex].iCoord_X;
  226. }
  227. int BoostGraphWrapper::getVertexCenterCoordX(VertexDescriptor &vertex)
  228. {
  229. return getVertexCenterCoordX(vertex , m_Graph);
  230. }
  231. void BoostGraphWrapper::setVertexCenterCoordX(VertexDescriptor &vertex, int iCoordX)
  232. {
  233. setVertexCenterCoordX(vertex , m_Graph , iCoordX);
  234. }
  235. void BoostGraphWrapper::setVertexCenterCoordX(VertexDescriptor &vertex, SubGraph &subgraph, int iCoordX)
  236. {
  237. subgraph[vertex].iCoord_X = iCoordX;
  238. int iLeftTopX = iCoordX - (subgraph[vertex].iWidth)/2;
  239. subgraph[vertex].iLeftCoordX = iLeftTopX;
  240. }
  241. int BoostGraphWrapper::getVertexCenterCoordY(VertexDescriptor &vertex, SubGraph &subgraph)
  242. {
  243. return subgraph[vertex].iCoord_Y;
  244. }
  245. int BoostGraphWrapper::getVertexCenterCoordY(VertexDescriptor &vertex)
  246. {
  247. return getVertexCenterCoordY(vertex , m_Graph);
  248. }
  249. void BoostGraphWrapper::setVertexCenterCoordY(VertexDescriptor &vertex, SubGraph &subgraph, int iCoordY)
  250. {
  251. subgraph[vertex].iCoord_Y = iCoordY;
  252. int iLeftTopY = iCoordY - (subgraph[vertex].iHeight)/2;
  253. subgraph[vertex].iLeftCoordY = iLeftTopY;
  254. }
  255. void BoostGraphWrapper::setVertexCenterCoordY(VertexDescriptor &vertex, int iCoordY)
  256. {
  257. setVertexCenterCoordY(vertex , m_Graph , iCoordY);
  258. }
  259. bool BoostGraphWrapper::getVertexIsInvisible(VertexDescriptor &vertex, SubGraph &subgraph)
  260. {
  261. return subgraph[vertex].bIsInvisible;
  262. }
  263. bool BoostGraphWrapper::getVertexIsInvisible(VertexDescriptor &vertex)
  264. {
  265. return getVertexIsInvisible(vertex , m_Graph);
  266. }
  267. void BoostGraphWrapper::setVertexIsInvisible(VertexDescriptor &vertex, SubGraph &subgraph, bool bIsInvisible)
  268. {
  269. subgraph[vertex].bIsInvisible = bIsInvisible;
  270. }
  271. void BoostGraphWrapper::setVertexIsInvisible(VertexDescriptor &vertex, bool bIsInvisible)
  272. {
  273. setVertexIsInvisible(vertex , m_Graph , bIsInvisible);
  274. }
  275. bool BoostGraphWrapper::getVertexExpandable(VertexDescriptor &vertex, SubGraph &subgraph)
  276. {
  277. return subgraph[vertex].bIsExpandable;
  278. }
  279. bool BoostGraphWrapper::getVertexExpandable(VertexDescriptor &vertex)
  280. {
  281. return getVertexExpandable(vertex , m_Graph);
  282. }
  283. void BoostGraphWrapper::setVertexExpandable(VertexDescriptor &vertex, SubGraph &subgraph, bool bIsExpandable)
  284. {
  285. subgraph[vertex].bIsExpandable = bIsExpandable;
  286. }
  287. void BoostGraphWrapper::setVertexExpandable(VertexDescriptor &vertex, bool bIsExpandable)
  288. {
  289. setVertexExpandable(vertex , m_Graph , bIsExpandable);
  290. }
  291. int BoostGraphWrapper::getVertexTreeWidth(VertexDescriptor &vertex, SubGraph &subgraph)
  292. {
  293. return subgraph[vertex].iTreeWidth;
  294. }
  295. int BoostGraphWrapper::getVertexTreeWidth(VertexDescriptor &vertex)
  296. {
  297. return getVertexTreeWidth(vertex , m_Graph);
  298. }
  299. void BoostGraphWrapper::setVertexTreeWidth(VertexDescriptor &vertex, SubGraph &subgraph, int iTreeWidth)
  300. {
  301. subgraph[vertex].iTreeWidth = iTreeWidth;
  302. }
  303. void BoostGraphWrapper::setVertexTreeWidth(VertexDescriptor &vertex, int iTreeWidth)
  304. {
  305. setVertexTreeWidth(vertex , m_Graph , iTreeWidth);
  306. }
  307. int BoostGraphWrapper::getVertexDistanceFromRoot(VertexDescriptor &vertex, SubGraph &subgraph)
  308. {
  309. return subgraph[vertex].iDistanceFromRoot;
  310. }
  311. int BoostGraphWrapper::getVertexDistanceFromRoot(VertexDescriptor &vertex)
  312. {
  313. return getVertexDistanceFromRoot(vertex , m_Graph);
  314. }
  315. void BoostGraphWrapper::setVertexDistanceFromRoot(VertexDescriptor &vertex, SubGraph &subgraph, int iDistanceFromRoot)
  316. {
  317. subgraph[vertex].iDistanceFromRoot = iDistanceFromRoot;
  318. }
  319. void BoostGraphWrapper::setVertexDistanceFromRoot(VertexDescriptor &vertex, int iDistanceFromRoot)
  320. {
  321. setVertexDistanceFromRoot(vertex , m_Graph , iDistanceFromRoot);
  322. }
  323. int BoostGraphWrapper::getVertexRank(VertexDescriptor &vertex, SubGraph &subgraph)
  324. {
  325. // XXX obselete
  326. // Q_ASSERT_X(&subgraph != NULL, "Get Vertex Rank" , "NULL graph");
  327. return subgraph[vertex].iRank;
  328. }
  329. int BoostGraphWrapper::getVertexRank(VertexDescriptor &vertex)
  330. {
  331. return getVertexRank(vertex , m_Graph);
  332. }
  333. void BoostGraphWrapper::setVertexRank(VertexDescriptor &vertex, SubGraph &subgraph, int iRank)
  334. {
  335. subgraph[vertex].iRank = iRank;
  336. }
  337. void BoostGraphWrapper::setVertexRank(VertexDescriptor &vertex, int iRank)
  338. {
  339. setVertexRank(vertex , m_Graph , iRank);
  340. }
  341. int BoostGraphWrapper::getVertexHorizontalPosition(VertexDescriptor &vertex, SubGraph &subgraph)
  342. {
  343. return subgraph[vertex].iHorizontalPosition;
  344. }
  345. int BoostGraphWrapper::getVertexHorizontalPosition(VertexDescriptor &vertex)
  346. {
  347. return getVertexHorizontalPosition(vertex , m_Graph);
  348. }
  349. void BoostGraphWrapper::setVertexHorizontalPosition(VertexDescriptor &vertex, SubGraph &subgraph, int iHorizontalPosition)
  350. {
  351. subgraph[vertex].iHorizontalPosition = iHorizontalPosition;
  352. }
  353. void BoostGraphWrapper::setVertexHorizontalPosition(VertexDescriptor &vertex, int iHorizontalPosition)
  354. {
  355. setVertexHorizontalPosition(vertex , m_Graph , iHorizontalPosition);
  356. }
  357. double BoostGraphWrapper::getVertexBarryCenter(VertexDescriptor &vertex, SubGraph &subgraph)
  358. {
  359. return subgraph[vertex].dBarryCenter;
  360. }
  361. double BoostGraphWrapper::getVertexBarryCenter(VertexDescriptor &vertex)
  362. {
  363. return getVertexBarryCenter(vertex , m_Graph);
  364. }
  365. void BoostGraphWrapper::setVertexBarryCenter(VertexDescriptor &vertex, SubGraph &subgraph, double dBarryCenter)
  366. {
  367. subgraph[vertex].dBarryCenter = dBarryCenter;
  368. }
  369. void BoostGraphWrapper::setVertexBarryCenter(VertexDescriptor &vertex, double dBarryCenter)
  370. {
  371. setVertexBarryCenter(vertex , m_Graph , dBarryCenter);
  372. }
  373. int BoostGraphWrapper::getVertexTreeLeftX(VertexDescriptor &vertex, SubGraph &subgraph)
  374. {
  375. return subgraph[vertex].iTreeLeftX;
  376. }
  377. int BoostGraphWrapper::getVertexTreeLeftX(VertexDescriptor &vertex)
  378. {
  379. return getVertexTreeLeftX(vertex , m_Graph);
  380. }
  381. void BoostGraphWrapper::setVertexTreeLeftX(VertexDescriptor &vertex, SubGraph &subgraph, int iTreeLeftX)
  382. {
  383. subgraph[vertex].iTreeLeftX = iTreeLeftX;
  384. }
  385. void BoostGraphWrapper::setVertexTreeLeftX(VertexDescriptor &vertex, int iTreeLeftX)
  386. {
  387. setVertexTreeLeftX(vertex , m_Graph , iTreeLeftX);
  388. }
  389. LayoutEnum::NodeType BoostGraphWrapper::getVertexType(VertexDescriptor &vertex, SubGraph &subgraph)
  390. {
  391. try{
  392. return subgraph[vertex].enVertexType;
  393. }
  394. catch(boost::exception& eBoostException)
  395. {
  396. throw *boost::get_error_info<errmsg_info>(eBoostException);
  397. }
  398. }
  399. LayoutEnum::NodeType BoostGraphWrapper::getVertexType(VertexDescriptor &vertex)
  400. {
  401. return getVertexType(vertex , m_Graph);
  402. }
  403. void BoostGraphWrapper::setVertexType(VertexDescriptor &vertex, SubGraph &subgraph, LayoutEnum::NodeType enVertexType)
  404. {
  405. subgraph[vertex].enVertexType = enVertexType;
  406. }
  407. void BoostGraphWrapper::setVertexType(VertexDescriptor &vertex, LayoutEnum::NodeType enVertexType)
  408. {
  409. setVertexType(vertex , m_Graph , enVertexType);
  410. }
  411. bool BoostGraphWrapper::getVertexVisited(VertexDescriptor &vertex, SubGraph &subgraph)
  412. {
  413. return subgraph[vertex].bVisited;
  414. }
  415. bool BoostGraphWrapper::getVertexVisited(VertexDescriptor &vertex)
  416. {
  417. return getVertexVisited(vertex , m_Graph);
  418. }
  419. void BoostGraphWrapper::setVertexVisited(VertexDescriptor &vertex, SubGraph &subgraph, bool bVisited)
  420. {
  421. subgraph[vertex].bVisited = bVisited;
  422. }
  423. void BoostGraphWrapper::setVertexVisited(VertexDescriptor &vertex, bool bVisited)
  424. {
  425. setVertexVisited(vertex , m_Graph , bVisited);
  426. }
  427. int BoostGraphWrapper::getVertexTopologicalOrder(VertexDescriptor &vertex, SubGraph &subgraph)
  428. {
  429. // XXX obsellete Q_ASSERT_X(&subgraph != NULL, "Get Vertex TopologicalOrder" , "NULL graph");
  430. return subgraph[vertex].iTopologicalOrder;
  431. }
  432. int BoostGraphWrapper::getVertexTopologicalOrder(VertexDescriptor &vertex)
  433. {
  434. return getVertexTopologicalOrder(vertex , m_Graph);
  435. }
  436. void BoostGraphWrapper::setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor &vertex, SubGraph &subgraph)
  437. {
  438. // XXX #warning "hee"
  439. // qDebug() <<"Topo Val:"<<iTopologicalOrder;
  440. subgraph[vertex].iTopologicalOrder = iTopologicalOrder;
  441. }
  442. void BoostGraphWrapper::setVertexTopologicalOrder(int iTopologicalOrder , VertexDescriptor &vertex )
  443. {
  444. setVertexTopologicalOrder(iTopologicalOrder , vertex , m_Graph);
  445. }
  446. QString BoostGraphWrapper::getEdgeId(EdgeDescriptor &edge, SubGraph &subgraph)
  447. {
  448. return subgraph[edge].sId;
  449. }
  450. QString BoostGraphWrapper::getEdgeId(EdgeDescriptor &edge)
  451. {
  452. return getEdgeId(edge , m_Graph);
  453. }
  454. void BoostGraphWrapper::setEdgeId(EdgeDescriptor &edge, SubGraph &subgraph, QString sId)
  455. {
  456. subgraph[edge].sId = sId;
  457. }
  458. void BoostGraphWrapper::setEdgeId(EdgeDescriptor &edge, QString sId)
  459. {
  460. setEdgeId(edge, m_Graph , sId);
  461. }
  462. std::size_t BoostGraphWrapper::getEdgeIndex(EdgeDescriptor &edge, SubGraph &subgraph)
  463. {
  464. return subgraph[edge].iEdgeIndex;
  465. }
  466. std::size_t BoostGraphWrapper::getEdgeIndex(EdgeDescriptor &edge)
  467. {
  468. return getEdgeIndex(edge , m_Graph);
  469. }
  470. void BoostGraphWrapper::setEdgeIndex(EdgeDescriptor &edge, SubGraph &subgraph, std::size_t iEdgeIndex)
  471. {
  472. subgraph[edge].iEdgeIndex = iEdgeIndex;
  473. }
  474. void BoostGraphWrapper::setEdgeIndex(EdgeDescriptor &edge, std::size_t iEdgeIndex)
  475. {
  476. setEdgeIndex(edge, m_Graph , iEdgeIndex);
  477. }
  478. bool BoostGraphWrapper::getEdgeBidirectional(EdgeDescriptor &edge, SubGraph &subgraph)
  479. {
  480. return subgraph[edge].bBidirectional;
  481. }
  482. bool BoostGraphWrapper::getEdgeBidirectional(EdgeDescriptor &edge)
  483. {
  484. return getEdgeBidirectional(edge , m_Graph);
  485. }
  486. void BoostGraphWrapper::setEdgeBidirectional(EdgeDescriptor &edge, SubGraph &subgraph, bool bBidirectional)
  487. {
  488. subgraph[edge].bBidirectional = bBidirectional;
  489. }
  490. void BoostGraphWrapper::setEdgeBidirectional(EdgeDescriptor &edge, bool bBidirectional)
  491. {
  492. setEdgeBidirectional(edge , m_Graph , bBidirectional);
  493. }
  494. bool BoostGraphWrapper::getEdgeIsInvisible(EdgeDescriptor &edge, SubGraph &subgraph)
  495. {
  496. return subgraph[edge].bIsInvisible;
  497. }
  498. bool BoostGraphWrapper::getEdgeIsInvisible(EdgeDescriptor &edge)
  499. {
  500. return getEdgeIsInvisible(edge , m_Graph);
  501. }
  502. void BoostGraphWrapper::setEdgeIsInvisible(EdgeDescriptor &edge, SubGraph &subgraph, bool bIsInvisible)
  503. {
  504. subgraph[edge].bIsInvisible = bIsInvisible;
  505. }
  506. void BoostGraphWrapper::setEdgeIsInvisible(EdgeDescriptor &edge, bool bIsInvisible)
  507. {
  508. setEdgeIsInvisible(edge , m_Graph , bIsInvisible);
  509. }
  510. bool BoostGraphWrapper::getEdgeVisited(EdgeDescriptor &edge, SubGraph &subgraph)
  511. {
  512. return subgraph[edge].bVisited;
  513. }
  514. bool BoostGraphWrapper::getEdgeVisited(EdgeDescriptor &edge)
  515. {
  516. return getEdgeVisited(edge , m_Graph);
  517. }
  518. void BoostGraphWrapper::setEdgeVisited(EdgeDescriptor &edge, SubGraph &subgraph, bool bVisited)
  519. {
  520. subgraph[edge].bVisited = bVisited;
  521. }
  522. void BoostGraphWrapper::setEdgeVisited(EdgeDescriptor &edge, bool bVisited)
  523. {
  524. setEdgeVisited(edge, m_Graph , bVisited);
  525. }
  526. bool BoostGraphWrapper::getEdgeReversed(EdgeDescriptor &edge, SubGraph &subgraph)
  527. {
  528. return subgraph[edge].bReversed;
  529. }
  530. bool BoostGraphWrapper::getEdgeReversed(EdgeDescriptor &edge)
  531. {
  532. return getEdgeReversed(edge , m_Graph);
  533. }
  534. void BoostGraphWrapper::setEdgeReversed(EdgeDescriptor &edge, SubGraph &subgraph, bool bReversed)
  535. {
  536. subgraph[edge].bReversed = bReversed;
  537. }
  538. void BoostGraphWrapper::setEdgeReversed(EdgeDescriptor &edge, bool bReversed)
  539. {
  540. setEdgeReversed(edge, m_Graph , bReversed);
  541. }
  542. bool BoostGraphWrapper::getEdgeIsConflicted(EdgeDescriptor &edge, SubGraph &subgraph)
  543. {
  544. return subgraph[edge].bIsConflicted;
  545. }
  546. bool BoostGraphWrapper::getEdgeIsConflicted(EdgeDescriptor &edge)
  547. {
  548. return getEdgeIsConflicted(edge , m_Graph);
  549. }
  550. void BoostGraphWrapper::setEdgeIsConflicted(EdgeDescriptor &edge, SubGraph &subgraph, bool bIsConflicted)
  551. {
  552. subgraph[edge].bIsConflicted = bIsConflicted;
  553. }
  554. void BoostGraphWrapper::setEdgeIsConflicted(EdgeDescriptor &edge, bool bIsConflicted)
  555. {
  556. setEdgeIsConflicted(edge , m_Graph , bIsConflicted);
  557. }
  558. LayoutEnum::EdgeType BoostGraphWrapper::getEdgeType(EdgeDescriptor eEdge, SubGraph &gGraph)
  559. {
  560. try{
  561. return gGraph[eEdge].enEdgeType;
  562. }
  563. catch(boost::exception& eBoostException)
  564. {
  565. throw *boost::get_error_info<errmsg_info>(eBoostException);
  566. }
  567. }
  568. LayoutEnum::EdgeType BoostGraphWrapper::getEdgeType(EdgeDescriptor eEdge)
  569. {
  570. return getEdgeType(eEdge , m_Graph);
  571. }
  572. void BoostGraphWrapper::setEdgeType(EdgeDescriptor eEdge, SubGraph &subgraph, LayoutEnum::EdgeType enEdgeType)
  573. {
  574. subgraph[eEdge].enEdgeType = enEdgeType;
  575. }
  576. void BoostGraphWrapper::setEdgeType(EdgeDescriptor eEdge, LayoutEnum::EdgeType enEdgeType)
  577. {
  578. setEdgeType(eEdge, m_Graph, enEdgeType);
  579. }
  580. std::pair<IteratorQVectorBendPoints, IteratorQVectorBendPoints> BoostGraphWrapper::edgeBendPointsIter(EdgeDescriptor& eEdge, SubGraph &gSubgraph)
  581. {
  582. // get the values bend points iterator
  583. IteratorQVectorBendPoints iterBendPointsStart = gSubgraph[eEdge].vecBendPoints.begin();
  584. IteratorQVectorBendPoints iterBendPointsEnd = gSubgraph[eEdge].vecBendPoints.end();
  585. // prepare pair for the iterartors
  586. std::pair<IteratorQVectorBendPoints, IteratorQVectorBendPoints> pairIteratorBendPoints;
  587. // get data into pair
  588. pairIteratorBendPoints.first = iterBendPointsStart;
  589. pairIteratorBendPoints.second = iterBendPointsEnd;
  590. // return pair of iterators
  591. return pairIteratorBendPoints;
  592. }
  593. void BoostGraphWrapper::addBendPoint(BendPoints *bendPointRef, EdgeDescriptor eEdge, SubGraph &gGraph)
  594. {
  595. gGraph[eEdge].vecBendPoints.push_back(bendPointRef);
  596. }
  597. QString BoostGraphWrapper::getGraphId(SubGraph &gSubgraph)
  598. {
  599. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  600. return mapGraphProp[&gSubgraph].sId;
  601. }
  602. // XXX #warning "crash"
  603. // changed adding var gid
  604. QString BoostGraphWrapper::getGraphId()
  605. {
  606. QString gid;
  607. gid = getGraphId(m_Graph);
  608. return gid;
  609. }
  610. void BoostGraphWrapper::setGraphId(QString sId, SubGraph &gSubgraph)
  611. {
  612. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  613. mapGraphProp[&gSubgraph].sId = sId;
  614. }
  615. void BoostGraphWrapper::setGraphId(QString sId)
  616. {
  617. setGraphId(sId , m_Graph);
  618. }
  619. size_t BoostGraphWrapper::getGraphDummyNodeIndex(SubGraph &gSubgraph)
  620. {
  621. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  622. return mapGraphProp[&gSubgraph].iDummyNodeIndex;
  623. }
  624. size_t BoostGraphWrapper::getGraphDummyNodeIndex()
  625. {
  626. return getGraphDummyNodeIndex(m_Graph);
  627. }
  628. void BoostGraphWrapper::setGraphDummyNodeIndex(size_t iDummyNodeIndex, SubGraph &gSubgraph)
  629. {
  630. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  631. mapGraphProp[&gSubgraph].iDummyNodeIndex = iDummyNodeIndex;
  632. }
  633. void BoostGraphWrapper::setGraphDummyNodeIndex(size_t iDummyNodeIndex)
  634. {
  635. setGraphDummyNodeIndex(iDummyNodeIndex , m_Graph);
  636. }
  637. int BoostGraphWrapper::getGraphLeftTopCoordX(SubGraph &gSubgraph)
  638. {
  639. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  640. return mapGraphProp[&gSubgraph].iLeftTopCoordX;
  641. }
  642. int BoostGraphWrapper::getGraphLeftTopCoordX()
  643. {
  644. return getGraphLeftTopCoordX(m_Graph);
  645. }
  646. void BoostGraphWrapper::setGraphLeftTopCoordX(int iLeftTopCoordX, SubGraph &gSubgraph)
  647. {
  648. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  649. mapGraphProp[&gSubgraph].iLeftTopCoordX = iLeftTopCoordX;
  650. }
  651. void BoostGraphWrapper::setGraphLeftTopCoordX(int iLeftTopCoordX)
  652. {
  653. setGraphLeftTopCoordX(iLeftTopCoordX , m_Graph);
  654. }
  655. int BoostGraphWrapper::getGraphLeftTopCoordY(SubGraph &gSubgraph)
  656. {
  657. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  658. return mapGraphProp[&gSubgraph].iLeftTopCoordY;
  659. }
  660. int BoostGraphWrapper::getGraphLeftTopCoordY()
  661. {
  662. return getGraphLeftTopCoordY(m_Graph);
  663. }
  664. void BoostGraphWrapper::setGraphLeftTopCoordY(int iLeftTopCoordY, SubGraph &gSubgraph)
  665. {
  666. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  667. mapGraphProp[&gSubgraph].iLeftTopCoordY = iLeftTopCoordY;
  668. }
  669. void BoostGraphWrapper::setGraphLeftTopCoordY(int iLeftTopCoordY)
  670. {
  671. setGraphLeftTopCoordY(iLeftTopCoordY , m_Graph);
  672. }
  673. int BoostGraphWrapper::getGraphCenterCoordX(SubGraph &gSubgraph)
  674. {
  675. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  676. return mapGraphProp[&gSubgraph].iCenterCoordX;
  677. }
  678. int BoostGraphWrapper::getGraphCenterCoordX()
  679. {
  680. return getGraphCenterCoordX(m_Graph);
  681. }
  682. void BoostGraphWrapper::setGraphCenterCoordX(int iCenterCoordX, SubGraph &gSubgraph)
  683. {
  684. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  685. mapGraphProp[&gSubgraph].iCenterCoordX = iCenterCoordX;
  686. }
  687. void BoostGraphWrapper::setGraphCenterCoordX(int iCenterCoordX)
  688. {
  689. setGraphCenterCoordX(iCenterCoordX , m_Graph);
  690. }
  691. int BoostGraphWrapper::getGraphCenterCoordY(SubGraph &gSubgraph)
  692. {
  693. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  694. return mapGraphProp[&gSubgraph].iCenterCoordY;
  695. }
  696. int BoostGraphWrapper::getGraphCenterCoordY()
  697. {
  698. return getGraphCenterCoordY(m_Graph);
  699. }
  700. void BoostGraphWrapper::setGraphCenterCoordY(int iCenterCoordY, SubGraph &gSubgraph)
  701. {
  702. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  703. mapGraphProp[&gSubgraph].iCenterCoordY = iCenterCoordY;
  704. }
  705. void BoostGraphWrapper::setGraphCenterCoordY(int iCenterCoordY)
  706. {
  707. setGraphCenterCoordY(iCenterCoordY , m_Graph);
  708. }
  709. double BoostGraphWrapper::getGraphRadius(SubGraph &gSubgraph)
  710. {
  711. try{
  712. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  713. return mapGraphProp[&gSubgraph].dRadius;
  714. }
  715. catch(boost::exception& eBoostException)
  716. {
  717. throw *boost::get_error_info<errmsg_info>(eBoostException);
  718. }
  719. }
  720. double BoostGraphWrapper::getGraphRadius()
  721. {
  722. return getGraphRadius(m_Graph);
  723. }
  724. void BoostGraphWrapper::setGraphRadius(double dRadius, SubGraph &gSubgraph)
  725. {
  726. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  727. mapGraphProp[&gSubgraph].dRadius = dRadius;
  728. }
  729. void BoostGraphWrapper::setGraphRadius(double dRadius)
  730. {
  731. setGraphRadius(dRadius, m_Graph);
  732. }
  733. int BoostGraphWrapper::getGraphHeight(SubGraph &gSubgraph)
  734. {
  735. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  736. return mapGraphProp[&gSubgraph].iHeight;
  737. }
  738. int BoostGraphWrapper::getGraphHeight()
  739. {
  740. return getGraphHeight(m_Graph);
  741. }
  742. void BoostGraphWrapper::setGraphHeight(int iHeight, SubGraph &gSubgraph)
  743. {
  744. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  745. mapGraphProp[&gSubgraph].iHeight = iHeight;
  746. }
  747. void BoostGraphWrapper::setGraphHeight(int iHeight)
  748. {
  749. setGraphHeight(iHeight , m_Graph);
  750. }
  751. int BoostGraphWrapper::getGraphWidth(SubGraph &gSubgraph)
  752. {
  753. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  754. return mapGraphProp[&gSubgraph].iWidth;
  755. }
  756. int BoostGraphWrapper::getGraphWidth()
  757. {
  758. return getGraphWidth(m_Graph);
  759. }
  760. void BoostGraphWrapper::setGraphWidth(int iWidth, SubGraph &gSubgraph)
  761. {
  762. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  763. mapGraphProp[&gSubgraph].iWidth = iWidth;
  764. }
  765. void BoostGraphWrapper::setGraphWidth(int iWidth)
  766. {
  767. setGraphWidth(iWidth , m_Graph);
  768. }
  769. int BoostGraphWrapper::getGraphCoordX(SubGraph &gSubgraph)
  770. {
  771. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  772. return mapGraphProp[&gSubgraph].iCoordX;
  773. }
  774. int BoostGraphWrapper::getGraphCoordX()
  775. {
  776. return getGraphCoordX(m_Graph);
  777. }
  778. void BoostGraphWrapper::setGraphCoordX(int iCoordX, SubGraph &gSubgraph)
  779. {
  780. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  781. mapGraphProp[&gSubgraph].iCoordX = iCoordX;
  782. }
  783. void BoostGraphWrapper::setGraphCoordX(int iCoordX)
  784. {
  785. setGraphCoordX(iCoordX , m_Graph);
  786. }
  787. int BoostGraphWrapper::getGraphCoordY(SubGraph &gSubgraph)
  788. {
  789. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  790. return mapGraphProp[&gSubgraph].iCoordY;
  791. }
  792. int BoostGraphWrapper::getGraphCoordY()
  793. {
  794. return getGraphCoordY(m_Graph);
  795. }
  796. void BoostGraphWrapper::setGraphCoordY(int iCoordY, SubGraph &gSubgraph)
  797. {
  798. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  799. mapGraphProp[&gSubgraph].iCoordY = iCoordY;
  800. }
  801. void BoostGraphWrapper::setGraphCoordY(int iCoordY)
  802. {
  803. setGraphCoordY(iCoordY , m_Graph);
  804. }
  805. int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordX(SubGraph &gSubgraph)
  806. {
  807. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  808. return mapGraphProp[&gSubgraph].iXDistanceFromDummyNodeCentroid;
  809. }
  810. int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordX()
  811. {
  812. return getGraphDistanceBetweenCentoidAndCenterCoordX(m_Graph);
  813. }
  814. void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX, SubGraph &gSubgraph)
  815. {
  816. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  817. mapGraphProp[&gSubgraph].iXDistanceFromDummyNodeCentroid = iDistanceCoordX;
  818. }
  819. void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordX(int iDistanceCoordX)
  820. {
  821. setGraphDistanceBetweenCentoidAndCenterCoordX(iDistanceCoordX , m_Graph);
  822. }
  823. int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordY(SubGraph &gSubgraph)
  824. {
  825. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  826. return mapGraphProp[&gSubgraph].iYDistanceFromDummyNodeCentroid;
  827. }
  828. int BoostGraphWrapper::getGraphDistanceBetweenCentoidAndCenterCoordY()
  829. {
  830. return getGraphDistanceBetweenCentoidAndCenterCoordY(m_Graph);
  831. }
  832. void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY, SubGraph &gSubgraph)
  833. {
  834. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  835. mapGraphProp[&gSubgraph].iYDistanceFromDummyNodeCentroid = iDistanceCoordY;
  836. }
  837. void BoostGraphWrapper::setGraphDistanceBetweenCentoidAndCenterCoordY(int iDistanceCoordY)
  838. {
  839. setGraphDistanceBetweenCentoidAndCenterCoordY(iDistanceCoordY , m_Graph);
  840. }
  841. void BoostGraphWrapper::setAsOwnVertex(VertexDescriptor vVertex, SubGraph &gGraph)
  842. {
  843. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  844. mapGraphProp[&gGraph].vectOwnVertices.push_back(vVertex);
  845. }
  846. bool BoostGraphWrapper::isOwnVertex(VertexDescriptor vVertex, SubGraph &gGraph)
  847. {
  848. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  849. return mapGraphProp[&gGraph].vectOwnVertices.contains(vVertex);
  850. }
  851. std::pair<IteratorQVectorUInt, IteratorQVectorUInt> BoostGraphWrapper::ownVerticesIter(SubGraph &gGraph)
  852. {
  853. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  854. IteratorQVectorUInt iterOwnVerticesBegin = mapGraphProp[&gGraph].vectOwnVertices.begin();
  855. IteratorQVectorUInt iterOwnVerticesEnd = mapGraphProp[&gGraph].vectOwnVertices.end();
  856. std::pair<IteratorQVectorUInt, IteratorQVectorUInt> pairOwnVerticesIters;
  857. pairOwnVerticesIters.first = iterOwnVerticesBegin;
  858. pairOwnVerticesIters.second = iterOwnVerticesEnd;
  859. return pairOwnVerticesIters;
  860. }
  861. int BoostGraphWrapper::getCountOfOwnVertices(SubGraph &gGraph)
  862. {
  863. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  864. int iNumOwnVertices = (mapGraphProp[&gGraph].vectOwnVertices).size();
  865. return iNumOwnVertices;
  866. }
  867. std::size_t BoostGraphWrapper::getGraphUpperBorderVertex(SubGraph &gGraph)
  868. {
  869. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  870. return mapGraphProp[&gGraph].vUpperBorderVertex;
  871. }
  872. std::size_t BoostGraphWrapper::getGraphUpperBorderVertex()
  873. {
  874. return getGraphUpperBorderVertex(m_Graph);
  875. }
  876. void BoostGraphWrapper::setGraphUpperBorderVertex(std::size_t vUpperBorderVertex, SubGraph &gGraph)
  877. {
  878. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  879. mapGraphProp[&gGraph].vUpperBorderVertex = vUpperBorderVertex;
  880. }
  881. void BoostGraphWrapper::setGraphUpperBorderVertex(std::size_t vUpperBorderVertex)
  882. {
  883. setGraphUpperBorderVertex(vUpperBorderVertex , m_Graph);
  884. }
  885. std::size_t BoostGraphWrapper::getGraphLowerBorderVertex(SubGraph &gGraph)
  886. {
  887. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  888. return mapGraphProp[&gGraph].vLowerBorderVertex;
  889. }
  890. std::size_t BoostGraphWrapper::getGraphLowerBorderVertex()
  891. {
  892. return getGraphLowerBorderVertex(m_Graph);
  893. }
  894. void BoostGraphWrapper::setGraphLowerBorderVertex(std::size_t vLowerBorderVertex, SubGraph &gGraph)
  895. {
  896. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gGraph);
  897. mapGraphProp[&gGraph].vLowerBorderVertex = vLowerBorderVertex;
  898. }
  899. void BoostGraphWrapper::setGraphLowerBorderVertex(std::size_t vLowerBorderVertex)
  900. {
  901. setGraphLowerBorderVertex(vLowerBorderVertex , m_Graph);
  902. }
  903. VertexDescriptor BoostGraphWrapper::getEdgeTarget(EdgeDescriptor edge, SubGraph &subgraph)
  904. {
  905. return target(edge , subgraph);
  906. }
  907. VertexDescriptor BoostGraphWrapper::getEdgeTarget(EdgeDescriptor edge)
  908. {
  909. return getEdgeTarget(edge , m_Graph);
  910. }
  911. VertexDescriptor BoostGraphWrapper::getEdgeSource(EdgeDescriptor edge, SubGraph &subgraph)
  912. {
  913. return source(edge , subgraph);
  914. }
  915. VertexDescriptor BoostGraphWrapper::getEdgeSource(EdgeDescriptor edge)
  916. {
  917. return getEdgeSource(edge , m_Graph);
  918. }
  919. VertexIterPair BoostGraphWrapper::getVertices()
  920. {
  921. return vertices(m_Graph);
  922. }
  923. VertexIterPair BoostGraphWrapper::getVertices(SubGraph &subgraph)
  924. {
  925. return vertices(subgraph);
  926. }
  927. ChildrenIterPair BoostGraphWrapper::getChildren()
  928. {
  929. return m_Graph.children();
  930. }
  931. ChildrenIterPair BoostGraphWrapper::getChildren(SubGraph &subgraph)
  932. {
  933. return subgraph.children();
  934. }
  935. InEdgeIterPair BoostGraphWrapper::getInEdges(VertexDescriptor& vertex)
  936. {
  937. return getInEdges(vertex,m_Graph);
  938. }
  939. InEdgeIterPair BoostGraphWrapper::getInEdges(VertexDescriptor &vertex, SubGraph &subgraph)
  940. {
  941. return in_edges(vertex,subgraph);
  942. }
  943. OutEdgeIterPair BoostGraphWrapper::getOutEdges(VertexDescriptor &vertex)
  944. {
  945. return getOutEdges(vertex,m_Graph);
  946. }
  947. OutEdgeIterPair BoostGraphWrapper::getOutEdges(VertexDescriptor &vertex, SubGraph &subgraph)
  948. {
  949. return out_edges(vertex,subgraph);
  950. }
  951. // XXX #warning "here2"
  952. void BoostGraphWrapper::getChildrenVector(SubGraph &gSubgraph, VectorSubgraphRefs& vecChildSubgraphs)
  953. {
  954. ChildrenIterator itrChild, itrChildEnd;
  955. for(boost::tie(itrChild,itrChildEnd) = gSubgraph.children();
  956. itrChild != itrChildEnd;
  957. ++itrChild)
  958. {
  959. vecChildSubgraphs.push_back(&(*itrChild));
  960. qDebug() << "Graph in PGL Iterator:\n";
  961. print_graph(*vecChildSubgraphs.back());
  962. }
  963. }
  964. bool BoostGraphWrapper::isValidOrder(std::size_t order)
  965. {
  966. bool bValidOrder = false;
  967. if(order>0)
  968. {
  969. bValidOrder = true;
  970. }
  971. return bValidOrder;
  972. }
  973. int BoostGraphWrapper::getVertexOrder(VertexDescriptor &vertex, SubGraph &subgraph)
  974. {
  975. try{
  976. VertexDescriptor vGlobalVertex = subgraph.local_to_global(vertex);
  977. SubGraph &gRootGraph = subgraph.root();
  978. int iOrder = gRootGraph[vGlobalVertex].iOrder;
  979. return iOrder;
  980. }
  981. catch(boost::exception& eBoostException)
  982. {
  983. throw *boost::get_error_info<errmsg_info>(eBoostException);
  984. }
  985. }
  986. bool BoostGraphWrapper::isValidShift(std::size_t iOrderSource, MapOrderVertex &mapOrderVertex, int iShiftBy, ShiftDirection enDirection)
  987. {
  988. bool isValidShift = false;
  989. int iCounter = iShiftBy;
  990. //check if iOrderSource is valid key in mapOrderVertex
  991. if(mapOrderVertex.contains(iOrderSource))
  992. {
  993. //iOrderSource is valid key in mapOrderVertex
  994. //Check shifting is valid or not
  995. if(iShiftBy==0)
  996. {
  997. isValidShift=false;
  998. }
  999. else
  1000. {
  1001. MapOrderVertex::const_iterator iter1;
  1002. iter1=mapOrderVertex.find(iOrderSource);
  1003. if(enDirection==LeftDirection)
  1004. {
  1005. while(iter1!=mapOrderVertex.constBegin())
  1006. {
  1007. iCounter--;
  1008. iter1--;
  1009. }
  1010. if(iCounter<=0)
  1011. {
  1012. //cout<<"I am left";
  1013. isValidShift=true;
  1014. }
  1015. }
  1016. else if(enDirection==RightDirection)
  1017. {
  1018. while(iter1!=mapOrderVertex.constEnd())
  1019. {
  1020. iCounter--;
  1021. iter1++;
  1022. }
  1023. if(iCounter<=-1)
  1024. {
  1025. //cout<<"I am right";
  1026. isValidShift=true;
  1027. }
  1028. }
  1029. }
  1030. }
  1031. else
  1032. {
  1033. //iOrderSource is not a valid order value in map 'mapOrderVertex'
  1034. cout << directionEnumString(enDirection).toStdString();
  1035. //cout<< " shift not possible. Invalid order: " << iOrderSource << "." << endl;
  1036. // XXX #warning "this"
  1037. }
  1038. return isValidShift;
  1039. }
  1040. void BoostGraphWrapper::initGraphVertexOrderValues(SubGraph &subgraph)
  1041. {
  1042. //Remove later
  1043. cout << "Initializing graph vertex order" << endl;
  1044. try{
  1045. // Get root graph
  1046. SubGraph& gMaingraph = subgraph.root();
  1047. //Create a map for vertex to iOrder property
  1048. PGL_MAP_VERTEX_ORDER(mapGlobalVertexOrder,subgraph)
  1049. //Initialize vertex iOrder value
  1050. BGL_FORALL_VERTICES(vertex,subgraph,SubGraph)
  1051. {
  1052. //Convert local to global vertex descriptor
  1053. VertexDescriptor globalVertex = subgraph.local_to_global(vertex);
  1054. mapGlobalVertexOrder[globalVertex] = PGL_VERTEX_INDEX(globalVertex,gMaingraph) + 1;
  1055. cout << mapGlobalVertexOrder[globalVertex] << " ";
  1056. }
  1057. }
  1058. catch(boost::exception& eBoostException)
  1059. {
  1060. throw *boost::get_error_info<errmsg_info>(eBoostException);
  1061. }
  1062. }
  1063. void BoostGraphWrapper::getMinMaxVertexOrder(SubGraph &gSubgraph, int& iMinVertexOrder, int& iMaxVertexOrder)
  1064. {
  1065. // XXX oissbl undefined
  1066. Q_UNUSED(iMinVertexOrder);
  1067. Q_UNUSED(iMaxVertexOrder);
  1068. PGL_MAP_VERTEX_ORDER(mapVertexOrder,gSubgraph);
  1069. MapOrderVertex mapOrderVertex;
  1070. mapOrderVertex = getMapOrderedVertices(gSubgraph, mapVertexOrder);
  1071. IteratorMapOrderVertex mapIter(mapOrderVertex);
  1072. bool bFirstTime = true;
  1073. while(mapIter.hasNext())
  1074. {
  1075. mapIter.next();
  1076. std::size_t key = mapIter.key();
  1077. if(bFirstTime == true)
  1078. {
  1079. iMinVertexOrder = key;
  1080. bFirstTime = false;
  1081. }
  1082. else
  1083. {
  1084. iMaxVertexOrder = key;
  1085. }
  1086. }
  1087. // XXX possible undefined values cout<<"mapIter() Min Max Value : "<<iMinVertexOrder<<" "<<iMaxVertexOrder<<endl;
  1088. }
  1089. void BoostGraphWrapper::getMinMaxVertices(SubGraph &gSubgraph, VertexDescriptor& vMinVertex, VertexDescriptor& vMaxVertex)
  1090. {
  1091. PGL_MAP_VERTEX_ORDER(mapVertexOrder,gSubgraph);
  1092. MapOrderVertex mapOrderVertex;
  1093. mapOrderVertex = getMapOrderedVertices(gSubgraph, mapVertexOrder);
  1094. int iMaxOrder;
  1095. int iMinOrder;
  1096. getMinMaxVertexOrder(gSubgraph, iMinOrder, iMaxOrder);
  1097. vMinVertex = mapOrderVertex.value(iMinOrder);
  1098. vMaxVertex = mapOrderVertex.value(iMaxOrder);
  1099. cout<< "Min - Max Vertices : "<<vMinVertex<<" "<<vMaxVertex<<endl;
  1100. // XXX #warning "this3"
  1101. }
  1102. VertexDescriptor BoostGraphWrapper::addDummyVertexForChildGraph(SubGraph &gParentGraph, SubGraph &gChildGraph)
  1103. {
  1104. /*
  1105. This function adds the dummy nodes to graph and set dummy node
  1106. index in the corresponding subgraph for which it is created
  1107. */
  1108. // XXX obselete Q_ASSERT_X(&gParentGraph != NULL,
  1109. // "Add dummy vertx",
  1110. // "Trying to ad dummy node in the empty graph");
  1111. // XXX obselete Q_ASSERT_X(&gChildGraph != NULL,
  1112. // "Ad dummy vertex",
  1113. // "Treing to add dummy vertex in the empty graph");
  1114. // add vertex and set own vertex
  1115. VertexDescriptor vVertex = addVertex(gParentGraph, LayoutEnum::DummyNode);
  1116. // get index
  1117. size_t iDummyNodeIndex = getVertexIndex(vVertex);
  1118. // setDummy node index
  1119. setGraphDummyNodeIndex(iDummyNodeIndex, gChildGraph);
  1120. return vVertex;
  1121. }
  1122. // Private Functionality
  1123. void BoostGraphWrapper::initVertexOrderValue(VertexDescriptor &vertex, SubGraph &subgraph)
  1124. {
  1125. //Assert:check vertex with same index is not present in global graph
  1126. VertexDescriptor globalVertex = subgraph.local_to_global(vertex);
  1127. SubGraph &gRootGraph = subgraph.root();
  1128. //Check if order value is assigned already or not (0= not assigned)
  1129. if(gRootGraph[globalVertex].iOrder==0)
  1130. {
  1131. gRootGraph[globalVertex].iOrder = PGL_VERTEX_INDEX(globalVertex,gRootGraph) + 1;
  1132. qDebug() << "Vertex order set\n";
  1133. }
  1134. else
  1135. {
  1136. qDebug() << "order is set already"<< endl;
  1137. }
  1138. // XXX #warning "hhtht"
  1139. }
  1140. QString BoostGraphWrapper::directionEnumString(ShiftDirection enDirection)
  1141. {
  1142. QString sDirection;
  1143. if(enDirection==LeftDirection)
  1144. {
  1145. sDirection = "Left";
  1146. }
  1147. else if(enDirection==RightDirection)
  1148. {
  1149. sDirection = "Right";
  1150. }
  1151. return sDirection;
  1152. }
  1153. QString BoostGraphWrapper::edgeToQString(EdgeDescriptor eEdge , SubGraph gGraph)
  1154. {
  1155. QString sEdge = "";
  1156. sEdge.append(QString::number(getEdgeSource(eEdge , gGraph)));
  1157. sEdge.append(" , ");
  1158. sEdge.append(QString::number(getEdgeTarget(eEdge , gGraph)));
  1159. return sEdge;
  1160. }
  1161. // Getting edge x and y coordinates
  1162. int BoostGraphWrapper::getEdgeSourceX(EdgeDescriptor eEdge, SubGraph& subGraph)
  1163. {
  1164. VertexDescriptor sourceVertex = source(eEdge,subGraph);
  1165. return subGraph[sourceVertex].iCoord_X;
  1166. }
  1167. int BoostGraphWrapper::getEdgeSourceY(EdgeDescriptor eEdge, SubGraph& subGraph)
  1168. {
  1169. VertexDescriptor sourceVertex = source(eEdge, subGraph);
  1170. return subGraph[sourceVertex].iCoord_Y;
  1171. }
  1172. int BoostGraphWrapper::getEdgeTargetX(EdgeDescriptor eEdge, SubGraph& subGraph)
  1173. {
  1174. VertexDescriptor targetVertex = target(eEdge, subGraph);
  1175. return subGraph[targetVertex].iCoord_X;
  1176. }
  1177. int BoostGraphWrapper::getEdgeTargetY(EdgeDescriptor eEdge, SubGraph& subGraph)
  1178. {
  1179. VertexDescriptor targetVertex = target(eEdge, subGraph);
  1180. return subGraph[targetVertex].iCoord_Y;
  1181. }
  1182. int BoostGraphWrapper::getEdgeCrossingCount(SubGraph &gGraph)
  1183. {
  1184. // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,LayoutMemoryException(__FUNCTION__,LayoutExceptionEnum::NULL_POINTER_EXCEPTION, "Graph"));
  1185. int iIntersectCount = 0;
  1186. BGL_FORALL_EDGES(eFirstEdge,gGraph,SubGraph)
  1187. {
  1188. BGL_FORALL_EDGES(eSecondEdge,gGraph,SubGraph)
  1189. {
  1190. if(eFirstEdge == eSecondEdge)
  1191. {
  1192. break;
  1193. }
  1194. else
  1195. {
  1196. try
  1197. {
  1198. // check intersection of two edges
  1199. bool bIsIntersecting = GeometryHelper::isIntersectingEdges(eFirstEdge,eSecondEdge,gGraph);
  1200. if(bIsIntersecting == true)
  1201. {
  1202. VertexDescriptor vFirstSource = source(eFirstEdge, gGraph);
  1203. VertexDescriptor vFirstTarget = target(eFirstEdge, gGraph);
  1204. VertexDescriptor vSecondSource = source(eSecondEdge, gGraph);
  1205. VertexDescriptor vSecondTarget = target(eSecondEdge, gGraph);
  1206. if((vFirstSource == vSecondSource) || (vFirstSource == vSecondTarget))
  1207. {
  1208. /* intersecting at the end (at the node position)
  1209. then it should not be considered as intersection.
  1210. */
  1211. }
  1212. else if((vFirstTarget == vSecondSource) || (vFirstTarget == vSecondTarget))
  1213. {
  1214. /* intersecting at the end (at the node position)
  1215. then it should not be considered as intersection.
  1216. */
  1217. }
  1218. else
  1219. {
  1220. // Count only real intersection between the edges.
  1221. iIntersectCount++;
  1222. }
  1223. }
  1224. }
  1225. catch(...)
  1226. {
  1227. throw;
  1228. }
  1229. }
  1230. }
  1231. }
  1232. return iIntersectCount;
  1233. }
  1234. /* This function will provide ordering to vertices
  1235. *on the basis of connected components
  1236. */
  1237. void BoostGraphWrapper::applyConnectedComponent(SubGraph &gGraph, MapOrderVertex& mapOrderVertex)
  1238. {
  1239. // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,LayoutException(__FUNCTION__
  1240. // , LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  1241. // , "gGraph"
  1242. // , ""));
  1243. std::vector<int> vecConnectedComponent(num_vertices(gGraph));
  1244. int iConnectedComponentCount = connected_components(gGraph, &vecConnectedComponent[0]);
  1245. std::cout<<"Number of connected components : "<<iConnectedComponentCount<<endl;
  1246. // initialize the vertex order TO DO : Shift this step at end of import
  1247. //initGraphVertexOrderValues(gGraph);
  1248. // XXX #warning "p9"
  1249. VectorVertexOrder vecVertexOrder;
  1250. PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
  1251. std::size_t iOrder;
  1252. for(int iComponentId = 0 ; iComponentId < iConnectedComponentCount ; iComponentId++)
  1253. {
  1254. BGL_FORALL_VERTICES(vVertex, gGraph, SubGraph)
  1255. {
  1256. // get order of vertex
  1257. if(iComponentId == vecConnectedComponent[vVertex])
  1258. {
  1259. iOrder = mapVertexOrder[vVertex];
  1260. vecVertexOrder.push_back(iOrder);
  1261. }
  1262. }
  1263. }
  1264. // Sorting the vertices according to order which we found through Topological ordering
  1265. sortVerticesByOrderList(vecVertexOrder, gGraph);
  1266. mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
  1267. }
  1268. /* This function will provide ordering to vertices
  1269. on the basis of Smallest degree last order.
  1270. */
  1271. void BoostGraphWrapper::applyTopologicalVertexOrdering(SubGraph &gGraph, MapOrderVertex &mapOrderVertex)
  1272. {
  1273. // XXX obselete LAYOUT_ASSERT(&gGraph != NULL,
  1274. // LayoutMemoryException(__FUNCTION__,
  1275. // LayoutExceptionEnum::NULL_POINTER_EXCEPTION,
  1276. // GRAPH));
  1277. std::deque<int> deqVertexTopologicalOrder(num_vertices(gGraph));
  1278. try
  1279. {
  1280. topological_sort(gGraph, front_inserter(deqVertexTopologicalOrder));
  1281. }
  1282. catch(boost::exception& eBoostException)
  1283. {
  1284. throw *boost::get_error_info<errmsg_info>(eBoostException);
  1285. }
  1286. // //cout<<"Topological Order :- "<<endl;
  1287. // for(int iItrOrder = 0 ; iItrOrder < deqVertexTopologicalOrder.size()/2 ; iItrOrder++)
  1288. // {
  1289. // //cout<<" "<<deqVertexTopologicalOrder[iItrOrder];
  1290. // }
  1291. // XXX #warning "ppp"
  1292. VectorVertexOrder vecVertexOrder;
  1293. PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
  1294. std::size_t iOrder;
  1295. int iDequeSize = deqVertexTopologicalOrder.size()/2;
  1296. for(int iItrOrder = 0 ; iItrOrder < iDequeSize ; iItrOrder++)
  1297. {
  1298. iOrder = mapVertexOrder[deqVertexTopologicalOrder[iItrOrder]];
  1299. vecVertexOrder.push_back(iOrder);
  1300. }
  1301. // Sorting the vertices according to order which we found through connected components
  1302. // //cout<<"Before sorting vertices order: "<<endl;
  1303. sortVerticesByOrderList(vecVertexOrder, gGraph);
  1304. // //cout<<"After sorting vertices order : "<<endl;
  1305. mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
  1306. // //cout<<"Afetr getMapOrderedVertices : "<<endl;
  1307. }
  1308. /* This function will sort the vertex descriptors according to the order which we are taking
  1309. input as a parameter */
  1310. void BoostGraphWrapper::sortVerticesByOrderList(VectorVertexOrder vecVertexOrder, SubGraph &gGraph)
  1311. {
  1312. // XXX obslete LAYOUT_ASSERT(&gGraph != NULL,
  1313. // LayoutMemoryException(__FUNCTION__,
  1314. // LayoutExceptionEnum::NULL_POINTER_EXCEPTION,
  1315. // GRAPH));
  1316. // XXX obselete LAYOUT_ASSERT(!vecVertexOrder.empty(),
  1317. // LayoutException(__FUNCTION__,
  1318. // LayoutExceptionEnum::EMPTY_CONTAINER,
  1319. // EMPTY,VECTOR_CONTENTS));
  1320. // Valid VectorVertexOrder
  1321. int iVectorSize = vecVertexOrder.size();
  1322. for(int iOrderIndex = 0 ; iOrderIndex < iVectorSize ; iOrderIndex++)
  1323. {
  1324. // if(!isValidOrder(vecVertexOrder[iOrderIndex]))
  1325. // {
  1326. // cout<<"iOrder Index : "<<iOrderIndex<<" Vertex : "<<vecVertexOrder[iOrderIndex]<<endl;
  1327. // printGraph(gGraph);
  1328. // }
  1329. LAYOUT_ASSERT(isValidOrder(vecVertexOrder[iOrderIndex]),LayoutException(__FUNCTION__
  1330. , LayoutExceptionEnum::INVALID_PARAMETER
  1331. , "in vector vecVertexOrder"
  1332. , "vertex order"));
  1333. }
  1334. //Create map
  1335. PGL_MAP_VERTEX_ORDER(mapVertexOrder,gGraph);
  1336. MapOrderVertex mapOrderVertex = getMapOrderedVertices(gGraph, mapVertexOrder);
  1337. // Bubble Sort
  1338. for(int iIter = 0 ; iIter < iVectorSize ; iIter++)
  1339. {
  1340. for(int iSeek = 0 ; iSeek < iVectorSize-1 ; iSeek++)
  1341. {
  1342. if( vecVertexOrder[iSeek] < vecVertexOrder[iSeek + 1])
  1343. {
  1344. //Swap original order values
  1345. swapVertexOrderByOrder(vecVertexOrder[iSeek], vecVertexOrder[iSeek + 1],
  1346. mapOrderVertex, mapVertexOrder);
  1347. //Swap
  1348. swap(vecVertexOrder[iSeek] , vecVertexOrder[iSeek + 1]);
  1349. }
  1350. }
  1351. }
  1352. }
  1353. // Force Directed Props
  1354. void BoostGraphWrapper::setVertXDisp(double iDispX,VertexDescriptor verDis, SubGraph& l_graph )
  1355. {
  1356. l_graph[verDis].iVertXDisp = iDispX;
  1357. }
  1358. void BoostGraphWrapper::setVertYDisp(double iDispY,VertexDescriptor verDis, SubGraph& l_graph )
  1359. {
  1360. l_graph[verDis].iVertYDisp = iDispY;
  1361. }
  1362. int BoostGraphWrapper :: getVertXDisp(VertexDescriptor verDis, SubGraph &l_graph)
  1363. {
  1364. return l_graph[verDis].iVertXDisp;
  1365. }
  1366. int BoostGraphWrapper :: getVertYDisp(VertexDescriptor verDis, SubGraph &l_graph)
  1367. {
  1368. return l_graph[verDis].iVertYDisp;
  1369. }
  1370. void BoostGraphWrapper::setVertexLock(VertexDescriptor verDis, SubGraph &l_graph)
  1371. {
  1372. l_graph[verDis].bIsVertexLocked = true;
  1373. }
  1374. bool BoostGraphWrapper::getIsVertexLocked(VertexDescriptor verDis, SubGraph &l_graph)
  1375. {
  1376. return l_graph[verDis].bIsVertexLocked;
  1377. }
  1378. void BoostGraphWrapper::setVertexClusterID(int iClusterID, VertexDescriptor vDisc, SubGraph& gSubgraph )
  1379. {
  1380. gSubgraph[vDisc].iClusterIdentifier = iClusterID;
  1381. }
  1382. int BoostGraphWrapper::getVertexClusterID(VertexDescriptor vDisc, SubGraph& gSubgraph )
  1383. {
  1384. return gSubgraph[vDisc].iClusterIdentifier;
  1385. }
  1386. int BoostGraphWrapper::getGraphClusterID(SubGraph &gSubgraph)
  1387. {
  1388. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1389. return mapGraphProp[&gSubgraph].iClusterID;
  1390. }
  1391. void BoostGraphWrapper::setGraphClusterID(int iClusterID, SubGraph& gSubgraph)
  1392. {
  1393. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1394. mapGraphProp[&gSubgraph].iClusterID = iClusterID;
  1395. }
  1396. bool BoostGraphWrapper::setIsVirtualNode(VertexDescriptor vertex, SubGraph &subgraph)
  1397. {
  1398. subgraph[vertex].bIsVirtualNode = true;
  1399. // XXX must return something - fixed
  1400. return true;
  1401. }
  1402. bool BoostGraphWrapper::getIsVirtualNode(VertexDescriptor vertex, SubGraph &subgraph)
  1403. {
  1404. return subgraph[vertex].bIsVirtualNode ;
  1405. }
  1406. int BoostGraphWrapper::getClusterXDisplacement(SubGraph& gSubgraph)
  1407. {
  1408. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1409. return mapGraphProp[&gSubgraph].iClusterXDisplacement;
  1410. }
  1411. void BoostGraphWrapper::setClusterXDisplacement(SubGraph& gSubgraph,int iDisp)
  1412. {
  1413. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1414. mapGraphProp[&gSubgraph].iClusterXDisplacement = iDisp;
  1415. }
  1416. int BoostGraphWrapper::getClusterYDisplacement(SubGraph& gSubgraph)
  1417. {
  1418. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1419. return mapGraphProp[&gSubgraph].iClusterYDisplacement;
  1420. }
  1421. void BoostGraphWrapper::setClusterYDisplacement(SubGraph& gSubgraph,int iDisp)
  1422. {
  1423. PGL_MAP_GRAPH_REF_PROPERTY(mapGraphProp , gSubgraph);
  1424. mapGraphProp[&gSubgraph].iClusterYDisplacement = iDisp;
  1425. }