Salome HOME
Fix valgrind error: Mismatched free() / delete / delete []
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_GetInPlace_3.cxx
index 1dcf1021b6132a151dc807a814b00ec2b88d47c0..9726a4f3b3ee72c791ca942452ae5f586c8acced 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +25,7 @@
 
 #include <GEOMAlgo_GetInPlace.hxx>
 
-#include <NMTTools_CoupleOfShape.hxx>
+#include <GEOMAlgo_CoupleOfShapes.hxx>
 
 static
   Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
@@ -62,7 +62,7 @@ void GEOMAlgo_GetInPlaceIterator::Clear()
 //function : AppendPair
 //purpose  :
 //=======================================================================
-void GEOMAlgo_GetInPlaceIterator::AppendPair(const NMTTools_CoupleOfShape& theCS)
+void GEOMAlgo_GetInPlaceIterator::AppendPair(const GEOMAlgo_CoupleOfShapes& theCS)
 {
   Standard_Integer iX;
   TopAbs_ShapeEnum aType1, aType2;
@@ -75,6 +75,16 @@ void GEOMAlgo_GetInPlaceIterator::AppendPair(const NMTTools_CoupleOfShape& theCS
   iX=TypeToInteger(aType1, aType2);
   if (iX>=0) {
     myLists[iX].Append(theCS);
+  } else {
+    // Add inverted pair of shapes.
+    iX=TypeToInteger(aType2, aType1);
+
+    if (iX>=0) {
+      GEOMAlgo_CoupleOfShapes aCSInv;
+
+      aCSInv.SetShapes(aS2, aS1);
+      myLists[iX].Append(aCSInv);
+    }
   }
 }
 //=======================================================================
@@ -114,7 +124,7 @@ void GEOMAlgo_GetInPlaceIterator::Next()
 // function: Value
 // purpose:
 //=======================================================================
-const NMTTools_CoupleOfShape& GEOMAlgo_GetInPlaceIterator::Value()const
+const GEOMAlgo_CoupleOfShapes& GEOMAlgo_GetInPlaceIterator::Value()const
 {
   return myIterator.Value();
 }