/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. #include <ShHealOper_ChangeOrientation.hxx>
  25. #include <BRep_Builder.hxx>
  26. #include <TopoDS_Iterator.hxx>
  27. //=======================================================================
  28. //function : ShHealOper_ChangeOrientation()
  29. //purpose : Constructor
  30. //=======================================================================
  31. ShHealOper_ChangeOrientation::ShHealOper_ChangeOrientation ( const TopoDS_Shape& theShape )
  32. {
  33. Init(theShape);
  34. }
  35. //=======================================================================
  36. //function : Init
  37. //purpose :
  38. //=======================================================================
  39. void ShHealOper_ChangeOrientation::Init(const TopoDS_Shape& theShape)
  40. {
  41. ShHealOper_Tool::Init(theShape);
  42. }
  43. //=======================================================================
  44. //function : Perform
  45. //purpose :
  46. //=======================================================================
  47. Standard_Boolean ShHealOper_ChangeOrientation::Perform()
  48. {
  49. BRep_Builder B;
  50. if (myInitShape.ShapeType() == TopAbs_SHELL) {
  51. myResultShape = myInitShape.EmptyCopied();
  52. TopoDS_Iterator itr(myInitShape);
  53. while (itr.More()) {
  54. B.Add(myResultShape,itr.Value().Reversed());
  55. itr.Next();
  56. }
  57. }
  58. else if (myInitShape.ShapeType() == TopAbs_FACE) {
  59. myResultShape = myInitShape.EmptyCopied();
  60. TopoDS_Iterator itr(myInitShape);
  61. while (itr.More()) {
  62. B.Add(myResultShape,itr.Value());
  63. itr.Next();
  64. }
  65. myResultShape.Reverse();
  66. }
  67. else if (myInitShape.ShapeType() == TopAbs_WIRE) {
  68. myResultShape = myInitShape.Reversed();
  69. }
  70. else if (myInitShape.ShapeType() == TopAbs_EDGE) {
  71. myResultShape = myInitShape.Reversed();
  72. }
  73. else {
  74. return false;
  75. }
  76. return true;
  77. }