From 8543e637cbb4ae48998c596241fce567a729eb67 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 20 Dec 2013 07:34:44 +0000 Subject: [PATCH] The bathymetry is changed to their base altitude class for geometry objects (Bug #214). --- src/HYDROData/HYDROData_CalculationCase.cxx | 24 +++---- src/HYDROData/HYDROData_ImmersibleZone.cxx | 6 +- src/HYDROData/HYDROData_Object.cxx | 34 +++++----- src/HYDROData/HYDROData_Object.h | 25 +++---- src/HYDROData/HYDROData_Polyline3D.cxx | 37 ++++++----- src/HYDROData/HYDROData_Polyline3D.h | 4 +- src/HYDROData/HYDROData_Zone.cxx | 36 +++++----- src/HYDROData/HYDROData_Zone.h | 30 ++++----- src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 4 +- src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 4 +- src/HYDROGUI/HYDROGUI_DataBrowser.cxx | 6 +- src/HYDROGUI/HYDROGUI_DataModel.cxx | 12 ++-- src/HYDROGUI/HYDROGUI_DataObject.h | 2 +- src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx | 8 +-- src/HYDROGUI/HYDROGUI_Poly3DOp.cxx | 8 +-- src/HYDROGUI/HYDROGUI_Zone.cxx | 73 ++++++++++----------- src/HYDROGUI/HYDROGUI_Zone.h | 14 ++-- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 +- src/HYDROPy/CMakeLists.txt | 3 +- src/HYDROPy/HYDROData.sip | 3 +- src/HYDROPy/HYDROData_Bathymetry.sip | 38 +++++------ src/HYDROPy/HYDROData_IAltitudeObject.sip | 70 ++++++++++++++++++++ src/HYDROPy/HYDROData_ImmersibleZone.sip | 40 ----------- src/HYDROPy/HYDROData_Object.sip | 39 +++++++++++ src/HYDROPy/HYDROData_Zone.sip | 44 ++++++------- 25 files changed, 316 insertions(+), 252 deletions(-) create mode 100644 src/HYDROPy/HYDROData_IAltitudeObject.sip diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 72c239c7..32fb6044 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -2,7 +2,7 @@ #include "HYDROData_CalculationCase.h" #include "HYDROData_ArtificialObject.h" -#include "HYDROData_Bathymetry.h" +#include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" #include "HYDROData_ShapesGroup.h" #include "HYDROData_Iterator.h" @@ -501,13 +501,13 @@ void HYDROData_CalculationCase::RemoveSplittedGroups() double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const { - double aResAltitude = HYDROData_Bathymetry::GetInvalidAltitude(); + double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude(); Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); if ( aZone.IsNull() ) return aResAltitude; - HYDROData_Zone::MergeBathymetriesType aZoneMergeType = aZone->GetMergeType(); + HYDROData_Zone::MergeAltitudesType aZoneMergeType = aZone->GetMergeType(); if ( !aZone->IsMergingNeed() ) { aZoneMergeType = HYDROData_Zone::Merge_UNKNOWN; @@ -519,9 +519,9 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) c if ( aZoneMergeType == HYDROData_Zone::Merge_Object ) { - Handle(HYDROData_Bathymetry) aMergeBathymetry = aZone->GetMergeBathymetry(); - if ( !aMergeBathymetry.IsNull() ) - aResAltitude = aMergeBathymetry->GetAltitudeForPoint( thePoint ); + Handle(HYDROData_IAltitudeObject) aMergeAltitude = aZone->GetMergeAltitude(); + if ( !aMergeAltitude.IsNull() ) + aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint ); } else { @@ -534,12 +534,12 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) c if ( aZoneObj.IsNull() ) continue; - Handle(HYDROData_Bathymetry) anObjBathymetry = aZoneObj->GetBathymetry(); - if ( anObjBathymetry.IsNull() ) + Handle(HYDROData_IAltitudeObject) anObjAltitude = aZoneObj->GetAltitudeObject(); + if ( anObjAltitude.IsNull() ) continue; - double aPointAltitude = anObjBathymetry->GetAltitudeForPoint( thePoint ); - if ( ValuesEquals( aPointAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) ) + double aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint ); + if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) ) continue; if ( aZoneMergeType == HYDROData_Zone::Merge_UNKNOWN ) @@ -549,7 +549,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) c } else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMIN ) { - if ( ValuesEquals( aResAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) || + if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) || aResAltitude > aPointAltitude ) { aResAltitude = aPointAltitude; @@ -557,7 +557,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) c } else if ( aZoneMergeType == HYDROData_Zone::Merge_ZMAX ) { - if ( ValuesEquals( aResAltitude, HYDROData_Bathymetry::GetInvalidAltitude() ) || + if ( ValuesEquals( aResAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) || aResAltitude < aPointAltitude ) { aResAltitude = aPointAltitude; diff --git a/src/HYDROData/HYDROData_ImmersibleZone.cxx b/src/HYDROData/HYDROData_ImmersibleZone.cxx index 1af6a8a3..4561fbf1 100644 --- a/src/HYDROData/HYDROData_ImmersibleZone.cxx +++ b/src/HYDROData/HYDROData_ImmersibleZone.cxx @@ -1,7 +1,7 @@ #include "HYDROData_ImmersibleZone.h" -#include "HYDROData_Bathymetry.h" +#include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" #include "HYDROData_ShapesGroup.h" #include "HYDROData_PolylineXY.h" @@ -72,8 +72,8 @@ QStringList HYDROData_ImmersibleZone::DumpToPython( MapOfTreatedObjects& theTrea aResList << QString( "%1.SetBorderColor( border_color );" ).arg( aZoneName ); aResList << QString( "" ); - Handle(HYDROData_Bathymetry) aRefBathymetry = GetBathymetry(); - setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetBathymetry" ); + Handle(HYDROData_IAltitudeObject) aRefAltitude = GetAltitudeObject(); + setPythonReferenceObject( theTreatedObjects, aResList, aRefAltitude, "SetAltitudeObject" ); Handle(HYDROData_PolylineXY) aRefPolyline = GetPolyline(); setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolyline" ); diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 64530903..970b62d7 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -1,10 +1,10 @@ #include "HYDROData_Object.h" -#include "HYDROData_Bathymetry.h" #include "HYDROData_DummyObject3D.h" #include "HYDROData_ShapesGroup.h" #include "HYDROData_Iterator.h" +#include "HYDROData_IAltitudeObject.h" #include #include @@ -66,9 +66,9 @@ HYDROData_SequenceOfObjects HYDROData_Object::GetAllReferenceObjects() const { HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects(); - Handle(HYDROData_Bathymetry) aRefBathymetry = GetBathymetry(); - if ( !aRefBathymetry.IsNull() ) - aResSeq.Append( aRefBathymetry ); + Handle(HYDROData_IAltitudeObject) aRefAltitude = GetAltitudeObject(); + if ( !aRefAltitude.IsNull() ) + aResSeq.Append( aRefAltitude ); return aResSeq; } @@ -130,16 +130,17 @@ HYDROData_SequenceOfObjects HYDROData_Object::GetGroups() const return GetReferenceObjects( DataTag_EdgesGroup ); } -bool HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ) +bool HYDROData_Object::SetAltitudeObject( + const Handle(HYDROData_IAltitudeObject)& theAltitude ) { - if ( theBathymetry.IsNull() ) + if ( theAltitude.IsNull() ) return false; - Handle(HYDROData_Bathymetry) aPrevBathymetry = GetBathymetry(); - if ( IsEqual( aPrevBathymetry, theBathymetry ) ) + Handle(HYDROData_IAltitudeObject) aPrevAltitude = GetAltitudeObject(); + if ( IsEqual( aPrevAltitude, theAltitude ) ) return true; - SetReferenceObject( theBathymetry, DataTag_Bathymetry ); + SetReferenceObject( theAltitude, DataTag_AltitudeObject ); // Indicate model of the need to update object SetToUpdate( true ); @@ -147,20 +148,19 @@ bool HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBat return true; } - -Handle(HYDROData_Bathymetry) HYDROData_Object::GetBathymetry() const +Handle(HYDROData_IAltitudeObject) HYDROData_Object::GetAltitudeObject() const { - return Handle(HYDROData_Bathymetry)::DownCast( - GetReferenceObject( DataTag_Bathymetry ) ); + return Handle(HYDROData_IAltitudeObject)::DownCast( + GetReferenceObject( DataTag_AltitudeObject ) ); } -void HYDROData_Object::RemoveBathymetry() +void HYDROData_Object::RemoveAltitudeObject() { - Handle(HYDROData_Bathymetry) aPrevBathymetry = GetBathymetry(); - if ( aPrevBathymetry.IsNull() ) + Handle(HYDROData_IAltitudeObject) aPrevAltitude = GetAltitudeObject(); + if ( aPrevAltitude.IsNull() ) return; - ClearReferenceObjects( DataTag_Bathymetry ); + ClearReferenceObjects( DataTag_AltitudeObject ); // Indicate model of the need to update object SetToUpdate( true ); diff --git a/src/HYDROData/HYDROData_Object.h b/src/HYDROData/HYDROData_Object.h index a7eb9aec..0e19876d 100644 --- a/src/HYDROData/HYDROData_Object.h +++ b/src/HYDROData/HYDROData_Object.h @@ -8,7 +8,7 @@ DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity) class TopoDS_Shape; -class Handle(HYDROData_Bathymetry); +class Handle(HYDROData_IAltitudeObject); class Handle(HYDROData_DummyObject3D); class Handle(HYDROData_ShapesGroup); @@ -27,11 +27,11 @@ protected: DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve DataTag_TopShape, DataTag_Shape3D, - DataTag_Bathymetry, ///< reference bathymetry - DataTag_FillingColor, ///< filling color of geometrical object - DataTag_BorderColor, ///< border color of geometrical object - DataTag_Object3D, ///< child 3D object - DataTag_EdgesGroup, ///< child group objects + DataTag_AltitudeObject, ///< reference altitude object + DataTag_FillingColor, ///< filling color of geometrical object + DataTag_BorderColor, ///< border color of geometrical object + DataTag_Object3D, ///< child 3D object + DataTag_EdgesGroup, ///< child group objects }; public: @@ -94,19 +94,20 @@ public: /** - * Set reference bathymetry object for geometry object. + * Set reference altitude object for geometry object. */ - HYDRODATA_EXPORT virtual bool SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ); + HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude ); /** - * Returns reference bathymetry object of geometry object. + * Returns reference altitude object of geometry object. */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry() const; + HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const; /** - * Clear the reference bathymetry object for geometry object. + * Clear the reference altitude object for geometry object. */ - HYDRODATA_EXPORT virtual void RemoveBathymetry(); + HYDRODATA_EXPORT virtual void RemoveAltitudeObject(); + /** * Sets filling color for object. diff --git a/src/HYDROData/HYDROData_Polyline3D.cxx b/src/HYDROData/HYDROData_Polyline3D.cxx index 2bdd60a5..67fe1a88 100644 --- a/src/HYDROData/HYDROData_Polyline3D.cxx +++ b/src/HYDROData/HYDROData_Polyline3D.cxx @@ -1,7 +1,7 @@ #include "HYDROData_Polyline3D.h" -#include "HYDROData_Bathymetry.h" +#include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" #include "HYDROData_PolylineXY.h" #include "HYDROData_Profile.h" @@ -99,8 +99,8 @@ void HYDROData_Polyline3D::Update() Handle(HYDROData_ProfileUZ) aProfileUZ = GetProfileUZ(); - Handle(HYDROData_Bathymetry) aBathymetry = GetBathymetry(); - if ( !aBathymetry.IsNull() ) + Handle(HYDROData_IAltitudeObject) anAltitude = GetAltitudeObject(); + if ( !anAltitude.IsNull() ) aProfileUZ = GetChildProfileUZ(); if ( aProfileUZ.IsNull() ) @@ -217,7 +217,7 @@ bool HYDROData_Polyline3D::SetProfileUZ( const Handle(HYDROData_ProfileUZ)& theP SetReferenceObject( theProfile, DataTag_ProfileUZ ); // Remove the bathymetry, because one altitude object can be presented at time - RemoveBathymetry(); + RemoveAltitudeObject(); // Indicate model of the need to update the polyline presentation SetToUpdate( true ); @@ -243,14 +243,15 @@ void HYDROData_Polyline3D::RemoveProfileUZ() SetToUpdate( true ); } -bool HYDROData_Polyline3D::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ) +bool HYDROData_Polyline3D::SetAltitudeObject( + const Handle(HYDROData_IAltitudeObject)& theAltitude ) { - Handle(HYDROData_Bathymetry) aPrevBathymetry = GetBathymetry(); + Handle(HYDROData_IAltitudeObject) aPrevAltitude = GetAltitudeObject(); - if ( !HYDROData_Object::SetBathymetry( theBathymetry ) ) + if ( !HYDROData_Object::SetAltitudeObject( theAltitude ) ) return false; - if ( IsEqual( aPrevBathymetry, theBathymetry ) ) + if ( IsEqual( aPrevAltitude, theAltitude ) ) return true; // Remove the u,z profile, because one altitude object can be presented at time @@ -263,9 +264,9 @@ bool HYDROData_Polyline3D::SetBathymetry( const Handle(HYDROData_Bathymetry)& th } -void HYDROData_Polyline3D::RemoveBathymetry() +void HYDROData_Polyline3D::RemoveAltitudeObject() { - HYDROData_Object::RemoveBathymetry(); + HYDROData_Object::RemoveAltitudeObject(); // Remove the child profile object removeChildProfileUZ(); @@ -299,11 +300,11 @@ Handle(HYDROData_ProfileUZ) HYDROData_Polyline3D::GetChildProfileUZ( const bool } HYDROData_IPolyline::PointsList generateProfileUZPoints( - const Handle(HYDROData_PolylineXY)& thePolyline, - const Handle(HYDROData_Bathymetry)& theBathymetry ) + const Handle(HYDROData_PolylineXY)& thePolyline, + const Handle(HYDROData_IAltitudeObject)& theAltitude ) { HYDROData_IPolyline::PointsList aPointsList; - if ( thePolyline.IsNull() || theBathymetry.IsNull() ) + if ( thePolyline.IsNull() || theAltitude.IsNull() ) return aPointsList; bool anIsSectionClosed = thePolyline->IsClosedSection( 0 ); @@ -317,8 +318,8 @@ HYDROData_IPolyline::PointsList generateProfileUZPoints( const HYDROData_PolylineXY::Point& aSectPoint = aPolylinePoints.Value( i ); double aPointDistance = thePolyline->GetDistance( 0, i - 1 ); - double aPointDepth = theBathymetry->GetAltitudeForPoint( aSectPoint ); - if( aPointDepth==theBathymetry->GetInvalidAltitude() ) + double aPointDepth = theAltitude->GetAltitudeForPoint( aSectPoint ); + if( aPointDepth == theAltitude->GetInvalidAltitude() ) aPointDepth = 0.0; HYDROData_IPolyline::Point anAltitudePoint( aPointDistance, aPointDepth ); @@ -330,8 +331,8 @@ HYDROData_IPolyline::PointsList generateProfileUZPoints( void HYDROData_Polyline3D::updateChildProfilePoints() { - Handle(HYDROData_Bathymetry) aBathymetry = GetBathymetry(); - if ( aBathymetry.IsNull() ) + Handle(HYDROData_IAltitudeObject) anAltitude = GetAltitudeObject(); + if ( anAltitude.IsNull() ) return; Handle(HYDROData_ProfileUZ) aChildProfileUZ = GetChildProfileUZ(); @@ -344,7 +345,7 @@ void HYDROData_Polyline3D::updateChildProfilePoints() return; HYDROData_IPolyline::PointsList aProfilePoints = - generateProfileUZPoints( GetPolylineXY(), GetBathymetry() ); + generateProfileUZPoints( GetPolylineXY(), anAltitude ); aProfile->SetParametricPoints( aProfilePoints ); aProfile->Update(); diff --git a/src/HYDROData/HYDROData_Polyline3D.h b/src/HYDROData/HYDROData_Polyline3D.h index 98d655ec..ad7a6e1a 100644 --- a/src/HYDROData/HYDROData_Polyline3D.h +++ b/src/HYDROData/HYDROData_Polyline3D.h @@ -118,13 +118,13 @@ public: * Set reference bathymetry object for geometry object. * Reimplemented to remove reference u,z profile. */ - HYDRODATA_EXPORT virtual bool SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ); + HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude ); /** * Clear the reference bathymetry object for geometry object. * Reimplemented to remove child u,z profile. */ - HYDRODATA_EXPORT virtual void RemoveBathymetry(); + HYDRODATA_EXPORT virtual void RemoveAltitudeObject(); /** diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index 76e5dc8c..70272326 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -2,7 +2,7 @@ #include "HYDROData_Zone.h" #include "HYDROData_ArtificialObject.h" -#include "HYDROData_Bathymetry.h" +#include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" #include "HYDROData_NaturalObject.h" @@ -99,7 +99,7 @@ TopoDS_Shape HYDROData_Zone::GetShape() const bool HYDROData_Zone::IsMergingNeed() const { - Handle(HYDROData_Bathymetry) aRefBathymetry; + Handle(HYDROData_IAltitudeObject) aRefAltitude; HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects ); @@ -110,24 +110,24 @@ bool HYDROData_Zone::IsMergingNeed() const if ( aRefGeomObj.IsNull() ) continue; - Handle(HYDROData_Bathymetry) anObjBathymetry = aRefGeomObj->GetBathymetry(); - if ( anObjBathymetry.IsNull() ) + Handle(HYDROData_IAltitudeObject) anObjAltitude = aRefGeomObj->GetAltitudeObject(); + if ( anObjAltitude.IsNull() ) continue; - if ( aRefBathymetry.IsNull() ) + if ( aRefAltitude.IsNull() ) { - aRefBathymetry = anObjBathymetry; + aRefAltitude = anObjAltitude; continue; } - if ( !IsEqual( aRefBathymetry, anObjBathymetry ) ) + if ( !IsEqual( aRefAltitude, anObjAltitude ) ) return true; } return false; } -void HYDROData_Zone::SetMergeType( const MergeBathymetriesType& theType ) +void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType ) { Handle(TDataStd_Integer) anInt; if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) ) @@ -140,31 +140,31 @@ void HYDROData_Zone::SetMergeType( const MergeBathymetriesType& theType ) } } -HYDROData_Zone::MergeBathymetriesType HYDROData_Zone::GetMergeType() const +HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const { - MergeBathymetriesType aMergeType = Merge_UNKNOWN; + MergeAltitudesType aMergeType = Merge_UNKNOWN; Handle(TDataStd_Integer) anInt; if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) ) - aMergeType = (MergeBathymetriesType)anInt->Get(); + aMergeType = (MergeAltitudesType)anInt->Get(); return aMergeType; } -void HYDROData_Zone::SetMergeBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ) +void HYDROData_Zone::SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude ) { - SetReferenceObject( theBathymetry, DataTag_Bathymetry ); + SetReferenceObject( theAltitude, DataTag_MergeAltitude ); } -Handle(HYDROData_Bathymetry) HYDROData_Zone::GetMergeBathymetry() const +Handle(HYDROData_IAltitudeObject) HYDROData_Zone::GetMergeAltitude() const { - return Handle(HYDROData_Bathymetry)::DownCast( - GetReferenceObject( DataTag_Bathymetry ) ); + return Handle(HYDROData_IAltitudeObject)::DownCast( + GetReferenceObject( DataTag_MergeAltitude ) ); } -void HYDROData_Zone::RemoveMergeBathymetry() +void HYDROData_Zone::RemoveMergeAltitude() { - ClearReferenceObjects( DataTag_Bathymetry ); + ClearReferenceObjects( DataTag_MergeAltitude ); } bool HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObject ) diff --git a/src/HYDROData/HYDROData_Zone.h b/src/HYDROData/HYDROData_Zone.h index a01db41e..ed7e1d7c 100644 --- a/src/HYDROData/HYDROData_Zone.h +++ b/src/HYDROData/HYDROData_Zone.h @@ -5,7 +5,7 @@ #include class Handle(HYDROData_Object); -class Handle(HYDROData_Bathymetry); +class Handle(HYDROData_IAltitudeObject); class TopoDS_Shape; DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity) @@ -19,13 +19,13 @@ class HYDROData_Zone : public HYDROData_Entity public: - // Enumeration of mergin types for conflict bathymetries - enum MergeBathymetriesType + // Enumeration of mergin types for conflict altitudes + enum MergeAltitudesType { Merge_UNKNOWN, // Undefined Merge_ZMIN, // The minimum values Merge_ZMAX, // The maximum values - Merge_Object // Only one bathymetry will be taken into account + Merge_Object // Only one altitude will be taken into account }; protected: @@ -38,7 +38,7 @@ protected: DataTag_Shape, ///< reference shape DataTag_GeometryObject, ///< reference geometry objects DataTag_MergeType, ///< mergin type of conflict bathymetries - DataTag_Bathymetry, ///< reference bathymetry + DataTag_MergeAltitude, ///< reference altitude for conflict merge }; public: @@ -90,32 +90,32 @@ public: /** - * Sets the merging type for conflict bathymetries. + * Sets the merging type for conflict altitudes. * By default it is set to Merge_UNKNOWN. */ - HYDRODATA_EXPORT virtual void SetMergeType( const MergeBathymetriesType& theType ); + HYDRODATA_EXPORT virtual void SetMergeType( const MergeAltitudesType& theType ); /** - * Returns the merging type for conflict bathymetries. + * Returns the merging type for conflict altitudes. */ - HYDRODATA_EXPORT virtual MergeBathymetriesType GetMergeType() const; + HYDRODATA_EXPORT virtual MergeAltitudesType GetMergeType() const; /** - * Sets the reference bathymetry to resolve the conflict. + * Sets the reference altitude to resolve the conflict. * This object is used only in case of "Merge_Object" merge type. */ - HYDRODATA_EXPORT virtual void SetMergeBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry ); + HYDRODATA_EXPORT virtual void SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude ); /** - * Returns the reference bathymetry to resolve the conflict. + * Returns the reference altitude to resolve the conflict. */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetMergeBathymetry() const; + HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetMergeAltitude() const; /** - * Removes the reference bathymetry for resolving the conflict. + * Removes the reference altitude for resolving the conflict. */ - HYDRODATA_EXPORT virtual void RemoveMergeBathymetry(); + HYDRODATA_EXPORT virtual void RemoveMergeAltitude(); /** diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index ece81504..ba31ad82 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -356,7 +356,7 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject ) myBathymetryChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN ); myBathymetryChoice->addItem( tr("MERGE_ZMIN"), HYDROData_Zone::Merge_ZMIN ); myBathymetryChoice->addItem( tr("MERGE_ZMAX"), HYDROData_Zone::Merge_ZMAX ); - QStringList aList = aZone->getBathymetries(); + QStringList aList = aZone->getAltitudes(); for ( int i = 0; i < aList.length(); i++ ) { myBathymetryChoice->addItem( aList.at( i ), HYDROData_Zone::Merge_Object ); @@ -372,7 +372,7 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject ) aCurIndex = 2; break; case HYDROData_Zone::Merge_Object: - aCurIndex = 3 + aList.indexOf( aZone->text( HYDROGUI_DataObject::BathymetryId ) ); + aCurIndex = 3 + aList.indexOf( aZone->text( HYDROGUI_DataObject::AltitudeObjId ) ); break; default: aCurIndex = 0; // Select unknown by default diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index e12aa5fc..f8143232 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -394,7 +394,7 @@ void HYDROGUI_CalculationOp::onCreateRegion( const QList& theZ } } -void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathymetryName ) +void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theAltitudeName ) { HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); @@ -403,7 +403,7 @@ void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathy HYDROGUI_Zone* aZone = aPanel->getCurrentZone(); if ( aZone ) { - aZone->setMergeType( theMergeType, theBathymetryName ); + aZone->setMergeType( theMergeType, theAltitudeName ); HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() ); if ( aShape ) { diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx index 714d2a16..2c16b0c6 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx @@ -60,7 +60,7 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat QString EntryCol = QObject::tr( "ENTRY_COLUMN" ); QString RefObjCol = tr( "REF_OBJECT_COLUMN" ); - QString BathymetryCol = tr( "BATHYMETRY_COLUMN" ); + QString AltitudeCol = tr( "ALTITUDE_COLUMN" ); SUIT_AbstractModel* treeModel = dynamic_cast( model() ); //RKV: treeModel->setSearcher( theModule->getApp() ); @@ -69,8 +69,8 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat treeModel->setAppropriate( EntryCol, Qtx::Toggled ); treeModel->registerColumn( 0, RefObjCol, HYDROGUI_DataObject::RefObjectId ); treeModel->setAppropriate( RefObjCol, Qtx::Toggled ); - treeModel->registerColumn( 0, BathymetryCol, HYDROGUI_DataObject::BathymetryId ); - treeModel->setAppropriate( BathymetryCol, Qtx::Toggled ); + treeModel->registerColumn( 0, AltitudeCol, HYDROGUI_DataObject::AltitudeObjId ); + treeModel->setAppropriate( AltitudeCol, Qtx::Toggled ); // Mantis issue 0020136: Drag&Drop in OB SUIT_ProxyModel* proxyModel = dynamic_cast(treeModel); diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 89c3edc2..81a96bfd 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -785,9 +785,9 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, LightApp_DataObject* aBathSect = createObject( aGuiObj, tr( "ZONE_BATHYMETRY" ), aGuiObj->entry() ); - Handle(HYDROData_Bathymetry) aBathymetry = aZoneObj->GetBathymetry(); - if ( !aBathymetry.IsNull() && !aBathymetry->IsRemoved() ) - createObject( aBathSect, aBathymetry, aGuiObj->entry(), false ); + Handle(HYDROData_IAltitudeObject) anAltitudeObj = aZoneObj->GetAltitudeObject(); + if ( !anAltitudeObj.IsNull() && !anAltitudeObj->IsRemoved() ) + createObject( aBathSect, anAltitudeObj, aGuiObj->entry(), false ); } else if ( anObjectKind == KIND_POLYLINE ) { @@ -819,9 +819,9 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, LightApp_DataObject* aBathSect = createObject( aGuiObj, tr( "POLYLINE3D_BATHYMETRY" ), aGuiObj->entry() ); - Handle(HYDROData_Bathymetry) aBathymetry = aPolyline3D->GetBathymetry(); - if ( !aBathymetry.IsNull() && !aBathymetry->IsRemoved() ) - createObject( aBathSect, aBathymetry, aGuiObj->entry(), false ); + Handle(HYDROData_IAltitudeObject) anAltitudeObj = aPolyline3D->GetAltitudeObject(); + if ( !anAltitudeObj.IsNull() && !anAltitudeObj->IsRemoved() ) + createObject( aBathSect, anAltitudeObj, aGuiObj->entry(), false ); } else if ( anObjectKind == KIND_CALCULATION ) { diff --git a/src/HYDROGUI/HYDROGUI_DataObject.h b/src/HYDROGUI/HYDROGUI_DataObject.h index d8b78a8c..8f158288 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.h +++ b/src/HYDROGUI/HYDROGUI_DataObject.h @@ -47,7 +47,7 @@ public: //! Column id enum { RefObjectId = RefEntryId + 1, //!< Ref.Object column - BathymetryId //!< Bathymetry column + AltitudeObjId //!< Altitude column }; //! Role diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx index 1dc958e4..aa0e89cf 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx @@ -85,9 +85,9 @@ void HYDROGUI_ImmersibleZoneOp::startOperation() if ( !aRefPolyline.IsNull() ) aSelectedPolyline = aRefPolyline->GetName(); - Handle(HYDROData_Bathymetry) aRefBathymetry = myEditedObject->GetBathymetry(); - if ( !aRefBathymetry.IsNull() ) - aSelectedBathymetry = aRefBathymetry->GetName(); + Handle(HYDROData_IAltitudeObject) aRefAltitude = myEditedObject->GetAltitudeObject(); + if ( !aRefAltitude.IsNull() ) + aSelectedBathymetry = aRefAltitude->GetName(); } } @@ -221,7 +221,7 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags, } aZoneObj->SetPolyline( aZonePolyline ); - aZoneObj->SetBathymetry( aZoneBathymetry ); + aZoneObj->SetAltitudeObject( aZoneBathymetry ); aZoneObj->Update(); closePreview(); diff --git a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx index 7a4bd951..6235cda2 100644 --- a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx +++ b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx @@ -89,9 +89,9 @@ void HYDROGUI_Poly3DOp::startOperation() if( !aPoly.IsNull() ) aPolyName = aPoly->GetName(); - Handle(HYDROData_Bathymetry) aBathymetry = myEditedObject->GetBathymetry(); - if( !aBathymetry.IsNull() ) - aBathName = aBathymetry->GetName(); + Handle(HYDROData_IAltitudeObject) anAltitudeObj = myEditedObject->GetAltitudeObject(); + if( !anAltitudeObj.IsNull() ) + aBathName = anAltitudeObj->GetName(); aPanel->setSelectedObjects( aPolyName, aProfileName, aBathName ); } @@ -167,7 +167,7 @@ bool HYDROGUI_Poly3DOp::processApply( int& theUpdateFlags, } else { - aResult->SetBathymetry( aBath ); + aResult->SetAltitudeObject( aBath ); } if( !myIsEdit ) diff --git a/src/HYDROGUI/HYDROGUI_Zone.cxx b/src/HYDROGUI/HYDROGUI_Zone.cxx index 4485ec4f..8a5bc0d3 100644 --- a/src/HYDROGUI/HYDROGUI_Zone.cxx +++ b/src/HYDROGUI/HYDROGUI_Zone.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -48,9 +48,9 @@ QString HYDROGUI_Zone::text( const int theColumnId ) const // Get Ref.Object name aRes = getRefObjectNames(); break; - case BathymetryId: - // Get bathymetry name - aRes = getBathimetryName(); + case AltitudeObjId: + // Get altitude object name + aRes = getAltitudeName(); break; default: aRes = LightApp_DataObject::text( theColumnId ); @@ -85,7 +85,7 @@ QString HYDROGUI_Zone::getRefObjectNames() const return aRes; } -QString HYDROGUI_Zone::getBathimetryName() const +QString HYDROGUI_Zone::getAltitudeName() const { QString aRes; Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() ); @@ -96,9 +96,9 @@ QString HYDROGUI_Zone::getBathimetryName() const if ( ( isMergingNeed && aZone->GetMergeType() == HYDROData_Zone::Merge_UNKNOWN ) || ( aSeq.Length() == 1 ) || ( !isMergingNeed ) ) { - // Collect all used bathymetries names when merging is necessary - // or just get the name of bathymetry of a single geometry object - // or just get the name of a single bathymetry + // Collect all used altitudes names when merging is necessary + // or just get the name of altitude of a single geometry object + // or just get the name of a single altitude HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); QSet aNamesSet; QString aName; @@ -108,14 +108,14 @@ QString HYDROGUI_Zone::getBathimetryName() const Handle(HYDROData_Object)::DownCast( anIter.Value() ); if ( !aRefGeomObj.IsNull() ) { - // Get bathymetry name - Handle(HYDROData_Bathymetry) aBathymetry = aRefGeomObj->GetBathymetry(); - if ( !aBathymetry.IsNull() ) + // Get altitude object name + Handle(HYDROData_IAltitudeObject) anAltitudeObj = aRefGeomObj->GetAltitudeObject(); + if ( !anAltitudeObj.IsNull() ) { - aName = aBathymetry->GetName(); + aName = anAltitudeObj->GetName(); if ( !isMergingNeed ) { - // Get the first geometry object's bathymetry name and go out + // Get the first geometry object's altitude name and go out aRes = aName; break; } @@ -144,13 +144,11 @@ QString HYDROGUI_Zone::getBathimetryName() const case HYDROData_Zone::Merge_ZMAX: // The maximum values aRes = QObject::tr( "MERGE_ZMAX" ); break; - case HYDROData_Zone::Merge_Object: // Only one bathymetry will be taken into account + case HYDROData_Zone::Merge_Object: // Only one altitude will be taken into account { - Handle(HYDROData_Bathymetry) aBathymetry = aZone->GetMergeBathymetry(); - if ( !aBathymetry.IsNull() ) - { - aRes = aBathymetry->GetName(); - } + Handle(HYDROData_IAltitudeObject) anAltitude = aZone->GetMergeAltitude(); + if ( !anAltitude.IsNull() ) + aRes = anAltitude->GetName(); break; } default: @@ -177,7 +175,7 @@ bool HYDROGUI_Zone::isMergingNeed() const QColor HYDROGUI_Zone::color( const ColorRole theColorRole, const int theColumnId ) const { - // Implement red color for bathymetry conflicts in case creation dialog + // Implement red color for altitude conflicts in case creation dialog QColor aRes; Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() ); if ( !aZone.IsNull() ) @@ -208,15 +206,15 @@ QColor HYDROGUI_Zone::color( const ColorRole theColorRole, const int theColumnId return aRes; } -QStringList HYDROGUI_Zone::getBathymetries() const +QStringList HYDROGUI_Zone::getAltitudes() const { QStringList aRes; Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() ); if ( !aZone.IsNull() ) { HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects(); - // Collect all used bathymetries names when merging is necessary - // or just get the name of bathymetry of a single geometry object + // Collect all used altitudes names when merging is necessary + // or just get the name of altitude of a single geometry object HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); for ( ; anIter.More(); anIter.Next() ) { @@ -224,21 +222,18 @@ QStringList HYDROGUI_Zone::getBathymetries() const Handle(HYDROData_Object)::DownCast( anIter.Value() ); if ( !aRefGeomObj.IsNull() ) { - // Get bathymetry name - Handle(HYDROData_Bathymetry) aBathymetry = aRefGeomObj->GetBathymetry(); - if ( !aBathymetry.IsNull() && !aRes.contains( aBathymetry->GetName() )) - { - aRes.append( aBathymetry->GetName() ); - } + Handle(HYDROData_IAltitudeObject) anAltitudeObj = aRefGeomObj->GetAltitudeObject(); + if ( !anAltitudeObj.IsNull() && !aRes.contains( anAltitudeObj->GetName() ) ) + aRes.append( anAltitudeObj->GetName() ); } } } return aRes; } -HYDROData_Zone::MergeBathymetriesType HYDROGUI_Zone::getMergeType() const +HYDROData_Zone::MergeAltitudesType HYDROGUI_Zone::getMergeType() const { - HYDROData_Zone::MergeBathymetriesType aRes = HYDROData_Zone::Merge_UNKNOWN; + HYDROData_Zone::MergeAltitudesType aRes = HYDROData_Zone::Merge_UNKNOWN; Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() ); if ( !aZone.IsNull() ) { @@ -247,17 +242,17 @@ HYDROData_Zone::MergeBathymetriesType HYDROGUI_Zone::getMergeType() const return aRes; } -void HYDROGUI_Zone::setMergeType( int theMergeType, QString theBathymetryName ) +void HYDROGUI_Zone::setMergeType( int theMergeType, QString theAltitudeName ) { Handle(HYDROData_Zone) aZone = Handle(HYDROData_Zone)::DownCast( modelObject() ); if ( !aZone.IsNull() ) { - HYDROData_Zone::MergeBathymetriesType aMergeType = - ( HYDROData_Zone::MergeBathymetriesType )theMergeType; + HYDROData_Zone::MergeAltitudesType aMergeType = + ( HYDROData_Zone::MergeAltitudesType )theMergeType; aZone->SetMergeType( aMergeType ); if ( aMergeType == HYDROData_Zone::Merge_Object ) { - // Find a bathymetry by the given name and set it as the zone's merge bathymetry + // Find an altitude object by the given name and set it as the zone's merge altitude HYDROData_SequenceOfObjects aSeq = aZone->GetGeometryObjects(); HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); for ( ; anIter.More(); anIter.Next() ) @@ -266,11 +261,11 @@ void HYDROGUI_Zone::setMergeType( int theMergeType, QString theBathymetryName ) Handle(HYDROData_Object)::DownCast( anIter.Value() ); if ( !aRefGeomObj.IsNull() ) { - // Get bathymetry name - Handle(HYDROData_Bathymetry) aBathymetry = aRefGeomObj->GetBathymetry(); - if ( !aBathymetry.IsNull() && theBathymetryName == aBathymetry->GetName() ) + // Get altitude object name + Handle(HYDROData_IAltitudeObject) anAltitudeObj = aRefGeomObj->GetAltitudeObject(); + if ( !anAltitudeObj.IsNull() && theAltitudeName == anAltitudeObj->GetName() ) { - aZone->SetMergeBathymetry( aBathymetry ); + aZone->SetMergeAltitude( anAltitudeObj ); break; } } diff --git a/src/HYDROGUI/HYDROGUI_Zone.h b/src/HYDROGUI/HYDROGUI_Zone.h index e960de24..29d8a2b9 100644 --- a/src/HYDROGUI/HYDROGUI_Zone.h +++ b/src/HYDROGUI/HYDROGUI_Zone.h @@ -76,23 +76,23 @@ public: bool isMergingNeed() const; /** - * Returns the list of bathymetries names. + * Returns the list of altidude object names. */ - QStringList getBathymetries() const; + QStringList getAltitudes() const; /** - * Returns the merging type for conflict bathymetries. + * Returns the merging type for conflict altidudes. */ - HYDROData_Zone::MergeBathymetriesType getMergeType() const; + HYDROData_Zone::MergeAltitudesType getMergeType() const; /** - * Set the merging type for conflict bathymetries. + * Set the merging type for conflict altidudes. * If the type is Merge_Object then use the second parameter to set the merge bathymetry. */ - void setMergeType( int theMergeType, QString theBathymetryName = QString() ); + void setMergeType( int theMergeType, QString theAltitudeName = QString() ); private: QString getRefObjectNames() const; - QString getBathimetryName() const; + QString getAltitudeName() const; }; #endif diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index e06b5c12..a0dc42c7 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -286,8 +286,8 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) Ref.Object - BATHYMETRY_COLUMN - Bathymetry + ALTITUDE_COLUMN + Altitude.Object diff --git a/src/HYDROPy/CMakeLists.txt b/src/HYDROPy/CMakeLists.txt index 09d94dd3..419bbe74 100644 --- a/src/HYDROPy/CMakeLists.txt +++ b/src/HYDROPy/CMakeLists.txt @@ -55,8 +55,9 @@ SET(_sip_files SET(_sip_files2 HYDROData_Entity.sip - HYDROData_Object.sip HYDROData_IPolyline.sip + HYDROData_IAltitudeObject.sip + HYDROData_Object.sip HYDROData_ProfileUZ.sip HYDROData_PolylineXY.sip HYDROData_ArtificialObject.sip diff --git a/src/HYDROPy/HYDROData.sip b/src/HYDROPy/HYDROData.sip index ccd6aa89..e25e4671 100644 --- a/src/HYDROPy/HYDROData.sip +++ b/src/HYDROPy/HYDROData.sip @@ -52,8 +52,9 @@ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com %Import QtGuimod.sip %Include HYDROData_Entity.sip -%Include HYDROData_Object.sip %Include HYDROData_IPolyline.sip +%Include HYDROData_IAltitudeObject.sip +%Include HYDROData_Object.sip %Include HYDROData_ProfileUZ.sip %Include HYDROData_PolylineXY.sip %Include HYDROData_ArtificialObject.sip diff --git a/src/HYDROPy/HYDROData_Bathymetry.sip b/src/HYDROPy/HYDROData_Bathymetry.sip index abeab659..6943e63d 100644 --- a/src/HYDROPy/HYDROData_Bathymetry.sip +++ b/src/HYDROPy/HYDROData_Bathymetry.sip @@ -33,7 +33,7 @@ HYDROData_Bathymetry::AltitudePoints convertFromPythonAltitudeList( PyObject* th %End -class HYDROData_Bathymetry : HYDROData_Entity +class HYDROData_Bathymetry : HYDROData_IAltitudeObject { %ConvertToSubClassCode @@ -106,10 +106,23 @@ public: // Public methods to work with Bathymetry altitudes. /** - * Returns altitude points list. - * \return points list + * Returns altitude for given point. + * \param thePoint the point to examine + * \return altitude value */ - static double GetInvalidAltitude(); + double GetAltitudeForPoint( const QPointF& thePoint ) const [double (const gp_XY&)]; + %MethodCode + + // The C++ API gets the gp_XY object, we convert it from QPointF. + gp_XY aPoint( a0->x(), a0->y() ); + + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->HYDROData_Bathymetry::GetAltitudeForPoint( aPoint ) : + sipCpp->GetAltitudeForPoint( aPoint ); + Py_END_ALLOW_THREADS + %End + + /** * Replace current altitude points by new one. @@ -167,23 +180,6 @@ public: */ void RemoveAltitudePoints(); - /** - * Returns altitude for given point. - * \param thePoint the point to examine - * \return altitude value - */ - double GetAltitudeForPoint( const QPointF& thePoint ) const; - %MethodCode - - // The C++ API gets the gp_XY object, we convert it from QPointF. - gp_XY aPoint( a0->x(), a0->y() ); - - Py_BEGIN_ALLOW_THREADS - sipRes = sipSelfWasArg ? sipCpp->HYDROData_Bathymetry::GetAltitudeForPoint( aPoint ) : - sipCpp->GetAltitudeForPoint( aPoint ); - Py_END_ALLOW_THREADS - %End - public: // Public methods to work with files. diff --git a/src/HYDROPy/HYDROData_IAltitudeObject.sip b/src/HYDROPy/HYDROData_IAltitudeObject.sip new file mode 100644 index 00000000..f8129add --- /dev/null +++ b/src/HYDROPy/HYDROData_IAltitudeObject.sip @@ -0,0 +1,70 @@ +// 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_IAltitudeObject : HYDROData_Entity /Abstract/ +{ + +%ConvertToSubClassCode + switch ( sipCpp->GetKind() ) + { + case KIND_BATHYMETRY: + sipClass = sipClass_HYDROData_Bathymetry; + break; + + default: + // We don't recognise the type. + sipClass = NULL; + } +%End + +%TypeHeaderCode +#include +%End + +public: + // Public methods to work with altitudes. + + /** + * Returns altitude points list. + * \return points list + */ + static double GetInvalidAltitude(); + +protected: + + /** + * Creates new object in the internal data structure. Use higher level objects + * to create objects with real content. + */ + HYDROData_IAltitudeObject(); + + /** + * Destructs properties of the object and object itself, removes it from the document. + */ + ~HYDROData_IAltitudeObject(); +}; + + diff --git a/src/HYDROPy/HYDROData_ImmersibleZone.sip b/src/HYDROPy/HYDROData_ImmersibleZone.sip index 326dd5cb..33d46350 100644 --- a/src/HYDROPy/HYDROData_ImmersibleZone.sip +++ b/src/HYDROPy/HYDROData_ImmersibleZone.sip @@ -106,46 +106,6 @@ public: */ void RemovePolyline(); - /** - * Set reference bathymetry object for zone. - */ - void SetBathymetry( 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_ImmersibleZone::SetBathymetry( aRefBath ) : - sipCpp->SetBathymetry( aRefBath ); - Py_END_ALLOW_THREADS - } - - %End - - /** - * Returns reference bathymetry object of zone. - */ - HYDROData_Bathymetry GetBathymetry() const [Handle_HYDROData_Bathymetry ()]; - %MethodCode - - Handle(HYDROData_Bathymetry) aRefBath; - - Py_BEGIN_ALLOW_THREADS - aRefBath = sipSelfWasArg ? sipCpp->HYDROData_ImmersibleZone::GetBathymetry() : - sipCpp->GetBathymetry(); - Py_END_ALLOW_THREADS - - sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath ); - - %End - - /** - * Clear the bathymetry object for zone. - */ - void RemoveBathymetry(); - protected: /** diff --git a/src/HYDROPy/HYDROData_Object.sip b/src/HYDROPy/HYDROData_Object.sip index 6a9e89b4..10119b10 100644 --- a/src/HYDROPy/HYDROData_Object.sip +++ b/src/HYDROPy/HYDROData_Object.sip @@ -53,6 +53,45 @@ class HYDROData_Object : HYDROData_Entity /Abstract/ public: + /** + * Set reference altitude object for geometry object. + */ + bool SetAltitudeObject( HYDROData_IAltitudeObject theAltitude ) [void (const Handle_HYDROData_IAltitudeObject&)]; + %MethodCode + + Handle(HYDROData_IAltitudeObject) aRefAltitude = + Handle(HYDROData_IAltitudeObject)::DownCast( createHandle( a0 ) ); + if ( !aRefAltitude.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->HYDROData_Object::SetAltitudeObject( aRefAltitude ) : + sipCpp->SetAltitudeObject( aRefAltitude ); + Py_END_ALLOW_THREADS + } + + %End + + /** + * Returns reference altitude object of geometry object. + */ + HYDROData_IAltitudeObject GetAltitudeObject() const [Handle_HYDROData_IAltitudeObject ()]; + %MethodCode + + Handle(HYDROData_IAltitudeObject) aRefAltitude; + + Py_BEGIN_ALLOW_THREADS + aRefAltitude = sipSelfWasArg ? sipCpp->HYDROData_Object::GetAltitudeObject() : + sipCpp->GetAltitudeObject(); + Py_END_ALLOW_THREADS + + sipRes = (HYDROData_IAltitudeObject*)createPointer( aRefAltitude ); + + %End + + /** + * Clear the reference altitude object for geometry object. + */ + void RemoveAltitudeObject(); protected: diff --git a/src/HYDROPy/HYDROData_Zone.sip b/src/HYDROPy/HYDROData_Zone.sip index 4b28e6d8..2b4f4d7d 100644 --- a/src/HYDROPy/HYDROData_Zone.sip +++ b/src/HYDROPy/HYDROData_Zone.sip @@ -46,68 +46,68 @@ class HYDROData_Zone : HYDROData_Entity public: - // Enumeration of mergin types for conflict bathymetries - enum MergeBathymetriesType + // Enumeration of mergin types for conflict altitudes + enum MergeAltitudesType { Merge_ZMIN, // The minimum values Merge_ZMAX, // The maximum values - Merge_Object // Only one bathymetry will be taken into account + Merge_Object // Only one altitude will be taken into account }; public: /** - * Sets the merging type for conflict bathymetries. + * Sets the merging type for conflict altitudes. * By default it is set to Merge_ZMIN. */ - void SetMergeType( const MergeBathymetriesType& theType ); + void SetMergeType( const MergeAltitudesType& theType ); /** - * Returns the merging type for conflict bathymetries. + * Returns the merging type for conflict altitudes. */ - MergeBathymetriesType GetMergeType() const; + MergeAltitudesType GetMergeType() const; /** - * Sets the reference bathymetry to resolve the conflict. + * Sets the reference altitude to resolve the conflict. * This object is used only in case of "Merge_Object" merge type. */ - void SetMergeBathymetry( HYDROData_Bathymetry theBathymetry ) [void (const Handle_HYDROData_Bathymetry&)]; + void SetMergeAltitude( HYDROData_IAltitudeObject theAltitude ) [void (const Handle_HYDROData_IAltitudeObject&)]; %MethodCode - Handle(HYDROData_Bathymetry) aRefBath = - Handle(HYDROData_Bathymetry)::DownCast( createHandle( a0 ) ); - if ( !aRefBath.IsNull() ) + Handle(HYDROData_IAltitudeObject) aRefAltitude = + Handle(HYDROData_IAltitudeObject)::DownCast( createHandle( a0 ) ); + if ( !aRefAltitude.IsNull() ) { Py_BEGIN_ALLOW_THREADS - sipSelfWasArg ? sipCpp->HYDROData_Zone::SetMergeBathymetry( aRefBath ) : - sipCpp->SetMergeBathymetry( aRefBath ); + sipSelfWasArg ? sipCpp->HYDROData_Zone::SetMergeAltitude( aRefAltitude ) : + sipCpp->SetMergeAltitude( aRefAltitude ); Py_END_ALLOW_THREADS } %End /** - * Returns the reference bathymetry to resolve the conflict. + * Returns the reference altitude to resolve the conflict. */ - HYDROData_Bathymetry GetMergeBathymetry() const [Handle_HYDROData_Bathymetry ()]; + HYDROData_IAltitudeObject GetMergeAltitude() const [Handle_HYDROData_IAltitudeObject ()]; %MethodCode - Handle(HYDROData_Bathymetry) aRefBath; + Handle(HYDROData_IAltitudeObject) aRefAltitude; Py_BEGIN_ALLOW_THREADS - aRefBath = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetMergeBathymetry() : - sipCpp->GetMergeBathymetry(); + aRefAltitude = sipSelfWasArg ? sipCpp->HYDROData_Zone::GetMergeAltitude() : + sipCpp->GetMergeAltitude(); Py_END_ALLOW_THREADS - sipRes = (HYDROData_Bathymetry*)createPointer( aRefBath ); + sipRes = (HYDROData_IAltitudeObject*)createPointer( aRefAltitude ); %End /** - * Removes the reference bathymetry for resolving the conflict. + * Removes the reference altitude for resolving the conflict. */ - void RemoveMergeBathymetry(); + void RemoveMergeAltitude(); /** -- 2.39.2