1 // Copyright (C) 2007-2013 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 <BOPTools_AlgoTools.hxx>
36 #include <GEOMAlgo_BuilderShape.hxx>
38 //=======================================================================
39 //function : PrepareHistory
41 //=======================================================================
42 void GEOMAlgo_Gluer2::PrepareHistory()
44 //Standard_Boolean bHasImage, bContainsSD;
47 GEOMAlgo_BuilderShape::PrepareHistory();
49 if(myShape.IsNull()) {
53 GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape);
56 //=======================================================================
57 //function : Generated
59 //=======================================================================
60 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& )
65 //=======================================================================
68 //=======================================================================
69 const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
71 Standard_Boolean bIsDeleted, bHasImage, bToReverse;
72 TopAbs_ShapeEnum aType;
77 aType=theS.ShapeType();
78 if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
79 aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
83 bIsDeleted=IsDeleted(theS);
88 bHasImage=myOrigins.IsBound(theS);
93 aSim=myOrigins.Find(theS);
94 if (aSim.IsSame(theS)){
98 if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
99 aSim.Orientation(theS.Orientation());
102 bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aSim, theS, myContext);
108 myHistShapes.Append(aSim);
112 //=======================================================================
113 //function : IsDeleted
115 //=======================================================================
116 Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS)
118 Standard_Boolean bRet, bContains, bHasImage;
126 bContains=myMapShape.Contains(theS);
131 bHasImage=myOrigins.IsBound(theS);
133 const TopoDS_Shape& aSim=myOrigins.Find(theS);
134 bContains=myMapShape.Contains(aSim);
142 //=======================================================================
143 //function : MapShapes
145 //=======================================================================
146 void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS,
147 TopTools_MapOfShape& theM)
152 aIt.Initialize(theS);
153 for (; aIt.More(); aIt.Next()) {
154 const TopoDS_Shape& aSx=aIt.Value();
155 GEOMAlgo_Gluer2::MapShapes(aSx, theM);