1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: GEOMAlgo_GetInPlace.hxx
24 // Author: Peter KURNEV
26 #ifndef _GEOMAlgo_GetInPlace_HeaderFile
27 #define _GEOMAlgo_GetInPlace_HeaderFile
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Integer.hxx>
32 #include <Standard_Real.hxx>
33 #include <Standard_Boolean.hxx>
35 #include <TopAbs_ShapeEnum.hxx>
36 #include <TopoDS_Shape.hxx>
38 #include <NMTTools_CoupleOfShape.hxx>
39 #include <NMTTools_ListOfCoupleOfShape.hxx>
40 #include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
42 #include <GEOMAlgo_DataMapOfShapeMapOfShape.hxx>
43 #include <GEOMAlgo_GluerAlgo.hxx>
44 #include <GEOMAlgo_Algo.hxx>
45 #include <GEOMAlgo_DataMapOfShapePnt.hxx>
48 //=======================================================================
50 * The implementation of iterator of intersected shapes
51 * for Get In Place Algorithm.
52 * The intersection is in terms of 3D bounding boxes.
54 //=======================================================================
55 //class : GEOMAlgo_GetInPlaceIterator
57 //=======================================================================
58 class GEOMAlgo_GetInPlaceIterator {
64 GEOMAlgo_GetInPlaceIterator();
70 virtual ~GEOMAlgo_GetInPlaceIterator();
73 * Clear the internal content.
79 * Append the pair of intersected shapes.
81 * The pair of intersected shapes.
84 void AppendPair(const NMTTools_CoupleOfShape& theCS) ;
87 * Initialize the iterator.
89 * The type of (sub)shape What.
91 * The type of (sub)shape Where.
94 void Initialize(const TopAbs_ShapeEnum theT1,
95 const TopAbs_ShapeEnum theT2) ;
97 * Check the existence of pairs to iterare.
99 * Standard_True if there are pairs to iterare.
102 Standard_Boolean More() const;
105 * Shift to the next pair.
111 * Returns the pair of intersected shapes.
113 * The pair of intersected shapes.
116 const NMTTools_CoupleOfShape& Value() const;
119 Standard_Integer myDim;
120 NMTTools_ListOfCoupleOfShape myLists[10];
121 NMTTools_ListOfCoupleOfShape myEmptyList;
122 NMTTools_ListIteratorOfListOfCoupleOfShape myIterator;
128 //=======================================================================
130 * The implementation of Get In Place Algorithm.
131 * The algorithm provides the search the argument [What]
132 * in the shape [Where].
134 //=======================================================================
135 //class : GEOMAlgo_GetInPlace
137 //=======================================================================
138 class GEOMAlgo_GetInPlace : public GEOMAlgo_GluerAlgo,
146 GEOMAlgo_GetInPlace();
151 virtual ~GEOMAlgo_GetInPlace();
153 * Modifier. Sets the shape where the search is intended.
155 * The shape where the search is intended.
158 virtual void SetShapeWhere(const TopoDS_Shape& theShape) ;
161 * Selector. Returns the shape where the search is intended.
163 * The shape where the search is intended.
166 const TopoDS_Shape& ShapeWhere() const;
169 * Modifier. Sets the tolerance of mass.
171 * The value tolerance of mass.
174 void SetTolMass(const Standard_Real theTol) ;
177 * Selector. Returns the value tolerance of mass.
179 * The value tolerance of mass.
182 Standard_Real TolMass() const;
185 * Modifier. Sets the tolerance of center of gravily.
187 * The value tolerance of center of gravily.
190 void SetTolCG(const Standard_Real theTol) ;
193 * Selector. Returns the tolerance of center of gravily.
195 * The value tolerance of center of gravily.
198 Standard_Real TolCG() const;
201 * Perform the algorithm.
204 virtual void Perform() ;
207 * Returns state of the search.
209 * Standard_True if the argument is found.
212 Standard_Boolean IsFound() const;
218 virtual void CheckData() ;
221 * Clear the internal content.
224 virtual void Clear() ;
227 * Returns the map of shapes IN.
229 ** Returns the map of shapes IN.
230 * The Key - the (sub)shape of the argument [What].
231 * The Item- the (sub)shapes of the shape [Where] that have
232 * the state IN in respect of [What].
235 const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesIn() const;
238 * Returns the map of shapes ON.
240 * Returns the map of shapes ON.
241 * The Key - the (sub)shape of the argument [What].
242 * The Item- the (sub)shapes of the shape [Where] that have
243 * the state ON in respect of [What].
246 const GEOMAlgo_DataMapOfShapeMapOfShape& ShapesOn() const;
277 void FillSolidsOn() ;
289 void FillImagesCompound(const TopoDS_Shape& theS) ;
295 void CheckGProps(const TopoDS_Shape& theS) ;
298 void FillShapesIn(const TopoDS_Shape& theS1,
299 const TopoDS_Shape& theS2) ;
302 void FillShapesOn(const TopoDS_Shape& theS1,
303 const TopoDS_Shape& theS2) ;
306 Standard_Boolean CheckCoincidence(const TopoDS_Shape& theS1,
307 const TopoDS_Shape& theS2);
310 TopoDS_Shape myShapeWhere;
311 GEOMAlgo_GetInPlaceIterator myIterator;
312 GEOMAlgo_DataMapOfShapeMapOfShape myShapesIn;
313 GEOMAlgo_DataMapOfShapeMapOfShape myShapesOn;
314 Standard_Real myTolMass;
315 Standard_Real myTolCG;
316 Standard_Boolean myFound;
317 GEOMAlgo_DataMapOfShapePnt myMapShapePnt;