]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
merge BR_v14_rc
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 28 Oct 2015 07:24:21 +0000 (08:24 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 28 Oct 2015 07:24:21 +0000 (08:24 +0100)
54 files changed:
CMakeLists.txt
bin/hydro_setenv.py [new file with mode: 0644]
doc/salome/CMakeLists.txt
src/HYDROData/HYDROData_ArtificialObject.cxx
src/HYDROData/HYDROData_ArtificialObject.h
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_Channel.cxx
src/HYDROData/HYDROData_Channel.h
src/HYDROData/HYDROData_Confluence.cxx
src/HYDROData/HYDROData_DummyObject3D.cxx
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_IAltitudeObject.cxx
src/HYDROData/HYDROData_IPolyline.cxx
src/HYDROData/HYDROData_Image.cxx
src/HYDROData/HYDROData_ImmersibleZone.cxx
src/HYDROData/HYDROData_LandCover.cxx
src/HYDROData/HYDROData_NaturalObject.cxx
src/HYDROData/HYDROData_NaturalObject.h
src/HYDROData/HYDROData_Object.cxx
src/HYDROData/HYDROData_Object.h
src/HYDROData/HYDROData_Obstacle.cxx
src/HYDROData/HYDROData_Polyline3D.cxx
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Region.cxx
src/HYDROData/HYDROData_River.cxx
src/HYDROData/HYDROData_ShapesGroup.cxx
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h
src/HYDROData/HYDROData_StreamAltitude.cxx
src/HYDROData/HYDROData_StreamAltitude.h
src/HYDROData/HYDROData_StricklerTable.cxx
src/HYDROData/HYDROData_Tool.cxx
src/HYDROData/HYDROData_Tool.h
src/HYDROData/HYDROData_VisualState.cxx
src/HYDROData/HYDROData_Zone.cxx
src/HYDROData/test_HYDROData_Bathymetry.cxx
src/HYDROData/test_HYDROData_Entity.cxx
src/HYDROData/test_HYDROData_Image.cxx
src/HYDROData/test_HYDROData_PolylineXY.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_ChannelOp.cxx
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_LandCoverOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Polyline.cxx
src/HYDROGUI/HYDROGUI_ProfileOp.cxx
src/HYDROGUI/HYDROGUI_StreamOp.cxx
src/HYDROGUI/HYDROGUI_UpdateObjectOp.cxx
src/HYDROGUI/HYDROGUI_ViewerDlg.cxx
src/HYDROPy/HYDROData_Entity.sip

index 6d87ed595efb3993561526451b699b7136fdeb01..601d0ab649a798621ca8709af69a4da9f8cd2b3b 100644 (file)
@@ -251,3 +251,9 @@ INSTALL(FILES
 # Install the export set for use with the install-tree
 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" 
         FILE ${PROJECT_NAME}Targets.cmake)
+
+
+
+SET(_bin_scripts bin/hydro_setenv.py)
+SALOME_INSTALL_SCRIPTS("${_bin_scripts}" ${SALOME_INSTALL_SCRIPT_SCRIPTS})
+
diff --git a/bin/hydro_setenv.py b/bin/hydro_setenv.py
new file mode 100644 (file)
index 0000000..866a0f2
--- /dev/null
@@ -0,0 +1,8 @@
+#! /usr/bin/env python
+#  -*- coding: iso-8859-1 -*-
+
+import os
+
+def set_env( args ):
+    os.environ["SALOME_MODULES_ORDER"] = "HYDRO,GEOM,SMESH"
+    pass
index c4b6fb90e38e4e755db9673d7759d86b776cc277..9a0a069ed2ad676335121ae21cb6bb6fe2c693ac 100644 (file)
@@ -21,3 +21,4 @@
 #
 
 ADD_SUBDIRECTORY(gui)
+ADD_SUBDIRECTORY(examples)
index 170477a8d6590c9416971383ea1da767dd773380..80a476546c2b87cd88cf9b087c1aff58a3012d64 100644 (file)
@@ -21,8 +21,8 @@
 IMPLEMENT_STANDARD_HANDLE(HYDROData_ArtificialObject,HYDROData_Object)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ArtificialObject,HYDROData_Object)
 
-HYDROData_ArtificialObject::HYDROData_ArtificialObject()
-: HYDROData_Object()
+HYDROData_ArtificialObject::HYDROData_ArtificialObject( Geometry theGeometry )
+: HYDROData_Object( theGeometry )
 {
 }
 
index e12d6a3fb6a3c21768b63de98ab7542060489c01..dc91253b3a924093632b0bb1d8777c0dc24858f3 100644 (file)
@@ -48,7 +48,7 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDRODATA_EXPORT HYDROData_ArtificialObject();
+  HYDRODATA_EXPORT HYDROData_ArtificialObject( Geometry );
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
index 2f09868e9f9dfed3c3c8cddb5cee210e6b6e498a..1e819a86aa376cb3d259d73fc6dea8204cb6b3ea 100644 (file)
@@ -113,7 +113,7 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints )
     aCoordsArray->SetValue( i * 3 + 2, aPoint.Z() );
   }
 
-  SetToUpdate( true );
+  Changed( Geom_Z );
 }
 
 HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(bool IsConvertToGlobal) const
@@ -192,12 +192,12 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const
 
 void HYDROData_Bathymetry::RemoveAltitudePoints()
 {
-  TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
-  if (!aLabel.IsNull())
-    {
-      aLabel.ForgetAllAttributes();
-      SetToUpdate(true);
-    }
+  TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false );
+  if ( !aLabel.IsNull() )
+  {
+    aLabel.ForgetAllAttributes();
+    Changed( Geom_Z );
+  }
 }
 
 void interpolateAltitudeForPoints( const gp_XY&                               thePoint,
@@ -449,7 +449,7 @@ void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted,
 
   TDataStd_Integer::Set( myLab.FindChild( DataTag_AltitudesInverted ), (Standard_Integer)theIsInverted );
 
-  SetToUpdate( true );
+  Changed( Geom_Z );
 
   if ( !theIsUpdate )
     return;
index 4f95d9ec0f293286a81437d81e3412a4655dac6e..07397d1a64ee1dbee12cd9ff728e10e38106dc1c 100644 (file)
@@ -86,7 +86,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
 
 HYDROData_CalculationCase::HYDROData_CalculationCase()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d_and_groups )
 {
 }
 
@@ -508,7 +508,7 @@ bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object
   AddReferenceObject( theObject, DataTag_GeometryObject );
   
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 
   return true;
 }
@@ -526,7 +526,7 @@ void HYDROData_CalculationCase::RemoveGeometryObject( const Handle(HYDROData_Obj
   RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_CalculationCase::RemoveGeometryObjects()
@@ -534,7 +534,7 @@ void HYDROData_CalculationCase::RemoveGeometryObjects()
   ClearReferenceObjects( DataTag_GeometryObject );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
@@ -548,7 +548,7 @@ bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesG
   AddReferenceObject( theGroup, DataTag_GeometryGroup );
   
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 
   return true;
 }
@@ -566,7 +566,7 @@ void HYDROData_CalculationCase::RemoveGeometryGroup( const Handle(HYDROData_Shap
   RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 }
 
 void HYDROData_CalculationCase::RemoveGeometryGroups()
@@ -574,7 +574,7 @@ void HYDROData_CalculationCase::RemoveGeometryGroups()
   ClearReferenceObjects( DataTag_GeometryGroup );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_Groups );
 }
 
 void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
@@ -584,7 +584,8 @@ void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Poly
   SetReferenceObject( thePolyline, DataTag_Polyline );
 
   // Indicate model of the need to update zones splitting
-  SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
+  if( !IsEqual( aPrevPolyline, thePolyline ) )
+    Changed( Geom_2d );
 }
 
 Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
@@ -600,7 +601,7 @@ void HYDROData_CalculationCase::RemoveBoundaryPolyline()
   ClearReferenceObjects( DataTag_Polyline );
 
   // Indicate model of the need to update zones splitting
-  SetToUpdate( !aPrevPolyline.IsNull() || IsMustBeUpdated() );
+  Changed( Geom_2d );
 }
 
 void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_StricklerTable)& theStricklerTable )
@@ -610,7 +611,8 @@ void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_Strick
   SetReferenceObject( theStricklerTable, DataTag_StricklerTable );
 
   // Indicate model of the need to update land covers partition
-  SetToUpdate( !IsEqual( aPrevStricklerTable, theStricklerTable ) || IsMustBeUpdated() );
+  if( !IsEqual( aPrevStricklerTable, theStricklerTable ) )
+    Changed( Geom_No );
 }
 
 Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
@@ -626,7 +628,7 @@ void HYDROData_CalculationCase::RemoveStricklerTable()
   ClearReferenceObjects( DataTag_StricklerTable );
 
   // Indicate model of the need to update land covers partition
-  SetToUpdate( !aPrevStricklerTable.IsNull() || IsMustBeUpdated() );
+  Changed( Geom_No );
 }
 
 bool HYDROData_CalculationCase::AddLandCover( const Handle(HYDROData_LandCover)& theLandCover )
@@ -637,7 +639,7 @@ bool HYDROData_CalculationCase::AddLandCover( const Handle(HYDROData_LandCover)&
   AddReferenceObject( theLandCover, DataTag_LandCover );
   
   // Indicate model of the need to update land covers partition
-  SetToUpdate( true );
+  Changed( Geom_No );
 
   return true;
 }
@@ -655,7 +657,7 @@ void HYDROData_CalculationCase::RemoveLandCover( const Handle(HYDROData_LandCove
   RemoveReferenceObject( theLandCover->Label(), DataTag_LandCover );
 
   // Indicate model of the need to update land cover partition
-  SetToUpdate( true );
+  Changed( Geom_No );
 }
 
 void HYDROData_CalculationCase::RemoveLandCovers()
@@ -663,7 +665,7 @@ void HYDROData_CalculationCase::RemoveLandCovers()
   ClearReferenceObjects( DataTag_LandCover );
 
   // Indicate model of the need to update land cover partition
-  SetToUpdate( true );
+  Changed( Geom_No );
 }
 
 Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone,
@@ -699,7 +701,7 @@ bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRe
   if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab )
   {
     Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF, theLandCover );
-    theRegion->CopyTo( aNewRegion );
+    theRegion->CopyTo( aNewRegion, true );
 
     aFatherCalc->RemoveRegion( theRegion, theLandCover );
 
@@ -1328,7 +1330,7 @@ void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag t
 
   // Indicate model of the need to update splitting
   if ( theIsSetToUpdate ) {
-    SetToUpdate( true );
+    Changed( Geom_2d );
   }
 }
 
@@ -1342,7 +1344,7 @@ void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)&    theO
   HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QString HYDROData_CalculationCase::DumpRules() const
@@ -1363,7 +1365,7 @@ void HYDROData_CalculationCase::SetAssignmentMode( AssignmentMode theMode )
   TDataStd_Integer::Set( aModeLab, ( int ) theMode );
 
   // Indicate model of the need to update splitting
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentMode() const
@@ -1466,7 +1468,7 @@ void HYDROData_CalculationCase::SetAssignmentLandCoverMode( AssignmentMode theMo
   TDataStd_Integer::Set( aModeLab, ( int ) theMode );
 
   // Indicate model of the need to update land covers partition
-  SetToUpdate( true );
+  Changed( Geom_No );
 }
 
 HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentLandCoverMode() const
index 841359413c29366c227a79411a3c3c5d674b853e..a2e8453750cabad42d08be0af5be9692c63c6601 100644 (file)
@@ -27,6 +27,7 @@
 #include "HYDROData_ShapesTool.h"
 #include "HYDROData_Pipes.h"
 #include "HYDROData_Stream.h"
+#include "HYDROData_Tool.h"
 
 #include <BRepBuilderAPI_MakeWire.hxx>
 
@@ -75,7 +76,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Channel,HYDROData_ArtificialObject)
 
 
 HYDROData_Channel::HYDROData_Channel()
