From: adv Date: Mon, 23 Sep 2013 11:55:16 +0000 (+0000) Subject: Python scripting is done for Zones and Calculations (Feature #13). X-Git-Tag: BR_hydro_v_0_1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3cff85424556651afcab2e7fa5081531d748b7cc;hp=01088db9a5bdbd5b54e202ee2743ccea76e8dc98;p=modules%2Fhydro.git Python scripting is done for Zones and Calculations (Feature #13). --- diff --git a/src/HYDROData/HYDROData_Calculation.cxx b/src/HYDROData/HYDROData_Calculation.cxx index 8b9c94d7..766077e1 100644 --- a/src/HYDROData/HYDROData_Calculation.cxx +++ b/src/HYDROData/HYDROData_Calculation.cxx @@ -10,7 +10,7 @@ #include -#define PYTHON_BATHYMETRY_ID "KIND_CALCULATION" +#define PYTHON_CALCULATION_ID "KIND_CALCULATION" IMPLEMENT_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Calculation, HYDROData_Object) @@ -35,11 +35,35 @@ QStringList HYDROData_Calculation::DumpToPython( MapOfTreatedObjects& theTreated QString aCalculName = GetName(); aResList << QString( "%1 = %2.CreateObject( %3 );" ) - .arg( aCalculName ).arg( aDocName ).arg( PYTHON_BATHYMETRY_ID ); + .arg( aCalculName ).arg( aDocName ).arg( PYTHON_CALCULATION_ID ); aResList << QString( "%1.SetName( \"%2\" );" ) .arg( aCalculName ).arg( aCalculName ); - - // TO_IMPLEMENT + aResList << QString( "" ); + + Handle(HYDROData_Polyline) aBoundaryPolyline = GetBoundaryPolyline(); + setPythonReferenceObject( theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" ); + aResList << QString( "" ); + + HYDROData_SequenceOfObjects aZones = GetZones(); + HYDROData_SequenceOfObjects::Iterator anIter( aZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if ( !aRefZone.IsNull() ) + setPythonReferenceObject( theTreatedObjects, aResList, aRefZone, "AddZone" ); + } + aResList << QString( "" ); + + aZones = GetSplittedZones(); + anIter.Init( aZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aSplittedZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if ( !aSplittedZone.IsNull() ) + setPythonReferenceObject( theTreatedObjects, aResList, aSplittedZone, "AddSplittedZone" ); + } return aResList; } diff --git a/src/HYDROData/HYDROData_Document.cxx b/src/HYDROData/HYDROData_Document.cxx index ec413b43..7c43e53e 100644 --- a/src/HYDROData/HYDROData_Document.cxx +++ b/src/HYDROData/HYDROData_Document.cxx @@ -197,6 +197,7 @@ bool HYDROData_Document::DumpToPython( const QString& theFileName ) const aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_IMAGE ); aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_POLYLINE ); aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_BATHYMETRY ); + aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_ZONE ); aRes = aRes && dumpPartitionToPython( aFile, aTreatedObjects, KIND_CALCULATION ); return aRes; diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index 362e1515..694e65f8 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -139,30 +139,7 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject for ( int i = 0; i < aNbReferences; ++i ) { Handle(HYDROData_Image) aRefImg = Handle(HYDROData_Image)::DownCast( Reference( i ) ); - if ( aRefImg.IsNull() ) - continue; - - QString aRefImgName = aRefImg->GetName(); - - // The definition of reference image must be dumped before this - if ( !theTreatedObjects.contains( aRefImgName ) ) - { - // Write definition of reference image - QStringList aRefImgDump = aRefImg->DumpToPython( theTreatedObjects ); - if ( aRefImgDump.isEmpty() ) - continue; - - QStringList aTmpList = aResList; - aResList = aRefImgDump; - - aResList.append( "" ); - aResList.append( aTmpList ); - - theTreatedObjects.insert( aRefImgName, aRefImg ); - } - - aResList << QString( "%1.AppendReference( %2 );" ) - .arg( anImageName ).arg( aRefImgName ); + setPythonReferenceObject( theTreatedObjects, aResList, aRefImg, "AppendReference" ); } } diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 9a971a75..2ee9bd7e 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -303,4 +303,44 @@ QColor HYDROData_Object::GetColor( const QColor& theDefColor, } return aResColor; -} \ No newline at end of file +} + +void HYDROData_Object::setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects, + QStringList& theScript, + const Handle(HYDROData_Object)& theRefObject, + const QString& theMethod ) const +{ + if ( theRefObject.IsNull() ) + return; + + QString aRefObjName = theRefObject->GetName(); + if ( aRefObjName.isEmpty() ) + return; + + bool anIsToSetObject = true; + + // The definition of reference polyline must be dumped before this + if ( !theTreatedObjects.contains( aRefObjName ) ) + { + // Write definition of reference polyline + QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects ); + if ( ( anIsToSetObject = !aRefObjDump.isEmpty() ) ) + { + QStringList aTmpList = theScript; + theScript = aRefObjDump; + + theScript << QString( "" ); + theScript << aTmpList; + + theTreatedObjects.insert( aRefObjName, theRefObject ); + } + } + + if ( anIsToSetObject ) + { + theScript << QString( "%1.%2( %3 );" ) + .arg( GetName() ).arg( theMethod ).arg( aRefObjName ); + } +} + + diff --git a/src/HYDROData/HYDROData_Object.h b/src/HYDROData/HYDROData_Object.h index caa0b29c..8ddb4948 100644 --- a/src/HYDROData/HYDROData_Object.h +++ b/src/HYDROData/HYDROData_Object.h @@ -236,6 +236,13 @@ protected: */ QColor GetColor( const QColor& theDefColor, const int theTag = 0 ) const; + +protected: + + void setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects, + QStringList& theScript, + const Handle(HYDROData_Object)& theRefObject, + const QString& theMethod ) const; protected: Handle(TDataStd_ReferenceList) getReferenceList( const int theTag, diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index fa2c0e16..91765f5f 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -11,7 +11,7 @@ #include #include -#define PYTHON_POLYLINE_ID "KIND_ZONE" +#define PYTHON_ZONE_ID "KIND_ZONE" IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Object) @@ -32,6 +32,43 @@ QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects 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( "" ); + + QColor aFillingColor = GetFillingColor(); + aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" ) + .arg( aFillingColor.red() ).arg( aFillingColor.green() ) + .arg( aFillingColor.blue() ).arg( aFillingColor.alpha() ); + aResList << QString( "%1.SetFillingColor( filling_color );" ).arg( aZoneName ); + aResList << QString( "" ); + + QColor aBorderColor = GetBorderColor(); + aResList << QString( "border_color = QColor( %1, %2, %3, %4 );" ) + .arg( aBorderColor.red() ).arg( aBorderColor.green() ) + .arg( aBorderColor.blue() ).arg( aBorderColor.alpha() ); + aResList << QString( "%1.SetBorderColor( border_color );" ).arg( aZoneName ); + aResList << QString( "" ); + + Handle(HYDROData_Polyline) aRefPolyline = GetPolyline(); + setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" ); + aResList << QString( "" ); + + HYDROData_SequenceOfObjects aZoneBaths = GetBathymetries(); + HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths ); + for ( ; aBathsIter.More(); aBathsIter.Next() ) + { + Handle(HYDROData_Bathymetry) aRefBath = + Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() ); + if ( !aRefBath.IsNull() ) + setPythonReferenceObject( theTreatedObjects, aResList, aRefBath, "AddBathymetry" ); + } + return aResList; } diff --git a/src/HYDROPy/HYDROData.sip b/src/HYDROPy/HYDROData.sip index 16016f2a..1ef50c1e 100644 --- a/src/HYDROPy/HYDROData.sip +++ b/src/HYDROPy/HYDROData.sip @@ -56,6 +56,8 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com %Include HYDROData_Image.sip %Include HYDROData_Polyline.sip %Include HYDROData_Bathymetry.sip +%Include HYDROData_Zone.sip +%Include HYDROData_Calculation.sip %Include HYDROData_Document.sip diff --git a/src/HYDROPy/HYDROData_Calculation.sip b/src/HYDROPy/HYDROData_Calculation.sip new file mode 100644 index 00000000..00c026c5 --- /dev/null +++ b/src/HYDROPy/HYDROData_Calculation.sip @@ -0,0 +1,254 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%ExportedHeaderCode +#include +%End + +class HYDROData_Calculation : HYDROData_Object +{ + +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + if ( !Handle(HYDROData_Calculation)::DownCast( sipCpp ).IsNull() ) + sipClass = sipClass_HYDROData_Calculation; + else + sipClass = NULL; +%End + +public: + + const ObjectKind GetKind() const; + +public: + + /** + * Sets boundary polyline for calculation case. + */ + void SetBoundaryPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)]; + %MethodCode + + Handle(HYDROData_Polyline) aRefPolyline = + Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) ); + if ( !aRefPolyline.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetBoundaryPolyline( aRefPolyline ) : + sipCpp->SetBoundaryPolyline( aRefPolyline ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Returns boundary polyline of calculation case. + */ + HYDROData_Polyline GetBoundaryPolyline() const [Handle_HYDROData_Polyline ()]; + %MethodCode + + Handle(HYDROData_Polyline) aRefPolyline; + + Py_BEGIN_ALLOW_THREADS + aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetBoundaryPolyline() : + sipCpp->GetBoundaryPolyline(); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline ); + + %End + + /** + * Removes boundary polyline of calculation case. + */ + void RemoveBoundaryPolyline(); + + + + /** + * Returns number of refrence zones for calculation case. + */ + int NbZones() const; + + /** + * Add new one refrence zone for calculation case. + */ + void AddZone( HYDROData_Zone theZone ) [void (const Handle_HYDROData_Zone&)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) ); + if ( !aRefZone.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Calculation::AddZone( aRefZone ) : + sipCpp->AddZone( aRefZone ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Replace the refrence zone for calculation case. + */ + void SetZone( const int theIndex, + HYDROData_Zone theZone ) [void (const int, const Handle_HYDROData_Zone&)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) ); + if ( !aRefZone.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetZone( a0, aRefZone ) : + sipCpp->SetZone( a0, aRefZone ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Sets the refrence zones for calculation case. + */ + //void SetZones( const HYDROData_SequenceOfObjects& theZones ); + + /** + * Returns refrence zone of calculation case by index. + */ + HYDROData_Zone GetZone( const int theIndex ) const [Handle_HYDROData_Zone (const int)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone; + + Py_BEGIN_ALLOW_THREADS + aRefZone = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetZone( a0 ) : + sipCpp->GetZone( a0 ); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_Zone*)createPointer( aRefZone ); + + %End + + /** + * Returns all refrence zone of calculation case. + */ + //HYDROData_SequenceOfObjects GetZones() const; + + /** + * Removes all refrence zone of calculation case. + */ + void RemoveZones(); + + + + /** + * Returns number of splitted zones for calculation case. + */ + int NbSplittedZones() const; + + /** + * Add new one splitted zone for calculation case. + */ + void AddSplittedZone( HYDROData_Zone theZone ) [void (const Handle_HYDROData_Zone&)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) ); + if ( !aRefZone.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Calculation::AddSplittedZone( aRefZone ) : + sipCpp->AddSplittedZone( aRefZone ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Replace the splitted zone for calculation case. + */ + void SetSplittedZone( const int theIndex, + HYDROData_Zone theZone ) [void (const int, const Handle_HYDROData_Zone&)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) ); + if ( !aRefZone.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Calculation::SetSplittedZone( a0, aRefZone ) : + sipCpp->SetSplittedZone( a0, aRefZone ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Sets the refrence zones for calculation case. + */ + //void SetSplittedZones( const HYDROData_SequenceOfObjects& theZones ); + + /** + * Returns splitted zone of calculation case by index. + */ + HYDROData_Zone GetSplittedZone( const int theIndex ) const [Handle_HYDROData_Zone (const int)]; + %MethodCode + + Handle(HYDROData_Zone) aRefZone; + + Py_BEGIN_ALLOW_THREADS + aRefZone = sipSelfWasArg ? sipCpp->HYDROData_Calculation::GetSplittedZone( a0 ) : + sipCpp->GetSplittedZone( a0 ); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_Zone*)createPointer( aRefZone ); + + %End + + /** + * Returns all splitted zones of calculation case. + */ + //HYDROData_SequenceOfObjects GetSplittedZones() const; + + /** + * Removes all splitted refrence zone of calculation case. + */ + void RemoveSplittedZones(); + + +protected: + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_Calculation(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + ~HYDROData_Calculation(); +}; + + diff --git a/src/HYDROPy/HYDROData_Document.sip b/src/HYDROPy/HYDROData_Document.sip index 4c2bfae1..a53cada0 100644 --- a/src/HYDROPy/HYDROData_Document.sip +++ b/src/HYDROPy/HYDROData_Document.sip @@ -77,6 +77,16 @@ class HYDROData_Document aRes = new HYDROData_Bathymetry( *dynamic_cast( theObject ) ); break; } + case KIND_CALCULATION: + { + aRes = new HYDROData_Calculation( *dynamic_cast( theObject ) ); + break; + } + case KIND_ZONE: + { + aRes = new HYDROData_Zone( *dynamic_cast( theObject ) ); + break; + } } return aRes; diff --git a/src/HYDROPy/HYDROData_Object.sip b/src/HYDROPy/HYDROData_Object.sip index 852e58f5..5cec249f 100644 --- a/src/HYDROPy/HYDROData_Object.sip +++ b/src/HYDROPy/HYDROData_Object.sip @@ -32,6 +32,8 @@ const ObjectKind KIND_IMAGE; const ObjectKind KIND_POLYLINE; const ObjectKind KIND_VISUAL_STATE; const ObjectKind KIND_BATHYMETRY; +const ObjectKind KIND_CALCULATION; +const ObjectKind KIND_ZONE; class HYDROData_Object { @@ -55,6 +57,14 @@ class HYDROData_Object sipClass = sipClass_HYDROData_Bathymetry; break; + case KIND_CALCULATION: + sipClass = sipClass_HYDROData_Calculation; + break; + + case KIND_ZONE: + sipClass = sipClass_HYDROData_Zone; + break; + case KIND_UNKNOWN: sipClass = sipClass_HYDROData_Object; break; diff --git a/src/HYDROPy/HYDROData_Zone.sip b/src/HYDROPy/HYDROData_Zone.sip new file mode 100644 index 00000000..892ef0aa --- /dev/null +++ b/src/HYDROPy/HYDROData_Zone.sip @@ -0,0 +1,195 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%ExportedHeaderCode +#include +%End + +class HYDROData_Zone : HYDROData_Object +{ + +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + if ( !Handle(HYDROData_Zone)::DownCast( sipCpp ).IsNull() ) + sipClass = sipClass_HYDROData_Zone; + else + sipClass = NULL; +%End + +public: + + const ObjectKind GetKind() const; + +public: + + /** + * Sets filling color for zone. + */ + void SetFillingColor( const QColor& theColor ); + + /** + * Returns filling color of zone. + */ + QColor GetFillingColor() const; + + /** + * Sets border color for zone. + */ + void SetBorderColor( const QColor& theColor ); + + /** + * Returns border color of zone. + */ + QColor GetBorderColor() const; + + /** + * Sets reference polyline object for zone. + */ + void SetPolyline( HYDROData_Polyline thePolyline ) [void (const Handle_HYDROData_Polyline&)]; + %MethodCode + + Handle(HYDROData_Polyline) aRefPolyline = + Handle(HYDROData_Polyline)::DownCast( createHandle( a0 ) ); + if ( !aRefPolyline.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Zone::SetPolyline( aRefPolyline ) : + sipCpp->SetPolyline( aRefPolyline ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Returns reference polyline object of zone. + */ + HYDROData_Polyline GetPolyline() const [Handle_HYDROData_Polyline ()]; + %MethodCode + + Handle(HYDROData_Polyline) aRefPolyline; + + Py_BEGIN_ALLOW_THREADS + aRefPolyline = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetPolyline() : + sipCpp->GetPolyline(); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_Polyline*)createPointer( aRefPolyline ); + + %End + + /** + * Remove reference polyline object of zone. + */ + void RemovePolyline(); + + /** + * Returns number of bathymetry objects for zone. + */ + int NbBathymetries() const; + + /** + * Add reference bathymetry object for zone. + */ + void AddBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)]; + %MethodCode + + Handle(HYDROData_Bathymetry) aRefBath = + Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) ); + if ( !aRefBath.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Zone::AddBathymetry( aRefBath ) : + sipCpp->AddBathymetry( aRefBath ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Change reference bathymetry object with given index for zone. + */ + void SetBathymetry( const int theIndex, + HYDROData_Bathymetry theBathymetry ) [void (const int, const Handle_HYDROData_Bathymetry&)]; + %MethodCode + + Handle(HYDROData_Bathymetry) aRefBath = + Handle(HYDROData_Bathymetry)::DownCast( createHandle( a1 ) ); + if ( !aRefBath.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->HYDROData_Zone::SetBathymetry( a0, aRefBath ) : + sipCpp->SetBathymetry( a0, aRefBath ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Returns reference bathymetry object of zone by it index. + */ + HYDROData_Bathymetry GetBathymetry( const int theIndex ) const [Handle_HYDROData_Bathymetry (const int)]; + %MethodCode + + Handle(HYDROData_Bathymetry) aRefBath; + + Py_BEGIN_ALLOW_THREADS + aRefBath = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetBathymetry( a0 ) : + sipCpp->GetBathymetry( a0 ); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath ); + + %End + + /** + * Returns list of all reference bathymetry objects of zone. + */ + //HYDROData_SequenceOfObjects GetBathymetries() const; + + /** + * Clear list of bathymetry objects of zone. + */ + void RemoveBathymetries(); + + /** + * Returns the painter path. The painter path is construct by polyline + */ + QPainterPath GetPainterPath() const; + +protected: + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_Zone(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + ~HYDROData_Zone(); +}; + + diff --git a/src/HYDROPy/HYDROPy.vcproj b/src/HYDROPy/HYDROPy.vcproj index 1b1f8559..ba703b69 100644 --- a/src/HYDROPy/HYDROPy.vcproj +++ b/src/HYDROPy/HYDROPy.vcproj @@ -170,6 +170,10 @@ RelativePath=".\HYDROData_Bathymetry.sip" > + + @@ -186,6 +190,10 @@ RelativePath=".\HYDROData_Polyline.sip" > + +