1 // Created on: 1996-12-30
2 // Created by: Stagiaire Mary FABIEN
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRep_Builder.hxx>
19 #include <BRepBuilderAPI_GTransform.hxx>
20 #include <BRepBuilderAPI_NurbsConvert.hxx>
21 #include <BRepTools_GTrsfModification.hxx>
22 #include <BRepTools_NurbsConvertModification.hxx>
24 #include <gp_GTrsf.hxx>
25 #include <Standard_NoSuchObject.hxx>
27 #include <TopoDS_Shape.hxx>
28 #include <TopTools_ListIteratorOfListOfShape.hxx>
29 #include <TopTools_ListOfShape.hxx>
31 //=======================================================================
32 //function : BRepBuilderAPI_GTransform
34 //=======================================================================
35 BRepBuilderAPI_GTransform::BRepBuilderAPI_GTransform (const gp_GTrsf& T) :
38 myModification = new BRepTools_GTrsfModification(T);
42 //=======================================================================
43 //function : BRepBuilderAPI_GTransform
45 //=======================================================================
47 BRepBuilderAPI_GTransform::BRepBuilderAPI_GTransform (const TopoDS_Shape& S,
49 const Standard_Boolean Copy) :
52 myModification = new BRepTools_GTrsfModification(T);
58 //=======================================================================
61 //=======================================================================
63 void BRepBuilderAPI_GTransform::Perform(const TopoDS_Shape& S,
64 const Standard_Boolean Copy)
66 BRepBuilderAPI_NurbsConvert nc;
69 TopoDS_Shape Slocal = nc.Shape();
70 Handle(BRepTools_GTrsfModification) theModif =
71 Handle(BRepTools_GTrsfModification)::DownCast(myModification);
72 theModif->GTrsf() = myGTrsf;
73 DoModif(Slocal,myModification);
74 // myHist.Filter (Shape());
78 //=======================================================================
81 //=======================================================================
83 const TopTools_ListOfShape& BRepBuilderAPI_GTransform::Modified
84 (const TopoDS_Shape& F)
87 const TopTools_DataMapOfShapeListOfShape& M = myHist.Modification();
89 TopTools_ListOfShape Li;
90 TopTools_ListIteratorOfListOfShape itL(M(F));
91 for (;itL.More();itL.Next())
92 Li.Assign(BRepBuilderAPI_ModifyShape::Modified(itL.Value()));
98 //=======================================================================
99 //function : ModifiedShape
101 //=======================================================================
103 TopoDS_Shape BRepBuilderAPI_GTransform::ModifiedShape
104 (const TopoDS_Shape& S) const
106 const TopTools_DataMapOfShapeListOfShape &aMapModif = myHist.Modification();
107 TopoDS_Shape aShape = S;
109 if (aMapModif.IsBound(S)) {
110 const TopTools_ListOfShape &aListModShape = aMapModif(S);
111 Standard_Integer aNbShapes = aListModShape.Extent();
114 aShape = aListModShape.First();
117 return BRepBuilderAPI_ModifyShape::ModifiedShape(aShape);