]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Common part of dump to python is moved to HYDROData_Entity.
authorrkv <rkv@opencascade.com>
Wed, 15 Jan 2014 08:21:12 +0000 (08:21 +0000)
committerrkv <rkv@opencascade.com>
Wed, 15 Jan 2014 08:21:12 +0000 (08:21 +0000)
20 files changed:
src/HYDROData/HYDROData_AltitudeObject.cxx
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_Channel.cxx
src/HYDROData/HYDROData_Confluence.cxx
src/HYDROData/HYDROData_Digue.cxx
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Image.cxx
src/HYDROData/HYDROData_ImmersibleZone.cxx
src/HYDROData/HYDROData_Obstacle.cxx
src/HYDROData/HYDROData_ObstacleAltitude.cxx
src/HYDROData/HYDROData_Polyline3D.cxx
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Region.cxx
src/HYDROData/HYDROData_River.cxx
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_StreamAltitude.cxx
src/HYDROData/HYDROData_Zone.cxx

index 005b4b1adcdb0dbc523192e02f796782d6663246..8c140e43bce74ab3c0f67469b560a8b74df83646 100644 (file)
@@ -4,9 +4,6 @@
 
 #include <QStringList>
 
-#define PYTHON_ALTITUDE_ID "KIND_ALTITUDE"
-
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_AltitudeObject, HYDROData_IAltitudeObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_AltitudeObject, HYDROData_IAltitudeObject)
 
@@ -21,20 +18,9 @@ HYDROData_AltitudeObject::~HYDROData_AltitudeObject()
 
 QStringList HYDROData_AltitudeObject::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString anAltitudeName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_ALTITUDE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( anAltitudeName ).arg( anAltitudeName );
-
   // TODO
 
   return aResList;
index f37c0ae6d3b92ab9079d14a73aaeeae0df08377c..86f403fd3e51a1b679752f86866e794ea7dc93e2 100644 (file)
@@ -26,9 +26,6 @@
 #include <OSD_Timer.hxx>
 #endif
 
-#define PYTHON_BATHYMETRY_ID "KIND_BATHYMETRY"
-
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
 
@@ -43,33 +40,15 @@ HYDROData_Bathymetry::~HYDROData_Bathymetry()
 
 QStringList HYDROData_Bathymetry::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString aBathymetryName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aBathymetryName ).arg( aDocName ).arg( PYTHON_BATHYMETRY_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aBathymetryName ).arg( aBathymetryName );
-
   aResList << QString( "%1.SetAltitudesInverted( %2 );" )
               .arg( aBathymetryName ).arg( IsAltitudesInverted() );
 
   TCollection_AsciiString aFilePath = GetFilePath();
-  if ( !aFilePath.IsEmpty() )
-  {
-    aResList << QString( "%1.ImportFromFile( \"%2\" );" )
-                .arg( aBathymetryName ).arg( aFilePath.ToCString() );
-  }
-  else
-  {
-    // TODO : bathymetry is composed from other bathymetry(ies)
-  }
+  aResList << QString( "%1.ImportFromFile( \"%2\" );" )
+              .arg( aBathymetryName ).arg( aFilePath.ToCString() );
 
   return aResList;
 }
index 5ec5856081718b834caafa6794e524067641b72d..eb3026c0e12c2efc5366d3ccf2838e1f66c812f6 100644 (file)
@@ -39,8 +39,6 @@
 #define CALCULATION_ZONES_PREF GetName() + "_Zone"
 #define CALCULATION_GROUPS_PREF GetName() + "_"
 
-#define PYTHON_CALCULATION_ID "KIND_CALCULATION"
-
 #define EXPORT_NAME "HYDRO_" + GetName()
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
@@ -104,21 +102,9 @@ void HYDROData_CalculationCase::SetName( const QString& theName )
 
 QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString aCalculName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aCalculName ).arg( aDocName ).arg( PYTHON_CALCULATION_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aCalculName ).arg( aCalculName );
-  aResList << QString( "" );
-
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
   HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
   for ( ; anIter.More(); anIter.Next() )
