Tulip  5.1.0
Large graphs analysis and drawing
Ordering.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef ORDERING_H
22 #define ORDERING_H
23 #include <tulip/Face.h>
24 //#include <tulip/PlanarConMap.h>
25 #include <tulip/Node.h>
26 #include <tulip/Edge.h>
27 //#include <vector>
28 //#include <map>
29 
30 #include <tulip/MutableContainer.h>
31 
32 namespace tlp {
33 class PluginProgress;
34 class PlanarConMap;
35 
36 class TLP_SCOPE Ordering {
37 public :
38 
39  typedef struct FaceAndPos_ {
40  Face face;
41  node n_first;
42  node n_last;
43  } FaceAndPos;
44 
45  std::vector<edge> getDummyEdges() {
46  return dummy_edge;
47  }
48 
49  Ordering(PlanarConMap * G, PluginProgress* pluginProgress = 0,
50  int minProgress = 0, int deltaProgress = 0, int maxProgress = 0);
51  ~Ordering();
52 // inline void push_back(std::vector<node> nodeVector) {
53  inline size_t size() {
54  return _data.size();
55  }
56  inline std::vector<node> operator[](const unsigned int i) const {
57  return _data[i];
58  }
59  inline std::vector<node>& operator[](const unsigned int i) {
60  return _data[i];
61  }
62 
63 private :
64  std::vector<std::vector<node> > _data;
65  PlanarConMap * Gp;
66  MutableContainer<int> oute;
67  MutableContainer<int> outv;
68  MutableContainer<bool> visitedNodes;
69  MutableContainer<bool> visitedFaces;
70  MutableContainer<bool> markedFaces;
71  MutableContainer<int> seqP;
72  MutableContainer<bool> isOuterFace;
73  MutableContainer<bool> contour;
74  MutableContainer<bool> is_selectable;
75  MutableContainer<bool> is_selectable_visited;
76  MutableContainer<bool> is_selectable_face;
77  MutableContainer<bool> is_selectable_visited_face;
78  MutableContainer<node> left;
79  MutableContainer<node> right;
80  bool existMarkedF;
81  FaceAndPos minMarkedFace ;
82  Face ext;
83  std::vector<node> v1;
84  std::vector<edge> dummy_edge;
85 
86  node getLastOfQ(Face f, node prec, node n, edge e);
87  node getLastOfP(Face f, node prec, node n,edge e);
88  std::vector<node> getPathFrom(std::vector<node> fn, int from);
89  int infFaceSize();
90 
91  void updateOutAndVisitedFaces(Face f);
92  void updateContourLeftRight(node prec, node n, edge e, node last);
93  void updateNewSelectableNodes(node node_f, node no_tmp2,edge ed_tmp, node node_last,std::vector<Face> v_faces, bool one_face = false, bool was_visited = false, bool selection_face = false);
94  void updateSelectableFaces(std::vector<Face> v_faces);
95 
96  int seqp(Face f);
97  void minMarkedf();
98  void setMinMarkedFace(Face f);
99 
100  struct augmentableAndNodes_ getAugAndNodes(Face f);
101  void augment(Face f, node prec, node n, node prec_last, node last, int nbNewFace, bool pair);
102  void selectAndUpdate(Face f);
103  void selectAndUpdate(node n);
104  bool isSelectable(node n);
105 
106  void init();
107  void init_v1(std::vector<node> fn);
108  void init_selectableNodes();
109  void init_selectableFaces();
110  void init_outv_oute();
111  void init_seqP();
112  void init_outerface();
113 
114 };
115 
116 }
117 #endif
118 
119 ///@endcond