Salome HOME
merge BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
index fdd7e8fd9e741238ba5a98dc14ad28bb22bebe80..3683d30cd676dedbbe76e12c064d7576115eb954 100644 (file)
@@ -39,8 +39,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 )
 {
 }
 
@@ -79,9 +79,14 @@ void HYDROData_Object::SetName( const QString& theName )
 
 void HYDROData_Object::Update()
 {
-  removeTopShape();
-  removeShape3D();
-  removeGroupObjects();
+  if( IsMustBeUpdated( Geom_2d ) )
+  {
+    removeTopShape();
+    removeGroupObjects();
+  }
+  if( IsMustBeUpdated( Geom_3d ) )
+    removeShape3D();
+
   checkAndSetAltitudeObject();
   HYDROData_Entity::Update();
 }
@@ -97,13 +102,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 )
@@ -121,29 +126,6 @@ void HYDROData_Object::SetShape3D( const TopoDS_Shape& theShape )
   checkAndSetObject3D();
 }
 
-Standard_Boolean HYDROData_Object::GetMiddleZ( Standard_Real& theMiddleZ ) const
-{
-  theMiddleZ = -9999;
-  TDF_Label aLabel = myLab.FindChild( DataTag_MiddleZ, false );
-  if ( !aLabel.IsNull() )
-  {
-    Handle(TDataStd_Real) aRealVal;
-    if ( aLabel.FindAttribute( TDataStd_Real::GetID(), aRealVal ) )
-    {
-      theMiddleZ = aRealVal->Get();
-      return Standard_True;
-    }
-  }
-
-  return Standard_False;
-
-}
-
-void HYDROData_Object::SetMiddleZ( const Standard_Real& theMiddleZ )
-{
-  TDataStd_Real::Set( myLab.FindChild( DataTag_MiddleZ ), theMiddleZ );
-}
-
 Handle(HYDROData_DummyObject3D) HYDROData_Object::GetObject3D() const
 {
   Handle(HYDROData_DummyObject3D) anObject;
@@ -221,8 +203,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;
 }
@@ -241,8 +224,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 )