-: HYDROData_ArtificialObject()
+: HYDROData_ArtificialObject( Geom_3d )
 {
 }
 
@@ -401,7 +402,7 @@ bool HYDROData_Channel::SetGuideLine( const Handle(HYDROData_Polyline3D)& theGui
   SetReferenceObject( theGuideLine, DataTag_GuideLine );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -421,7 +422,7 @@ void HYDROData_Channel::RemoveGuideLine()
   ClearReferenceObjects( DataTag_GuideLine );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Channel::SetProfile( const Handle(HYDROData_Profile)& theProfile )
@@ -440,7 +441,7 @@ bool HYDROData_Channel::SetProfile( const Handle(HYDROData_Profile)& theProfile
   SetReferenceObject( theProfile, DataTag_Profile );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -460,12 +461,24 @@ void HYDROData_Channel::RemoveProfile()
   ClearReferenceObjects( DataTag_Profile );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 ObjectKind HYDROData_Channel::getAltitudeObjectType() const
 {
   DEBTRACE("HYDROData_Channel::getAltitudeObjectType");
   return KIND_CHANNEL_ALTITUDE;
+  //return KIND_STREAM_ALTITUDE;
 }
 
+TopoDS_Shape HYDROData_Channel::GetLeftShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 1);
+}
+
+TopoDS_Shape HYDROData_Channel::GetRightShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 2);
+}
index a53db842abeda6bbfce977a717ca1bb7e0dbc176..5b4e694f84496701dff8b14f7ac227f12f2d0060 100644 (file)
@@ -100,6 +100,16 @@ public:
    */
   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
 
+  /**
+   * Returns the left edge of the channel.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const;
+
+  /**
+   * Returns the right edge of the channel.
+   */
+  HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const;
+
   /**
    * Update the shape presentations of stream.
    * Call this method whenever you made changes for channel data.
index 12f19b5a60a72396a9123feafc89662c29d55333..6efb1a7f34a37db464d5aa0ade6d6aa3e06b8407 100644 (file)
@@ -29,7 +29,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Confluence,HYDROData_NaturalObject)
 
 
 HYDROData_Confluence::HYDROData_Confluence()
-: HYDROData_NaturalObject()
+: HYDROData_NaturalObject( Geom_3d )
 {
 }
 
index f4f665b67dcbdf3c250b0a62f315fb42416b9ba8..fbc4851d3b7546b52f77c5afc64b0571934019a8 100644 (file)
@@ -29,7 +29,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_DummyObject3D,HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_DummyObject3D,HYDROData_Entity)
 
 HYDROData_DummyObject3D::HYDROData_DummyObject3D()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_3d )
 {
 }
 
index ac0c59620697b369915318c24728f6f98c711215..6af65981490a2ba5209ed69b0759fd83fc892cec 100644 (file)
@@ -41,7 +41,7 @@
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
-static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000");
+//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)
@@ -85,7 +85,7 @@ QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjec
 
 void HYDROData_Entity::Update()
 {
-  SetToUpdate( false );
+  ClearChanged();
 }
 
 void HYDROData_Entity::UpdateLocalCS( double theDx, double theDy )
@@ -115,31 +115,59 @@ QVariant HYDROData_Entity::GetDataVariant()
   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();
+
+  int aBitsToChange = ( myGeom & theChangedGeometry );
+  if( aBitsToChange == 0 )
+    return;
 
-    Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
-    if ( !aDocument.IsNull() )
+  aGeomChangeFlag = ( aGeomChangeFlag | aBitsToChange );
+  TDataStd_Integer::Set( aGeomChangeLab, aGeomChangeFlag );
+
+  HYDROData_Iterator anIter( aDocument );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    Handle(HYDROData_Entity) anObject = anIter.Current();
+    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
@@ -162,7 +190,8 @@ bool HYDROData_Entity::CanRemove()
   return true;
 }
 
-HYDROData_Entity::HYDROData_Entity()
+HYDROData_Entity::HYDROData_Entity( Geometry theGeom )
+  : myGeom( theGeom )
 {
 }
 
@@ -170,7 +199,8 @@ HYDROData_Entity::~HYDROData_Entity()
 {
 }
 
-void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination ) const
+void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                               bool isGenerateNewName ) const
 {
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   if ( aDocument.IsNull() ) {
@@ -180,23 +210,26 @@ void HYDROData_Entity::CopyTo( const Handle(HYDROData_Entity)& theDestination )
   TDF_CopyLabel aCopy(myLab, theDestination->Label());
   aCopy.Perform();
          
-  // generate a new unique name for the clone object:
-  // case 1: Image_1 -> Image_2
-  // case 2: ImageObj -> ImageObj_1
-  QString aName = theDestination->GetName();
-  QString aPrefix = aName;
-  if( aName.contains( '_' ) ) { // case 1
-    QString aSuffix = aName.section( '_', -1 );
-    bool anIsInteger = false;
-    aSuffix.toInt( &anIsInteger );
-    if( anIsInteger )
-      aPrefix = aName.section( '_', 0, -2 );
-  } else { // case 2
-    aPrefix = aName;
-  }
+  if( isGenerateNewName )
+  {
+    // generate a new unique name for the clone object:
+    // case 1: Image_1 -> Image_2
+    // case 2: ImageObj -> ImageObj_1
+    QString aName = theDestination->GetName();
+    QString aPrefix = aName;
+    if( aName.contains( '_' ) ) { // case 1
+      QString aSuffix = aName.section( '_', -1 );
+      bool anIsInteger = false;
+      aSuffix.toInt( &anIsInteger );
+      if( anIsInteger )
+        aPrefix = aName.section( '_', 0, -2 );
+    } else { // case 2
+      aPrefix = aName;
+    }
 
-  aName = HYDROData_Tool::GenerateObjectName( aDocument, aPrefix );
-  theDestination->SetName( aName );
+    aName = HYDROData_Tool::GenerateObjectName( aDocument, aPrefix );
+    theDestination->SetName( aName );
+  }
 }
 
 Handle(HYDROData_Entity) HYDROData_Entity::GetFatherObject() const
index 8661f3e212fb9ca5e214f27f282105c320911300..833751ee3a336a3e51050084b4f87dcc53434c84 100644 (file)
@@ -86,9 +86,7 @@ HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Hand
  */
 class HYDROData_Entity : public MMgt_TShared
 {
-
 protected:
-
   /**
    * Enumeration of tags corresponding to the persistent object parameters.
    */
@@ -96,6 +94,20 @@ protected:
   {
     DataTag_First  = 0,     ///< first tag, to reserve
     DataTag_ZLevel,         ///< z-level of object presentation
+    DataTag_GeomChange,
+  };
+
+public:
+  enum Geometry
+  {
+    Geom_No = 1,
+    Geom_2d = 2,
+    Geom_Z  = 4,
+    Geom_Groups = 8,
+
+    Geom_3d = Geom_2d | Geom_Z,
+    Geom_2d_and_groups = Geom_2d | Geom_Groups,
+    Geom_All = Geom_3d | Geom_Groups | Geom_No,
   };
 
 public:
@@ -114,7 +126,7 @@ public:
   /**
    * Updates the name of this object.
    */
-  HYDRODATA_EXPORT virtual void SetName( const QString& theName );
+  HYDRODATA_EXPORT void SetName( const QString& theName );
 
   /**
    * Returns the name of this object valid for Python script.
@@ -154,17 +166,11 @@ 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 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 virtual bool IsMustBeUpdated() const;
+  HYDRODATA_EXPORT virtual void ClearChanged();
+  HYDRODATA_EXPORT virtual void Changed( Geometry );
+
+  HYDRODATA_EXPORT bool IsMustBeUpdated( Geometry ) const;
 
   /**
    * Returns flag indicating that object is updateble or not.
@@ -196,7 +202,8 @@ public:
    * Objects must be the same type.
    * \param theDestination initialized object (from any document) - target of copying
    */
-  HYDRODATA_EXPORT virtual void CopyTo( const Handle(HYDROData_Entity)& theDestination ) const;
+  HYDRODATA_EXPORT virtual void CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                                        bool isGenerateNewName ) const;
 
   /**
    * Returns the label of this object.
@@ -263,7 +270,7 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDRODATA_EXPORT HYDROData_Entity();
+  HYDRODATA_EXPORT HYDROData_Entity( Geometry );
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
@@ -410,16 +417,18 @@ protected:
                              const QColor&        theColor,
                              const QColor&        theDefaultColor,
                              const QString&       theMethod ) const;
-
 protected:
 
   Handle(TDataStd_ReferenceList) getReferenceList( const int  theTag,
                                                    const bool theIsCreate ) const;
 
 
+  int GetGeomChangeFlag() const;
+
 protected:
   /// Array of pointers to the properties of this object; index in this array is returned by \a AddProperty.
   TDF_Label myLab; ///< label of this object
+  Geometry  myGeom;
 };
 
 #endif
index 521308afd757d7d142a3afc030076b9abf09da0f..3bafc988e6d5657374af9680d17457ba2ca9351c 100644 (file)
@@ -26,7 +26,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_IAltitudeObject, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IAltitudeObject, HYDROData_Entity)
 
 HYDROData_IAltitudeObject::HYDROData_IAltitudeObject()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_Z )
 {
 }
 
index df150b0a83c8525ce4fadbd6f13cec4a6ffc7c5f..695bf84ae3713d30519400c084407bc1a978f863 100755 (executable)
@@ -36,7 +36,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity)
 
 HYDROData_IPolyline::HYDROData_IPolyline()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d )
 {
 }
 
index b7ec1096ac9388886b0eee97984c45381809d7d6..e1787adae7950d3dc951c5ca1a327f5a8a681548 100644 (file)
@@ -46,7 +46,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Image, HYDROData_Entity)
 
 HYDROData_Image::HYDROData_Image()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d )
 {
 }
 
@@ -175,7 +175,7 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject
 
 void HYDROData_Image::Update()
 {
-  bool anIsToUpdate = IsMustBeUpdated();
+  bool anIsToUpdate = IsMustBeUpdated( Geom_2d );
 
   HYDROData_Entity::Update();
 
@@ -226,7 +226,7 @@ void HYDROData_Image::Update()
     UpdateTrsf();
   }
 
-  SetToUpdate( false );
+  ClearChanged();
 }
 
 bool HYDROData_Image::IsHas2dPrs() const
@@ -294,7 +294,7 @@ void HYDROData_Image::SetImage(const QImage& theImage)
     SaveByteArray(0, aData, anImage.byteCount());
   }
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_Image::LoadImage( const QString& theFilePath )
@@ -326,7 +326,7 @@ void HYDROData_Image::SetFilePath( const QString& theFilePath )
   TCollection_AsciiString anAsciiStr( theFilePath.toStdString().c_str() );
   TDataStd_AsciiString::Set( myLab.FindChild( DataTag_FilePath ), anAsciiStr );
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QString HYDROData_Image::GetFilePath() const
@@ -362,7 +362,7 @@ void HYDROData_Image::SetTrsf(const QTransform& theTrsf)
   anArray->SetValue(8, theTrsf.m32());
   anArray->SetValue(9, theTrsf.m33());
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QTransform HYDROData_Image::Trsf() const
@@ -507,7 +507,7 @@ void HYDROData_Image::RemoveAllReferences()
   QImage anImage = Image();
   if ( anImage.isNull() )
   {
-    SetToUpdate( false );
+    ClearChanged();
     return;
   }
 
@@ -528,7 +528,7 @@ void HYDROData_Image::RemoveAllReferences()
 
   SetGlobalPoints( ManualCartesian, aTrsfPointA, aTrsfPointB, aTrsfPointC );
 
-  SetToUpdate( false );
+  ClearChanged();
 }
 
 void HYDROData_Image::SetLocalPoints( const QPoint& thePointA,
@@ -552,7 +552,7 @@ void HYDROData_Image::SetLocalPoints( const QPoint& thePointA,
   if ( theIsUpdate )
     UpdateTrsf();
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_Image::GetLocalPoints( QPoint& thePointA,
@@ -607,7 +607,7 @@ void HYDROData_Image::SetGlobalPoints( const TransformationMode& theMode,
   if ( theIsUpdate )
     UpdateTrsf();
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_Image::GetGlobalPoints( TransformationMode& theMode,
@@ -759,7 +759,7 @@ bool HYDROData_Image::HasReferencePoints() const
 void HYDROData_Image::SetTrsfMode( const TransformationMode& theMode )
 {
   TDataStd_Integer::Set( myLab.FindChild( DataTag_TrsfMode ), (int)theMode );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 HYDROData_Image::TransformationMode HYDROData_Image::GetTrsfMode() const
@@ -780,7 +780,7 @@ HYDROData_Image::TransformationMode HYDROData_Image::GetTrsfMode() const
 void HYDROData_Image::SetTrsfReferenceImage( const Handle(HYDROData_Image)& theRefImage )
 {
   SetReferenceObject( theRefImage, DataTag_TrsfImage );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 Handle(HYDROData_Image) HYDROData_Image::GetTrsfReferenceImage() const
@@ -791,13 +791,13 @@ Handle(HYDROData_Image) HYDROData_Image::GetTrsfReferenceImage() const
 void HYDROData_Image::RemoveTrsfReferenceImage()
 {
   RemoveReferenceObject( DataTag_TrsfImage );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_Image::AppendReference( const Handle(HYDROData_Entity)& theReferenced )
 {
   AddReferenceObject( theReferenced, 0 );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 int HYDROData_Image::NbReferences() const
@@ -814,26 +814,26 @@ void HYDROData_Image::ChangeReference(
     const int theIndex, Handle(HYDROData_Entity) theReferenced)
 {
   SetReferenceObject( theReferenced, 0, theIndex );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_Image::RemoveReference(const int theIndex)
 {
   RemoveReferenceObject( 0, theIndex );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_Image::ClearReferences()
 {
   ClearReferenceObjects( 0 );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_Image::SetOperatorName( const QString theOpName )
 {
   TCollection_AsciiString anAsciiStr( theOpName.toStdString().c_str() );
   TDataStd_AsciiString::Set( myLab.FindChild( DataTag_Operator ), anAsciiStr );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QString HYDROData_Image::OperatorName() const
@@ -854,7 +854,7 @@ QString HYDROData_Image::OperatorName() const
 void HYDROData_Image::SetArgs(const QByteArray& theArgs)
 {
   SaveByteArray(DataTag_Operator, theArgs.constData(), theArgs.length());
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 QByteArray HYDROData_Image::Args() const
@@ -873,7 +873,7 @@ void HYDROData_Image::SetIsSelfSplitted(bool theFlag)
   } else {
     myLab.ForgetAttribute(GUID_SELF_SPLITTED);
   }
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_Image::IsSelfSplitted() const
index ae2b7ddd0493a391f831bbfdf64f75f8c9159170..9b0cfdd89cd567d8a1d56f5e662181252ca6fde3 100644 (file)
@@ -49,7 +49,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ImmersibleZone,HYDROData_NaturalObject)
 
 
 HYDROData_ImmersibleZone::HYDROData_ImmersibleZone()
-: HYDROData_NaturalObject()
+: HYDROData_NaturalObject( Geom_2d )
 {
 }
 
@@ -261,8 +261,11 @@ QColor HYDROData_ImmersibleZone::getDefaultBorderColor() const
 
 void HYDROData_ImmersibleZone::SetPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
 {
+  if( IsEqual( GetPolyline(), thePolyline ) )
+    return;
+
   SetReferenceObject( thePolyline, DataTag_Polyline );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 Handle(HYDROData_PolylineXY) HYDROData_ImmersibleZone::GetPolyline() const
@@ -274,7 +277,7 @@ Handle(HYDROData_PolylineXY) HYDROData_ImmersibleZone::GetPolyline() const
 void HYDROData_ImmersibleZone::RemovePolyline()
 {
   ClearReferenceObjects( DataTag_Polyline );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 
index 278f42c5f38fcc2f830c31bc84c440de00240b72..d17b52430ac43d87f6a1f3e5be0e33cbeab25e31 100644 (file)
@@ -46,6 +46,7 @@ IMPLEMENT_STANDARD_HANDLE( HYDROData_LandCover, HYDROData_Entity )
 IMPLEMENT_STANDARD_RTTIEXT( HYDROData_LandCover, HYDROData_Entity )
 
 HYDROData_LandCover::HYDROData_LandCover()
+: HYDROData_Entity( Geom_2d )
 {
 }
 
@@ -133,7 +134,7 @@ void HYDROData_LandCover::Update()
 void HYDROData_LandCover::SetPolylines( const HYDROData_SequenceOfObjects& thePolylines )
 {
   SetReferenceObjects( thePolylines, DataTag_Polylines );
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 HYDROData_SequenceOfObjects HYDROData_LandCover::GetPolylines() const
index fb7e9314c7dee1b01c4286769e0aa48462a08d73..d11424558259d25e638989b4f6016339ef1d2472 100644 (file)
@@ -21,8 +21,8 @@
 IMPLEMENT_STANDARD_HANDLE(HYDROData_NaturalObject,HYDROData_Object)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_NaturalObject,HYDROData_Object)
 
-HYDROData_NaturalObject::HYDROData_NaturalObject()
-: HYDROData_Object()
+HYDROData_NaturalObject::HYDROData_NaturalObject( Geometry theGeometry )
+: HYDROData_Object( theGeometry )
 {
 }
 
index 4454437de7dcf8e8e3e7cc9380d8861ad322ce05..e002b9a7b2733aabfa486fe62297bec2d06c5134 100644 (file)
@@ -48,7 +48,7 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDRODATA_EXPORT HYDROData_NaturalObject();
+  HYDRODATA_EXPORT HYDROData_NaturalObject( Geometry );
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
index 6a8ee297c192992bf666164f6d383a04a2c74673..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 )
@@ -198,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;
 }
@@ -218,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 )
index 56e1c4a02159acd577083c0a8060fdac92d3e931..e97144aacd8096868ece46c8e599a27b851fac50 100644 (file)
@@ -76,7 +76,7 @@ public:
    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
    * Reimplemented to update the state of child 3D object.
    */
