PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/src/contrib/geom-5.1.2.7/src/ShHealOper/ShHealOper_ChangeOrientation.cpp

http://pythonocc.googlecode.com/
C++ | 88 lines | 42 code | 11 blank | 35 comment | 14 complexity | 59fc6ef0b537db971af83979f29a5bb9 MD5 | raw file
 1// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 2// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 3// 
 4// This library is free software; you can redistribute it and/or
 5// modify it under the terms of the GNU Lesser General Public
 6// License as published by the Free Software Foundation; either 
 7// version 2.1 of the License.
 8// 
 9// This library is distributed in the hope that it will be useful 
10// but WITHOUT ANY WARRANTY; without even the implied warranty of 
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12// Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public  
15// License along with this library; if not, write to the Free Software 
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17//
18// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19//
20//
21// File:      ShHealOper_ChangeOrientation.cxx
22// Created:   11.07.06 11:46:45
23// Author:    Sergey KUUL
24
25
26#include <ShHealOper_ChangeOrientation.hxx>
27
28#include <BRep_Builder.hxx>
29#include <TopoDS_Iterator.hxx>
30
31//=======================================================================
32//function : ShHealOper_ChangeOrientation()
33//purpose  : Constructor
34//=======================================================================
35
36ShHealOper_ChangeOrientation::ShHealOper_ChangeOrientation ( const TopoDS_Shape& theShape )
37{
38  Init(theShape);
39}
40
41//=======================================================================
42//function : Init
43//purpose  : 
44//=======================================================================
45
46void ShHealOper_ChangeOrientation::Init(const TopoDS_Shape& theShape)
47{
48  ShHealOper_Tool::Init(theShape);
49}
50
51//=======================================================================
52//function : Perform
53//purpose  : 
54//=======================================================================
55
56Standard_Boolean ShHealOper_ChangeOrientation::Perform()
57{
58  BRep_Builder B;
59  if (myInitShape.ShapeType() == TopAbs_SHELL) {
60    myResultShape = myInitShape.EmptyCopied();
61    TopoDS_Iterator itr(myInitShape);
62    while (itr.More()) {
63      B.Add(myResultShape,itr.Value().Reversed());
64      itr.Next();
65    }
66  }
67  else if (myInitShape.ShapeType() == TopAbs_FACE) {
68    myResultShape = myInitShape.EmptyCopied();
69    TopoDS_Iterator itr(myInitShape);
70    while (itr.More()) {
71      B.Add(myResultShape,itr.Value());
72      itr.Next();
73    }
74    myResultShape.Reverse();
75  }
76  else if (myInitShape.ShapeType() == TopAbs_WIRE) {
77    myResultShape = myInitShape.Reversed();
78  }
79  else if (myInitShape.ShapeType() == TopAbs_EDGE) {
80    myResultShape = myInitShape.Reversed();
81  }
82  else {
83    return false;
84  }
85
86  return true;
87
88}