Salome HOME
refs #482: new function for export calculation case
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
index 719c105bf908f79ae3ddb090f11af3ce03be4671..7204f97fde1bf06c1bcdec4e5cf52457713122ba 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 )
 {
@@ -198,6 +230,29 @@ QColor HYDROData_Object::getDefaultBorderColor() const
   return QColor( Qt::transparent );
 }
 
+QStringList HYDROData_Object::dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const
+{
+  QStringList aResList = HYDROData_Entity::dumpObjectCreation( theTreatedObjects );
+  if ( aResList.isEmpty() )
+    return aResList; //Object was not created
+
+  QStringList aColorsDef;
+
+  QColor aFillingColor = GetFillingColor();
+  setPythonObjectColor( aColorsDef, aFillingColor, getDefaultFillingColor(), "SetFillingColor" );
+
+  QColor aBorderColor = GetBorderColor();
+  setPythonObjectColor( aColorsDef, aBorderColor, getDefaultBorderColor(), "SetBorderColor" );
+
+  if ( !aColorsDef.isEmpty() )
+  {
+    aResList << aColorsDef;
+    aResList << QString( "" );
+  }
+
+  return aResList;
+}
+
 ObjectKind HYDROData_Object::getAltitudeObjectType() const
 {
   return KIND_UNKNOWN;