Moka libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
boolean-operations.hh
Go to the documentation of this file.
1 /*
2  * lib-corefinement : Opérations de corafinement.
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-corefinement
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 #ifndef BOOLEAN_OPERATIONS_HH
25 #define BOOLEAN_OPERATIONS_HH
26 
27 #include "g-map-vertex.hh"
28 
38 
39 typedef enum {BO_Union, BO_Intersection,
41 
52 std::ostream & operator << (std::ostream & AStream, TBooleanOperation ABoolOp);
53 
55 
56 namespace GMap3d
57 {
58 
60 {
61 public:
62 
67 
79  CBooleanOperations(CGMapVertex * AMap, CDart * AObject1, CDart * AObject2,
80  bool ACalculateOrientation = true, int AVertexDI = -1);
81 
87  virtual ~CBooleanOperations();
88 
90 
95 
96  CDart * getObject1() const;
97  CDart * getObject2() const;
98 
99  void setObject1(CDart * AObject);
100  void setObject2(CDart * AObject);
101 
102  bool isComputationPossible() const;
103 
104  bool computeResults(std::bitset<NB_MARKS> ACopyMarks = 0);
105 
106  void markResult(TBooleanOperation AOperation, int AMark);
107  void markAllButResult(TBooleanOperation AOperation, int AMark);
108  void markResults(TBooleanOperation AOperation, int AKeepMark,
109  int ADiscardMark);
110 
111  CDart * getDartFromResult(TBooleanOperation AOperation);
112  CDart * getDartOutOfResult(TBooleanOperation AOperation);
113 
114  void keepResult(TBooleanOperation AOperation,
115  std::list<CDart*> * ACompoundList = NULL);
116  void keepAllButResult(TBooleanOperation AOperation,
117  std::list<CDart*> * ACompoundList = NULL);
118 
120 
121 protected:
122 
127 
128  CGMapVertex * getMap() const;
129 
130  int getObject1Mark() const;
131  int getObject2Mark() const;
132 
133  bool calculateOrientation() const;
134  int getVertexDI() const;
135 
136  void getMarkedCompounds(int AMark, std::list<CDart*> * AList);
137 
138  virtual bool corefineObjects(std::bitset<NB_MARKS> ACopyMarks) = 0;
139  virtual void extendMarks() = 0;
140 
142 
143 private:
144 
149 
150  CGMapVertex * FMap;
151 
152  CDart * FObject1;
153  CDart * FObject2;
154 
155  int FObject1Mark;
156  int FObject2Mark;
157 
158  bool FCalculateOrientation;
159  int FVertexDI;
160 
162 };
163 
164 } // namespace GMap3d
165 
166 #endif