Salome HOME
Copyright update 2022
[modules/geom.git] / src / GEOM_I / GEOM_IShapesOperations_i.cc
index 0f18c5bb0e533f73c1d2b57c1c803cfa222d902c..751c8839cde7b2f703ca07df7752d33902810a66 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  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
@@ -35,6 +35,8 @@
 #include <TColStd_HSequenceOfTransient.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 
+#include <vector>
+
 /**
  * This function converts GEOM::comparison_condition type into
  * GEOMUtils::ComparisonCondition type.
@@ -323,7 +325,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWithConstraints
 
   //Get the shapes
   std::list<Handle(::GEOM_Object)> aConstraints;
-  for( int ind = 0; ind < theConstraints.length(); ind++ ) {
+  for( CORBA::ULong ind = 0; ind < theConstraints.length(); ind++ ) {
     Handle(::GEOM_Object) anObject = GetObjectImpl( theConstraints[ind] );
     aConstraints.push_back(anObject);
   }
@@ -906,7 +908,6 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr t
                                                          const GEOM::ListOfLong& theIndices)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-  Standard_Integer i;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
@@ -918,7 +919,7 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr t
   if (aShape.IsNull()) return aSeq._retn();
 
   Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, theIndices.length());
-  for (i = 0; i < theIndices.length(); i++)
+  for (CORBA::ULong i = 0; i < theIndices.length(); i++)
     anArray->SetValue(i+1, theIndices[i]);
 
   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakeSubShapes(aShape, anArray);
@@ -927,7 +928,7 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::MakeSubShapes (GEOM::GEOM_Object_ptr t
 
   Standard_Integer aLength = aHSeq->Length();
   aSeq->length(aLength);
-  for (i = 0; i < aLength; i++)
+  for (int i = 0; i < aLength; i++)
     aSeq[i] = GetObject(Handle(::GEOM_Object)::DownCast(aHSeq->Value(i+1)));
 
   return aSeq._retn();
@@ -1433,9 +1434,9 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
                                                 (GEOM::GEOM_Object_ptr theShape,
                                                  CORBA::Long           theShapeType,
                                                  GEOM::GEOM_Object_ptr theTopLeftPoint,
-                                                 GEOM::GEOM_Object_ptr theTopRigthPoint,
+                                                 GEOM::GEOM_Object_ptr theTopRightPoint,
                                                  GEOM::GEOM_Object_ptr theBottomLeftPoint,
-                                                 GEOM::GEOM_Object_ptr theBottomRigthPoint,
+                                                 GEOM::GEOM_Object_ptr theBottomRightPoint,
                                                  GEOM::shape_state     theState)
 {
   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
@@ -1446,21 +1447,21 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnQuadrangle
   //Get the reference objects
   Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
   Handle(::GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
-  Handle(::GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
+  Handle(::GEOM_Object) aTopRightPoint = GetObjectImpl(theTopRightPoint);
   Handle(::GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
-  Handle(::GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
+  Handle(::GEOM_Object) aBottomRightPoint = GetObjectImpl(theBottomRightPoint);
 
   if (aShape.IsNull() ||
       aTopLeftPoint.IsNull() ||
-      aTopRigthPoint.IsNull() ||
+      aTopRightPoint.IsNull() ||
       aBottomLeftPoint.IsNull() ||
-      aBottomRigthPoint.IsNull())
+      aBottomRightPoint.IsNull())
     return aSeq._retn();
 
   //Get Shapes On Quadrangle
   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnQuadrangle
     (aShape, theShapeType,
-     aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
+     aTopLeftPoint, aTopRightPoint, aBottomLeftPoint, aBottomRightPoint,
      ShapeState(theState));
   if (!GetOperations()->IsDone() || aHSeq.IsNull())
     return aSeq._retn();
@@ -1670,9 +1671,9 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
                                                 (GEOM::GEOM_Object_ptr theShape,
                                                  CORBA::Long           theShapeType,
                                                  GEOM::GEOM_Object_ptr theTopLeftPoint,
-                                                 GEOM::GEOM_Object_ptr theTopRigthPoint,
+                                                 GEOM::GEOM_Object_ptr theTopRightPoint,
                                                  GEOM::GEOM_Object_ptr theBottomLeftPoint,
-                                                 GEOM::GEOM_Object_ptr theBottomRigthPoint,
+                                                 GEOM::GEOM_Object_ptr theBottomRightPoint,
                                                  GEOM::shape_state     theState)
 {
   GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
@@ -1683,21 +1684,21 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnQuadrangleIDs
   //Get the reference objects
   Handle(::GEOM_Object) aShape = GetObjectImpl(theShape);
   Handle(::GEOM_Object) aTopLeftPoint = GetObjectImpl(theTopLeftPoint);
-  Handle(::GEOM_Object) aTopRigthPoint = GetObjectImpl(theTopRigthPoint);
+  Handle(::GEOM_Object) aTopRightPoint = GetObjectImpl(theTopRightPoint);
   Handle(::GEOM_Object) aBottomLeftPoint = GetObjectImpl(theBottomLeftPoint);
-  Handle(::GEOM_Object) aBottomRigthPoint = GetObjectImpl(theBottomRigthPoint);
+  Handle(::GEOM_Object) aBottomRightPoint = GetObjectImpl(theBottomRightPoint);
 
   if (aShape.IsNull() ||
       aTopLeftPoint.IsNull() ||
-      aTopRigthPoint.IsNull() ||
+      aTopRightPoint.IsNull() ||
       aBottomLeftPoint.IsNull() ||
-      aBottomRigthPoint.IsNull() )
+      aBottomRightPoint.IsNull() )
     return aSeq._retn();
 
   //Get Shapes On Quadrangle
   Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnQuadrangleIDs
     (aShape, theShapeType,
-     aTopLeftPoint, aTopRigthPoint, aBottomLeftPoint, aBottomRigthPoint,
+     aTopLeftPoint, aTopRightPoint, aBottomLeftPoint, aBottomRightPoint,
      ShapeState(theState));
   if (!GetOperations()->IsDone() || aHSeq.IsNull())
     return aSeq._retn();
@@ -1986,6 +1987,39 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetInPlaceByHistory
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetInPlaceMap
+ */
+//=============================================================================
+GEOM::ListOfListOfLong*
+GEOM_IShapesOperations_i::GetInPlaceMap (GEOM::GEOM_Object_ptr theShapeWhere,
+                                         GEOM::GEOM_Object_ptr theShapeWhat)
+{
+  GEOM::ListOfListOfLong_var aResult = new GEOM::ListOfListOfLong();
+
+  //Get the reference objects
+  Handle(::GEOM_Object) aShapeWhere = GetObjectImpl(theShapeWhere);
+  Handle(::GEOM_Object) aShapeWhat = GetObjectImpl(theShapeWhat);
+
+  if (!aShapeWhere.IsNull() &&
+      !aShapeWhat.IsNull())
+  {
+    std::vector< std::vector< int > > resVec;
+    GetOperations()->GetInPlaceMap(aShapeWhere, aShapeWhat, resVec);
+
+    aResult->length( resVec.size() );
+    for ( size_t i = 0; i < resVec.size(); ++i )
+    {
+      //if ( !resVec[i].empty() )
+      aResult[i].length( resVec[i].size() );
+      for ( size_t j = 0; j < resVec[i].size(); ++j )
+        aResult[i][j] = resVec[i][j];
+    }
+  }
+  return aResult._retn();
+}
+
 //=============================================================================
 /*!
  *  GetSame