1 // Copyright (C) 2007-2023 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, or (at your option) any later version.
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 <BOPTools_AlgoTools.hxx>
36 #include <GEOMAlgo_BuilderShape.hxx>
39 //=======================================================================
40 //function : PrepareHistory
42 //=======================================================================
43 void GEOMAlgo_Gluer2::PrepareHistory()
47 GEOMAlgo_BuilderShape::PrepareHistory();
49 if(myShape.IsNull()) {
53 GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape);
57 //=======================================================================
58 //function : Generated
60 //=======================================================================
61 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& )
67 //=======================================================================
70 //=======================================================================
71 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
73 Standard_Boolean bIsDeleted, bHasImage, bToReverse;
74 TopAbs_ShapeEnum aType;
79 aType=theS.ShapeType();
80 if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
81 aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
85 bIsDeleted=IsDeleted(theS);
90 bHasImage=myOrigins.IsBound(theS);
95 aSim=myOrigins.Find(theS);
96 if (aSim.IsSame(theS)){
100 if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
101 aSim.Orientation(theS.Orientation());
104 bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
110 myHistShapes.Append(aSim);
115 //=======================================================================
116 //function : IsDeleted
118 //=======================================================================
119 Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS)
121 Standard_Boolean bRet, bContains, bHasImage;
129 bContains=myMapShape.Contains(theS);
134 bHasImage=myOrigins.IsBound(theS);
136 const TopoDS_Shape& aSim=myOrigins.Find(theS);
137 bContains=myMapShape.Contains(aSim);
146 //=======================================================================
147 //function : MapShapes
149 //=======================================================================
150 void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS,
151 TopTools_MapOfShape& theM)
156 aIt.Initialize(theS);
157 for (; aIt.More(); aIt.Next()) {
158 const TopoDS_Shape& aSx=aIt.Value();
159 GEOMAlgo_Gluer2::MapShapes(aSx, theM);