aRegionZone->AddGeometryObject( aRefObject );
}
}
+
+ // The splitted data is up to date
+ SetToUpdate( false );
}
bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
return false; // Object is already in reference list
AddReferenceObject( theObject, DataTag_GeometryObject );
+
+ // Indicate model of the need to update zones splitting
+ SetToUpdate( true );
+
return true;
}
return;
RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
+
+ // Indicate model of the need to update zones splitting
+ SetToUpdate( true );
}
void HYDROData_CalculationCase::RemoveGeometryObjects()
{
ClearReferenceObjects( DataTag_GeometryObject );
+
+ // Indicate model of the need to update zones splitting
+ SetToUpdate( true );
}
Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
#include <QStringList>
#include <QVariant>
+static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000");
+
IMPLEMENT_STANDARD_HANDLE(HYDROData_Entity,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Entity,MMgt_TShared)
return QVariant();
}
+void HYDROData_Entity::SetToUpdate(bool theFlag)
+{
+ if ( theFlag )
+ {
+ TDataStd_UAttribute::Set( myLab, GUID_MUST_BE_UPDATED );
+ }
+ else
+ {
+ myLab.ForgetAttribute( GUID_MUST_BE_UPDATED );
+ }
+}
+
+bool HYDROData_Entity::IsMustBeUpdated() const
+{
+ return myLab.IsAttribute( GUID_MUST_BE_UPDATED );
+}
+
bool HYDROData_Entity::IsRemoved() const
{
return !myLab.HasAttribute();
*/
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);
+
+ /**
+ * 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;
+
/**
* Checks is object exists in the data structure.
* \returns true is object is not exists in the data model
#include <QStringList>
-static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000");
static const Standard_GUID GUID_SELF_SPLITTED("997995aa-5c19-40bf-9a60-ab4b70ad04d8");
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");
if ( !aDocument.IsNull() )
{
// Change the states of this and all depended images
- MustBeUpdated( true );
+ SetToUpdate( true );
HYDROData_Tool::SetMustBeUpdatedImages( aDocument );
- MustBeUpdated( false );
+ SetToUpdate( false );
}
}
SetIsSelfSplitted( false );
}
- MustBeUpdated( false );
+ SetToUpdate( false );
bool anIsByTwoPoints = IsByTwoPoints();
return QByteArray(aData, aLen);
}
-void HYDROData_Image::MustBeUpdated(bool theFlag)
-{
- if (theFlag) {
- TDataStd_UAttribute::Set(myLab, GUID_MUST_BE_UPDATED);
- } else {
- myLab.ForgetAttribute(GUID_MUST_BE_UPDATED);
- }
-}
-
-bool HYDROData_Image::MustBeUpdated() const
-{
- return myLab.IsAttribute(GUID_MUST_BE_UPDATED);
-}
-
void HYDROData_Image::SetIsSelfSplitted(bool theFlag)
{
if (theFlag) {
*/
HYDRODATA_EXPORT QByteArray Args() const;
- /**
- * Sets the "MustBeUpdated" flag: if image is depended on updated features.
- * \param theFlag is true for images that must be updated, false for up-to-date
- */
- HYDRODATA_EXPORT void MustBeUpdated(bool theFlag);
-
- /**
- * Returns the "MustBeUpdated" flag: is image must be recomputed or not
- * \returns false if image is up to date
- */
- HYDRODATA_EXPORT bool MustBeUpdated() const;
/**
* Marks the image as self-splitted.
void HYDROData_Tool::SetMustBeUpdatedImages(
const Handle(HYDROData_Document)& theDoc )
{
- bool aChanged = true;
+ bool anIsChanged = true;
// iterate until there is no changes because images on all level of dependency must be updated
- while ( aChanged )
+ while ( anIsChanged )
{
- aChanged = false;
+ anIsChanged = false;
HYDROData_Iterator anIter( theDoc, KIND_IMAGE );
for ( ; anIter.More(); anIter.Next() )
{
Handle(HYDROData_Image) anImage =
Handle(HYDROData_Image)::DownCast( anIter.Current() );
- if ( anImage.IsNull() || anImage->MustBeUpdated() )
+ if ( anImage.IsNull() || anImage->IsMustBeUpdated() )
continue;
Handle(HYDROData_Image) aTrsfRefImage = anImage->GetTrsfReferenceImage();
- if ( !aTrsfRefImage.IsNull() && aTrsfRefImage->MustBeUpdated() )
+ if ( !aTrsfRefImage.IsNull() && aTrsfRefImage->IsMustBeUpdated() )
{
- anImage->MustBeUpdated( true );
- aChanged = true;
+ anImage->SetToUpdate( true );
+ anIsChanged = true;
continue;
}
{
Handle(HYDROData_Image) aRefImage =
Handle(HYDROData_Image)::DownCast( anImage->Reference( i ) );
- if ( !aRefImage.IsNull() && aRefImage->MustBeUpdated() )
+ if ( !aRefImage.IsNull() && aRefImage->IsMustBeUpdated() )
{
// image references to updated => also must be updated
- anImage->MustBeUpdated(true);
- aChanged = true;
+ anImage->SetToUpdate( true );
+ anIsChanged = true;
}
}
}
QFont aFont = LightApp_DataObject::font( theId );
if( theId == NameId )
{
- Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( modelObject() );
- if( !anImage.IsNull() && anImage->MustBeUpdated() )
+ Handle(HYDROData_Entity) aDataObject = modelObject();
+ if( !aDataObject.IsNull() && aDataObject->IsMustBeUpdated() )
aFont.setItalic( true );
}
return aFont;
anIsSplittedImage = true;
}
}
- anIsMustBeUpdatedImage = anImage->MustBeUpdated();
+ anIsMustBeUpdatedImage = anImage->IsMustBeUpdated();
}
}
else if( anObject->GetKind() == KIND_POLYLINE )
{
Handle(HYDROData_Image) anImage =
Handle(HYDROData_Image)::DownCast( aSeq.Value( anIndex ) );
- if( !anImage.IsNull() && anImage->MustBeUpdated() )
+ if( !anImage.IsNull() && anImage->IsMustBeUpdated() )
anImage->Update();
}