From: rkv Date: Wed, 15 Jan 2014 08:21:12 +0000 (+0000) Subject: Common part of dump to python is moved to HYDROData_Entity. X-Git-Tag: BR_hydro_v_1_0~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4fb26469914cfdce427475638c0ed89299036c54;p=modules%2Fhydro.git Common part of dump to python is moved to HYDROData_Entity. --- diff --git a/src/HYDROData/HYDROData_AltitudeObject.cxx b/src/HYDROData/HYDROData_AltitudeObject.cxx index 005b4b1a..8c140e43 100644 --- a/src/HYDROData/HYDROData_AltitudeObject.cxx +++ b/src/HYDROData/HYDROData_AltitudeObject.cxx @@ -4,9 +4,6 @@ #include -#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; diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index f37c0ae6..86f403fd 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -26,9 +26,6 @@ #include #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; } diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 5ec58560..eb3026c0 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -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() ) diff --git a/src/HYDROData/HYDROData_Channel.cxx b/src/HYDROData/HYDROData_Channel.cxx index 50a27326..9a564715 100644 --- a/src/HYDROData/HYDROData_Channel.cxx +++ b/src/HYDROData/HYDROData_Channel.cxx @@ -30,8 +30,6 @@ #include #include -#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 diff --git a/src/HYDROData/HYDROData_Confluence.cxx b/src/HYDROData/HYDROData_Confluence.cxx index 64aeacf8..fd2535e5 100644 --- a/src/HYDROData/HYDROData_Confluence.cxx +++ b/src/HYDROData/HYDROData_Confluence.cxx @@ -7,8 +7,6 @@ #include -#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 diff --git a/src/HYDROData/HYDROData_Digue.cxx b/src/HYDROData/HYDROData_Digue.cxx index 5efa4406..f63247e1 100644 --- a/src/HYDROData/HYDROData_Digue.cxx +++ b/src/HYDROData/HYDROData_Digue.cxx @@ -8,8 +8,6 @@ #include #include -#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 diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index 8153d3e9..8931dfe6 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -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(); diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 9429b172..d0a9088d 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -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, diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index e1ea0bfb..88e1a3b0 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -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() ) { diff --git a/src/HYDROData/HYDROData_ImmersibleZone.cxx b/src/HYDROData/HYDROData_ImmersibleZone.cxx index 028e6666..20424a33 100644 --- a/src/HYDROData/HYDROData_ImmersibleZone.cxx +++ b/src/HYDROData/HYDROData_ImmersibleZone.cxx @@ -25,7 +25,6 @@ #include #include -#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() ) diff --git a/src/HYDROData/HYDROData_Obstacle.cxx b/src/HYDROData/HYDROData_Obstacle.cxx index f75d3f1e..370b80c7 100644 --- a/src/HYDROData/HYDROData_Obstacle.cxx +++ b/src/HYDROData/HYDROData_Obstacle.cxx @@ -37,8 +37,6 @@ #include -#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 diff --git a/src/HYDROData/HYDROData_ObstacleAltitude.cxx b/src/HYDROData/HYDROData_ObstacleAltitude.cxx index 1a9b428a..d74ea473 100644 --- a/src/HYDROData/HYDROData_ObstacleAltitude.cxx +++ b/src/HYDROData/HYDROData_ObstacleAltitude.cxx @@ -4,9 +4,6 @@ #include -#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 diff --git a/src/HYDROData/HYDROData_Polyline3D.cxx b/src/HYDROData/HYDROData_Polyline3D.cxx index 67fe1a88..2cc3e3af 100644 --- a/src/HYDROData/HYDROData_Polyline3D.cxx +++ b/src/HYDROData/HYDROData_Polyline3D.cxx @@ -18,8 +18,6 @@ #include #include -#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 diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index f55f42b8..65cd2e00 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -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& 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 aSectNames; NCollection_Sequence aSectTypes; diff --git a/src/HYDROData/HYDROData_Profile.cxx b/src/HYDROData/HYDROData_Profile.cxx index b5ddec6a..50228619 100755 --- a/src/HYDROData/HYDROData_Profile.cxx +++ b/src/HYDROData/HYDROData_Profile.cxx @@ -28,8 +28,6 @@ #include #include -#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; } diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx index 81916d5a..6b2c1974 100644 --- a/src/HYDROData/HYDROData_Region.cxx +++ b/src/HYDROData/HYDROData_Region.cxx @@ -25,8 +25,6 @@ #include -#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() ) diff --git a/src/HYDROData/HYDROData_River.cxx b/src/HYDROData/HYDROData_River.cxx index 7193b0e4..851b5322 100644 --- a/src/HYDROData/HYDROData_River.cxx +++ b/src/HYDROData/HYDROData_River.cxx @@ -7,8 +7,6 @@ #include -#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 diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 67846466..d01c043d 100644 --- a/src/HYDROData/HYDROData_Stream.cxx +++ b/src/HYDROData/HYDROData_Stream.cxx @@ -68,8 +68,6 @@ #include #endif -#define PYTHON_STREAM_ID "KIND_STREAM" - typedef NCollection_DataMap 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 diff --git a/src/HYDROData/HYDROData_StreamAltitude.cxx b/src/HYDROData/HYDROData_StreamAltitude.cxx index 7d3673b4..dc51dbe1 100644 --- a/src/HYDROData/HYDROData_StreamAltitude.cxx +++ b/src/HYDROData/HYDROData_StreamAltitude.cxx @@ -32,9 +32,6 @@ #include -#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 diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index 4d0675a2..752af3af 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -15,8 +15,6 @@ #include -#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 );