-  HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
+  HYDRODATA_EXPORT virtual void Changed( Geometry );
 
 
   /**
@@ -178,7 +178,7 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDRODATA_EXPORT HYDROData_Object();
+  HYDRODATA_EXPORT HYDROData_Object( Geometry );
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.
index 00f332b94b1c497d7ebecca0e5902b9d3c0595fd..2f37ee1dc5550deb157c77a6391d9dfc6184199e 100644 (file)
@@ -65,7 +65,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Obstacle,HYDROData_ArtificialObject)
 
 
 HYDROData_Obstacle::HYDROData_Obstacle()
-: HYDROData_ArtificialObject()
+: HYDROData_ArtificialObject( Geom_3d )
 {
 }
 
index 508224597315e978bfa0a3537c69e87dbf76e9c0..f2cb00e4091b923eceb0e9659a8dd0fcfbf86f32 100644 (file)
@@ -58,7 +58,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Polyline3D,HYDROData_Object)
 
 
 HYDROData_Polyline3D::HYDROData_Polyline3D()
-: HYDROData_Object()
+: HYDROData_Object( Geom_3d )
 {
 }
 
@@ -249,7 +249,7 @@ bool HYDROData_Polyline3D::SetPolylineXY( const Handle(HYDROData_PolylineXY)& th
     updateChildProfilePoints();
 
   // Indicate model of the need to update the polyline presentation
-  SetToUpdate( true );
+  Changed( Geom_2d );
 
   return true;
 }
@@ -269,7 +269,7 @@ void HYDROData_Polyline3D::RemovePolylineXY()
   ClearReferenceObjects( DataTag_PolylineXY );
 
   // Indicate model of the need to update the polyline presentation
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_Polyline3D::SetProfileUZ( const Handle(HYDROData_ProfileUZ)& theProfile )
@@ -287,7 +287,7 @@ bool HYDROData_Polyline3D::SetProfileUZ( const Handle(HYDROData_ProfileUZ)& theP
   RemoveAltitudeObject();
 
   // Indicate model of the need to update the polyline presentation
-  SetToUpdate( true );
+  Changed( Geom_Z );
 
   return true;
 }
@@ -307,7 +307,7 @@ void HYDROData_Polyline3D::RemoveProfileUZ()
   ClearReferenceObjects( DataTag_ProfileUZ );
 
   // Indicate model of the need to update the polyline presentation
-  SetToUpdate( true );
+  Changed( Geom_Z );
 }
 
 bool HYDROData_Polyline3D::SetAltitudeObject( 
index 839e949a123ba47ce64dd36d253f7dca79cb6e93..8c97c15d21687c0fe0ee7c020d4a585a9bb7dfe4 100755 (executable)
@@ -484,7 +484,7 @@ void HYDROData_PolylineXY::Update()
   if ( !IsEditable() )
   {
     // If polyline is not editable we no need to update it wire
-    SetToUpdate( false );
+    ClearChanged();
     return;
   }
 
@@ -710,7 +710,7 @@ void HYDROData_PolylineXY::AddSection( const TCollection_AsciiString& theSectNam
   aTypesList->Append( theSectionType );
   aClosuresList->Append( theIsClosed );
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 TCollection_AsciiString HYDROData_PolylineXY::GetSectionName( const int theSectionIndex ) const
@@ -754,8 +754,6 @@ void HYDROData_PolylineXY::SetSectionName( const int                      theSec
   TDataStd_ListIteratorOfListOfExtendedString aNamesIter( anOldNamesList );
   for ( int i = 0; aNamesIter.More(); aNamesIter.Next(), ++i )
     aNamesList->Append( i == theSectionIndex ? aNewSectName : aNamesIter.Value() );
-
-  SetToUpdate( true );
 }
 
 HYDROData_PolylineXY::SectionType HYDROData_PolylineXY::GetSectionType( const int theSectionIndex ) const
@@ -793,7 +791,7 @@ void HYDROData_PolylineXY::SetSectionType( const int         theSectionIndex,
   for ( int i = 0; aTypesIter.More(); aTypesIter.Next(), ++i )
     aTypesList->Append( i == theSectionIndex ? theSectionType : aTypesIter.Value() );
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 bool HYDROData_PolylineXY::IsClosedSection( const int theSectionIndex ) const
@@ -831,7 +829,7 @@ void HYDROData_PolylineXY::SetSectionClosed( const int  theSectionIndex,
   for ( int i = 0; aClosuresIter.More(); aClosuresIter.Next(), ++i )
     aClosuresList->Append( i == theSectionIndex ? theIsClosed : (bool)aClosuresIter.Value() );
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
@@ -913,14 +911,14 @@ void HYDROData_PolylineXY::RemoveSection( const int theSectionIndex )
     removePointsLists( theSectionIndex );
   }
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::RemoveSections()
 {
   removeSectionsLists();
   removePointsLists();
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::AddPoint( const int    theSectionIndex,
@@ -966,7 +964,7 @@ void HYDROData_PolylineXY::AddPoint( const int    theSectionIndex,
     }
   }
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::SetPoint( const int    theSectionIndex,
@@ -1017,7 +1015,7 @@ void HYDROData_PolylineXY::SetPoint( const int    theSectionIndex,
     }
   }
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::SetPoints( const int         theSectionIndex,
@@ -1073,7 +1071,7 @@ void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex,
     }
   }
 
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex, bool IsConvertToGlobal ) const
@@ -1156,7 +1154,7 @@ void HYDROData_PolylineXY::UpdateLocalCS( double theDx, double theDy )
     }
     SetPoints( i, aPoints );
   }
-  SetToUpdate( true );
+  Changed( Geom_2d );
 }
 
 void HYDROData_PolylineXY::Transform( const QTransform& theTrsf )
index 2649e2b04a26c032477e1ae1af2d364c4f337b7b..9c4eda1d8288de01ba5a2b436f6acaa4b6e9bca2 100755 (executable)
@@ -56,7 +56,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_Profile, HYDROData_Object)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Profile, HYDROData_Object)
 
 HYDROData_Profile::HYDROData_Profile()
-: HYDROData_Object()
+: HYDROData_Object( Geom_3d )
 {
 }
 
@@ -239,7 +239,7 @@ void HYDROData_Profile::SetLeftPoint( const gp_XY& theGPoint, bool IsConvertFrom
   anArray->SetValue( 0, aLPoint.X() );
   anArray->SetValue( 1, aLPoint.Y() );
 
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Profile::GetLeftPoint( gp_XY& thePoint, bool IsConvertToGlobal,
@@ -291,7 +291,7 @@ void HYDROData_Profile::SetRightPoint( const gp_XY& theGPoint, bool IsConvertFro
   anArray->SetValue( 0, aLPoint.X() );
   anArray->SetValue( 1, aLPoint.Y() );
 
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Profile::GetRightPoint( gp_XY& thePoint, bool IsConvertToGlobal,
@@ -336,7 +336,7 @@ void HYDROData_Profile::Invalidate()
   if ( !aLastLabel.IsNull() )
     aLastLabel.ForgetAllAttributes();
 
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 Handle(HYDROData_ProfileUZ) HYDROData_Profile::GetProfileUZ( const bool theIsCreate ) const
@@ -369,7 +369,7 @@ void HYDROData_Profile::RemovePoints()
   if ( !aProfileUZ.IsNull() )
   {
     aProfileUZ->RemoveSections();
-    SetToUpdate( true );
+    Changed( Geom_3d );
   }
 }
 
@@ -384,7 +384,7 @@ void HYDROData_Profile::SetParametricPoints( const HYDROData_ProfileUZ::PointsLi
     aProfileUZ->AddPoint( 0, aPoint );
   }
 
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 HYDROData_ProfileUZ::PointsList HYDROData_Profile::GetParametricPoints() const
index 20a86e42665435658222b149d6832e021bcf6c0c..582357e8dc2f33fce07215099e70dd3bfe9105ef 100644 (file)
@@ -52,7 +52,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Entity)
 
 
 HYDROData_Region::HYDROData_Region()
- : HYDROData_Entity()
+ : HYDROData_Entity( Geom_2d )
 {
 }
 
@@ -107,7 +107,7 @@ bool HYDROData_Region::AddZone( const Handle(HYDROData_Zone)& theZone )
   if ( !aFatherRegion.IsNull() && aFatherRegion->Label() != myLab )
   {
     Handle(HYDROData_Zone) aNewZone = addNewZone( aDocument, "", TopoDS_Face(), QStringList() );
-    theZone->CopyTo( aNewZone );
+    theZone->CopyTo( aNewZone, false );
 
     // To prevent changing of stored shape
     aNewZone->SetShape( theZone->GetShape() );
index 2bb5cef767d311822810ed892643bf54772fab89..88f7c84ce9b9a936640b31191cf6e8a9b1b7eb56 100644 (file)
@@ -29,7 +29,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_River,HYDROData_NaturalObject)
 
 
 HYDROData_River::HYDROData_River()
-: HYDROData_NaturalObject()
+: HYDROData_NaturalObject( Geom_3d )
 {
 }
 
index 3501522148c06f9bad65239ca0433896b1e9c665..12807de7f35040acbb6d59202f279c777d3368da 100644 (file)
@@ -137,7 +137,7 @@ void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream&           theSt
 
 
 HYDROData_ShapesGroup::HYDROData_ShapesGroup()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_Groups )
 {
 }
 
index 42a62b5771f92a31f0ccbe1475d0e29404041127..a0f663f836bc9bae25390bd0f99351c97ca058f1 100644 (file)
@@ -95,7 +95,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Stream,HYDROData_NaturalObject)
 
 
 HYDROData_Stream::HYDROData_Stream()
-: HYDROData_NaturalObject()
+: HYDROData_NaturalObject( Geom_3d )
 {
 }
 
@@ -303,49 +303,28 @@ bool HYDROData_Stream::IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theHyd
   return true;
 }
 
-TopoDS_Shape getShapeFromGroup( const HYDROData_SequenceOfObjects& theGroups,
-                                const int                          theGroupId )
-{
-  TopoDS_Shape aResShape;
-  if ( theGroups.Length() != 4 )
-    return aResShape;
-
-  Handle(HYDROData_ShapesGroup) aGroup =
-    Handle(HYDROData_ShapesGroup)::DownCast( theGroups.Value( theGroupId ) );
-  if ( aGroup.IsNull() )
-    return aResShape;
-
-  TopTools_SequenceOfShape aGroupShapes;
-  aGroup->GetShapes( aGroupShapes );
-
-  if ( !aGroupShapes.IsEmpty() )
-    aResShape = aGroupShapes.First();
-
-  return aResShape;
-}
-
 TopoDS_Shape HYDROData_Stream::GetLeftShape() const
 {
   HYDROData_SequenceOfObjects aGroups = GetGroups();
-  return getShapeFromGroup( aGroups, 1 );
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 1);
 }
 
 TopoDS_Shape HYDROData_Stream::GetRightShape() const
 {
   HYDROData_SequenceOfObjects aGroups = GetGroups();
-  return getShapeFromGroup( aGroups, 2 );
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 2);
 }
 
 TopoDS_Shape HYDROData_Stream::GetInletShape() const
 {
   HYDROData_SequenceOfObjects aGroups = GetGroups();
-  return getShapeFromGroup( aGroups, 3 );
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 3);
 }
 
 TopoDS_Shape HYDROData_Stream::GetOutletShape() const
 {
   HYDROData_SequenceOfObjects aGroups = GetGroups();
-  return getShapeFromGroup( aGroups, 4 );
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 4);
 }
 
 QColor HYDROData_Stream::getDefaultFillingColor() const
@@ -373,7 +352,7 @@ bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& the
   updateProfilesOrder();
 
   // Indicate model of the need to update the stream presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -396,7 +375,7 @@ void HYDROData_Stream::RemoveHydraulicAxis()
   RemoveProfiles();
 
   // Indicate model of the need to update the stream presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_Profile)& theProfile,
@@ -530,7 +509,7 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile )
   insertProfileInToOrder( theProfile, aProfileIndex );
   
   // Indicate model of the need to update the stream presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -575,7 +554,7 @@ bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfil
     SetReferenceObjects( theProfiles, DataTag_Profile );
 
     if ( anIsToUpdate )
-      SetToUpdate( true );
+      Changed( Geom_3d );
   }
 
   return true;
@@ -618,22 +597,20 @@ bool HYDROData_Stream::RemoveProfile( const Handle(HYDROData_Profile)& theProfil
   removeParameter( aProfileIndex );
 
   // Indicate model of the need to update the stream presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
 
 void HYDROData_Stream::RemoveProfiles()
 {
-  bool anIsToUpdate = IsMustBeUpdated() || NbReferenceObjects( DataTag_Profile ) > 0;
-
   ClearReferenceObjects( DataTag_Profile );
 
   // Remove the parameters array
   removeParametersArray();
 
   // Indicate model of the need to update the stream presentation
-  SetToUpdate( anIsToUpdate );
+  Changed( Geom_3d );
 }
 
 void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
@@ -1028,7 +1005,8 @@ bool HYDROData_Stream::Interpolate( HYDROData_IProfilesInterpolator* theInterpol
   return isOK;
 }
 
-void HYDROData_Stream::CopyTo( const Handle(HYDROData_Entity)& theDestination ) const
+void HYDROData_Stream::CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                               bool isGenerateNewName ) const
 {
   // Get the document
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
@@ -1037,7 +1015,7 @@ void HYDROData_Stream::CopyTo( const Handle(HYDROData_Entity)& theDestination )
   }
 
   // Call base method
-  HYDROData_Entity::CopyTo( theDestination );
+  HYDROData_Entity::CopyTo( theDestination, isGenerateNewName );
 
   Handle(HYDROData_Stream) aStreamCopy = 
     Handle(HYDROData_Stream)::DownCast( theDestination );
index 6ebf6427e19a4bfba0df279a5f31bb499196ba01..fd4ffca5f1784e6741e632ade6f93e980a9087a0 100644 (file)
@@ -136,7 +136,8 @@ public:
   /**
    *
    */
