Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/geom.git] / src / GEOM_I / GEOM_IShapesOperations_i.cc
index 4c452deae9a292d7cdf2c78b4588224a88ce8cdd..d41f919b73642928331eb24018c32489d60cded8 100644 (file)
@@ -438,6 +438,76 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetSubShape
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  GetSubShapeIndex
+ */
+//=============================================================================
+CORBA::Long GEOM_IShapesOperations_i::GetSubShapeIndex
+  (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
+{
+  if (theMainShape == NULL || theSubShape == NULL) return -1;
+
+  //Get the reference shapes
+  Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject
+    (theMainShape->GetStudyID(), theMainShape->GetEntry());
+  Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
+    (theSubShape->GetStudyID(), theSubShape->GetEntry());
+  if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
+
+  //Get the unique ID of <theSubShape> inside <theMainShape>
+  CORBA::Long anID = GetOperations()->GetSubShapeIndex(aMainShapeRef, aSubShapeRef);
+  if (!GetOperations()->IsDone())
+    return -1;
+
+  return anID;
+}
+
+//=============================================================================
+/*!
+ *  GetTopologyIndex
+ */
+//=============================================================================
+CORBA::Long GEOM_IShapesOperations_i::GetTopologyIndex
+  (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr theSubShape)
+{
+  if (theMainShape == NULL || theSubShape == NULL) return -1;
+
+  //Get the reference shapes
+  Handle(GEOM_Object) aMainShapeRef = GetOperations()->GetEngine()->GetObject
+    (theMainShape->GetStudyID(), theMainShape->GetEntry());
+  Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
+    (theSubShape->GetStudyID(), theSubShape->GetEntry());
+  if (aMainShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
+
+  //Get an ID of <theSubShape>, unique among all sub-shapes of <theMainShape> of the same type
+  CORBA::Long anID = GetOperations()->GetTopologyIndex(aMainShapeRef, aSubShapeRef);
+  if (!GetOperations()->IsDone())
+    return -1;
+
+  return anID;
+}
+
+//=============================================================================
+/*!
+ *  GetShapeTypeString
+ */
+//=============================================================================
+char* GEOM_IShapesOperations_i::GetShapeTypeString (GEOM::GEOM_Object_ptr theShape)
+{
+  if (theShape == NULL) return NULL;
+
+  //Get the reference shape
+  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
+    (theShape->GetStudyID(), theShape->GetEntry());
+
+  if (aShape.IsNull()) return NULL;
+
+  // Get shape parameters
+  TCollection_AsciiString aDescription = GetOperations()->GetShapeTypeString(aShape);
+  return CORBA::string_dup(aDescription.ToCString());
+}
+
 //=============================================================================
 /*!
  *  NumberOfFaces