QStringList HYDROData_AltitudeObject::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
QStringList HYDROData_Bathymetry::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aBathymetryName = GetName();
+ QString aBathymetryName = GetObjPyName();
aResList << QString( "%1.SetAltitudesInverted( %2 );" )
.arg( aBathymetryName ).arg( IsAltitudesInverted() );
QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aCalculName = GetName();
+ QString aCalculName = GetObjPyName();
HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects );
QStringList HYDROData_Channel::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
- // TODO
+ Handle(HYDROData_Polyline3D) aRefGideLine = GetGuideLine();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefGideLine, "SetGuideLine" );
+
+ Handle(HYDROData_Profile) aRefProfile = GetProfile();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefProfile, "SetProfile" );
aResList << QString( "" );
aResList << QString( "%1.Update();" ).arg( aName );
QStringList HYDROData_Confluence::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
{
}
-QStringList HYDROData_Digue::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
-{
- QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
-
- // TODO
-
- aResList << QString( "" );
- aResList << QString( "%1.Update();" ).arg( aName );
- aResList << QString( "" );
-
- return aResList;
-}
-
QColor HYDROData_Digue::DefaultFillingColor()
{
return QColor( Qt::red );
*/
HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_DIGUE;}
- /**
- * Dump object to Python script representation.
- */
- HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
-
/**
* Returns default filling color for new digue.
*/
return QString();
}
+QString HYDROData_Entity::GetObjPyName() const
+{
+ return GetName().replace(" ", "_");
+}
+
void HYDROData_Entity::SetName(const QString& theName)
{
TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
return aResList;
QString aDocName = aDocument->GetDocPyName();
- QString aName = GetName();
+ QString aName = GetObjPyName();
aResList << QString( "%1 = %2.CreateObject( %3 );" )
.arg( aName ).arg( aDocName ).arg( getPyTypeID() );
aResList << QString( "%1.SetName( \"%2\" );" )
- .arg( aName ).arg( aName );
+ .arg( aName ).arg( GetName() );
aResList << QString( "" );
return aResList;
if ( theRefObject.IsNull() )
return;
- QString aRefObjName = theRefObject->GetName();
+ QString aRefObjName = theRefObject->GetObjPyName();
if ( aRefObjName.isEmpty() )
return;
if ( anIsToSetObject )
{
theScript << QString( "%1.%2( %3 );" )
- .arg( GetName() ).arg( theMethod ).arg( aRefObjName );
+ .arg( GetObjPyName() ).arg( theMethod ).arg( aRefObjName );
}
}
*/
HYDRODATA_EXPORT virtual void SetName( const QString& theName );
+ /**
+ * Returns the name of this object valid for Python script.
+ */
+ HYDRODATA_EXPORT virtual QString GetObjPyName() const;
+
/**
* Dump object to Python script representation.
* Base implementation returns empty list,
QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString anImageName = GetName();
+ QString anImageName = GetObjPyName();
QString aFilePath = GetFilePath();
if ( !aFilePath.isEmpty() )
QStringList HYDROData_ImmersibleZone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aZoneName = GetName();
+ QString aZoneName = GetObjPyName();
QColor aFillingColor = GetFillingColor();
aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
QStringList HYDROData_Obstacle::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
QStringList HYDROData_ObstacleAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
QStringList HYDROData_Polyline3D::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
- // TODO
+ Handle(HYDROData_PolylineXY) aRefPolyline = GetPolylineXY();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolylineXY" );
+
+ Handle(HYDROData_ProfileUZ) aRefProfile = GetProfileUZ();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefProfile, "SetProfileUZ" );
+
+ Handle(HYDROData_IAltitudeObject) aRefBathymetry = GetAltitudeObject();
+ setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetAltitudeObject" );
aResList << QString( "" );
aResList << QString( "%1.Update();" ).arg( aName );
QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aPolylineName = GetName();
+ QString aPolylineName = GetObjPyName();
// Set polilyne data
NCollection_Sequence<TCollection_AsciiString> aSectNames;
QStringList HYDROData_Profile::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
QColor aFillingColor = GetFillingColor();
aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
QStringList HYDROData_ProfileUZ::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// Set polilyne data
const TCollection_AsciiString& aSectName = GetSectionName( 0 );
QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aRegionName = GetName();
+ QString aRegionName = GetObjPyName();
HYDROData_SequenceOfObjects aZones = GetZones();
HYDROData_SequenceOfObjects::Iterator anIter( aZones );
QStringList HYDROData_River::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
QStringList HYDROData_Stream::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
QStringList HYDROData_StreamAltitude::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
- QString aName = GetName();
+ QString aName = GetObjPyName();
// TODO
// How can we get the shape? Mb Update() method to intersect the shapes of reference objects?
// TODO: TopoDS_Shape aRefShape = GetShape();
- QString aName = GetName();
+ QString aName = GetObjPyName();
aResList << QString( "" );
aResList << QString( "%1.Update();" ).arg( aName );
aResList << QString( "" );