-  HYDRODATA_EXPORT virtual void CopyTo( const Handle(HYDROData_Entity)& theDestination ) const;
+  HYDRODATA_EXPORT virtual void CopyTo( const Handle(HYDROData_Entity)& theDestination,
+                                        bool isGenerateNewName ) const;
 
 
   /**
index 893be4427bfaf905da9f35dc4c5bdffb0b3dc18b..96b33ad8cb62e0ad1fb8b67114081823b35191f1 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "HYDROData_StreamAltitude.h"
 
+#include "HYDROData_Channel.h"
 #include "HYDROData_Document.h"
 #include "HYDROData_Profile.h"
 #include "HYDROData_Stream.h"
@@ -37,6 +38,7 @@
 
 #include <Precision.hxx>
 
+#include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 
 #include <TopoDS.hxx>
@@ -44,6 +46,7 @@
 #include <TopoDS_Edge.hxx>
 
 #include <TopTools_SequenceOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
 #include <Geom_Line.hxx>
 
@@ -69,150 +72,169 @@ HYDROData_StreamAltitude::~HYDROData_StreamAltitude()
 {
 }
 
-Standard_Real getAltitudeFromProfile( const Handle(HYDROData_Profile)& theProfile,
-                                      const Standard_Real&             theLeftDist,
-                                      const Standard_Real&             theRightDist )
+bool IsPointBetweenEdges( const gp_Pnt& aFirstPnt1, const gp_Pnt& aLastPnt1,
+                          const gp_Pnt& aFirstPnt2, const gp_Pnt& aLastPnt2,
+                          const gp_Pnt& thePoint) {
+  BRepBuilderAPI_MakeEdge aLeftMakeEdge( aFirstPnt1, aLastPnt1 );
+  BRepBuilderAPI_MakeEdge aBotMakeEdge( aLastPnt1, aLastPnt2 );
+  BRepBuilderAPI_MakeEdge aRightMakeEdge( aLastPnt2, aFirstPnt2 );
+  BRepBuilderAPI_MakeEdge aTopMakeEdge( aFirstPnt2, aFirstPnt1 );
+
+  BRepBuilderAPI_MakeWire aMakeWire( aLeftMakeEdge.Edge(), aBotMakeEdge.Edge(), 
+                                     aRightMakeEdge.Edge(), aTopMakeEdge.Edge() );
+
+  BRepBuilderAPI_MakeFace aMakeFace( aMakeWire.Wire() );
+       
+  TopoDS_Face aFace = aMakeFace.Face();
+#ifdef DEB_CLASS2D
+  TopoDS_Compound aCmp;
+  BRep_Builder aBB;
+  aBB.MakeCompound(aCmp);
+  aBB.Add(aCmp, aFace);
+  BRepBuilderAPI_MakeVertex aMk(thePoint);
+  aBB.Add(aCmp, aMk.Vertex());
+  BRepTools::Write(aCmp, "ProfileFace.brep");
+#endif     
+
+  gp_XY anXY( thePoint.X(), thePoint.Y() );
+  TopAbs_State aPointState =  HYDROData_Tool::ComputePointState(anXY, aFace);
+
+#ifdef DEB_CLASS2D
+         cout << "Point status is = " << aPointState <<endl;
+#endif
+  return aPointState != TopAbs_OUT;
+}
+
+Standard_Real getAltitudeFromWire( const TopoDS_Wire& theWire,
+                                   const Standard_Real& theLeftDist,
+                                   const Standard_Real& theRightDist )
 {
   Standard_Real aResAlt = 0.0;
 
   gp_XY aFirstPoint, aLastPoint;
-  if ( !theProfile->GetLeftPoint( aFirstPoint, false ) ||
-       !theProfile->GetRightPoint( aLastPoint, false ) )
-    return aResAlt;
-
-  gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
-  gp_Pnt aPnt2( aLastPoint.X(),  aLastPoint.Y(),  0 );
-
+  TopoDS_Vertex aFirstVertex, aLastVertex;
+  TopExp::Vertices( theWire, aFirstVertex, aLastVertex );
+
+  gp_Pnt aPnt1( BRep_Tool::Pnt( aFirstVertex ) );
+  aPnt1.SetZ( 0 );
+  gp_Pnt aPnt2( BRep_Tool::Pnt( aLastVertex ) );
+  aPnt2.SetZ( 0 );
+  
   Standard_Real aProfileDist = aPnt1.Distance( aPnt2 );
 
   Standard_Real aCoeff = aProfileDist / ( theLeftDist + theRightDist );
 
   gp_Pnt anIntPoint( aPnt1.XYZ() + ( aCoeff * theLeftDist ) * gp_Dir( gp_Vec( aPnt1, aPnt2 ) ).XYZ() );
 
-  gp_Lin aPointLine( anIntPoint, gp::DZ() );
-
-  gp_Pnt aPrevPoint;
-  gp_Lin aPrevNormal;
-  HYDROData_Profile::ProfilePoints aProfilePoints = theProfile->GetProfilePoints( false );
-  for ( int i = 1, n = aProfilePoints.Length(); i <= n; ++i )
-  {
-    gp_Pnt aProfPoint( aProfilePoints.Value( i ) );
-
-    Standard_Real aDist = aPointLine.Distance( aProfPoint );
-    if ( aDist <= gp::Resolution() )
-    {
-      // We found the intersected point
-      aResAlt = aProfPoint.Z();
-      break;
-    }
-   
-    gp_Lin aNormal = aPointLine.Normal( aProfPoint );
-    if ( i == 1 )
-    {
-      aPrevNormal = aNormal;
-      aPrevPoint = aProfPoint;
-      continue;
-    }
-
-    if ( aPrevNormal.Direction().Dot( aNormal.Direction() ) < 0 )
-    {
-      // We found the intersected edge
-      gp_Lin anEdgeLine( aPrevPoint, gp_Dir( gp_Vec( aPrevPoint, aProfPoint ) ) );
-     
-      Extrema_ExtElC anExtrema( aPointLine, anEdgeLine, Precision::Angular() );
-      if ( !anExtrema.IsParallel() )
-      {
-        Extrema_POnCurv aFirstPnt, aSecPnt;
-        anExtrema.Points( 1, aFirstPnt, aSecPnt );
-
-        const gp_Pnt& anIntPnt = aSecPnt.Value();
-        aResAlt = anIntPnt.Z();
-
-        break;
-      }
-    }
-
-    aPrevNormal = aNormal;
-    aPrevPoint = aProfPoint;
-  }
-
-  return aResAlt;
+  return HYDROData_Tool::GetAltitudeForWire( theWire,
+                                             gp_XY(anIntPoint.X(), anIntPoint.Y()),
+                                             1E-2,
+                                             1E-2,
+                                             HYDROData_IAltitudeObject::GetInvalidAltitude() );
 }
 
-bool HYDROData_StreamAltitude::getBoundaryProfilesForPoint(
-  const gp_XY&               thePoint,
-  Handle(HYDROData_Profile)& theLeftProfile,
-  Handle(HYDROData_Profile)& theRightProfile ) const
+bool HYDROData_StreamAltitude::getBoundaryWiresForPoint(
+  const gp_XY& thePoint,
+  TopoDS_Wire& theLeftWire,
+  TopoDS_Wire& theRightWire ) const
 {
-  Handle(HYDROData_Stream) aStream =
-    Handle(HYDROData_Stream)::DownCast( GetFatherObject() );
-  if ( aStream.IsNull() )
-    return false;
+  gp_Pnt aTestPnt( thePoint.X(),  thePoint.Y(), 0 );
 
-  HYDROData_SequenceOfObjects aStreamProfiles = aStream->GetProfiles();
-  if ( aStreamProfiles.Length() < 2 )
+  Handle(HYDROData_Object) anObject =
+    Handle(HYDROData_Object)::DownCast( GetFatherObject() );
+  if ( anObject.IsNull() ) {
     return false;
+  }
 
-  Handle(HYDROData_Profile) aPrevProfile;
-  gp_Pnt aPrevPnt1, aPrevPnt2;
-  for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
-  {
-    Handle(HYDROData_Profile) aProfile =
-      Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
-    if ( aProfile.IsNull() )
-      continue;
-
-    gp_XY aFirstPoint, aLastPoint;
-    if ( !aProfile->GetLeftPoint( aFirstPoint, false ) ||
-         !aProfile->GetRightPoint( aLastPoint, false ) )
-      continue;
+  if ( anObject->GetKind() == KIND_STREAM ) {
+    Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast( anObject );
+    if ( aStream.IsNull() )
+      return false;
 
-    gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
-    gp_Pnt aPnt2( aLastPoint.X(),  aLastPoint.Y(),  0 );
+    HYDROData_SequenceOfObjects aStreamProfiles = aStream->GetProfiles();
+    if ( aStreamProfiles.Length() < 2 )
+      return false;
 
-    if ( !aPrevProfile.IsNull() )
+    Handle(HYDROData_Profile) aPrevProfile;
+    gp_Pnt aPrevPnt1, aPrevPnt2;
+    for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i )
     {
-      BRepBuilderAPI_MakeEdge aLeftMakeEdge( aPrevPnt1, aPrevPnt2 );
-      BRepBuilderAPI_MakeEdge aBotMakeEdge( aPrevPnt2, aPnt2 );
-      BRepBuilderAPI_MakeEdge aRightMakeEdge( aPnt2, aPnt1 );
-      BRepBuilderAPI_MakeEdge aTopMakeEdge( aPnt1, aPrevPnt1 );
-
-      BRepBuilderAPI_MakeWire aMakeWire( aLeftMakeEdge.Edge(), aBotMakeEdge.Edge(), 
-                                         aRightMakeEdge.Edge(), aTopMakeEdge.Edge() );
-
-      BRepBuilderAPI_MakeFace aMakeFace( aMakeWire.Wire() );
-       
-      TopoDS_Face aProfilesFace = aMakeFace.Face();
-#ifdef DEB_CLASS2D
-         TopoDS_Compound aCmp;
-      BRep_Builder aBB;
-      aBB.MakeCompound(aCmp);
-         aBB.Add(aCmp, aProfilesFace);
-         gp_Pnt aPnt (thePoint.X(), thePoint.Y(), 0.);
-         BRepBuilderAPI_MakeVertex aMk(aPnt);
-         aBB.Add(aCmp, aMk.Vertex());
-         BRepTools::Write(aCmp, "ProfileFace.brep");
-#endif     
-
-         TopAbs_State aPointState =  HYDROData_Tool::ComputePointState(thePoint, aProfilesFace);
+      Handle(HYDROData_Profile) aProfile =
+        Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) );
+      if ( aProfile.IsNull() )
+        continue;
+
+      gp_XY aFirstPoint, aLastPoint;
+      if ( !aProfile->GetLeftPoint( aFirstPoint, false ) ||
+           !aProfile->GetRightPoint( aLastPoint, false ) )
+        continue;
+      
+      gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
+      gp_Pnt aPnt2( aLastPoint.X(),  aLastPoint.Y(),  0 );
+
+      if ( !aPrevProfile.IsNull() )
+      {        
+        if ( IsPointBetweenEdges( aPrevPnt1, aPrevPnt2, aPnt1, aPnt2, aTestPnt ) )
+        {
+          theLeftWire = TopoDS::Wire( aPrevProfile->GetShape3D() );
+          theRightWire = TopoDS::Wire( aProfile->GetShape3D() );
+          break;
+        }
+      }
 
-#ifdef DEB_CLASS2D
-         cout << "Point status is = " << aPointState <<endl;
-#endif
-      if ( aPointState != TopAbs_OUT )
-      {
-        theLeftProfile = aPrevProfile;
-        theRightProfile = aProfile;
-        break;
+      aPrevProfile = aProfile;
+      aPrevPnt1 = aPnt1;
+      aPrevPnt2 = aPnt2;
+    }
+  } else if ( anObject->GetKind() == KIND_CHANNEL ) {
+    Handle(HYDROData_Channel) aChannel = Handle(HYDROData_Channel)::DownCast( anObject );
+    if ( aChannel.IsNull() )
+      return false;
+
+    TopTools_ListOfShape aWiresList;
+    TopExp_Explorer anExp( aChannel->GetShape3D(), TopAbs_WIRE );
+    for ( ; anExp.More(); anExp.Next() ) {
+      if(!anExp.Current().IsNull()) {
+        const TopoDS_Wire& aWire = TopoDS::Wire( anExp.Current() );
+        aWiresList.Append( aWire );
       }
     }
 
-    aPrevProfile = aProfile;
-    aPrevPnt1 = aPnt1;
-    aPrevPnt2 = aPnt2;
+    if ( aWiresList.Extent() < 2 )
+      return false;
+
+    TopoDS_Wire aPrevWire;
+    gp_Pnt aPrevPnt1, aPrevPnt2;
+
+    TopTools_ListIteratorOfListOfShape anIt( aWiresList );
+    for ( ; anIt.More(); anIt.Next() ) {
+      TopoDS_Wire& aWire = TopoDS::Wire( anIt.Value() );
+      if ( aWire.IsNull() )
+        continue;
+
+      TopoDS_Vertex aFirstVertex, aLastVertex;
+      TopExp::Vertices( aWire, aFirstVertex, aLastVertex );
+    
+      gp_Pnt aPnt1( BRep_Tool::Pnt( aFirstVertex ) );
+      aPnt1.SetZ( 0 );
+      gp_Pnt aPnt2( BRep_Tool::Pnt( aLastVertex ) );
+      aPnt2.SetZ( 0 );
+
+      if ( !aPrevWire.IsNull() ) {
+        if ( IsPointBetweenEdges( aPrevPnt1, aPrevPnt2, aPnt1, aPnt2, aTestPnt ) ) {
+          theLeftWire = aPrevWire;
+          theRightWire = aWire;
+          break;
+        }
+      }
+
+      aPrevWire = aWire;
+      aPrevPnt1 = aPnt1;
+      aPrevPnt2 = aPnt2;
+    }
   }
 
-  return !theLeftProfile.IsNull() && !theRightProfile.IsNull();
+  return !theLeftWire.IsNull() && !theRightWire.IsNull();
 }
 
 double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
@@ -220,40 +242,39 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
   DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
   double aResAltitude = GetInvalidAltitude();
 
-  Handle(HYDROData_Stream) aStream =
-    Handle(HYDROData_Stream)::DownCast( GetFatherObject() );
-  if ( aStream.IsNull() )
+  Handle(HYDROData_Object) anObject =
+    Handle(HYDROData_Object)::DownCast( GetFatherObject() );
+  if ( anObject.IsNull() )
   {
-       DEBTRACE("aStream.IsNull()");
+    DEBTRACE("aStream.IsNull()");
     return aResAltitude;
   }
-
-  TopoDS_Shape aStreamShape = aStream->GetTopShape();
-  if ( aStreamShape.IsNull() )
+  TopoDS_Shape aTopShape = anObject->GetTopShape();
+  if ( aTopShape.IsNull() )
   {
-       DEBTRACE("aStreamShape.IsNull()");
+    DEBTRACE("aTopShape.IsNull()");
     return aResAltitude;
   }
 
-  TopExp_Explorer aStreamFaceExp( aStreamShape, TopAbs_FACE );
-  if ( !aStreamFaceExp.More() )
+  TopExp_Explorer aFaceExp( aTopShape, TopAbs_FACE );
+  if ( !aFaceExp.More() )
   {
-       DEBTRACE("!aStreamFaceExp.More()");
+    DEBTRACE("!aFaceExp.More()");
     return aResAltitude;
   }
 
   // Get only face because of 2d profile wires is in compound
-  TopoDS_Face aStreamFace = TopoDS::Face( aStreamFaceExp.Current() );
+  TopoDS_Face aFace = TopoDS::Face( aFaceExp.Current() );
 
-  // Check if point is inside of stream presentation
-  TopAbs_State aPointState = HYDROData_Tool::ComputePointState(thePoint, aStreamFace);
+  // Check if point is inside of stream/channel presentation
+  TopAbs_State aPointState = HYDROData_Tool::ComputePointState(thePoint, aFace);
 
 #ifdef DEB_CLASS2D
       cout << "Point status is = " << aPointState <<endl;
          TopoDS_Compound aCmp;
       BRep_Builder aBB;
       aBB.MakeCompound(aCmp);
-         aBB.Add(aCmp, aStreamFace);
+         aBB.Add(aCmp, aFace);
          gp_Pnt aPnt (thePoint.X(), thePoint.Y(), 0.);
          BRepBuilderAPI_MakeVertex aMk(aPnt);
          aBB.Add(aCmp, aMk.Vertex());
@@ -265,48 +286,72 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
     return aResAltitude;
   }
 
+  TopoDS_Edge aLeftEdge, aRightEdge;
+
+  if ( anObject->GetKind() == KIND_STREAM ) {
+    Handle(HYDROData_Stream) aStream =
+      Handle(HYDROData_Stream)::DownCast( GetFatherObject() );
+    if ( !aStream.IsNull() ) {
+      aLeftEdge = TopoDS::Edge( aStream->GetLeftShape() );
+      aRightEdge = TopoDS::Edge( aStream->GetRightShape() );
+    }
+  } else if ( anObject->GetKind() == KIND_CHANNEL ) {
+    Handle(HYDROData_Channel) aChannel =
+      Handle(HYDROData_Channel)::DownCast( GetFatherObject() );
+    if ( !aChannel.IsNull() ) {
+      aLeftEdge = TopoDS::Edge( aChannel->GetLeftShape() );
+      aRightEdge = TopoDS::Edge( aChannel->GetRightShape() );
+    }
+  }
+  
   // Find the two profiles between which the point is lies
-  Handle(HYDROData_Profile) aLeftProfile, aRightProfile;
-  if ( !getBoundaryProfilesForPoint( thePoint, aLeftProfile, aRightProfile ) )
+  TopoDS_Wire aLeftWire, aRightWire;
+  if ( !getBoundaryWiresForPoint( thePoint, aLeftWire, aRightWire ) )
   {
-       DEBTRACE("!getBoundaryProfilesForPoint( thePoint, aLeftProfile, aRightProfile )");
-    return aResAltitude;
+      DEBTRACE("!getBoundaryProfilesForPoint( thePoint, aLeftProfile, aRightProfile )");
+      return aResAltitude;
   }
 
   // Find the projections of point to borders of stream
   gp_XYZ aPointToTest( thePoint.X(), thePoint.Y(), 0.0 );
-
-  TopoDS_Edge aStreamLeftEdge = TopoDS::Edge( aStream->GetLeftShape() );
-  TopoDS_Edge aStreamRightEdge = TopoDS::Edge( aStream->GetRightShape() );
-
+  
   Standard_Real aFirst = 0.0, aLast = 0.0;
-  Handle(Geom_Curve) anEdgeLeftCurve = BRep_Tool::Curve( aStreamLeftEdge, aFirst, aLast );
-  Handle(Geom_Curve) anEdgeRightCurve = BRep_Tool::Curve( aStreamRightEdge, aFirst, aLast );
+  Handle(Geom_Curve) anEdgeLeftCurve = BRep_Tool::Curve( aLeftEdge, aFirst, aLast );
+  Handle(Geom_Curve) anEdgeRightCurve = BRep_Tool::Curve( aRightEdge, aFirst, aLast );
 
   GeomAPI_ProjectPointOnCurve aLeftProject( aPointToTest, anEdgeLeftCurve );
   GeomAPI_ProjectPointOnCurve aRightProject( aPointToTest, anEdgeRightCurve );
 
+  int aNbPoints1 = aRightProject.NbPoints();
+  int aNbPoints2 = aLeftProject.NbPoints();
+  if ( aNbPoints1 < 1 || aNbPoints2 < 1)
+     return aResAltitude;
   Standard_Real aLeftDist = aLeftProject.LowerDistance();
   Standard_Real aRightDist = aRightProject.LowerDistance();
 
   // Find the altitude in profiles
-  Standard_Real aLeftAlt = getAltitudeFromProfile( aLeftProfile, aLeftDist, aRightDist );
-  Standard_Real aRightAlt = getAltitudeFromProfile( aRightProfile, aLeftDist, aRightDist );
+  Standard_Real aLeftAlt, aRightAlt;
+  gp_Pnt aLeftProfileP1, aLeftProfileP2, aRightProfileP1, aRightProfileP2;
+  aLeftAlt = getAltitudeFromWire( aLeftWire, aLeftDist, aRightDist );
+  aRightAlt = getAltitudeFromWire( aRightWire, aLeftDist, aRightDist );
+  
+  TopoDS_Vertex aFirstVertex, aLastVertex;
+  TopExp::Vertices( aLeftWire, aFirstVertex, aLastVertex );
+  aLeftProfileP1 = BRep_Tool::Pnt( aFirstVertex );
+  aLeftProfileP2 = BRep_Tool::Pnt( aLastVertex );
+
+  TopExp::Vertices( aRightWire, aFirstVertex, aLastVertex );
+  aRightProfileP1 = BRep_Tool::Pnt( aFirstVertex );
+  aRightProfileP2 = BRep_Tool::Pnt( aLastVertex );
 
   // Interpolate altitudes
   // Left profile line ( the segment between the firts and the last profile point )
-  HYDROData_Profile::ProfilePoints aLeftProfilePoints = aLeftProfile->GetProfilePoints( false );
-  gp_Pnt aLeftProfileP1( aLeftProfilePoints.First() );
   aLeftProfileP1.SetZ( 0 );
-  gp_Pnt aLeftProfileP2( aLeftProfilePoints.Last() );
   aLeftProfileP2.SetZ( 0 );
   gp_Vec aLeftProfileVec( aLeftProfileP1, aLeftProfileP2 );
   Handle(Geom_Line) aLeftProfileLine = new Geom_Line( gp_Ax1( aLeftProfileP1, aLeftProfileVec ) );
   // Right profile line
-  HYDROData_Profile::ProfilePoints aRightProfilePoints = aRightProfile->GetProfilePoints( false );
-  gp_Pnt aRightProfileP1( aRightProfilePoints.First() );
   aRightProfileP1.SetZ( 0 );
-  gp_Pnt aRightProfileP2( aRightProfilePoints.Last() );
   aRightProfileP2.SetZ( 0 );
   gp_Vec aRightProfileVec( aRightProfileP1, aRightProfileP2 );
   Handle(Geom_Line) aRightProfileLine = new Geom_Line( gp_Ax1( aRightProfileP1, aRightProfileVec ) );
index 5cb6cc214762ae50a85f378cadfe7d9f216bacdf..02cbc3083d42ed54036a3aecd0fe171fe3bd7c91 100644 (file)
 
 #include "HYDROData_IAltitudeObject.h"
 
-class Handle(HYDROData_Profile);
 
 DEFINE_STANDARD_HANDLE(HYDROData_StreamAltitude, HYDROData_IAltitudeObject)
 
+class TopoDS_Wire;
 
 /**\class HYDROData_StreamAltitude
  * \brief Class that stores/retreives information about the stream altitude.
@@ -65,9 +65,9 @@ public:
 
 protected:
 
-  bool getBoundaryProfilesForPoint( const gp_XY&               thePoint,
-                                    Handle(HYDROData_Profile)& theLeftProfile,
-                                    Handle(HYDROData_Profile)& theRightProfile ) const;
+  bool getBoundaryWiresForPoint( const gp_XY&               thePoint,
+                                 TopoDS_Wire& theLeftWire,
+                                 TopoDS_Wire& theRightWire ) const;
 
 protected:
 
index d3ef0b86fbf945bc4820547a44db1bb9e05422e3..5d7623d8047cedf9f153be9b5e9d86a77f25fae4 100644 (file)
@@ -32,7 +32,8 @@
 IMPLEMENT_STANDARD_HANDLE( HYDROData_StricklerTable, HYDROData_Entity )
     IMPLEMENT_STANDARD_RTTIEXT( HYDROData_StricklerTable, HYDROData_Entity )
 
-    HYDROData_StricklerTable::HYDROData_StricklerTable()
+HYDROData_StricklerTable::HYDROData_StricklerTable()
+: HYDROData_Entity( Geom_No )
 {
 }
 
index b9b0dcdbb67ab2780523f69d853b0ef7903b6493..dee9901e4f7766d179f1baf3de5a547fb0d2d0c8 100644 (file)
@@ -22,6 +22,7 @@
 #include "HYDROData_Image.h"
 #include "HYDROData_Iterator.h"
 #include "HYDROData_NaturalObject.h"
+#include "HYDROData_ShapesGroup.h"
 
 #include <QFile>
 #include <QStringList>
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
 #include <BRep_Tool.hxx>
+#include <Geom_Curve.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopExp_Explorer.hxx>
 
 static int aMaxNameId = std::numeric_limits<int>::max();
 
@@ -53,38 +58,6 @@ void HYDROData_Tool::WriteStringsToFile( QFile&             theFile,
   anOutStream << aWriteStr << theSep << theSep;
 }
 
-void HYDROData_Tool::SetMustBeUpdatedObjects(
-  const Handle(HYDROData_Document)& theDoc  )
-{
-  bool anIsChanged = true;
-
-  // iterate until there is no changes because objects on all level of dependency must be updated
-  while ( anIsChanged )
-  {
-    anIsChanged = false;
-
-    HYDROData_Iterator anIter( theDoc );
-    for ( ; anIter.More(); anIter.Next() )
-    {
-      Handle(HYDROData_Entity) anObject = anIter.Current();
-      if ( anObject.IsNull() || anObject->IsMustBeUpdated() )
-        continue;
-
-      HYDROData_SequenceOfObjects aRefSeq = anObject->GetAllReferenceObjects();
-      for ( int i = 1, n = aRefSeq.Length(); i <= n; ++i )
-      {
-        Handle(HYDROData_Entity) aRefObject = aRefSeq.Value( i );
-        if ( aRefObject.IsNull() || !aRefObject->IsMustBeUpdated() )
-          continue;
-
-        anObject->SetToUpdate( true );
-        anIsChanged = true;
-        break;
-      }
-    }
-  }
-}
-
 QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
                                             const QString&                    thePrefix,
                                             const QStringList&                theUsedNames,
@@ -194,4 +167,89 @@ TopAbs_State HYDROData_Tool::ComputePointState( const gp_XY& theXY, const TopoDS
   BRepTopAdaptor_FClass2d aClassifier( theFace, toluv ); 
   aState = aClassifier.Perform( gp_Pnt2d(aU1, aV1), Standard_False );
   return aState;
+}
+
+double HYDROData_Tool::GetAltitudeForEdge( const TopoDS_Edge& theEdge,
+                                           const gp_XY& thePoint,
+                                           double theParameterTolerance,
+                                           double theSquareDistanceTolerance,
+                                           double theInvalidAltitude )
+{
+  double aFirst, aLast;
+  Handle(Geom_Curve) aCurve = BRep_Tool::Curve( theEdge, aFirst, aLast );
+  if( aCurve.IsNull() )
+    return theInvalidAltitude;
+
+  gp_Pnt aFirstPnt, aLastPnt;
+
+  aCurve->D0( aFirst, aFirstPnt );
+  aCurve->D0( aLast, aLastPnt );
+
+  gp_Pnt2d aFirstPnt2d( aFirstPnt.X(), aFirstPnt.Y() );
+  gp_Pnt2d aLastPnt2d( aLastPnt.X(), aLastPnt.Y() );
+
+  double aFirstDist = 0;
+  double aLastDist = aFirstPnt2d.SquareDistance( aLastPnt2d );
+  double aNecDist = aFirstPnt2d.SquareDistance( thePoint );
+
+  while( fabs( aLast - aFirst ) > theParameterTolerance )
+  {
+    double aMid = ( aFirst + aLast ) / 2;
+    gp_Pnt aMidPnt;
+    aCurve->D0( aMid, aMidPnt );
+    double aDist = aFirstPnt2d.SquareDistance( gp_Pnt2d( aMidPnt.X(), aMidPnt.Y() ) );
+
+    if( aDist < aNecDist )
+      aFirst = aMid;
+    else
+      aLast = aMid;
+  }
+
+  double aMid = ( aFirst + aLast ) / 2;
+  gp_Pnt aMidPnt;
+  aCurve->D0( aMid, aMidPnt );
+
+  gp_Pnt2d aMidPnt2d( aMidPnt.X(), aMidPnt.Y() );
+  if( aMidPnt2d.SquareDistance( thePoint ) < theSquareDistanceTolerance )
+    return aMidPnt.Z();
+  else
+    return theInvalidAltitude;
+}
+
+double HYDROData_Tool::GetAltitudeForWire( const TopoDS_Wire& theWire,
+                                           const gp_XY& thePoint,
+                                           double theParameterTolerance,
+                                           double theSquareDistanceTolerance,
+                                           double theInvalidAltitude )
+{
+  TopExp_Explorer anExp( theWire, TopAbs_EDGE );
+  for( ; anExp.More(); anExp.Next() )
+  {
+    double anAltitude = GetAltitudeForEdge( TopoDS::Edge( anExp.Current() ), thePoint,
+      theParameterTolerance, theSquareDistanceTolerance, theInvalidAltitude );
+    if( anAltitude != theInvalidAltitude )
+      return anAltitude;
+  }
+  return theInvalidAltitude;
+}
+
+TopoDS_Shape HYDROData_Tool::getFirstShapeFromGroup( const HYDROData_SequenceOfObjects& theGroups,
+                                                     const int                          theGroupId )
+{
+  TopoDS_Shape aResShape;
+  if ( theGroupId < 1 || theGroupId > theGroups.Length() )
+    return aResShape;
+
+  Handle(HYDROData_ShapesGroup) aGroup =
+    Handle(HYDROData_ShapesGroup)::DownCast( theGroups.Value( theGroupId ) );
+  if ( aGroup.IsNull() )
+    return aResShape;
+
+  TopTools_SequenceOfShape aGroupShapes;
+  aGroup->GetShapes( aGroupShapes );
+
+  if ( !aGroupShapes.IsEmpty() )
+    aResShape = aGroupShapes.First();
+
+  return aResShape;
 }
\ No newline at end of file
index 83b1c0421ca439e37739500e4b43971b0d2564d0..0642d4fd74e6bc5da83cfbe2924ca10beb126207 100644 (file)
@@ -35,6 +35,8 @@ class QFile;
 class TopoDS_Shape;
 class TopTools_SequenceOfShape;
 class Handle(HYDROData_Document);
+class TopoDS_Edge;
+class TopoDS_Wire;
 
 class HYDRODATA_EXPORT HYDROData_Tool {
 
@@ -44,12 +46,6 @@ public:
                                                             const QStringList& theStrings,
                                                             const QString&     theSep = "\n" );
 
-  /**
-   * Enables "MustBeUpdated" flag for objects that are depended on "MustBeUpdated" objects.
-   * \param theDoc document where this operation is performed
-   */
-  static void                           SetMustBeUpdatedObjects( const Handle(HYDROData_Document)& theDoc );
-
   /**
    * \brief Generate name for new object.
    * \param theDoc document
@@ -95,6 +91,25 @@ public:
 
  static TopAbs_State                    ComputePointState( const gp_XY& thePnt2d, 
                                                               const TopoDS_Face& theFace );
+
+  static double GetAltitudeForEdge( const TopoDS_Edge& theEdge,
+                                    const gp_XY& thePoint,
+                                    double theParameterTolerance,
+                                    double theSquareDistanceTolerance,
+                                    double theInvalidAltitude );
+  static double GetAltitudeForWire( const TopoDS_Wire& theWire,
+                                    const gp_XY& thePoint,
+                                    double theParameterTolerance,
+                                    double theSquareDistanceTolerance,
+                                    double theInvalidAltitude );
+
+  /**
+   * \brief Returns the first shape from the group.
+   * \param theGroups the list of groups
+   * \param theGroupId the group id
+   */
+  static TopoDS_Shape getFirstShapeFromGroup( const HYDROData_SequenceOfObjects& theGroups,
+                                              const int                          theGroupId );
 };
 
 inline bool ValuesEquals( const double& theFirst, const double& theSecond )
