]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/NMTDS/NMTDS_Tools.cxx
Salome HOME
0021672: [CEA 565] Dump Study from script
[modules/geom.git] / src / NMTDS / NMTDS_Tools.cxx
index 32dfdb4270dce9f6713c4ff2c3b76821c204f412..f34ce68e5e9623069315365bff04bbf906ac8347 100644 (file)
@@ -1,28 +1,27 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 // File:        NMTDS_Tools.cxx
 // Created:     Tue Feb 20 14:57:28 2007
 // Author:      Peter KURNEV
-//              <pkv@irinox>
-//
-#include <NMTDS_Tools.ixx>
+
+#include <NMTDS_Tools.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <gp_Pnt.hxx>
 #include <BRep_Tool.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <BRep_Builder.hxx>
 
-void CopySource(const TopoDS_Shape& aS, 
-                TopTools_IndexedDataMapOfShapeShape& aMapSS, 
+void CopySource(const TopoDS_Shape& aS,
+                TopTools_IndexedDataMapOfShapeShape& aMapSS,
                 TopoDS_Shape& aSC);
 
 //=======================================================================
 //function : CopyShape
-//purpose  : 
+//purpose  :
 //=======================================================================
-  void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, 
+  void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
                               TopoDS_Shape& aSC)
 {
   TopTools_IndexedDataMapOfShapeShape aMapSS;
@@ -49,9 +48,9 @@ void CopySource(const TopoDS_Shape& aS,
 }
 //=======================================================================
 //function : CopyShape
-//purpose  : 
+//purpose  :
 //=======================================================================
-  void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS, 
+  void NMTDS_Tools::CopyShape(const TopoDS_Shape& aS,
                               TopoDS_Shape& aSC,
                               TopTools_IndexedDataMapOfShapeShape& aMapSS)
 {
@@ -59,15 +58,16 @@ void CopySource(const TopoDS_Shape& aS,
 }
 //=======================================================================
 //function : CopySource
-//purpose  : 
+//purpose  :
 //=======================================================================
-void CopySource(const TopoDS_Shape& aS, 
-                TopTools_IndexedDataMapOfShapeShape& aMapSS, 
+void CopySource(const TopoDS_Shape& aS,
+                TopTools_IndexedDataMapOfShapeShape& aMapSS,
                 TopoDS_Shape& aSC)
 {
   Standard_Boolean bFree;
   TopAbs_ShapeEnum aT;
   TopoDS_Iterator aIt;
+  TopoDS_Shape aSF;
   BRep_Builder BB;
   //
   aT=aS.ShapeType();
@@ -84,13 +84,22 @@ void CopySource(const TopoDS_Shape& aS,
   //
   bFree=aSC.Free();
   aSC.Free(Standard_True);
-  aIt.Initialize(aS);
+  aSF=aS;
+  if (aT==TopAbs_EDGE){
+    TopAbs_Orientation aOr;
+    //
+    aOr=aS.Orientation();
+    if(aOr==TopAbs_INTERNAL) {
+      aSF.Orientation(TopAbs_FORWARD);
+    }
+  }
+  aIt.Initialize(aSF);
   for (; aIt.More();  aIt.Next()) {
     TopoDS_Shape aSCx;
     //
     const TopoDS_Shape& aSx=aIt.Value();
     //
-    CopySource (aSx, aMapSS, aSCx);  
+    CopySource (aSx, aMapSS, aSCx);
     //
     aSCx.Orientation(aSx.Orientation());
     BB.Add(aSC, aSCx);
@@ -99,9 +108,9 @@ void CopySource(const TopoDS_Shape& aS,
 }
 //=======================================================================
 // function: ComputeVV
-// purpose: 
+// purpose:
 //=======================================================================
-  Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1, 
+  Standard_Integer NMTDS_Tools::ComputeVV(const TopoDS_Vertex& aV1,
                                           const TopoDS_Vertex& aV2)
 {
   Standard_Real aTolV1, aTolV2, aTolSum, aTolSum2, aD2;
@@ -123,7 +132,7 @@ void CopySource(const TopoDS_Shape& aS,
 }
 //=======================================================================
 // function: HasBRep
-// purpose: 
+// purpose:
 //=======================================================================
   Standard_Boolean NMTDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
 {
@@ -131,7 +140,7 @@ void CopySource(const TopoDS_Shape& aS,
 }
 //=======================================================================
 //function : TypeToInteger
-//purpose  : 
+//purpose  :
 //=======================================================================
   Standard_Integer NMTDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
                                             const TopAbs_ShapeEnum aType2)
@@ -168,5 +177,5 @@ void CopySource(const TopoDS_Shape& aS,
     default:
       break;
   }
-  return iRet; 
+  return iRet;
 }