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_GetInPlaceIterator.cxx
24 // Author: Peter KURNEV
26 #include <GEOMAlgo_GetInPlace.hxx>
28 #include <NMTTools_CoupleOfShape.hxx>
31 Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
32 const TopAbs_ShapeEnum aType2);
34 //=======================================================================
37 //=======================================================================
38 GEOMAlgo_GetInPlaceIterator::GEOMAlgo_GetInPlaceIterator()
42 //=======================================================================
45 //=======================================================================
46 GEOMAlgo_GetInPlaceIterator::~GEOMAlgo_GetInPlaceIterator()
49 //=======================================================================
52 //=======================================================================
53 void GEOMAlgo_GetInPlaceIterator::Clear()
57 for (i=0; i<myDim; ++i) {
61 //=======================================================================
62 //function : AppendPair
64 //=======================================================================
65 void GEOMAlgo_GetInPlaceIterator::AppendPair(const NMTTools_CoupleOfShape& theCS)
68 TopAbs_ShapeEnum aType1, aType2;
70 const TopoDS_Shape& aS1=theCS.Shape1();
71 const TopoDS_Shape& aS2=theCS.Shape2();
72 aType1=aS1.ShapeType();
73 aType2=aS2.ShapeType();
75 iX=TypeToInteger(aType1, aType2);
77 myLists[iX].Append(theCS);
80 //=======================================================================
81 //function : ShapeWhere
83 //=======================================================================
84 void GEOMAlgo_GetInPlaceIterator::Initialize(const TopAbs_ShapeEnum aType1,
85 const TopAbs_ShapeEnum aType2)
89 iX=TypeToInteger(aType1, aType2);
91 myIterator.Initialize(myLists[iX]);
94 myIterator.Initialize(myEmptyList);
97 //=======================================================================
100 //=======================================================================
101 Standard_Boolean GEOMAlgo_GetInPlaceIterator::More()const
103 return myIterator.More();
105 //=======================================================================
108 //=======================================================================
109 void GEOMAlgo_GetInPlaceIterator::Next()
113 //=======================================================================
116 //=======================================================================
117 const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const
119 return myIterator.Value();
121 //=======================================================================
122 //function : TypeToInteger
124 //=======================================================================
125 Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
126 const TopAbs_ShapeEnum aType2)
128 Standard_Integer iRet;
132 if (aType1==TopAbs_VERTEX) {
133 if (aType2==TopAbs_VERTEX) {
137 else if (aType1==TopAbs_EDGE) {
138 if (aType2==TopAbs_VERTEX) {
141 else if (aType2==TopAbs_EDGE) {
145 else if (aType1==TopAbs_FACE) {
146 if (aType2==TopAbs_VERTEX) {
149 else if (aType2==TopAbs_EDGE) {
152 else if (aType2==TopAbs_FACE) {
157 else if (aType1==TopAbs_SOLID) {
158 if (aType2==TopAbs_VERTEX) {
161 else if (aType2==TopAbs_EDGE) {
164 else if (aType2==TopAbs_FACE) {
167 else if (aType2==TopAbs_SOLID) {