index e2867ea8e3e4a199ddbbb3267a00cc2f3b71c61c..e7d8ff79529ffb5e03bf33c67669db9f120ce1fc 100644 (file)
@@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_HANDLE(HYDROData_VisualState, HYDROData_Entity)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_VisualState, HYDROData_Entity)
 
 HYDROData_VisualState::HYDROData_VisualState()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_No )
 {
 }
 
index 97e1da6c1e39c46da179889af2e8af8233cfa60b..c0a5a884e0c5cf4861ca2f8b46a6959bbfc3a8bf 100644 (file)
@@ -41,7 +41,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity)
 
 
 HYDROData_Zone::HYDROData_Zone()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d )
 {
   myInterpolator = NULL;
 }
index dbc229fd9464ea2f7ca9c83400246426acb0c582..e3b2509a4ec903299251ce162cf76151133e039e 100755 (executable)
@@ -185,7 +185,7 @@ void test_HYDROData_Bathymetry::testCopy()
   Handle(HYDROData_Bathymetry) aBathymetry2 = 
     Handle(HYDROData_Bathymetry)::DownCast( aDoc->CreateObject( KIND_BATHYMETRY ) );
 
-  aBathymetry1->CopyTo( aBathymetry2 );
+  aBathymetry1->CopyTo( aBathymetry2, true );
 
   if ( anIsFileCreated )
   {
index a68508017da090b044283c03686db778e8f95d96..e55530bbfb3525c98b23239c3a473111b7536767 100644 (file)
@@ -57,7 +57,7 @@ void test_HYDROData_Entity::testCopy()
 
   Handle(HYDROData_Entity) aCopy = aDoc->CreateObject(KIND_IMAGE); // object for copy
   CPPUNIT_ASSERT(aCopy->GetName().isEmpty());
-  anObj->CopyTo(aCopy);
+  anObj->CopyTo(aCopy, true);
 
   // check the copied object has same name as original
   CPPUNIT_ASSERT_EQUAL(aName.toStdString(), aCopy->GetName().toStdString());
index 689c7a64f1198b74c1b3462eff4fda245cb92e11..ddeeeb87193851436a5a3e33b695b811eb95fd73 100644 (file)
@@ -154,7 +154,7 @@ void test_HYDROData_Image::testCopy()
   // copy image to the new one
   Handle(HYDROData_Image) anImage3 = 
     Handle(HYDROData_Image)::DownCast(aDoc->CreateObject(KIND_IMAGE));
-  anImage1->CopyTo(anImage3);
+  anImage1->CopyTo(anImage3, true);
 
   // check all fields are correctly copied
   CPPUNIT_ASSERT(anImage1->Image() == anImage3->Image());
index 6c019831e3ef79ecf90fb04de9cd773fb4f76017..99b61069f176803719f92e44a540f220e17fd2ff 100644 (file)
@@ -66,7 +66,7 @@ void test_HYDROData_PolylineXY::testCopy()
   Handle(HYDROData_PolylineXY) aPolyline2 = 
     Handle(HYDROData_PolylineXY)::DownCast(aDoc->CreateObject(KIND_POLYLINEXY));
 
-  aPolyline1->CopyTo(aPolyline2);
+  aPolyline1->CopyTo(aPolyline2, true);
 
 
   aDoc->Close();
index edce573b2294e7e2bd3bc4afe9f68df1566c1e42..169d5c26fd13f9cbf914012fc8ea09c778b183b2 100644 (file)
@@ -632,7 +632,7 @@ void HYDROGUI_CalculationOp::onRemoveObjects()
 bool HYDROGUI_CalculationOp::confirmRegionsChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with zones
@@ -657,7 +657,7 @@ bool HYDROGUI_CalculationOp::confirmRegionsChange() const
 bool HYDROGUI_CalculationOp::confirmOrderChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with zones
@@ -682,7 +682,7 @@ bool HYDROGUI_CalculationOp::confirmOrderChange() const
 bool HYDROGUI_CalculationOp::confirmRuleChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with zones
@@ -707,7 +707,7 @@ bool HYDROGUI_CalculationOp::confirmRuleChange() const
 bool HYDROGUI_CalculationOp::confirmModeChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with zones
@@ -761,7 +761,7 @@ bool HYDROGUI_CalculationOp::confirmContinueWithWarning( const HYDROData_Warning
 bool HYDROGUI_CalculationOp::confirmLandCoverRegionsChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_No );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with land cover zones
@@ -786,7 +786,7 @@ bool HYDROGUI_CalculationOp::confirmLandCoverRegionsChange() const
 bool HYDROGUI_CalculationOp::confirmLandCoverModeChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_No );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with land cover zones
