Salome HOME
Implementation of change orientation in Repair in GEOM.
authorskl <skl@opencascade.com>
Thu, 13 Jul 2006 10:12:22 +0000 (10:12 +0000)
committerskl <skl@opencascade.com>
Thu, 13 Jul 2006 10:12:22 +0000 (10:12 +0000)
idl/GEOM_Gen.idl
src/GEOMContext/GEOM_icons.po
src/GEOMGUI/GEOM_images.po
src/GEOMGUI/GEOM_msg_en.po
src/GEOMGUI/GeometryGUI.cxx
src/GEOM_I/GEOM_IHealingOperations_i.cc
src/GEOM_I/GEOM_IHealingOperations_i.hh
src/GEOM_SWIG/geompy.py
src/ShHealOper/Makefile.in
src/ShHealOper/ShHealOper_ChangeOrientation.cxx [new file with mode: 0644]
src/ShHealOper/ShHealOper_ChangeOrientation.hxx [new file with mode: 0644]

index dec1d38cb0bc5f2df6fff693263490c48de09860..6f3652d8c25c62d6e25fd2e1277fd1de339f5a19 100644 (file)
@@ -1894,6 +1894,15 @@ module GEOM
     boolean GetFreeBoundary (in GEOM_Object theObject,
                             out ListOfGO theClosedWires,
                             out ListOfGO theOpenWires);