index 50a27326a9ab5fd4a4e4d3d897d2d9397d07dd36..9a564715193850561724737c056f47eb86fde99a 100644 (file)
@@ -30,8 +30,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_CHANNEL_ID "KIND_CHANNEL"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Channel,HYDROData_ArtificialObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Channel,HYDROData_ArtificialObject)
 
@@ -47,20 +45,7 @@ HYDROData_Channel::~HYDROData_Channel()
 
 QStringList HYDROData_Channel::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aChannelName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aChannelName ).arg( aDocName ).arg( PYTHON_CHANNEL_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aChannelName ).arg( aChannelName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 64aeacf8e335c20e504d2e959344624e77cb6baa..fd2535e537cf9d63fd3617b5592758adb5d0c1d0 100644 (file)
@@ -7,8 +7,6 @@
 
 #include <QStringList>
 
-#define PYTHON_CONFLUENCE_ID "KIND_CONFLUENCE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Confluence,HYDROData_NaturalObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Confluence,HYDROData_NaturalObject)
 
@@ -24,20 +22,7 @@ HYDROData_Confluence::~HYDROData_Confluence()
 
 QStringList HYDROData_Confluence::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aConfluenceName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aConfluenceName ).arg( aDocName ).arg( PYTHON_CONFLUENCE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aConfluenceName ).arg( aConfluenceName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 5efa44060097c0803dab09ec90bc7994fadd103e..f63247e1125525c94bc99dcba0cc686387680f78 100644 (file)
@@ -8,8 +8,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_DIGUE_ID "KIND_DIGUE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Digue,HYDROData_Channel)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Digue,HYDROData_Channel)
 
@@ -25,20 +23,7 @@ HYDROData_Digue::~HYDROData_Digue()
 
 QStringList HYDROData_Digue::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aDigueName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aDigueName ).arg( aDocName ).arg( PYTHON_DIGUE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aDigueName ).arg( aDigueName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 8153d3e909aaa791248fe3919de046a14bcb245f..8931dfe61fa3faeda3d7c24ea0a7eab1944cf30b 100644 (file)
@@ -50,8 +50,22 @@ void HYDROData_Entity::SetName(const QString& theName)
 
 QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList anEmptyList;
-  return anEmptyList;
+  QStringList aResList;
+
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  if ( aDocument.IsNull() )
+    return aResList;
+
+  QString aDocName = aDocument->GetDocPyName();
+  QString aName = GetName();
+
+  aResList << QString( "%1 = %2.CreateObject( %3 );" )
+              .arg( aName ).arg( aDocName ).arg( getPyTypeID() );
+  aResList << QString( "%1.SetName( \"%2\" );" )
+              .arg( aName ).arg( aName );
+  aResList << QString( "" );
+
+  return aResList;
 }
 
 void HYDROData_Entity::Update()
@@ -59,6 +73,39 @@ void HYDROData_Entity::Update()
   SetToUpdate( false );
 }
 
