Salome HOME
refs #636: flags for geometry 2d/3d change
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
index 25b9e2625187447f1a6a2ad224eb99c530b2da13..fff074adebd0d85ed9f4dbb78b5ae42b49b1de85 100644 (file)
@@ -35,8 +35,8 @@
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,HYDROData_Entity)
 
-HYDROData_Object::HYDROData_Object()
-: HYDROData_Entity()
+HYDROData_Object::HYDROData_Object( Geometry theGeometry )
+  : HYDROData_Entity( theGeometry )
 {
 }
 
@@ -75,9 +75,14 @@ void HYDROData_Object::SetName( const QString& theName )
 
 void HYDROData_Object::Update()
 {
-  removeTopShape();
-  removeShape3D();
-  removeGroupObjects();
+  if( IsMustBeUpdated2d() )
+  {
+    removeTopShape();
+    removeGroupObjects();
+  }
+  if( IsMustBeUpdated3d() )
+    removeShape3D();
+
   checkAndSetAltitudeObject();
   HYDROData_Entity::Update();
 }
@@ -93,13 +98,13 @@ HYDROData_SequenceOfObjects HYDROData_Object::GetAllReferenceObjects() const
   return aResSeq;
 }
 
-void HYDROData_Object::SetToUpdate( bool theFlag )
+void HYDROData_Object::Changed( Geometry theChangedGeometry )
 {
-  HYDROData_Entity::SetToUpdate( theFlag );
+  HYDROData_Entity::Changed( theChangedGeometry );
 
   Handle(HYDROData_DummyObject3D) anObject3D = GetObject3D();
   if ( !anObject3D.IsNull() )
-    anObject3D->SetToUpdate( theFlag );
+    anObject3D->Changed( theChangedGeometry );
 }
 
 void HYDROData_Object::SetTopShape( const TopoDS_Shape& theShape )
@@ -194,8 +199,9 @@ bool HYDROData_Object::SetAltitudeObject(
 
   SetReferenceObject( theAltitude, DataTag_AltitudeObject );
 
-  // Indicate model of the need to update object
-  SetToUpdate( true );
+  // #636: In the case of the altitude object change the geometry of the main object is not changed,
+  // to the object should not be marked as updated
+  //SetToUpdate( true );
 
   return true;
 }
@@ -214,8 +220,9 @@ void HYDROData_Object::RemoveAltitudeObject()
 
   ClearReferenceObjects( DataTag_AltitudeObject );
 
-  // Indicate model of the need to update object
-  SetToUpdate( true );
+  // #636: In the case of the altitude object change the geometry of the main object is not changed,
+  // to the object should not be marked as updated
+  //SetToUpdate( true );
 }
 
 void HYDROData_Object::SetFillingColor( const QColor& theColor )