+
+    /*!
+     *  Change orientation of the given object.
+     *  \param theObject Shape to be processed.
+     *  \return New GEOM_Object, containing processed shape.
+     */
+    GEOM_Object ChangeOrientation (in GEOM_Object theObject);
+    GEOM_Object ChangeOrientationCopy (in GEOM_Object theObject);
+
   };
 
   /*!
index 0bd0c46ee25139ec03701ea31036b89413f6c5e7..996122d66220d42e948f72ed3afc45310afc2c6c 100644 (file)
@@ -337,6 +337,10 @@ msgstr "supresshole.png"
 msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL"
 msgstr "supressHolesOnFaceShell.png"
 
+#ChangeOrientationDlg
+msgid "ICON_DLG_CHANGE_ORIENTATION"
+msgstr "change_orientation.png"
+
 #MultiTranslationDlg
 msgid "ICON_DLG_MULTITRANSLATION_SIMPLE"
 msgstr "multitranslationsimple.png"
index bd3321fd23b02b6f87ea0f0f7c48757e67496eaa..e8132904a24960db31ec80034607aa42f9e8c99e 100644 (file)
@@ -307,6 +307,10 @@ msgstr "pointonedge.png"
 msgid "ICON_DLG_SEWING"
 msgstr "sewing.png"
 
+#ChangeOrientationDlg
+msgid "ICON_DLG_CHANGE_ORIENTATION"
+msgstr "change_orientation.png"
+
 #PipeDlg
 msgid "ICON_DLG_PIPE"
 msgstr "pipe.png"
@@ -701,6 +705,9 @@ msgstr "free_bound.png"
 msgid "ICO_CHECK_FREE_FACES"
 msgstr "free_faces.png"
 
+msgid "ICO_CHANGE_ORIENTATION"
+msgstr "change_orientation.png"
+
 msgid "ICO_POINT_COORDS"
 msgstr "point_coord.png"
 
index 80750baff3efc40a6603d8827e8439154e645d46..8bbe3cae2756e889093b868749b304ae5afe4305 100644 (file)
@@ -1642,6 +1642,12 @@ msgstr "Free boundaries"
 msgid "GEOM_FREE_FACES"
 msgstr "Free faces"
 
+msgid "GEOM_CHANGE_ORIENTATION_TITLE"
+msgstr "Change orientation"
+
+msgid "GEOM_CHANGE_ORIENTATION"
+msgstr "Objects to change orientation"
+
 msgid "GEOM_BY_PARAMETER"
 msgstr "By parameter"
 
@@ -1988,6 +1994,9 @@ msgstr "ProcessShape"
 msgid "SUPRESS_FACE_NEW_OBJ_NAME"
 msgstr "SupressFaces"
 
+msgid "CHANGE_ORIENTATION_NEW_OBJ_NAME"
+msgstr "Invert"
+
 msgid "NON_GEOM_OBJECTS_SELECTED"
 msgstr "There are objects selected which do not belong to %1 component."
 
@@ -2613,6 +2622,15 @@ msgstr "Check free faces"
 msgid "STB_CHECK_FREE_FACES"
 msgstr "Check free faces"
 
+msgid "TOP_CHANGE_ORIENTATION"
+msgstr "Change orientation"
+
+msgid "MEN_CHANGE_ORIENTATION"
+msgstr "Change orientation"
+
+msgid "STB_CHANGE_ORIENTATION"
+msgstr "Change orientation"
+
 msgid "MEN_MEASURES"
 msgstr "Measures"
 
index bced30d609ff13cbab8492b1eb0579a72b2f16c1..8db643a1705d5ecc28dcd03d33094bc0f0deaad0 100644 (file)
@@ -503,6 +503,7 @@ void GeometryGUI::OnGUIEvent( int id )
            id == 608 ||   // MENU REPAIR - ADD POINT ON EDGE
            id == 609 ||   // MENU REPAIR - FREE BOUNDARIES
            id == 610 ||   // MENU REPAIR - FREE FACES
+           id == 611 ||   // MENU REPAIR - CHANGE ORIENTATION
           id == 602 ) {  // MENU REPAIR - GLUE FACES
 #ifndef WNT
        library = getLibrary( "libRepairGUI.so" );
@@ -829,6 +830,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( 608, "POINT_ON_EDGE" );
   createGeomAction( 609, "CHECK_FREE_BNDS" );
   createGeomAction( 610, "CHECK_FREE_FACES" );
+  createGeomAction( 611, "CHANGE_ORIENTATION" );
   
   createGeomAction( 708, "POINT_COORDS" );
   createGeomAction( 701, "BASIC_PROPS" );
@@ -971,6 +973,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( 608, repairId, -1 );  
   createMenu( 609, repairId, -1 );  
   createMenu( 610, repairId, -1 );  
+  createMenu( 611, repairId, -1 );  
 
   int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
   createMenu( 708, measurId, -1 );  
index a3dc9b4aa491b3c69149e789ee0d36cc9382ab54..cdd3f1efec13f02368601a86dfef46afbaa98045 100644 (file)
@@ -454,3 +454,71 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt
 
   return true;
 }
+
+
+//=============================================================================
+/*!
+ *  ChangeOrientation
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_Object_ptr theObject)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Check parameters
+  if ( CORBA::is_nil(theObject) )
+    return aGEOMObject._retn();
+
+  aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
+
+  // Get the object itself
+  Handle(GEOM_Object) anObject =
+    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  if (anObject.IsNull())
+    return aGEOMObject._retn();
+
+  // Perform
+//  Handle(GEOM_Object) aNewObject =
+    GetOperations()->ChangeOrientation( anObject );
+//  if (!GetOperations()->IsDone() || aNewObject.IsNull())
+//    return aGEOMObject._retn();
+
+  //return GetObject(aNewObject);
+  return aGEOMObject._retn();  
+}
+
+
+//=============================================================================
+/*!
+ *  ChangeOrientationCopy
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  // Check parameters
+  if ( CORBA::is_nil(theObject) )
+    return aGEOMObject._retn();
+
+  // Get the object itself
+  Handle(GEOM_Object) anObject =
+    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  if (anObject.IsNull())
+    return aGEOMObject._retn();
+
+  // Perform
+  Handle(GEOM_Object) aNewObject =
+    GetOperations()->ChangeOrientationCopy( anObject );
+  if (!GetOperations()->IsDone() || aNewObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(aNewObject);
+}
+
index 5314af087afd92121e33dd51f4bf2715b890c691..ca859dc504176ee0ba76feca0d030ebba38dfec3 100644 (file)
@@ -61,6 +61,9 @@ class GEOM_IHealingOperations_i :
 
    CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires );
    
+   GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject);
+   GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject);
+
    ::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); }
 
 private:
index 0a231ab7358b09717221365afc3a777ab8a6b129..d22a825a4d73e55cae9c7d7dfa840b9cff6604ea 100644 (file)
@@ -1199,6 +1199,23 @@ def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
       print "DivideEdge : ", HealOp.GetErrorCode()
     return anObj
 
+## Change orientation of the given object.
+#  @param theObject Shape to be processed.
+#  @update given shape
+def ChangeOrientation(theObject):
+    theObject = HealOp.ChangeOrientation(theObject)
+    if HealOp.IsDone() == 0:
+      print "ChangeOrientation : ", HealOp.GetErrorCode()
+
+## Change orientation of the given object.
+#  @param theObject Shape to be processed.
+#  @return New GEOM_Object, containing processed shape.
+def ChangeOrientationCopy(theObject):
+    anObj = HealOp.ChangeOrientation(theObject)
+    if HealOp.IsDone() == 0:
+      print "ChangeOrientation : ", HealOp.GetErrorCode()
+    return anObj
+
 ## Get a list of wires (wrapped in GEOM_Object-s),
 #  that constitute a free boundary of the given shape.
 #  @param theObject Shape to get free boundary of.
index f164e12eb3a91694d23a23dbe2c1d4342dcd5fac..2497fc526648d97239c6f0d342ec576a1ef0f81c 100644 (file)
@@ -47,6 +47,7 @@ LIB_SRC = \
        ShHealOper_ShapeProcess.cxx \
        ShHealOper_SplitCurve2d.cxx \
        ShHealOper_SplitCurve3d.cxx \
+       ShHealOper_ChangeOrientation.cxx \
        ShHealOper_Tool.cxx \
 
 LIB_CLIENT_IDL = 
@@ -64,6 +65,7 @@ EXPORT_HEADERS = \
        ShHealOper_SpiltCurve2d.hxx \
        ShHealOper_SplitCurve2d.hxx \
        ShHealOper_SplitCurve3d.hxx \
+       ShHealOper_ChangeOrientation.hxx \
        ShHealOper_Tool.hxx
 
 # idl files
diff --git a/src/ShHealOper/ShHealOper_ChangeOrientation.cxx b/src/ShHealOper/ShHealOper_ChangeOrientation.cxx
new file mode 100644 (file)
index 0000000..0bd3c97
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:      ShHealOper_ChangeOrientation.cxx
+// Created:   11.07.06 11:46:45
+// Author:    Sergey KUUL
+
+
+#include <ShHealOper_ChangeOrientation.hxx>
+
+#include <BRep_Builder.hxx>
+#include <TopoDS_Iterator.hxx>
+
+//=======================================================================
+//function : ShHealOper_ChangeOrientation()
+//purpose  : Constructor
+//=======================================================================
+
+ShHealOper_ChangeOrientation::ShHealOper_ChangeOrientation ( const TopoDS_Shape& theShape )
+{
+  Init(theShape);
+}
+
+//=======================================================================
+//function : Init
+//purpose  : 
+//=======================================================================
+
+void ShHealOper_ChangeOrientation::Init(const TopoDS_Shape& theShape)
+{
+  ShHealOper_Tool::Init(theShape);
+}
+
+//=======================================================================
+//function : Perform
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean ShHealOper_ChangeOrientation::Perform()
+{
+  if (myInitShape.ShapeType() == TopAbs_SHELL) {
+    BRep_Builder B;
+    myResultShape = myInitShape.EmptyCopied();
+    TopoDS_Iterator itr(myInitShape);
+    while (itr.More()) {
+      B.Add(myResultShape,itr.Value().Reversed());
+      itr.Next();
+    }
+  }
+  else if (myInitShape.ShapeType() == TopAbs_FACE) {
+    myResultShape = myInitShape.Reversed();
+  }
+  else if (myInitShape.ShapeType() == TopAbs_WIRE) {
+    myResultShape = myInitShape.Reversed();
+  }
+  else if (myInitShape.ShapeType() == TopAbs_EDGE) {
+    myResultShape = myInitShape.Reversed();
+  }
+  else {
+    return false;
+  }
+
+  return true;
+
+}
diff --git a/src/ShHealOper/ShHealOper_ChangeOrientation.hxx b/src/ShHealOper/ShHealOper_ChangeOrientation.hxx
new file mode 100644 (file)
index 0000000..fe6ee94
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:      ShHealOper_ChangeOrientation.hxx
+// Created:   11.07.06 11:22:26
+// Author:    Sergey KUUL
+
+
+#ifndef ShHealOper_ChangeOrientation_HeaderFile
+#define ShHealOper_ChangeOrientation_HeaderFile
+
+#include <MMgt_TShared.hxx>
+#include <ShHealOper_Tool.hxx>
+#include <TopoDS_Shape.hxx>
+
+///  Class ShHealOper_ChangeOrientation
+// Intended for change orientation of given shape
+// if shape is Shell - create empty copy and put to it
+//                     each face as Reversed()
+
+class ShHealOper_ChangeOrientation : public ShHealOper_Tool
+{
+ public:
+  // ---------- PUBLIC METHODS ----------
+
+  /// Empty constructor
+  Standard_EXPORT ShHealOper_ChangeOrientation () {}
+
+  /// Copy constructor
+  Standard_EXPORT ShHealOper_ChangeOrientation (const TopoDS_Shape& theShape);
+  //Method for initalization by whole shape.
+  
+  Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
+  //Method for initalization by whole shape.
+  
+  Standard_EXPORT Standard_Boolean Perform();
+  //Change orientation
+  
+
+ public:
+// Declaration of CASCADE RTTI
+//DEFINE_STANDARD_RTTI (ShHealOper_RemoveInternalWires)
+};
+
+// Definition of HANDLE object using Standard_DefineHandle.hxx
+//DEFINE_STANDARD_HANDLE (ShHealOper_RemoveInternalWires, )
+
+
+#endif