+QString HYDROData_Entity::getPyTypeID() const
+{
+  switch( GetKind() )
+  {
+    case KIND_IMAGE:             return "KIND_IMAGE";
+    case KIND_POLYLINE:          return "KIND_POLYLINE";
+    case KIND_BATHYMETRY:        return "KIND_BATHYMETRY";
+    case KIND_ALTITUDE:          return "KIND_ALTITUDE";
+    case KIND_IMMERSIBLE_ZONE:   return "KIND_IMMERSIBLE_ZONE";
+    case KIND_RIVER:             return "KIND_RIVER";
+    case KIND_STREAM:            return "KIND_STREAM";
+    case KIND_CONFLUENCE:        return "KIND_CONFLUENCE";
+    case KIND_CHANNEL:           return "KIND_CHANNEL";
+    case KIND_OBSTACLE:          return "KIND_OBSTACLE";
+    case KIND_DIGUE:             return "KIND_DIGUE";
+    case KIND_PROFILE:           return "KIND_PROFILE";
+    case KIND_PROFILEUZ:         return "KIND_PROFILEUZ";
+    case KIND_POLYLINEXY:        return "KIND_POLYLINEXY";
+    case KIND_CALCULATION:       return "KIND_CALCULATION";
+    case KIND_ZONE:              return "KIND_ZONE";
+    case KIND_REGION:            return "KIND_REGION";
+    case KIND_VISUAL_STATE:      return "KIND_VISUAL_STATE";
+    case KIND_ARTIFICIAL_OBJECT: return "KIND_ARTIFICIAL_OBJECT";
+    case KIND_NATURAL_OBJECT:    return "KIND_NATURAL_OBJECT";
+    case KIND_DUMMY_3D:          return "KIND_DUMMY_3D";
+    case KIND_SHAPES_GROUP:      return "KIND_SHAPES_GROUP";
+    case KIND_SPLITTED_GROUP:    return "KIND_SPLITTED_GROUP";
+    case KIND_STREAM_ALTITUDE:   return "KIND_STREAM_ALTITUDE";
+    case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE";
+    default:                     return "KIND_UNKNOWN"; ///! Unrecognized object
+  }
+}
+
 QVariant HYDROData_Entity::GetDataVariant()
 {
   return QVariant();
index 9429b1720cf14598aab2f5befee74578e0986fcd..d0a9088dbd1e62fc4c0e455ddfb841f48f3aac71 100644 (file)
@@ -327,6 +327,9 @@ protected:
                                  QStringList&                    theScript,
                                  const Handle(HYDROData_Entity)& theRefObject,
                                  const QString&                  theMethod ) const;