@@ -811,7 +811,7 @@ bool HYDROGUI_CalculationOp::confirmLandCoverModeChange() const
 bool HYDROGUI_CalculationOp::confirmLandCoverOrderChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_No );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with land cover zones
@@ -836,7 +836,7 @@ bool HYDROGUI_CalculationOp::confirmLandCoverOrderChange() const
 bool HYDROGUI_CalculationOp::confirmLandCoverRuleChange() const
 {
   // Check if the case is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_No );
   if ( !isConfirmed )
   {
     // If not modified check if the case has already defined regions with land cover zones
@@ -987,10 +987,10 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
       }
     }
     aPanel->setStricklerTableNames( aList, anEntryList );
-    bool anUpdateState = myEditedObject->IsMustBeUpdated();
+    //@ASL: bool anUpdateState = myEditedObject->IsMustBeUpdated();
     if ( !aList.isEmpty() )
       aPanel->setStricklerTable( aList.at( 0 ), false );
-    myEditedObject->SetToUpdate( anUpdateState );
+    //@ASL: myEditedObject->SetToUpdate( anUpdateState );
 
     // Fill in list widget with all available land covers
     aSeq = HYDROGUI_Tool::GetLandCovers( module() );
@@ -1060,7 +1060,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
     if ( aMode == HYDROData_CalculationCase::AUTOMATIC )
     {
       // Set objects in the specified order
-      if( myEditedObject->IsMustBeUpdated() )
+      if( myEditedObject->IsMustBeUpdated(  HYDROData_Entity::Geom_2d ) )
       {
         myEditedObject->RemoveGeometryObjects();
         foreach ( const QString& aName, aPanel->getAllGeomObjects() )
@@ -1093,7 +1093,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
     if ( aMode == HYDROData_CalculationCase::AUTOMATIC )
     {
       // Set objects in the specified order
-      if( myEditedObject->IsMustBeUpdated() )
+      if( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
       {
         myEditedObject->RemoveLandCovers();
         foreach ( const QString& aName, aPanel->getAllLandCovers() )
@@ -1119,7 +1119,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
     }
     aPanel->setEditLandCoverZonesEnabled( aMode == HYDROData_CalculationCase::MANUAL );
          
-    if ( myEditedObject->IsMustBeUpdated() )
+    if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
     {
       myShowZones = true;
       myEditedObject->Update();
@@ -1577,7 +1577,7 @@ void HYDROGUI_CalculationOp::setAvailableGroups()
       aGroupsNames.append( aGroup->GetName() );
     }
   }
-  if( myEditedObject->IsMustBeUpdated() ) {
+  if( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) ) {
     for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ ) {
       Handle(HYDROData_ShapesGroup) aGeomGroup =
         Handle(HYDROData_ShapesGroup)::DownCast( aSeq.Value( anIndex ) );
@@ -1590,7 +1590,7 @@ void HYDROGUI_CalculationOp::setAvailableGroups()
   aPanel->setAvailableGroups( aGroupsNames );
   aPanel->includeGroups( aList );
 
-  bool isUpdated = myEditedObject->IsMustBeUpdated();
+  //@ASL: bool isUpdated = myEditedObject->IsMustBeUpdated();
 }
 
 void HYDROGUI_CalculationOp::onAddGroups()
@@ -1747,7 +1747,7 @@ void HYDROGUI_CalculationOp::onOrderChanged( bool& isConfirmed )
 
   isConfirmed = confirmOrderChange();
   if( isConfirmed )
-    myEditedObject->SetToUpdate( true );
+    myEditedObject->Changed( HYDROData_Entity::Geom_2d );
 }
 
 void HYDROGUI_CalculationOp::onOrderLandCoverChanged( bool& isConfirmed )
@@ -1759,7 +1759,7 @@ void HYDROGUI_CalculationOp::onOrderLandCoverChanged( bool& isConfirmed )
 
   isConfirmed = confirmLandCoverOrderChange();
   if( isConfirmed )
-    myEditedObject->SetToUpdate( true );
+    myEditedObject->Changed( HYDROData_Entity::Geom_No );
 }
 
 void HYDROGUI_CalculationOp::onRuleChanged( bool& isConfirmed )
@@ -1771,7 +1771,7 @@ void HYDROGUI_CalculationOp::onRuleChanged( bool& isConfirmed )
 
   isConfirmed = confirmRuleChange();
   if( isConfirmed )
-    myEditedObject->SetToUpdate( true );
+    myEditedObject->Changed( HYDROData_Entity::Geom_2d );
 }
 
 void HYDROGUI_CalculationOp::onRuleLandCoverChanged( bool& isConfirmed )
