From c6ed1fc51a1a0c344f148e006c9601f98fe184f3 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 6 Dec 2013 06:52:57 +0000 Subject: [PATCH] Update mechanism for calculation case and it child objects corrected. --- src/HYDROData/HYDROData_CalculationCase.cxx | 4 ++++ src/HYDROData/HYDROData_Entity.cxx | 5 +++++ src/HYDROData/HYDROData_Entity.h | 11 +++++++++-- src/HYDROData/HYDROData_Region.cxx | 5 +++++ src/HYDROData/HYDROData_Region.h | 6 ++++++ src/HYDROData/HYDROData_Zone.cxx | 5 +++++ src/HYDROData/HYDROData_Zone.h | 6 ++++++ src/HYDROGUI/HYDROGUI_Module.cxx | 8 ++++---- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index c1b32445..9d6b58f4 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -133,6 +133,10 @@ HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() { HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects(); + Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline(); + if ( !aBoundaryPolyline.IsNull() ) + aResSeq.Append( aBoundaryPolyline ); + HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions(); aResSeq.Append( aSeqOfRegions ); diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index 126f6dff..512c0431 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -91,6 +91,11 @@ bool HYDROData_Entity::IsMustBeUpdated() const return myLab.IsAttribute( GUID_MUST_BE_UPDATED ); } +bool HYDROData_Entity::CanBeUpdated() const +{ + return true; +} + bool HYDROData_Entity::IsRemoved() const { return !myLab.HasAttribute(); diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index dd067a18..b1211e45 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -108,17 +108,24 @@ public: */ HYDRODATA_EXPORT virtual QVariant GetDataVariant(); + /** * Sets the "MustBeUpdated" flag: if object is depended on updated features. * \param theFlag is true for objects that must be updated, false for up-to-date */ - HYDRODATA_EXPORT void SetToUpdate( bool theFlag ); + HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag ); /** * Returns the "MustBeUpdated" flag: is object data must be updated or not * \returns false if object is up to date */ - HYDRODATA_EXPORT bool IsMustBeUpdated() const; + HYDRODATA_EXPORT virtual bool IsMustBeUpdated() const; + + /** + * Returns flag indicating that object is updateble or not. + */ + HYDRODATA_EXPORT virtual bool CanBeUpdated() const; + /** * Checks is object exists in the data structure. diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx index 90cc82e2..12103c78 100644 --- a/src/HYDROData/HYDROData_Region.cxx +++ b/src/HYDROData/HYDROData_Region.cxx @@ -66,6 +66,11 @@ QStringList HYDROData_Region::DumpToPython( MapOfTreatedObjects& theTreatedObjec return aResList; } +bool HYDROData_Region::CanBeUpdated() const +{ + return false; +} + void HYDROData_Region::Remove() { Handle(HYDROData_CalculationCase) aFatherCalc = diff --git a/src/HYDROData/HYDROData_Region.h b/src/HYDROData/HYDROData_Region.h index e6769ebe..7139837b 100644 --- a/src/HYDROData/HYDROData_Region.h +++ b/src/HYDROData/HYDROData_Region.h @@ -43,6 +43,12 @@ public: HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const; + /** + * Returns flag indicating that object is updateble or not. + */ + HYDRODATA_EXPORT virtual bool CanBeUpdated() const; + + /** * Removes object and it child sub-objects from the data structure. * Reimplemented to update names of regions in father calculation. diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index 6dfa4efa..76e5dc8c 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -63,6 +63,11 @@ QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects return aResList; } +bool HYDROData_Zone::CanBeUpdated() const +{ + return false; +} + bool HYDROData_Zone::CanRemove() { return false; diff --git a/src/HYDROData/HYDROData_Zone.h b/src/HYDROData/HYDROData_Zone.h index 610b3e18..a01db41e 100644 --- a/src/HYDROData/HYDROData_Zone.h +++ b/src/HYDROData/HYDROData_Zone.h @@ -55,6 +55,12 @@ public: HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const; + /** + * Returns flag indicating that object is updateble or not. + */ + HYDRODATA_EXPORT virtual bool CanBeUpdated() const; + + /** * Returns flag indicating that object can be removed or not. */ diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 19d2e207..ce333bb3 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -253,7 +253,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsFusedImage = false; bool anIsCutImage = false; bool anIsSplittedImage = false; - bool anIsMustobjectBeUpdated = false; + bool anIsMustObjectBeUpdated = false; bool anIsPolyline = false; bool anIsPolyline3D = false; bool anIsProfile = false; @@ -290,9 +290,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsVisibleInSelection |= aVisibility; anIsHiddenInSelection |= !aVisibility; - if ( anObject->IsMustBeUpdated() ) + if ( anObject->CanBeUpdated() && anObject->IsMustBeUpdated() ) { - anIsMustobjectBeUpdated = true; + anIsMustObjectBeUpdated = true; } ObjectKind anObjectKind = anObject->GetKind(); @@ -411,7 +411,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, if( anIsSelectedDataObjects ) { - if ( anIsMustobjectBeUpdated ) + if ( anIsMustObjectBeUpdated ) { theMenu->addAction( action( UpdateObjectId ) ); theMenu->addSeparator(); -- 2.39.2