+
+  QString HYDROData_Entity::getPyTypeID() const;
+
 protected:
 
   Handle(TDataStd_ReferenceList) getReferenceList( const int  theTag,
index e1ea0bfbf4bd824948fff0994649989a830e78e7..88e1a3b0bea3c9ca21fe8606582f576ed017aa85 100644 (file)
@@ -25,8 +25,6 @@ static const Standard_GUID GUID_SELF_SPLITTED("997995aa-5c19-40bf-9a60-ab4b70ad0
 static const Standard_GUID GUID_HAS_LOCAL_POINTS("FD8841AA-FC44-42fa-B6A7-0F682CCC6F27");
 static const Standard_GUID GUID_HAS_GLOBAL_POINTS("330D0E81-742D-4ea3-92D4-484877CFA7C1");
 
-#define PYTHON_IMAGE_ID "KIND_IMAGE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Entity)
 
@@ -41,20 +39,9 @@ HYDROData_Image::~HYDROData_Image()
 
 QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString anImageName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( anImageName ).arg( aDocName ).arg( PYTHON_IMAGE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( anImageName ).arg( anImageName );
-
   QString aFilePath = GetFilePath();
   if ( !aFilePath.isEmpty() )
   {
index 028e666610c78d9420f8e85a519b81481d8ddd95..20424a3351674971733bc47a193319448912fd67 100644 (file)
@@ -25,7 +25,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_IMMERSIBLE_ZONE_ID "KIND_IMMERSIBLE_ZONE"
 //#define HYDRODATA_IMZONE_DEB 1
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_ImmersibleZone,HYDROData_NaturalObject)
@@ -43,21 +42,9 @@ HYDROData_ImmersibleZone::~HYDROData_ImmersibleZone()
 
 QStringList HYDROData_ImmersibleZone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString aZoneName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aZoneName ).arg( aDocName ).arg( PYTHON_IMMERSIBLE_ZONE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aZoneName ).arg( aZoneName );
-  aResList << QString( "" );
-
   QColor aFillingColor = GetFillingColor();
   aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
               .arg( aFillingColor.red()  ).arg( aFillingColor.green() )
index f75d3f1e07935cb19546263c2a50715d17f49b5d..370b80c7deafbc2b55ff3e69fbf417382663208b 100644 (file)
@@ -37,8 +37,6 @@
 
 #include <HYDROData_Projection.h>
 
-#define PYTHON_OBSTACLE_ID "KIND_OBSTACLE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Obstacle,HYDROData_ArtificialObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Obstacle,HYDROData_ArtificialObject)
 
@@ -54,20 +52,7 @@ HYDROData_Obstacle::~HYDROData_Obstacle()
 
 QStringList HYDROData_Obstacle::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString anObstacleName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( anObstacleName ).arg( aDocName ).arg( PYTHON_OBSTACLE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( anObstacleName ).arg( anObstacleName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 1a9b428af0b23113b86bf60677e21fb1201e52d4..d74ea473e034c42ac0d28f2340a594823c359009 100644 (file)
@@ -4,9 +4,6 @@
 
 #include <QStringList>
 
-#define PYTHON_OBSTACLE_ALTITUDE_ID "KIND_OBSTACLE_ALTITUDE"
-
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ObstacleAltitude, HYDROData_IAltitudeObject)
 
@@ -21,19 +18,7 @@ HYDROData_ObstacleAltitude::~HYDROData_ObstacleAltitude()
 
 QStringList HYDROData_ObstacleAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
-  QString anAltitudeName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_OBSTACLE_ALTITUDE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( anAltitudeName ).arg( anAltitudeName );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 67fe1a88f3d26daecbebc3274c9a390a3ec9a90d..2cc3e3af4869104e00421585c82663cc6ff8c6c6 100644 (file)
@@ -18,8 +18,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_POLYLINE_ID "KIND_POLYLINE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Polyline3D,HYDROData_Object)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Polyline3D,HYDROData_Object)
 
@@ -35,19 +33,7 @@ HYDROData_Polyline3D::~HYDROData_Polyline3D()
 
 QStringList HYDROData_Polyline3D::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aPolylineName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aPolylineName ).arg( aDocName ).arg( PYTHON_POLYLINE_ID );
-  aResList << QString( "%1.SetName( \"%1\" );" ).arg( aPolylineName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index f55f42b8ce6ab679873e44bc921122f8a8d4d62f..65cd2e00625cac57b5e25a161ec1c6c6ec3a66eb 100755 (executable)
@@ -56,8 +56,6 @@
 
 static const Standard_GUID GUID_IS_UNEDITABLE("e5799736-9030-4051-91a4-2e58321fa153");
 
-#define PYTHON_POLYLINEXY_ID "KIND_POLYLINEXY"
-
 const double LOCAL_SELECTION_TOLERANCE = 0.0001;
 
 TCollection_AsciiString getUniqueSectionName( const NCollection_Sequence<TCollection_AsciiString>& theNamesSeq )
@@ -108,19 +106,9 @@ HYDROData_PolylineXY::~HYDROData_PolylineXY()
 
 QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString aPolylineName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aPolylineName ).arg( aDocName ).arg( PYTHON_POLYLINEXY_ID );
-  aResList << QString( "%1.SetName( \"%1\" );" ).arg( aPolylineName );
-
   // Set polilyne data
   NCollection_Sequence<TCollection_AsciiString>           aSectNames;
   NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
index b5ddec6a8a489c2fb8cea7c7b0cddbcf5e5f68ff..50228619b33228a2464f82713bf4fa669ba11087 100755 (executable)
@@ -28,8 +28,6 @@
 #include <QColor>
 #include <QStringList>
 
-#define PYTHON_PROFILE_ID "KIND_PROFILE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Profile, HYDROData_Object)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Profile, HYDROData_Object)
 
@@ -44,18 +42,9 @@ HYDROData_Profile::~HYDROData_Profile()
 
 QStringList HYDROData_Profile::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
-  QString aProfileName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aProfileName ).arg( aDocName ).arg( PYTHON_PROFILE_ID );
-  aResList << QString( "%1.SetName( \"%1\" );" ).arg( aProfileName );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
+
+  //TODO
 
   return aResList;
 }
index 81916d5a2b3855b980f6f710afdf4a2d31d42b1e..6b2c19742fa59ae90f6aae0dc07edde96ca26ec5 100644 (file)
@@ -25,8 +25,6 @@
 
 #include <QStringList>
 