@@ -1783,7 +1783,7 @@ void HYDROGUI_CalculationOp::onRuleLandCoverChanged( bool& isConfirmed )
 
   isConfirmed = confirmLandCoverRuleChange();
   if( isConfirmed )
-    myEditedObject->SetToUpdate( true );
+    myEditedObject->Changed( HYDROData_Entity::Geom_No );
 }
 
 void HYDROGUI_CalculationOp::onRegenerateColors()
index f00d5804c1d847b70661f8ba8f19570b55bd2550..1141a0061dce47da48d3e97124fc870ccb7ba39d 100644 (file)
@@ -211,7 +211,7 @@ bool HYDROGUI_ChannelOp::processApply( int& theUpdateFlags,
     myEditedObject->SetProfile( aProfile );
   }
 
-  if ( myEditedObject->IsMustBeUpdated() )
+  if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
     myEditedObject->Update();
 
   erasePreview();
index 88bb35b290d435bad73c6dacad67b36ae9b8a32a..1478a7473c2deaedb6d26afbaf15645ea102e83e 100644 (file)
@@ -679,7 +679,7 @@ bool HYDROGUI_DataModel::paste()
       Handle(HYDROData_Entity) aClone = getDocument()->CreateObject( aKind );
       if( !aClone.IsNull() )
       {
-        anObject->CopyTo( aClone );
+        anObject->CopyTo( aClone, true );
         anIsChanged = true;
 
         // remove Z layer
index e0183809bff9da876c0cd9f5bdcd50d93d4ed0e5..8ec9658dab3b3c3120276eaca84a192d9b5e15f6 100644 (file)
@@ -74,7 +74,7 @@ QFont HYDROGUI_DataObject::font( const int theId ) const
   if( theId == NameId )
   {
     Handle(HYDROData_Entity) aDataObject = modelObject();
-    if( !aDataObject.IsNull() && aDataObject->IsMustBeUpdated() )
+    if( !aDataObject.IsNull() && aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
     {
       aFont.setItalic( true );
       aFont.setBold( true );
@@ -108,7 +108,7 @@ QColor HYDROGUI_DataObject::color( const ColorRole theRole, const int theId ) co
   if ( !aColor.isValid() )
   {
     Handle(HYDROData_Entity) aDataObject = modelObject();
-    if( !aDataObject.IsNull() && aDataObject->IsMustBeUpdated() )
+    if( !aDataObject.IsNull() && aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
     {
       switch ( theRole )
       {
@@ -148,7 +148,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
     }
     else
     {
-      QString aNeedUpdate( aDataObject->IsMustBeUpdated() ? "M_" : "" );
+      QString aNeedUpdate( aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) ? "M_" : "" );
 
       int anObjectKind = (int)aDataObject->GetKind();
       if ( anObjectKind == KIND_DUMMY_3D )
index 17ac4487b9240f3af18e973d34092387fc4a8712..32d45fd4ddd11d954b0e9e876464bd0229c5b176 100644 (file)
@@ -372,7 +372,7 @@ bool HYDROGUI_LandCoverOp::confirmPolylinesChange() const
     return true;
 
   // Check if the land cover object is already modified or not
-  bool isConfirmed = myEditedObject->IsMustBeUpdated();
+  bool isConfirmed = myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d );
   if ( !isConfirmed )
   {
     // If not modified check if the land cover has already defined polylines
index 60609a971612abb30b26f6291b1901b73daa82a9..81ad9fa08755b9f788dd910c46f02633b4c3bd1b 100644 (file)
@@ -399,7 +399,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       anIsVisibleInSelection |= aVisibility;
       anIsHiddenInSelection |= !aVisibility;
 
-      if ( anObject->CanBeUpdated() && anObject->IsMustBeUpdated() )
+      if ( anObject->CanBeUpdated() && anObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
       {
         anIsMustObjectBeUpdated = true;
       }
index 7d312cb56d6c75b55e674507463c87bd1c4afbd1..91e0a06ab5c10de7e1653de9b4776db9f950ce4c 100644 (file)
 #include <TopoDS_Vertex.hxx>
 #include <BRepBndLib.hxx>
 #include <Precision.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
+#include <GCPnts_QuasiUniformDeflection.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <Prs3d_LineAspect.hxx>
 
 IMPLEMENT_STANDARD_HANDLE (HYDROGUI_Polyline, AIS_Shape)
 IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_Polyline, AIS_Shape)
@@ -53,11 +57,43 @@ HYDROGUI_Polyline::~HYDROGUI_Polyline()
 {
 }
 
+Handle( Graphic3d_ArrayOfPolylines ) BuildEdgePresentation( const TopoDS_Edge& theEdge, double theDeviation )
+{
+  BRepAdaptor_Curve aCurveAdaptor( theEdge );
+  GCPnts_QuasiUniformDeflection aPnts( aCurveAdaptor, theDeviation );
+
+  Handle( Graphic3d_ArrayOfPolylines ) anArray;
+  if( !aPnts.IsDone() )
+    return anArray;
+
+  int n = aPnts.NbPoints();
+  anArray = new Graphic3d_ArrayOfPolylines( n );
+  for( int i=1; i<=n; i++ )
+    anArray->AddVertex( aPnts.Value( i ) );
+
+  return anArray;
+}
+
 void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
                             const Handle(Prs3d_Presentation)& aPrs,
                             const Standard_Integer aMode)
 {  
-  AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
+  //AIS_Shape::Compute(aPresentationManager, aPrs, aMode);
+
+  aPrs->Clear();
+  Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs );
+  Handle(Graphic3d_AspectLine3d) anAspect = Attributes()->FaceBoundaryAspect()->Aspect();
+  aGroup->SetGroupPrimitivesAspect( anAspect );
+
+  TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
+  for ( ; Exp1.More(); Exp1.Next() )
+  {
+    TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
+    Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
+    if( !anArray.IsNull() )
+      aGroup->AddPrimitiveArray ( anArray );
+  }
+
    
   TopExp_Explorer Exp ( myshape, TopAbs_EDGE );
   for ( ; Exp.More(); Exp.Next() ) {
index 759795a528cc20c5eb0ae59ae81ab4a971710cb8..d7995dd18a865a612f8529c91ec4b32ccba1b137 100644 (file)
@@ -232,7 +232,7 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   }
 
   // At first we update the child u,z profile object
-  aProfileUZ->SetToUpdate( true );
+  aProfileUZ->Changed( HYDROData_Entity::Geom_2d );
   aProfileUZ->Update();
 
   // And now we update our edited object
index 6162acb8e391d9ae2836e8f09dc9e084886dbd42..4123e5be98b1b1b580eff9e0096215e058e8b3c1 100755 (executable)
@@ -245,7 +245,7 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
   myEditedObject->SetHydraulicAxis( aHydAxis );
   myEditedObject->SetProfiles( aRefProfiles, false );
 
-  if ( myEditedObject->IsMustBeUpdated() )
+  if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
     myEditedObject->Update();
 
   if ( !myIsEdit )
index d7925e36df72fda09021920f105fa64a084745f0..08a1de813863cefaf12ceb177f98c0b8fe66aca8 100644 (file)
@@ -73,7 +73,7 @@ void HYDROGUI_UpdateObjectOp::updateObject( const Handle(HYDROData_Entity)& theO
     updateObject( anObject, theMapOfTreated );
   }
 
-  if ( !myIsForced && !theObject->IsMustBeUpdated() )
+  if ( !myIsForced && !theObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
     return;
 
   theObject->Update();
index 43a017d36e66e0b8ae1724a36ea9dff5480d3903..8be7fa3739c21e284da2c3317c63a998de22025f 100644 (file)
@@ -72,7 +72,7 @@ HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QStrin
 
   myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
 
-  aViewer->enableMultiselection( false );
+  //aViewer->enableMultiselection( false );
 
   SUIT_ViewWindow* aViewWin = myViewManager->createViewWindow();
   aViewer->setStaticTrihedronDisplayed( false );
index 9dc1676ed2653049d725949cfc06f4b36fcfdd28..ee4e48417ad23aa3c5784c438a799a6f2b76d5fc 100644 (file)
@@ -154,6 +154,16 @@ class HYDROData_Entity
 %End
 
 public:
+  enum Geometry
+  {
+    Geom_No = 1,
+    Geom_2d = 2,
+    Geom_Z  = 4,
+    Geom_Groups = 8,
+
+    Geom_3d = 6,
+    Geom_2d_and_groups = 10,
+  };
 
   /**
    * Returns the kind of this object. Must be redefined in all objects of known type.
@@ -186,19 +196,6 @@ public:
    */
   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
-   */
-  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
-   */
-  virtual bool IsMustBeUpdated() const;
-
   /**
    * Returns flag indicating that object is updateble or not.
    */
@@ -216,24 +213,6 @@ public:
    */
   virtual void Remove();
 
-
-  /**
-   * Copies all properties of this to the destinated object.
-   * Objects must be the same type.
-   * \param theDestination initialized object (from any document) - target of copying
-   */
-  void CopyTo( HYDROData_Entity theDestination ) const [void ( const Handle_HYDROData_Entity& )];
-  %MethodCode
-    Handle(HYDROData_Entity) aCopyTo = createHandle( a0 );
-    if ( !aCopyTo.IsNull() )
-    {
-      Py_BEGIN_ALLOW_THREADS
-      sipSelfWasArg ? sipCpp->HYDROData_Entity::CopyTo( aCopyTo ):
-                      sipCpp->CopyTo( aCopyTo );
-      Py_END_ALLOW_THREADS
-    }
-  %End
-
   /**
    * Returns father object. For object created under root document label
    * this method always return NULL object.
@@ -279,7 +258,7 @@ protected:
    * Creates new object in the internal data structure. Use higher level objects 
    * to create objects with real content.
    */
-  HYDROData_Entity();
+  HYDROData_Entity( Geometry );
 
   /**
    * Destructs properties of the object and object itself, removes it from the document.