}
-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)
TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
}
-QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+QStringList HYDROData_Entity::DumpToPython( const QString& thePyScriptPath,
+ MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList anEmptyList;
return anEmptyList;
void HYDROData_Entity::Update()
{
- SetToUpdate( false );
+ ClearChanged();
}
void HYDROData_Entity::UpdateLocalCS( double theDx, double theDy )
return QVariant();
}
-void HYDROData_Entity::SetToUpdate( bool theFlag )
+void HYDROData_Entity::ClearChanged()
{
- if ( IsMustBeUpdated() == theFlag )
+ TDataStd_Integer::Set( myLab.FindChild( DataTag_GeomChange ), 0 );
+}
+
+int HYDROData_Entity::GetGeomChangeFlag() const
+{
+ int aGeomChangeFlag = 0;
+ Handle(TDataStd_Integer) aGeomChangeAttr;
+ TDF_Label aGeomChangeLab = myLab.FindChild( DataTag_GeomChange );
+ aGeomChangeLab.FindAttribute( TDataStd_Integer::GetID(), aGeomChangeAttr );
+ if ( !aGeomChangeAttr.IsNull() )
+ aGeomChangeFlag = aGeomChangeAttr->Get();
+ return aGeomChangeFlag;
+}
+
+void HYDROData_Entity::Changed( Geometry theChangedGeometry )
+{
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+ if( aDocument.IsNull() )
return;
- if ( theFlag )
- {
- TDataStd_UAttribute::Set( myLab, GUID_MUST_BE_UPDATED );
+ int aGeomChangeFlag = 0;
+ Handle(TDataStd_Integer) aGeomChangeAttr;
+ TDF_Label aGeomChangeLab = myLab.FindChild( DataTag_GeomChange );
+ aGeomChangeLab.FindAttribute( TDataStd_Integer::GetID(), aGeomChangeAttr );
+ if ( !aGeomChangeAttr.IsNull() )
+ aGeomChangeFlag = aGeomChangeAttr->Get();
- Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
- if ( !aDocument.IsNull() )
+ int aBitsToChange = ( myGeom & theChangedGeometry );
+ if( aBitsToChange == 0 )
+ return;
+
+ aGeomChangeFlag = ( aGeomChangeFlag | aBitsToChange );
+ TDataStd_Integer::Set( aGeomChangeLab, aGeomChangeFlag );
+
+ HYDROData_Iterator anIter( aDocument );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Entity) anObject = anIter.Current();
+ if( anObject.IsNull() )
+ continue;
+ HYDROData_SequenceOfObjects aRefSeq = anObject->GetAllReferenceObjects();
+ for ( int i = 1, n = aRefSeq.Length(); i <= n; ++i )
{
- // Change the states of this and all depended objects
- HYDROData_Tool::SetMustBeUpdatedObjects( aDocument );
+ Handle(HYDROData_Entity) aRefObject = aRefSeq.Value( i );
+ if( aRefObject->Label()==myLab )
+ anObject->Changed( theChangedGeometry );
}
}
- else
- {
- myLab.ForgetAttribute( GUID_MUST_BE_UPDATED );
- }
}
-bool HYDROData_Entity::IsMustBeUpdated() const
+bool HYDROData_Entity::IsMustBeUpdated( Geometry theGeom ) const
{
- return myLab.IsAttribute( GUID_MUST_BE_UPDATED );
+ return ( ( GetGeomChangeFlag() & theGeom ) != 0 );
}
bool HYDROData_Entity::CanBeUpdated() const
return true;
}
-HYDROData_Entity::HYDROData_Entity()
+HYDROData_Entity::HYDROData_Entity( Geometry theGeom )
+ : myGeom( theGeom )
{
}
case KIND_STREAM_ALTITUDE: return "KIND_STREAM_ALTITUDE";
case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE";
case KIND_STRICKLER_TABLE: return "KIND_STRICKLER_TABLE";
- case KIND_LAND_COVER: return "KIND_LAND_COVER";
+ case KIND_LAND_COVER_OBSOLETE: return "";
case KIND_LAND_COVER_MAP: return "KIND_LAND_COVER_MAP";
default: return "KIND_UNKNOWN"; ///! Unrecognized object
}
}
-void HYDROData_Entity::setPythonReferenceObject( MapOfTreatedObjects& theTreatedObjects,
+void HYDROData_Entity::setPythonReferenceObject( const QString& thePyScriptPath,
+ MapOfTreatedObjects& theTreatedObjects,
QStringList& theScript,
const Handle(HYDROData_Entity)& theRefObject,
const QString& theMethod ) const
{
- if ( !checkObjectPythonDefinition( theTreatedObjects, theScript, theRefObject ) )
+ if ( !checkObjectPythonDefinition( thePyScriptPath, theTreatedObjects, theScript, theRefObject ) )
return;
QString aRefObjName = theRefObject->GetObjPyName();
.arg( anObjName ).arg( theMethod ).arg( aRefObjName );
}
-bool HYDROData_Entity::checkObjectPythonDefinition( MapOfTreatedObjects& theTreatedObjects,
+bool HYDROData_Entity::checkObjectPythonDefinition( const QString& thePyScriptPath,
+ MapOfTreatedObjects& theTreatedObjects,
QStringList& theScript,
const Handle(HYDROData_Entity)& theRefObject ) const
{
return true;
// The definition of reference object must be dumped before this
- QStringList aRefObjDump = theRefObject->DumpToPython( theTreatedObjects );
+ QStringList aRefObjDump = theRefObject->DumpToPython( thePyScriptPath, theTreatedObjects );
if ( aRefObjDump.isEmpty() )
return false;