-#define PYTHON_REGION_ID "KIND_REGION"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Entity)
 
@@ -42,21 +40,9 @@ HYDROData_Region::~HYDROData_Region()
 
 QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
   QString aRegionName = GetName();
 
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aRegionName ).arg( aDocName ).arg( PYTHON_REGION_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aRegionName ).arg( aRegionName );
-  aResList << QString( "" );
-
   HYDROData_SequenceOfObjects aZones = GetZones();
   HYDROData_SequenceOfObjects::Iterator anIter( aZones );
   for ( ; anIter.More(); anIter.Next() )
index 7193b0e4fbe4951d416f86f1e5799da4c932b7c9..851b5322a13f8e2b32e7a2730dfe7e6de5692e79 100644 (file)
@@ -7,8 +7,6 @@
 
 #include <QStringList>
 
-#define PYTHON_RIVER_ID "KIND_RIVER"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_River,HYDROData_NaturalObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_River,HYDROData_NaturalObject)
 
@@ -24,20 +22,7 @@ HYDROData_River::~HYDROData_River()
 
 QStringList HYDROData_River::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aRiverName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aRiverName ).arg( aDocName ).arg( PYTHON_RIVER_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aRiverName ).arg( aRiverName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 67846466ae3eb3e8f462623cd9a1295bbee0adc7..d01c043d7f5e5479cb0941d7b3dfff3fab6e9852 100644 (file)
@@ -68,8 +68,6 @@
 #include <TCollection_AsciiString.hxx>
 #endif
 
-#define PYTHON_STREAM_ID "KIND_STREAM"
-
 typedef NCollection_DataMap<Standard_Real, Handle(HYDROData_Profile)> HYDROData_DataMapOfRealOfHDProfile;
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Stream,HYDROData_NaturalObject)
@@ -87,20 +85,7 @@ HYDROData_Stream::~HYDROData_Stream()
 
 QStringList HYDROData_Stream::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aStreamName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aStreamName ).arg( aDocName ).arg( PYTHON_STREAM_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aStreamName ).arg( aStreamName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 7d3673b44e6a80562876233ae918e9ea7d09f387..dc51dbe17cceca24207276c81e2bc911cdadd192 100644 (file)
@@ -32,9 +32,6 @@
 
 #include <QStringList>
 
-#define PYTHON_STREAM_ALTITUDE_ID "KIND_STREAM_ALTITUDE"
-
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
 
@@ -49,19 +46,7 @@ HYDROData_StreamAltitude::~HYDROData_StreamAltitude()
 
 QStringList HYDROData_StreamAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-                             
-  QString aDocName = aDocument->GetDocPyName();
-  QString anAltitudeName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( anAltitudeName ).arg( aDocName ).arg( PYTHON_STREAM_ALTITUDE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( anAltitudeName ).arg( anAltitudeName );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   // TODO
 
index 4d0675a2eed68d5f7b7ebbdba436c5e0b1c69918..752af3af858b3432b20e140cc550194a1f55bb4c 100644 (file)
@@ -15,8 +15,6 @@
 
 #include <TDataStd_Integer.hxx>
 
-#define PYTHON_ZONE_ID "KIND_ZONE"
-
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
 
@@ -32,20 +30,7 @@ HYDROData_Zone::~HYDROData_Zone()
 
 QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
 {
-  QStringList aResList;
-
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-  if ( aDocument.IsNull() )
-    return aResList;
-
-  QString aDocName = aDocument->GetDocPyName();
-  QString aZoneName = GetName();
-
-  aResList << QString( "%1 = %2.CreateObject( %3 );" )
-              .arg( aZoneName ).arg( aDocName ).arg( PYTHON_ZONE_ID );
-  aResList << QString( "%1.SetName( \"%2\" );" )
-              .arg( aZoneName ).arg( aZoneName );
-  aResList << QString( "" );
+  QStringList aResList = HYDROData_Entity::DumpToPython( theTreatedObjects );
 
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
   HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects );