Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
operations-topology.cc
Go to the documentation of this file.
1 /*
2  * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler-gmap
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include "g-map-vertex.hh"
26 #include "compute-homology.hh"
27 #include "controler-gmap.hh"
28 #include <cassert>
29 
30 using namespace GMap3d;
31 using namespace std;
32 //******************************************************************************
34 {
35  unsigned int nb=FMap->countNonLocalDegreeTwoEdges();
36  if (nb==0)
37  {
38  setMessage("No edge with local degre > 2: "
39  "the map is a 2D quasi manifold.");
40  }
41  else
42  {
43  if (nb==1)
44  setMessage("1 edge with local degre > 2: "
45  "the map is NOT a 2D quasi manifold.");
46  else
47  setMessage(nb," edges with local degre > 2: "
48  "the map is NOT a 2D quasi manifold.");
49  }
50  return nb;
51 }
52 //******************************************************************************
54  int* ANbVertices, int* ANbEdges,
55  int* ANbFaces, int* ANbVolumes,
56  int* ANbCC,
57  int* ANb0Borders, int* ANb1Borders,
58  int* ANb2Borders, int* ANb3Borders)
59 {
60  FMap->getGlobalCharacteristics(ANbDarts,
61  ANbVertices, ANbEdges, ANbFaces, ANbVolumes,
62  ANbCC,
63  ANb0Borders, ANb1Borders, ANb2Borders,
64  ANb3Borders);
65 }
66 //******************************************************************************
68  int* ANbDarts,
69  int* ANbVertices, int* ANbEdges,
70  int* ANbFaces,
71  int* ANb0Borders, int* ANb1Borders,
72  int* ANb2Borders,
73  int* ANb2BordersWhenClosed,
74  int* AEuler, int* AOrient,
75  int* AGenus)
76 {
77  // Caractéristiques de l'objet pointé:
78  CDart* root;
79  CDart* last = FParameterSelection->getLastSelectedDart();
80 
81  int n = FMap->getMarkedCells(ORBIT_VOLUME,
82  FParameterSelection->getSelectionMark(),
83  last, & root);
84 
85  bool ok = n==1 || (n>1 && last != NULL);
86 
87  if (ok)
88  {
89  int nb2WhenClosed;
90  int orient;
91  int genus;
92 
93  int* pNb2WhenClosed = ANb2BordersWhenClosed;
94  int* pOrient = AOrient;
95  int* pGenus = AGenus;
96 
97  if (AName == NULL)
98  {
99  if (pNb2WhenClosed == NULL) pNb2WhenClosed = & nb2WhenClosed;
100  if (pOrient == NULL) pOrient = & orient ;
101  if (pGenus == NULL) pGenus = & genus ;
102  }
103 
104  FMap->getSurfaceCharacteristics(root, ANbDarts,
105  ANbVertices, ANbEdges, ANbFaces,
106  ANb0Borders, ANb1Borders, ANb2Borders,
107  pNb2WhenClosed,
108  AEuler, pOrient, pGenus);
109 
110  if (AName != NULL)
111  *AName = treatAccent(FMap->getSurfaceName(*pNb2WhenClosed, *pOrient,
112  *pGenus));
113  }
114 
115  return ok;
116 }
117 //******************************************************************************