]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Access methods for object groups added.
authoradv <adv@opencascade.com>
Thu, 16 Jan 2014 11:44:21 +0000 (11:44 +0000)
committeradv <adv@opencascade.com>
Thu, 16 Jan 2014 11:44:21 +0000 (11:44 +0000)
src/HYDROData/HYDROData_Object.cxx
src/HYDROData/HYDROData_Object.h
src/HYDROPy/HYDROData_Object.sip

index 719c105bf908f79ae3ddb090f11af3ce03be4671..e018ca249352b5f6a923cc3f000bfad4a618a8b0 100644 (file)
@@ -132,6 +132,38 @@ HYDROData_SequenceOfObjects HYDROData_Object::GetGroups() const
   return GetReferenceObjects( DataTag_EdgesGroup );
 }
 
+Handle(HYDROData_ShapesGroup) HYDROData_Object::GetGroup( const int theGroupId ) const
+{
+  Handle(HYDROData_ShapesGroup) aResGroup;
+
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  if ( theGroupId < 0 || theGroupId >= aGroups.Length() )
+    return aResGroup;
+
+  aResGroup = Handle(HYDROData_ShapesGroup)::DownCast( aGroups.Value( theGroupId + 1 ) );
+
+  return aResGroup;
+}
+
+int HYDROData_Object::GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const
+{
+  int aRes = -1;
+
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  for ( int i = 1, n = aGroups.Length(); i <= n; ++i )
+  {
+    Handle(HYDROData_ShapesGroup) aGroup =
+      Handle(HYDROData_ShapesGroup)::DownCast( aGroups.Value( i ) );
+    if ( IsEqual( theGroup, aGroup ) )
+    {
+      aRes = i - 1;
+      break;
+    }
+  }
+
+  return aRes;
+}
+
 bool HYDROData_Object::SetAltitudeObject( 
   const Handle(HYDROData_IAltitudeObject)& theAltitude )
 {
index 312368eb183a5b3aca8188c0e2ffdb6cbc275cee..d59e4708578e863b336e6bd3048a4ace25aef553 100644 (file)
@@ -88,11 +88,22 @@ public:
    */
   HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
 
+
   /**
    * Returns sequence of object groups.
    */
   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
 
+  /**
+   * Returns group data model object by it id.
+   */
+  HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) GetGroup( const int theGroupId ) const;
+
+  /**
+   * Returns group id by data model object.
+   */
+  HYDRODATA_EXPORT virtual int GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const;
+
 
   /**
    * Set reference altitude object for geometry object.
index 39f890264827b8b210899deb94e1a045f1dd9512..399ce5b6287bcb90578cb0be1c1b8105eb9eb091 100644 (file)
@@ -138,6 +138,48 @@ public:
    */
   virtual QColor GetBorderColor() const;
 
+
+  /**
+   * Returns sequence of object groups.
+   */
+  HYDROData_SequenceOfObjects GetGroups() const;
+
+  /**
+   * Returns group data model object by it id.
+   */
+  HYDROData_ShapesGroup GetGroup( const int theGroupId ) const [Handle_HYDROData_ShapesGroup ()];
+  %MethodCode
+
+    Handle(HYDROData_ShapesGroup) aRefGroup;
+    
+    Py_BEGIN_ALLOW_THREADS
+    aRefGroup = sipSelfWasArg ? sipCpp->HYDROData_Object::GetGroup( a0 ) : 
+                                sipCpp->GetGroup( a0 );
+    Py_END_ALLOW_THREADS
+    
+    sipRes = (HYDROData_ShapesGroup*)createPointer( aRefGroup );
+  
+  %End
+
+  /**
+   * Returns group id by data model object.
+   */
+  int GetGroupId( HYDROData_ShapesGroup theGroup ) const [int (const Handle_HYDROData_ShapesGroup&)];
+  %MethodCode
+
+    Handle(HYDROData_ShapesGroup) aRefGroup =
+      Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
+    if ( !aRefGroup.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipRes = sipSelfWasArg ? sipCpp->HYDROData_Object::GetGroupId( aRefGroup ) : 
+                               sipCpp->GetGroupId( aRefGroup );
+      Py_END_ALLOW_THREADS
+    }
+
+  %End
+
+
 protected:
 
   /**