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
23 // File: ShHealOper_ChangeOrientation.cxx
24 // Created: 11.07.06 11:46:45
25 // Author: Sergey KUUL
27 #include <ShHealOper_ChangeOrientation.hxx>
29 #include <BRep_Builder.hxx>
30 #include <BRepBuilderAPI_Copy.hxx>
32 #include <TopoDS_Iterator.hxx>
34 //=======================================================================
35 //function : ShHealOper_ChangeOrientation()
36 //purpose : Constructor
37 //=======================================================================
39 ShHealOper_ChangeOrientation::ShHealOper_ChangeOrientation ( const TopoDS_Shape& theShape )
44 //=======================================================================
47 //=======================================================================
49 void ShHealOper_ChangeOrientation::Init(const TopoDS_Shape& theShape)
51 ShHealOper_Tool::Init(theShape);
54 //=======================================================================
57 //=======================================================================
59 Standard_Boolean ShHealOper_ChangeOrientation::Perform()
62 if (myInitShape.ShapeType() == TopAbs_SHELL) {
63 myResultShape = myInitShape.EmptyCopied();
64 TopoDS_Iterator itr (myInitShape);
66 B.Add(myResultShape,itr.Value().Reversed());
70 else if (myInitShape.ShapeType() == TopAbs_FACE) {
71 myResultShape = myInitShape.EmptyCopied();
72 TopoDS_Iterator itr (myInitShape);
74 B.Add(myResultShape,itr.Value());
77 myResultShape.Reverse();
79 else if ( myInitShape.ShapeType() == TopAbs_WIRE || myInitShape.ShapeType() == TopAbs_EDGE) {
80 myResultShape = myInitShape.EmptyCopied();
81 TopoDS_Iterator itr (myInitShape);
83 B.Add(myResultShape,itr.Value());
86 myResultShape.Reverse();
89 BRepBuilderAPI_Copy Copy (myInitShape);
90 if (!Copy.IsDone()) return false;
92 myResultShape = Copy.Shape();
93 if (myResultShape.IsNull()) return false;
95 if (myResultShape.Orientation() == TopAbs_FORWARD)
96 myResultShape.Orientation(TopAbs_REVERSED);
98 myResultShape.Orientation(TopAbs_FORWARD);