1 // Copyright (C) 2007-2011 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_Gluer2_2.cxx
24 // Author: Peter KURNEV
27 #include <GEOMAlgo_Gluer2.hxx>
29 #include <TopAbs_ShapeEnum.hxx>
31 #include <TopoDS_Iterator.hxx>
32 #include <TopoDS_Shape.hxx>
34 #include <GEOMAlgo_BuilderShape.hxx>
35 #include <GEOMAlgo_Tools3D.hxx>
37 //=======================================================================
38 //function : PrepareHistory
40 //=======================================================================
41 void GEOMAlgo_Gluer2::PrepareHistory()
43 //Standard_Boolean bHasImage, bContainsSD;
46 GEOMAlgo_BuilderShape::PrepareHistory();
48 if(myShape.IsNull()) {
52 GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape);
55 //=======================================================================
56 //function : Generated
58 //=======================================================================
59 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& )
64 //=======================================================================
67 //=======================================================================
68 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
70 Standard_Boolean bIsDeleted, bHasImage, bToReverse;
71 TopAbs_ShapeEnum aType;
76 aType=theS.ShapeType();
77 if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
78 aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
82 bIsDeleted=IsDeleted(theS);
87 bHasImage=myOrigins.IsBound(theS);
92 aSim=myOrigins.Find(theS);
93 if (aSim.IsSame(theS)){
97 if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
98 aSim.Orientation(theS.Orientation());
101 bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
107 myHistShapes.Append(aSim);
111 //=======================================================================
112 //function : IsDeleted
114 //=======================================================================
115 Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS)
117 Standard_Boolean bRet, bContains, bHasImage;
125 bContains=myMapShape.Contains(theS);
130 bHasImage=myOrigins.IsBound(theS);
132 const TopoDS_Shape& aSim=myOrigins.Find(theS);
133 bContains=myMapShape.Contains(aSim);
141 //=======================================================================
142 //function : MapShapes
144 //=======================================================================
145 void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS,
146 TopTools_MapOfShape& theM)
151 aIt.Initialize(theS);
152 for (; aIt.More(); aIt.Next()) {
153 const TopoDS_Shape& aSx=aIt.Value();
154 GEOMAlgo_Gluer2::MapShapes(aSx, theM);