]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
merge trunk on BR_quadtree 20140820 BR_quadtree_20140917
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 20 Aug 2014 17:58:47 +0000 (17:58 +0000)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 20 Aug 2014 17:58:47 +0000 (17:58 +0000)
79 files changed:
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_Bathymetry.h
src/HYDROData/HYDROData_Confluence.cxx
src/HYDROData/HYDROData_Confluence.h
src/HYDROData/HYDROData_Document.cxx
src/HYDROData/HYDROData_Document.h
src/HYDROData/HYDROData_DummyObject3D.h
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Obstacle.cxx
src/HYDROData/HYDROData_Obstacle.h
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_PolylineXY.h
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Profile.h
src/HYDROData/HYDROData_River.cxx
src/HYDROData/HYDROData_River.h
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_StreamAltitude.cxx
src/HYDROData/HYDROData_Zone.h
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx
src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_ChannelOp.cxx
src/HYDROGUI/HYDROGUI_ChannelOp.h
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataModel.h
src/HYDROGUI/HYDROGUI_DataModelSync.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_DataModelSync.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_DataObject.h
src/HYDROGUI/HYDROGUI_DigueOp.cxx
src/HYDROGUI/HYDROGUI_DigueOp.h
src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx
src/HYDROGUI/HYDROGUI_ExportCalculationOp.h
src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx
src/HYDROGUI/HYDROGUI_GeoreferencementOp.h
src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx
src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.h
src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx
src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h
src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx
src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
src/HYDROGUI/HYDROGUI_ImportImageOp.h
src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx
src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.h
src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx
src/HYDROGUI/HYDROGUI_LocalCSDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LocalCSDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LocalCSOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_LocalCSOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operation.cxx
src/HYDROGUI/HYDROGUI_Operation.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_Poly3DOp.cxx
src/HYDROGUI/HYDROGUI_Poly3DOp.h
src/HYDROGUI/HYDROGUI_PolylineOp.cxx
src/HYDROGUI/HYDROGUI_PolylineOp.h
src/HYDROGUI/HYDROGUI_ProfileOp.cxx
src/HYDROGUI/HYDROGUI_ProfileOp.h
src/HYDROGUI/HYDROGUI_SetColorOp.cxx
src/HYDROGUI/HYDROGUI_SetColorOp.h
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_StreamOp.cxx
src/HYDROGUI/HYDROGUI_StreamOp.h
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx
src/HYDROGUI/HYDROGUI_TranslateObstacleOp.h
src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx
src/HYDROGUI/HYDROGUI_TwoImagesOp.h
src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx
src/HYDROGUI/HYDROGUI_ZLevelsOp.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROPy/HYDROData_Document.sip

index 4624bb8acdb53f738a30e5e46455026b6bd68a2f..202ffe337a3007267452b65c5f35a3639410af98 100644 (file)
@@ -468,9 +468,19 @@ bool HYDROData_Bathymetry::ImportFromFile( const TCollection_AsciiString& theFil
   // Try to import the file
   if ( aFileSuf == "xyz" )
     aRes = importFromXYZFile( aFile, aPoints );
-    
+
   // Close the file
   aFile.close();
+  
+
+  // Convert from global to local CS
+  Handle_HYDROData_Document aDoc = HYDROData_Document::Document( myLab );
+  AltitudePoints::Iterator anIter( aPoints );
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    AltitudePoint& aPoint = anIter.ChangeValue();
+    aDoc->Transform( aPoint, true );
+  }
 
   if ( aRes )
   {
@@ -546,14 +556,14 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile&          theFile,
 }
 
 
-bool HYDROData_Bathymetry::CreateBoundaryPolyline() const
+Handle_HYDROData_PolylineXY HYDROData_Bathymetry::CreateBoundaryPolyline() const
 {
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   Handle_HYDROData_PolylineXY aResult = 
     Handle_HYDROData_PolylineXY::DownCast( aDocument->CreateObject( KIND_POLYLINEXY ) );
 
   if( aResult.IsNull() )
-    return false;
+    return aResult;
 
   //search free name
   QString aPolylinePref = GetName() + "_Boundary";
@@ -588,5 +598,19 @@ bool HYDROData_Bathymetry::CreateBoundaryPolyline() const
   aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymin ) );
   aResult->Update();
 
-  return true;
+  return aResult;
 }
+
+void HYDROData_Bathymetry::UpdateLocalCS( double theDx, double theDy )
+{
+  gp_XYZ aDelta( theDx, theDy, 0 );
+  AltitudePoints aPoints = GetAltitudePoints();
+  AltitudePoints::Iterator anIter( aPoints );
+  for ( int i = 0 ; anIter.More(); ++i, anIter.Next() )
+  {
+    AltitudePoint& aPoint = anIter.ChangeValue();
+    aPoint += aDelta;
+  }
+  SetAltitudePoints( aPoints );
+}
+
index 95af7420ea73536f7275112f7badb93425217345..622fc82ee913f17ecae472d427ab7e6e8337e031 100644 (file)
@@ -7,6 +7,7 @@
 
 class QFile;
 class gp_XYZ;
+class Handle_HYDROData_PolylineXY;
 
 DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject)
 
@@ -114,7 +115,9 @@ public:
    */
   HYDRODATA_EXPORT virtual bool             ImportFromFile( const TCollection_AsciiString& theFileName );
 
-  HYDRODATA_EXPORT bool CreateBoundaryPolyline() const;
+  HYDRODATA_EXPORT Handle_HYDROData_PolylineXY CreateBoundaryPolyline() const;
+
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
 
 private:
 
index 64883f888580fcb2d84d0d8e55b0e734d7265746..bf7ee295e82efe209f01863142be6b4a8f8a809b 100644 (file)
@@ -46,5 +46,10 @@ TopoDS_Shape HYDROData_Confluence::GetShape3D() const
   return getShape3D();
 }
 
+void HYDROData_Confluence::UpdateLocalCS( double theDx, double theDy )
+{
+  //TODO
+}
+
 
 
index 224b19e6b34e4ca5bc5267db56c90c22c140e093..f8f68af7dadded3f52034c4d7b3ed6ee65a5b40e 100644 (file)
@@ -44,6 +44,8 @@ public:
    */
   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
+
 protected:
 
   friend class HYDROData_Iterator;
index eea22c6d30248c4d0de805a4093d64225e449ac2..86d16b089d2686eb1e724daf1a5b521cef3e8d19 100644 (file)
@@ -5,9 +5,12 @@
 #include <HYDROData_Tool.h>
 
 #include <TDataStd_Integer.hxx>
+#include <TDataXtd_Position.hxx>
 
 #include <TDF_Delta.hxx>
 
+#include <gp_Pnt.hxx>
+
 #include <QFile>
 #include <QStringList>
 #include <QTextStream>
@@ -23,6 +26,8 @@ static const int TAG_PROPS = 1; // general properties tag
 static const int TAG_PROPS_NEW_ID = 1; // general properties: tag for storage of the new object ID
 static const int TAG_OBJECTS = 2; // tag of the objects sub-tree
 static const int TAG_HISTORY = 3; // tag of the history sub-tree (Root for History)
+static const int TAG_LOCAL_CS = 4; // tag of local coordinate system information
+static const gp_Pnt2d DEFAULT_LOCAL_CS( 0, 0 );
 
 using namespace std;
 
@@ -197,6 +202,11 @@ bool HYDROData_Document::DumpToPython( const QString& theFileName,
 
   bool aRes = true;
 
+  // Dump the local CS data to Python 
+  UpdateLCSFields();
+  QString aLCS = QString( "%1.SetLocalCS( %2, %3 )" ).arg( GetDocPyName() ).arg( myLX ).arg( myLY );
+  HYDROData_Tool::WriteStringsToFile( aFile, QStringList() << aLCS );
+
   // Dump all model objects to Python script
   aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_IMAGE );
   aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_POLYLINEXY );
@@ -632,12 +642,16 @@ HYDROData_Document::HYDROData_Document()
   myDoc->SetUndoLimit(UNDO_LIMIT);
   NewID(); // needed to have at least one attribute in initial document to avoid errors
   myTransactionsAfterSave = 0;
+  myLX = -1;
+  myLY = -1;
 }
 
 HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
 {
   myDoc = theDoc;
   myTransactionsAfterSave = 0;
+  myLX = -1;
+  myLY = -1;
 }
 
 HYDROData_Document::~HYDROData_Document()
@@ -661,3 +675,106 @@ TDF_Label HYDROData_Document::LabelOfObjects()
 {
   return myDoc->Main().FindChild(TAG_OBJECTS);
 }
+
+TDF_Label HYDROData_Document::LabelOfLocalCS() const
+{
+  return myDoc->Main().FindChild(TAG_LOCAL_CS);
+}
+
+void HYDROData_Document::GetLocalCS( double& theLX, double& theLY ) const
+{
+  TDF_Label aLocalCSLab = LabelOfLocalCS();
+
+  Handle( TDataXtd_Position ) aLocalCS;
+  if( aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
+  {
+    gp_Pnt aLocalCS3d = aLocalCS->GetPosition();
+    theLX = aLocalCS3d.X();
+    theLY = aLocalCS3d.Y();
+  }
+  else
+  {
+    theLX = DEFAULT_LOCAL_CS.X();
+    theLY = DEFAULT_LOCAL_CS.Y();
+  }
+}
+
+void HYDROData_Document::SetLocalCS( double theLX, double theLY )
+{
+  UpdateLCSFields();
+
+  // update the local CS data in attribute
+  TDF_Label aLocalCSLab = LabelOfLocalCS();
+  Handle( TDataXtd_Position ) aLocalCS;
+  if( !aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
+    aLocalCS = TDataXtd_Position::Set( aLocalCSLab );
+
+  gp_Pnt aLocalCS3d( theLX, theLY, 0 );
+  aLocalCS->SetPosition( aLocalCS3d );
+
+  // calculate delta for coordinates
+  double aDX = myLX - theLX;
+  double aDY = myLY - theLY;
+
+  // update the local CS data in internal fields
+  myLX = theLX;
+  myLY = theLY;
+
+  //update all objects in the document
+  HYDROData_Iterator anIterator( this, KIND_UNKNOWN );
+  for( ; anIterator.More(); anIterator.Next() )
+    anIterator.Current()->UpdateLocalCS( aDX, aDY );
+}
+
+void HYDROData_Document::UpdateLCSFields() const
+{
+  if( myLX >= 0 && myLY >= 0 )
+    return;
+
+  double aLX, aLY;
+  GetLocalCS( aLX, aLY );
+  HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
+  aThat->myLX = aLX;
+  aThat->myLY = aLY;
+}
+
+void HYDROData_Document::Transform( double& X, double& Y, bool IsToLocalCS ) const
+{
+  UpdateLCSFields();
+  if( IsToLocalCS )
+  {
+    X -= myLX;
+    Y -= myLY;
+  }
+  else
+  {
+    X += myLX;
+    Y += myLY;
+  }
+}
+
+void HYDROData_Document::Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const
+{
+  double X = thePnt.X();
+  double Y = thePnt.Y();
+  double Z = thePnt.Z();
+  Transform( X, Y, IsToLocalCS );
+  thePnt = gp_Pnt( X, Y, Z ); 
+}
+
+void HYDROData_Document::Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const
+{
+  double X = thePnt.X();
+  double Y = thePnt.Y();
+  double Z = thePnt.Z();
+  Transform( X, Y, IsToLocalCS );
+  thePnt = gp_XYZ( X, Y, Z ); 
+}
+
+void HYDROData_Document::Transform( gp_XY& thePnt, bool IsToLocalCS ) const
+{
+  double X = thePnt.X();
+  double Y = thePnt.Y();
+  Transform( X, Y, IsToLocalCS );
+  thePnt = gp_XY( X, Y ); 
+}
index ffdaf981451ad7b33a5fd50d030a3f3c1a8e2346..7efc1d63137509f1a501e49763aee6c919105c83 100644 (file)
@@ -7,6 +7,10 @@
 #include <TDocStd_Document.hxx>
 
 class QFile;
+class gp_Pnt2d;
+class gp_Pnt;
+class gp_XYZ;
+class gp_XY;
 
 /**
  * Errors that could appear on document open/save actions.
@@ -123,6 +127,12 @@ public:
   //! Removes the order of objects presentation.
   HYDRODATA_EXPORT void RemoveObjectsLayerOrder();
 
+  HYDRODATA_EXPORT void GetLocalCS( double&, double& ) const;
+  HYDRODATA_EXPORT void SetLocalCS( double, double );
+  HYDRODATA_EXPORT void Transform( double& X, double& Y, bool IsToLocalCS ) const;
+  HYDRODATA_EXPORT void Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const;
+  HYDRODATA_EXPORT void Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const;
+  HYDRODATA_EXPORT void Transform( gp_XY& thePnt, bool IsToLocalCS ) const;
 
 public:
 
@@ -194,6 +204,8 @@ protected:
   //! Returns the label where the objects are located (used by Iterator)
   HYDRODATA_EXPORT TDF_Label LabelOfObjects();
 
+  HYDRODATA_EXPORT TDF_Label LabelOfLocalCS() const;
+
 private:
   
   // Dump header Python part in to file \c theFile
@@ -205,10 +217,12 @@ private:
                               const bool           theIsMultiFile,
                               MapOfTreatedObjects& theDumpedObjects,
                               const ObjectKind&    theObjectKind ) const;
+  void UpdateLCSFields() const;
 
 private:
   Handle(TDocStd_Document) myDoc; ///< OCAF document instance corresponding for keeping all persistent data
   int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
+  double myLX, myLY;
 };
 
 #endif
index e1222fa6a25c4592588dcc00e393017ffc2f5a8e..dcc0795b54df0b705f9cd77db22546860dbfa0d2 100644 (file)
@@ -71,7 +71,6 @@ public:
    */
   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
 
-
 protected:
 
   friend class HYDROData_Iterator;
index 4c1ed735f799d96d7bd44f9056b8f72733311ff0..fc5fe6c2d82493c5dc07de427a120fdc2e67090f 100644 (file)
@@ -65,6 +65,11 @@ void HYDROData_Entity::Update()
   SetToUpdate( false );
 }
 
+void HYDROData_Entity::UpdateLocalCS( double theDx, double theDy )
+{
+  //On the base level no actions are necessary
+}
+
 bool HYDROData_Entity::IsHas2dPrs() const
 {
   return false;
index b46a6e43d0bf9a25dda95c4e43c4317a4c3f062b..d639c4a7c976cf18704e605e112e34fb6a4a69b0 100644 (file)
@@ -114,6 +114,7 @@ public:
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
 
   /**
    * Checks that object has 2D presentation. Base implementation returns false.
index 4dfae8672fad9e58e82e208ab9255230e52479db..b7c8eb54c8eb67c8bcd3b8e14ce4e3228773e869 100644 (file)
@@ -482,3 +482,8 @@ bool HYDROData_Obstacle::getTranslation( double& theDx, double& theDy, double& t
   return true;
 }
 
+void HYDROData_Obstacle::UpdateLocalCS( double theDx, double theDy )
+{
+  Translate( theDx, theDy, 0 );
+}
+
index a0ba13ad53b4bd48656eb1cf95c986a29e76236b..3641ba9d592f978e8f87c5243df000762f2eeb74 100644 (file)
@@ -43,6 +43,8 @@ public:
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
+
   /**
    * Checks that object has 2D presentation. Reimlemented to retun true.
    */
index be2495cd0f11872616ac56feb545e7cb1c64145b..72423bb3e76612eeadc53a40b338b6c3f8cc6c6a 100755 (executable)
@@ -1102,4 +1102,26 @@ QPainterPath HYDROData_PolylineXY::GetPainterPath() const
   return aPath;
 }
 
+void HYDROData_PolylineXY::UpdateLocalCS( double theDx, double theDy )
+{
+  NCollection_Sequence<TCollection_AsciiString>           aSectNames;
+  NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+  NCollection_Sequence<bool>                              aSectClosures;
+  GetSections( aSectNames, aSectTypes, aSectClosures );
+
+  gp_XY aDelta( theDx, theDy );
+  for ( int i = 0, aNbSects = aSectNames.Size(); i < aNbSects; i++ )
+  {
+    PointsList aPoints = GetPoints( i );
+    for( int j = 1, n = aPoints.Size(); j <= n; ++j )
+    {
+      Point& aPoint = aPoints.ChangeValue( j );
+      aPoint += aDelta;
+    }
+    SetPoints( i, aPoints );
+  }
+  SetToUpdate( true );
+}
+
+
 
index 86ae8e54d2e3f836a68cf26c1d4523e0c9da5308..1643aeab55d4f28533557d6cbd9b8ee70ac1b78e 100644 (file)
@@ -46,6 +46,8 @@ public:
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
+
   /**
    * Checks that object has 2D presentation. Reimlemented to retun true.
    */
index 76dfad84e4cbe97516c276d931b1c9133e19db9c..494461f2d15ec65cf4ea33924507ca4dc3dab89c 100755 (executable)
@@ -60,7 +60,7 @@ QStringList HYDROData_Profile::DumpToPython( MapOfTreatedObjects& theTreatedObje
   QString aGap = QString().fill( ' ', aPntsListName.length() + 5 );
   if ( anIsValidProfile )
   {
-    HYDROData_Profile::ProfilePoints aPointsList = GetProfilePoints();
+    HYDROData_Profile::ProfilePoints aPointsList = GetProfilePoints( true );
     for ( int k = 1, aNbPoints = aPointsList.Size(); k <= aNbPoints; ++k )
     {
       const ProfilePoint& aPoint = aPointsList.Value( k );
@@ -122,7 +122,7 @@ TopoDS_Shape HYDROData_Profile::GetTopShape() const
   TopoDS_Wire aWire;
 
   gp_XY aFirstPoint, aLastPoint;
-  if ( !GetLeftPoint( aFirstPoint ) || !GetRightPoint( aLastPoint ) )
+  if ( !GetLeftPoint( aFirstPoint, false ) || !GetRightPoint( aLastPoint, false ) )
     return aWire;
 
   gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
@@ -150,7 +150,7 @@ void HYDROData_Profile::Update()
   Handle(HYDROData_ProfileUZ) aProfile = GetProfileUZ( false );
   if ( !aProfile.IsNull() )
   {
-    ProfilePoints aProfilePoints = GetProfilePoints();
+    ProfilePoints aProfilePoints = GetProfilePoints( false );
     HYDROData_IPolyline::SectionType aSectionType = aProfile->GetSectionType( 0 );
 
     aWire = HYDROData_PolylineXY::BuildWire( aSectionType, false, aProfilePoints );
@@ -181,33 +181,41 @@ QColor HYDROData_Profile::getDefaultBorderColor() const
 bool HYDROData_Profile::IsValid() const
 {
   gp_XY aFirstPoint, aLastPoint;
-  if ( !GetLeftPoint( aFirstPoint ) || !GetRightPoint( aLastPoint ) )
+  if ( !GetLeftPoint( aFirstPoint, false ) || !GetRightPoint( aLastPoint, false ) )
     return false;
 
   int aNbPoints = NbPoints();
   return aNbPoints > 1;
 }
 
-void HYDROData_Profile::SetLeftPoint( const gp_XY& thePoint )
+void HYDROData_Profile::SetLeftPoint( const gp_XY& theGPoint, bool IsConvertFromGlobal )
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_FirstPoint );
+  if ( aLabel.IsNull() )
+    return;
+
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( Label() );
+  gp_XY aLPoint = theGPoint;
+  if( IsConvertFromGlobal )
+    aDoc->Transform( aLPoint, true );
 
   Handle(TDataStd_RealArray) anArray;
   if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
     anArray = TDataStd_RealArray::Set( aLabel, 0, 1 );
 
-  anArray->SetValue( 0, thePoint.X() );
-  anArray->SetValue( 1, thePoint.Y() );
+  anArray->SetValue( 0, aLPoint.X() );
+  anArray->SetValue( 1, aLPoint.Y() );
 
   SetToUpdate( true );
 }
 
-bool HYDROData_Profile::GetLeftPoint( gp_XY& thePoint ) const
+bool HYDROData_Profile::GetLeftPoint( gp_XY& thePoint, bool IsConvertToGlobal ) const
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_FirstPoint, false );
   if ( aLabel.IsNull() )
     return false;
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab );
   Handle(TDataStd_RealArray) anArray;
   if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
     return false;
@@ -215,29 +223,38 @@ bool HYDROData_Profile::GetLeftPoint( gp_XY& thePoint ) const
   thePoint.SetX( anArray->Value( 0 ) );
   thePoint.SetY( anArray->Value( 1 ) );
 
+  if( IsConvertToGlobal )
+    aDoc->Transform( thePoint, false );
+
   return true;
 }
 
-void HYDROData_Profile::SetRightPoint( const gp_XY& thePoint )
+void HYDROData_Profile::SetRightPoint( const gp_XY& theGPoint, bool IsConvertFromGlobal )
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_LastPoint );
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( Label() );
+  gp_XY aLPoint = theGPoint;
+  if( IsConvertFromGlobal )
+    aDoc->Transform( aLPoint, true );
+
   Handle(TDataStd_RealArray) anArray;
   if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
     anArray = TDataStd_RealArray::Set( aLabel, 0, 1 );
 
-  anArray->SetValue( 0, thePoint.X() );
-  anArray->SetValue( 1, thePoint.Y() );
+  anArray->SetValue( 0, aLPoint.X() );
+  anArray->SetValue( 1, aLPoint.Y() );
 
   SetToUpdate( true );
 }
 
-bool HYDROData_Profile::GetRightPoint( gp_XY& thePoint ) const
+bool HYDROData_Profile::GetRightPoint( gp_XY& thePoint, bool IsConvertToGlobal ) const
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_LastPoint, false );
   if ( aLabel.IsNull() )
     return false;
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab );
   Handle(TDataStd_RealArray) anArray;
   if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
     return false;
@@ -245,6 +262,9 @@ bool HYDROData_Profile::GetRightPoint( gp_XY& thePoint ) const
   thePoint.SetX( anArray->Value( 0 ) );
   thePoint.SetY( anArray->Value( 1 ) );
 
+  if( IsConvertToGlobal )
+    aDoc->Transform( thePoint, false );
+
   return true;
 }
 
@@ -315,7 +335,7 @@ HYDROData_ProfileUZ::PointsList HYDROData_Profile::GetParametricPoints() const
   return aProfileUZ.IsNull() ? HYDROData_ProfileUZ::PointsList() : aProfileUZ->GetPoints();
 }
 
-void HYDROData_Profile::SetProfilePoints( const ProfilePoints& thePoints )
+void HYDROData_Profile::SetProfilePoints( const ProfilePoints& thePoints, bool IsConvertFromGlobal )
 {
   RemovePoints();
   if ( thePoints.Length() < 2 )
@@ -323,10 +343,14 @@ void HYDROData_Profile::SetProfilePoints( const ProfilePoints& thePoints )
 
   gp_XY aFirstPoint, aLastPoint;
 
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( Label() );
   Handle(HYDROData_ProfileUZ) aProfileUZ = GetProfileUZ();
   for ( int i = 1, n = thePoints.Length(); i <= n ; ++i )
   {
-    const ProfilePoint& aPoint = thePoints.Value( i );
+    ProfilePoint aPoint = thePoints.Value( i );
+    if( IsConvertFromGlobal )
+      aDoc->Transform( aPoint, true );
+
     gp_XY aPointXY( aPoint.X(), aPoint.Y() );
 
     if ( i == 1 )
@@ -340,16 +364,17 @@ void HYDROData_Profile::SetProfilePoints( const ProfilePoints& thePoints )
     aProfileUZ->AddPoint( 0, aParPoint );
   }
 
-  SetLeftPoint( aFirstPoint );
-  SetRightPoint( aLastPoint );
+  SetLeftPoint( aFirstPoint, false );//already converted to local CS
+  SetRightPoint( aLastPoint, false );
 }
 
-HYDROData_Profile::ProfilePoints HYDROData_Profile::GetProfilePoints() const
+HYDROData_Profile::ProfilePoints HYDROData_Profile::GetProfilePoints( bool IsConvertToGlobal ) const
 {
   ProfilePoints aResPoints;
 
   gp_XY aFirstPoint, aLastPoint;
-  if ( !GetLeftPoint( aFirstPoint ) || !GetRightPoint( aLastPoint ) )
+  if ( !GetLeftPoint( aFirstPoint, IsConvertToGlobal ) ||
+       !GetRightPoint( aLastPoint, IsConvertToGlobal ) )
     return aResPoints;
 
   HYDROData_ProfileUZ::PointsList aParametricPoints = GetParametricPoints();
@@ -594,7 +619,7 @@ bool HYDROData_Profile::ImportFromFile( OSD_File& theFile,
     }
     else if ( anIsGeoref )
     {
-      SetProfilePoints( aPointsXYZ );
+      SetProfilePoints( aPointsXYZ, true );
     }
 
     Update();
@@ -603,5 +628,18 @@ bool HYDROData_Profile::ImportFromFile( OSD_File& theFile,
   return aRes;
 }
 
+void HYDROData_Profile::UpdateLocalCS( double theDx, double theDy )
+{
+  gp_XY aDelta( theDx, theDy );
+  gp_XY aPnt;
+
+  GetLeftPoint( aPnt, false );
+  aPnt += aDelta;
+  SetLeftPoint( aPnt, false );
+
+  GetRightPoint( aPnt, false );
+  aPnt += aDelta;
+  SetRightPoint( aPnt, false );
+}
 
 
index 3c56846fa142f933433b07a7cce68611d22c3feb..45b916a8bdfe548197af18dd77703ebf7d179725 100644 (file)
@@ -65,6 +65,8 @@ public:
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
+
   /**
    * Returns default filling color for new profile.
    */
@@ -99,27 +101,27 @@ public:
    * Set first(left) point for profile.
    * \param thePoint the point
    */
-  HYDRODATA_EXPORT void SetLeftPoint( const gp_XY& thePoint );
+  HYDRODATA_EXPORT void SetLeftPoint( const gp_XY& thePoint, bool IsConvertFromGlobal = false );
 
   /**
    * Returns first(left) point of profile.
    * \param thePoint[out] profile first point
    * \return true if point has been set
    */
-  HYDRODATA_EXPORT bool GetLeftPoint( gp_XY& thePoint ) const;
+  HYDRODATA_EXPORT bool GetLeftPoint( gp_XY& thePoint, bool IsConvertToGlobal = false ) const;
 
   /**
    * Set last(right) point for profile.
    * \param thePoint the point
    */
-  HYDRODATA_EXPORT void SetRightPoint( const gp_XY& thePoint );
+  HYDRODATA_EXPORT void SetRightPoint( const gp_XY& thePoint, bool IsConvertFromGlobal = false );
 
   /**
    * Returns last(right) point of profile.
    * \param thePoint[out] profile last point
    * \return true if point has been set
    */
-  HYDRODATA_EXPORT bool GetRightPoint( gp_XY& thePoint ) const;
+  HYDRODATA_EXPORT bool GetRightPoint( gp_XY& thePoint, bool IsConvertToGlobal = false ) const;
 
 
   /**
@@ -159,15 +161,14 @@ public:
    * First and last points will be automatically updated.
    * \param thePoints the list with new profile points
    */
-  HYDRODATA_EXPORT void SetProfilePoints( const ProfilePoints& thePoints );
+  HYDRODATA_EXPORT void SetProfilePoints( const ProfilePoints& thePoints, bool IsConvertFromGlobal = true );
 
   /**
    * Returns profile points.
    * Empty sequence is returned if first or last point was not set.
    * \return profile points list
    */
-  HYDRODATA_EXPORT ProfilePoints GetProfilePoints() const;
-
+  HYDRODATA_EXPORT ProfilePoints GetProfilePoints( bool IsConvertToGlobal = false ) const;
 
 public:
   // Public methods to work with files.
index 012167d29c96f2a0a31a8fa83852c6f48cfe3217..b5958347a486cfe1d89b4d85cde30edd5123b9b9 100644 (file)
@@ -57,5 +57,10 @@ TopoDS_Shape HYDROData_River::GetShape3D() const
   return getShape3D();
 }
 
+void HYDROData_River::UpdateLocalCS( double theDx, double theDy )
+{
+  //TODO
+}
+
 
 
index 9503d5b06b6ee163602d166d3026e3c91c6b42c5..5ac5f963f0657ff54e8ac291181c9adc8e8a7aed 100644 (file)
@@ -40,6 +40,8 @@ public:
    */
   HYDRODATA_EXPORT virtual void Update();
 
+  HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
+
   /**
    * Checks that object has 2D presentation. Reimlemented to retun true.
    */
index 128239eac56a836a0e07c9f6d1a6c71ddda2c72c..b4d48d61f9cdd1cd29c8d74c2cbd4fb7cf10a62f 100644 (file)
@@ -152,8 +152,8 @@ bool HYDROData_Stream::IsHas2dPrs() const
 }
 
 bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis,
-                                           const HYDROData_SequenceOfObjects&  theProfiles,
-                                           PrsDefinition&                      thePrs )
+                                            const HYDROData_SequenceOfObjects&  theProfiles,
+                                            PrsDefinition&                      thePrs )
 {
   if ( theHydAxis.IsNull() || theProfiles.Length() < 2 )
     return false;
@@ -175,7 +175,7 @@ bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_PolylineXY)&
 
     const TopoDS_Shape& aProf3d = aProfile->GetShape3D();
     gp_XY aPnt1, aPnt2;
-    if ( !aProfile->GetLeftPoint( aPnt1 ) || !aProfile->GetRightPoint( aPnt2 ) )
+    if ( !aProfile->GetLeftPoint( aPnt1, false ) || !aProfile->GetRightPoint( aPnt2, false ) )
       continue;
 
     anArrOfProfiles.SetValue(i,aProfile->GetShape3D());//aProfile->GetTopShape();
index 11cd35e4d5e73359105f52d91e55c4d613bd7f98..8c1f9f69f53bf84c9ef70b73bb9db4dadcb102d5 100644 (file)
@@ -56,8 +56,8 @@ Standard_Real getAltitudeFromProfile( const Handle(HYDROData_Profile)& theProfil
   Standard_Real aResAlt = 0.0;
 
   gp_XY aFirstPoint, aLastPoint;
-  if ( !theProfile->GetLeftPoint( aFirstPoint ) ||
-       !theProfile->GetRightPoint( aLastPoint ) )
+  if ( !theProfile->GetLeftPoint( aFirstPoint, false ) ||
+       !theProfile->GetRightPoint( aLastPoint, false ) )
     return aResAlt;
 
   gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
@@ -73,7 +73,7 @@ Standard_Real getAltitudeFromProfile( const Handle(HYDROData_Profile)& theProfil
 
   gp_Pnt aPrevPoint;
   gp_Lin aPrevNormal;
-  HYDROData_Profile::ProfilePoints aProfilePoints = theProfile->GetProfilePoints();
+  HYDROData_Profile::ProfilePoints aProfilePoints = theProfile->GetProfilePoints( false );
   for ( int i = 1, n = aProfilePoints.Length(); i <= n; ++i )
   {
     gp_Pnt aProfPoint( aProfilePoints.Value( i ) );
@@ -143,7 +143,8 @@ bool HYDROData_StreamAltitude::getBoundaryProfilesForPoint(
       continue;
 
     gp_XY aFirstPoint, aLastPoint;
-    if ( !aProfile->GetLeftPoint( aFirstPoint ) || !aProfile->GetRightPoint( aLastPoint ) )
+    if ( !aProfile->GetLeftPoint( aFirstPoint, false ) ||
+         !aProfile->GetRightPoint( aLastPoint, false ) )
       continue;
 
     gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), 0 );
@@ -258,7 +259,7 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
 
   // Interpolate altitudes
   // Left profile line ( the segment between the firts and the last profile point )
-  HYDROData_Profile::ProfilePoints aLeftProfilePoints = aLeftProfile->GetProfilePoints();
+  HYDROData_Profile::ProfilePoints aLeftProfilePoints = aLeftProfile->GetProfilePoints( false );
   gp_Pnt aLeftProfileP1( aLeftProfilePoints.First() );
   aLeftProfileP1.SetZ( 0 );
   gp_Pnt aLeftProfileP2( aLeftProfilePoints.Last() );
@@ -266,7 +267,7 @@ double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) co
   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();
+  HYDROData_Profile::ProfilePoints aRightProfilePoints = aRightProfile->GetProfilePoints( false );
   gp_Pnt aRightProfileP1( aRightProfilePoints.First() );
   aRightProfileP1.SetZ( 0 );
   gp_Pnt aRightProfileP2( aRightProfilePoints.Last() );
index f1e3ba962985935e28fbb302ff44e67bca2965d3..2bdcac746de8207bad6968862cea690eab9acb72 100644 (file)
@@ -149,7 +149,6 @@ public:
    */
   HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
 
-
 protected:
 
   friend class HYDROData_Region;
index 79549b29ce725798faf55ed8e3b491466c87e091..26bb74a6e3d5de995f6938181e18882d6ab016a3 100644 (file)
@@ -14,6 +14,7 @@ set(PROJECT_HEADERS
     HYDROGUI_CopyPastePositionOp.h
     HYDROGUI_DataBrowser.h
     HYDROGUI_DataModel.h
+    HYDROGUI_DataModelSync.h
     HYDROGUI_DataObject.h
     HYDROGUI_DeleteDlg.h
     HYDROGUI_DeleteOp.h
@@ -29,6 +30,8 @@ set(PROJECT_HEADERS
     HYDROGUI_ImportImageDlg.h
     HYDROGUI_ImportImageOp.h
     HYDROGUI_InputPanel.h
+    HYDROGUI_LocalCSDlg.h
+    HYDROGUI_LocalCSOp.h
     HYDROGUI_Module.h
     HYDROGUI_NameValidator.h
     HYDROGUI_ObjSelector.h
@@ -108,6 +111,7 @@ set(PROJECT_SOURCES
     HYDROGUI_CopyPastePositionOp.cxx
     HYDROGUI_DataBrowser.cxx
     HYDROGUI_DataModel.cxx
+    HYDROGUI_DataModelSync.cxx
     HYDROGUI_DataObject.cxx
     HYDROGUI_DeleteDlg.cxx
     HYDROGUI_DeleteOp.cxx
@@ -123,6 +127,8 @@ set(PROJECT_SOURCES
     HYDROGUI_ImportImageDlg.cxx
     HYDROGUI_ImportImageOp.cxx
     HYDROGUI_InputPanel.cxx
+    HYDROGUI_LocalCSDlg.cxx
+    HYDROGUI_LocalCSOp.cxx
     HYDROGUI_Module.cxx
     HYDROGUI_NameValidator.cxx
     HYDROGUI_ObjSelector.cxx
index cf042190c10bbab4b2780124e18143c6ec38c38a..1dd589b72eb7d04f09f4819f51dea95f2340c10d 100644 (file)
@@ -24,6 +24,8 @@
 #include <HYDROGUI_Tool.h>
 #include <HYDROGUI_UpdateFlags.h>
 #include <HYDROGUI_Module.h>
+#include <HYDROGUI_DataObject.h>
+#include <HYDROData_PolylineXY.h>
 
 HYDROGUI_BathymetryBoundsOp::HYDROGUI_BathymetryBoundsOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule )
@@ -50,13 +52,18 @@ void HYDROGUI_BathymetryBoundsOp::startOperation()
     onApply();
 }
 
-bool HYDROGUI_BathymetryBoundsOp::processApply( int& theUpdateFlags, QString& theErrorMsg )
+bool HYDROGUI_BathymetryBoundsOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries )
 {
-  bool isOK = myBath->CreateBoundaryPolyline();
+  Handle_HYDROData_PolylineXY aPolyline = myBath->CreateBoundaryPolyline();
+  bool isOK = !aPolyline.IsNull();
   theUpdateFlags = 0;
   if( isOK ) {
     module()->setIsToUpdate( myBath );
     theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+    
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aPolyline );
+    theBrowseObjectsEntries.append( anEntry );
   }
   else
     theErrorMsg = tr( "CANNOT_CREATE_BOUNDARY_POLYLINE" );
index 00b92d56831a6f39bdd7b59fee7a1a00c2ab80df..7586c17d2e36b08dc6c03a9f23f61a8b4facebce 100644 (file)
@@ -37,7 +37,8 @@ public:
 protected:
   virtual void startOperation();
   virtual HYDROGUI_InputPanel* createInputPanel() const;
-  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
 
 private:
   Handle(HYDROData_Bathymetry) myBath;
index 71f47ea772995f6a2441a8a4987af21af80bf8fb..954e789f45028ac10c404ea4ff7056d38026ace0 100644 (file)
@@ -498,13 +498,20 @@ bool HYDROGUI_CalculationOp::confirmRegionsChange() const
 }
 
 bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
-                                           QString& theErrorMsg )
+                                           QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_CalculationDlg* aPanel = 
     ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
   if ( !aPanel )
     return false;
 
+  if( !myIsEdit )
+  {
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( myEditedObject );
+    theBrowseObjectsEntries.append( anEntry );
+  }
+
   theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init;
 
   return true;
@@ -516,12 +523,13 @@ void HYDROGUI_CalculationOp::onApply()
 
   int anUpdateFlags = 0;
   QString anErrorMsg;
+  QStringList aBrowseObjectsEntries;
 
   bool aResult = false;
   
   try
   {
-    aResult = processApply( anUpdateFlags, anErrorMsg );
+    aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
   }
   catch ( Standard_Failure )
   {
@@ -540,6 +548,7 @@ void HYDROGUI_CalculationOp::onApply()
   {
     module()->update( anUpdateFlags );
     commit();
+    browseObjects( aBrowseObjectsEntries );
   }
   else
   {
index 829c01bbe3a42f64592f7ec146c1750857c65f0c..81c19c61dcd4142c75b9524c964d78be9a09a17f 100644 (file)
@@ -52,7 +52,8 @@ protected:
   virtual HYDROGUI_InputPanel*    createInputPanel() const;
 
   virtual void                    onApply();
-  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries );
 
   void setAvailableGroups();
 
index 0a6227851bcce28a3f74afdb2faab14bc741189f..e820deb641e97d42beba677505cbd82b080385ca 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_ChannelOp.h"
 
 #include "HYDROGUI_DataModel.h"
+#include <HYDROGUI_DataObject.h>
 #include "HYDROGUI_ChannelDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Shape.h"
@@ -143,7 +144,8 @@ HYDROGUI_InputPanel* HYDROGUI_ChannelOp::createInputPanel() const
 }
 
 bool HYDROGUI_ChannelOp::processApply( int& theUpdateFlags,
-                                       QString& theErrorMsg )
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_ChannelDlg* aPanel = ::qobject_cast<HYDROGUI_ChannelDlg*>( inputPanel() );
   if ( !aPanel )
@@ -203,7 +205,11 @@ bool HYDROGUI_ChannelOp::processApply( int& theUpdateFlags,
   erasePreview();
 
   if( !myIsEdit )
+  {
     module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), myEditedObject, true );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( myEditedObject );
+    theBrowseObjectsEntries.append( anEntry );
+  }
 
   module()->setIsToUpdate( myEditedObject );
 
index 798d7a89ae747e3aa981f3111758b83421a87c8b..bb1c5acbf20b6b14e037f7b148f473e0dada911a 100644 (file)
@@ -46,7 +46,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 protected slots:
   virtual void               onCreatePreview();
index 654451d863bd0a2dfcf77abd94e807c45f692f24..6f1adada33b9121c81a475262fb6489338014aa0 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_CalculationCase.h>
+#include <HYDROGUI_DataModelSync.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_DummyObject3D.h>
 #include <HYDROData_Image.h>
@@ -47,8 +48,6 @@
 #include <HYDROData_River.h>
 #include <HYDROData_Stream.h>
 
-#include <CAM_Application.h>
-#include <CAM_DataObject.h>
 #include <CAM_Module.h>
 #include <CAM_Study.h>
 
 #include <LightApp_DataObject.h>
 #include <LightApp_Study.h>
 
-#include <SUIT_DataObject.h>
 #include <SUIT_DataBrowser.h>
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Study.h>
 #include <SUIT_Tools.h>
+#include <SUIT_TreeSync.h>
 
 #include <HYDROData_Document.h>
 
@@ -77,6 +76,9 @@
 
 static HYDROData_SequenceOfObjects myCopyingObjects;
 
+const int ENTRY_COLUMN = 2;
+
+
 HYDROGUI_DataModel::HYDROGUI_DataModel( CAM_Module* theModule )
 : LightApp_DataModel( theModule )
 {
@@ -95,17 +97,19 @@ bool HYDROGUI_DataModel::open( const QString& theURL,
   const int aStudyId = theStudy->id();
 
   Data_DocError res = DocError_UnknownProblem;
-  if( theFileList.count() == 2 )
+  if( theFileList.count() >= 2 )
   {
     QString aTmpDir = theFileList[0];
-    QString aFileName = theFileList[1];
+    QString aDataFileName = theFileList[1];
+    QString aStatesFileName = theFileList.count() == 3 ? theFileList[2] : "";
 
     myStudyURL = theURL;
-    QString aFullPath = SUIT_Tools::addSlash( aTmpDir ) + aFileName;
+    QString aDataFullPath = SUIT_Tools::addSlash( aTmpDir ) + aDataFileName;
+    QString aStatesFullPath = aStatesFileName.isEmpty() ? "" : SUIT_Tools::addSlash( aTmpDir ) + aStatesFileName;
 
     try
     {
-      res = HYDROData_Document::Load( (char*)aFullPath.toLatin1().constData(), aStudyId );
+      res = HYDROData_Document::Load( (char*)aDataFullPath.toLatin1().constData(), aStudyId );
     }
     catch(...)
     {
@@ -116,6 +120,16 @@ bool HYDROGUI_DataModel::open( const QString& theURL,
       module()->application()->putInfo( tr( "LOAD_ERROR" ) );
       return false;
     }
+
+    if( !aStatesFullPath.isEmpty() )
+    {
+      QFile aFile( aStatesFullPath );
+      if( aFile.open( QFile::ReadOnly ) )
+      {
+        myStates = aFile.readAll();
+        aFile.close();
+      }
+    }
   }
 
   // if the document open was successful, the data model update happens
@@ -134,27 +148,41 @@ bool HYDROGUI_DataModel::save( QStringList& theFileList )
   LightApp_DataModel::save( theFileList );
 
   QString aTmpDir;
-  QString aFileName;
   SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
   bool isMultiFile = false;
   if( resMgr )
     isMultiFile = resMgr->booleanValue( "Study", "multi_file", false );
 
-  // save data to temporary files
+  // save module data to temporary files
   LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( module()->application()->activeStudy() );
   aTmpDir = aStudy->GetTmpDir( myStudyURL.toLatin1().constData(), isMultiFile ).c_str();
-  aFileName = SUIT_Tools::file( myStudyURL, false ) + "_HYDRO.cbf";
-
-  QString aFullPath = aTmpDir + aFileName;
-  Data_DocError res = getDocument()->Save( (char*)aFullPath.toLatin1().constData() );
+  
+  // save OCAF data to a temporary file
+  QString aDataFileName = SUIT_Tools::file( myStudyURL, false ) + "_HYDRO.cbf";
+  QString aDataFullPath = aTmpDir + aDataFileName;
+  Data_DocError res = getDocument()->Save( (char*)aDataFullPath.toLatin1().constData() );
   if( res != DocError_OK )
   {
     module()->application()->putInfo( tr( "SAVE_ERROR" ) );
     return false;
   }
 
+  // save tree state data to a temporary file
+  LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( module()->application() );
+  QByteArray aStatesData = anApp->objectBrowser()->getOpenStates( ENTRY_COLUMN );
+  QString aStatesFileName = SUIT_Tools::file( myStudyURL, false ) + "_HYDRO_tree_states.txt";
+  QString aStatesFullPath = aTmpDir + aStatesFileName;
+  QFile aFile( aStatesFullPath );
+  if( aFile.open( QFile::WriteOnly ) )
+  {
+    aFile.write( aStatesData );
+    aFile.close();
+  }
+
+  // add temporary files to the list
   theFileList.append( aTmpDir );
-  theFileList.append( aFileName );
+  theFileList.append( aDataFileName );
+  theFileList.append( aStatesFileName );
 
   return true;
 }
@@ -219,19 +247,8 @@ void HYDROGUI_DataModel::update( const int theStudyId )
   if( !aStudyRoot )
     return;
 
-  // create root object if not exist
-  CAM_DataObject* aRootObj = root();
-  if( !aRootObj )
-    aRootObj = createRootModuleObject( aStudyRoot );
-
-  if( !aRootObj )
-    return;
-
-  DataObjectList aList;
-  aRootObj->children( aList );
-  QListIterator<SUIT_DataObject*> anIter( aList );
-  while( anIter.hasNext() )
-    removeChild( aRootObj, anIter.next() );
+  // create a new root object
+  CAM_DataObject* aNewRootObj = new CAM_DataObject();
 
   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theStudyId );
   if( aDocument.IsNull() )
@@ -240,34 +257,34 @@ void HYDROGUI_DataModel::update( const int theStudyId )
   // Create root objects:
 
   // IMAGES
-  LightApp_DataObject* anImageRootObj = createObject( aRootObj, tr( partitionName( KIND_IMAGE ).toAscii() ) );
+  LightApp_DataObject* anImageRootObj = createObject( aNewRootObj, tr( partitionName( KIND_IMAGE ).toAscii() ) );
 
   // BATHYMETRY
-  LightApp_DataObject* aBathymetryRootObj = createObject( aRootObj, tr( partitionName( KIND_BATHYMETRY ).toAscii() ) );
+  LightApp_DataObject* aBathymetryRootObj = createObject( aNewRootObj, tr( partitionName( KIND_BATHYMETRY ).toAscii() ) );
 
   // ARTIFICIAL OBJECTS
-  LightApp_DataObject* anArtificialObjectsRootObj = createObject( aRootObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toAscii() ) );
+  LightApp_DataObject* anArtificialObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_ARTIFICIAL_OBJECT ).toAscii() ) );
 
   // NATURAL OBJECTS
-  LightApp_DataObject* aNaturalObjectsRootObj = createObject( aRootObj, tr( partitionName( KIND_NATURAL_OBJECT ).toAscii() ) );
+  LightApp_DataObject* aNaturalObjectsRootObj = createObject( aNewRootObj, tr( partitionName( KIND_NATURAL_OBJECT ).toAscii() ) );
 
   // OBSTACLES
-  LightApp_DataObject* anObstaclesRootObj = createObject( aRootObj, tr( partitionName( KIND_OBSTACLE ).toAscii() ) );
+  LightApp_DataObject* anObstaclesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_OBSTACLE ).toAscii() ) );
 
   // CALCULATION CASES
-  LightApp_DataObject* aCalculRootObj = createObject( aRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) );
+  LightApp_DataObject* aCalculRootObj = createObject( aNewRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) );
 
   // POLYLINES
-  LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINEXY ).toAscii() ) );
+  LightApp_DataObject* aPolylineRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINEXY ).toAscii() ) );
 
   // POLYLINES
-  LightApp_DataObject* aPolyline3DRootObj = createObject( aRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) );
+  LightApp_DataObject* aPolyline3DRootObj = createObject( aNewRootObj, tr( partitionName( KIND_POLYLINE ).toAscii() ) );
 
   // PROFILES
-  LightApp_DataObject* aProfileRootObj = createObject( aRootObj, tr( partitionName( KIND_PROFILE ).toAscii() ) );
+  LightApp_DataObject* aProfileRootObj = createObject( aNewRootObj, tr( partitionName( KIND_PROFILE ).toAscii() ) );
 
   // VISUAL STATES
-  LightApp_DataObject* aVisualStateRootObj = createObject( aRootObj, tr( partitionName( KIND_VISUAL_STATE ).toAscii() ) );
+  LightApp_DataObject* aVisualStateRootObj = createObject( aNewRootObj, tr( partitionName( KIND_VISUAL_STATE ).toAscii() ) );
 
   HYDROData_Iterator anIterator( aDocument, KIND_UNKNOWN );
   for( ; anIterator.More(); anIterator.Next() ) {
@@ -410,10 +427,27 @@ void HYDROGUI_DataModel::update( const int theStudyId )
     }
   }
 
-  if( SUIT_DataBrowser* anObjectBrowser = anApp->objectBrowser() )
+  //if( SUIT_DataBrowser* anObjectBrowser = anApp->objectBrowser() )
+  //{
+  //  anObjectBrowser->setAutoOpenLevel( 3 );
+  //  anObjectBrowser->openLevels();
+  //}
+
+  HYDROGUI_DataModelSync aSync( aNewRootObj );
+  SUIT_DataObject* aRoot = root();
+  bool isNewDoc = aRoot==0;
+  if( isNewDoc )
+    aRoot = createRootModuleObject( aStudyRoot );
+  ::synchronize < suitPtr, suitPtr, HYDROGUI_DataModelSync >
+    ( aNewRootObj, aRoot, aSync );
+
+
+  if( !myStates.isEmpty() )
   {
-    anObjectBrowser->setAutoOpenLevel( 3 );
-    anObjectBrowser->openLevels();
+    LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( module()->application() );
+    anApp->objectBrowser()->updateTree();
+    anApp->objectBrowser()->setOpenStates( myStates, ENTRY_COLUMN );
+    myStates.clear();
   }
 }
 
index 019350e1a849a5ab3cff1c512a550f38dddedc37..dde52d05706e242d126b9baef36c82d8427199c5 100644 (file)
@@ -363,6 +363,7 @@ protected:
 
 protected:
   QString myStudyURL; ///< the saved/opened document URL
+  QByteArray myStates;
 };
 
 #endif 
diff --git a/src/HYDROGUI/HYDROGUI_DataModelSync.cxx b/src/HYDROGUI/HYDROGUI_DataModelSync.cxx
new file mode 100644 (file)
index 0000000..5f148e9
--- /dev/null
@@ -0,0 +1,93 @@
+
+#include <HYDROGUI_DataModelSync.h>
+#include <HYDROGUI_DataObject.h>
+#include <typeinfo>
+
+HYDROGUI_DataModelSync::HYDROGUI_DataModelSync( SUIT_DataObject* theRoot )
+  : myRoot( theRoot )
+{
+}
+
+HYDROGUI_DataModelSync::~HYDROGUI_DataModelSync()
+{
+}
+
+void HYDROGUI_DataModelSync::deleteItemWithChildren( const suitPtr& theSuitPtr ) const
+{
+  if( !theSuitPtr )
+    return;
+
+  theSuitPtr->setAutoDeleteChildren( true );
+  theSuitPtr->deleteLater();
+}
+
+suitPtr HYDROGUI_DataModelSync::nullSrc() const
+{
+  return 0;
+}
+
+suitPtr HYDROGUI_DataModelSync::nullTrg() const
+{
+  return 0;
+}
+
+QList<suitPtr> HYDROGUI_DataModelSync::children( const suitPtr& theSuitPtr ) const
+{
+  QList<suitPtr> aChildren;
+  if( theSuitPtr )
+  {
+    DataObjectList anObjList;
+    theSuitPtr->children( anObjList );
+    foreach( SUIT_DataObject* anObj, anObjList )
+      aChildren.append( anObj );
+  }
+  return aChildren;
+}
+
+suitPtr HYDROGUI_DataModelSync::parent( const suitPtr& theSuitPtr ) const
+{
+  return theSuitPtr ? theSuitPtr->parent() : 0;
+}
+
+void HYDROGUI_DataModelSync::updateItem( const suitPtr& theSrcPtr, const suitPtr& theTrgPtr ) const
+{
+  HYDROGUI_DataObject* aDataObj = dynamic_cast<HYDROGUI_DataObject*>( theTrgPtr );
+  if( aDataObj )
+    aDataObj->updateBy( theSrcPtr );
+
+  HYDROGUI_NamedObject* aNamedObj = dynamic_cast<HYDROGUI_NamedObject*>( theTrgPtr );
+  if( aNamedObj )
+    aNamedObj->updateBy( theSrcPtr );
+}
+
+bool HYDROGUI_DataModelSync::isEqual( const suitPtr& theSrcPtr, const suitPtr& theTrgPtr ) const
+{
+  if( theSrcPtr==myRoot )
+    return true;
+
+  if( theSrcPtr==0 )
+    return theTrgPtr==0;
+
+  if( theTrgPtr==0 )
+    return theSrcPtr==0;
+
+  QString aSrcClass = typeid( *theSrcPtr ).name();
+  QString aTrgClass = typeid( *theTrgPtr ).name();
+  return aSrcClass==aTrgClass;
+}
+
+suitPtr HYDROGUI_DataModelSync::createItem( const suitPtr& theSrcPtr,
+                                            const suitPtr& theParent,
+                                            const suitPtr& theAfter ) const
+{
+  if( theParent )
+  {
+    int aPos = theParent->childPos( theAfter );
+    if( aPos>=0 )
+      theParent->insertChild( theSrcPtr, aPos+1 );
+    else
+      theParent->appendChild( theSrcPtr );
+  }
+  return theSrcPtr;
+}
+
diff --git a/src/HYDROGUI/HYDROGUI_DataModelSync.h b/src/HYDROGUI/HYDROGUI_DataModelSync.h
new file mode 100644 (file)
index 0000000..9192068
--- /dev/null
@@ -0,0 +1,30 @@
+
+#ifndef HYDROGUI_DATA_MODEL_SYNC_HEADER
+#define HYDROGUI_DATA_MODEL_SYNC_HEADER
+
+#include <QList>
+
+class SUIT_DataObject;
+
+typedef SUIT_DataObject* suitPtr;
+
+class HYDROGUI_DataModelSync
+{
+public:
+  HYDROGUI_DataModelSync( SUIT_DataObject* theRoot );
+  ~HYDROGUI_DataModelSync();
+
+  void     deleteItemWithChildren( const suitPtr& ) const;
+  suitPtr  nullSrc() const;
+  suitPtr  nullTrg() const;
+  QList<suitPtr> children( const suitPtr& ) const;
+  suitPtr  parent( const suitPtr& ) const;
+  void     updateItem( const suitPtr&, const suitPtr& ) const;
+  bool     isEqual( const suitPtr&, const suitPtr& ) const;
+  suitPtr  createItem( const suitPtr&, const suitPtr&, const suitPtr& ) const;
+
+private:
+  SUIT_DataObject* myRoot;
+};
+
+#endif
index a259a866e83a88b6078527673b852c0e1d089a07..9701970ad2ee07bfdeae4a3e043341e1d861ba24 100644 (file)
@@ -220,6 +220,23 @@ bool HYDROGUI_DataObject::renameAllowed( const int theColumnId ) const
   return aRes;
 }
 
+void HYDROGUI_DataObject::updateBy( SUIT_DataObject* theObj )
+{
+  HYDROGUI_DataObject* aDataObj = dynamic_cast<HYDROGUI_DataObject*>( theObj );
+  if( !aDataObj )
+    return;
+
+  myData = aDataObj->myData;
+  myParentEntry = aDataObj->myParentEntry;
+  myIsValid = aDataObj->myIsValid;
+  myIsInOperation = aDataObj->myIsInOperation;
+  myIcon = aDataObj->myIcon;
+  setModified( true );
+}
+
+
+
+
 
 
 HYDROGUI_NamedObject::HYDROGUI_NamedObject( SUIT_DataObject* theParent,
@@ -270,6 +287,24 @@ QFont HYDROGUI_NamedObject::font( const int theId ) const
   return aFont;
 }
 
+void HYDROGUI_NamedObject::updateBy( SUIT_DataObject* theObj )
+{
+  HYDROGUI_NamedObject* aNamedObj = dynamic_cast<HYDROGUI_NamedObject*>( theObj );
+  if( !aNamedObj )
+    return;
+
+  myName = aNamedObj->myName;
+  myParentEntry = aNamedObj->myParentEntry;
+  myIcon = aNamedObj->myIcon;
+  myIsInOperation = aNamedObj->myIsInOperation;
+  setModified( true );
+}
+
+
+
+
+
+
 HYDROGUI_DropTargetObject::HYDROGUI_DropTargetObject( SUIT_DataObject* theParent,
                                             const QString&   theName,
                                             const QString&   theParentEntry,
index 6ffeaa1eed17ecf1a0e33710bbba4258d8174289..b35d60c01860e7aa79bb882a5b5e3fb339559d4e 100644 (file)
@@ -141,6 +141,8 @@ public:
    */
   bool isInOperation() const { return myIsInOperation; }
 
+  void updateBy( SUIT_DataObject* );
+
 protected:
   Handle(HYDROData_Entity) myData; ///< object from data model
   QString myParentEntry;
@@ -199,6 +201,8 @@ public:
    */
   bool isInOperation() const { return myIsInOperation; }
 
+  void updateBy( SUIT_DataObject* );
+
 private:
   QString myName; ///< name in the OB
   QString myParentEntry;
index f16708f3da20d4839370f3f66a217c84bc1d363b..60c8119fd8b96855aa78a28110e3d17655899942 100644 (file)
@@ -54,9 +54,10 @@ void HYDROGUI_DigueOp::startOperation()
 }
 
 bool HYDROGUI_DigueOp::processApply( int& theUpdateFlags,
-                                     QString& theErrorMsg )
+                                     QString& theErrorMsg,
+                                     QStringList& theBrowseObjectsEntries )
 {
-  if ( !HYDROGUI_ChannelOp::processApply( theUpdateFlags, theErrorMsg ) )
+  if ( !HYDROGUI_ChannelOp::processApply( theUpdateFlags, theErrorMsg, theBrowseObjectsEntries ) )
     return false;
 
   if ( !myIsEdit )
index 782626a789388e002eb18db4ff45a1946115142a..f5c434555423de87a6a132bf9d29adea856cb250 100644 (file)
@@ -37,7 +37,8 @@ protected:
 
   virtual void                 startOperation();
 
-  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                             QStringList& theBrowseObjectsEntries );
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
index 8e3f852269c927ff25d3d220ff6a4747b65b3493..d91522bbe093b1b6dc28b9f2b7e710c037949675 100644 (file)
@@ -68,7 +68,8 @@ void HYDROGUI_ExportCalculationOp::commitOperation()
 }
 
 bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
-                                                QString& theErrorMsg )
+                                                 QString& theErrorMsg,
+                                                 QStringList& theBrowseObjectsEntries )
 {
   // Get the selected calculation case
   Handle(HYDROData_CalculationCase) aCalculation = 
@@ -107,9 +108,10 @@ void HYDROGUI_ExportCalculationOp::onApply()
   QString anErrorMsg;
 
   bool aResult = false;
-  
+  QStringList aBrowseObjectsEntries;
+
   try {
-    aResult = processApply( anUpdateFlags, anErrorMsg );
+    aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
   }
   catch ( Standard_Failure )
   {
@@ -127,6 +129,7 @@ void HYDROGUI_ExportCalculationOp::onApply()
   if ( aResult ) {
     module()->update( anUpdateFlags );
     commit();
+    browseObjects( aBrowseObjectsEntries );
 
     // Show message box
     SUIT_MessageBox::information( module()->getApp()->desktop(),
index 1b42f3ffab6c04b1612b94e8fee79e36466a0d4b..7cbe6b2953436f3af7fc1b184cecbd50b1a5c120 100644 (file)
@@ -38,7 +38,8 @@ protected:
   virtual void               abortOperation();
   virtual void               commitOperation();
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
   virtual void               onApply();
 };
 
index d7b389e6bd0f3fee6e3287ec754888ee5302f01d..9c7ef5c2158b113852a2f805852a78d976b77d4d 100644 (file)
@@ -115,7 +115,8 @@ HYDROGUI_InputPanel* HYDROGUI_GeoreferencementOp::createInputPanel() const
 }
 
 bool HYDROGUI_GeoreferencementOp::processApply( int& theUpdateFlags,
-                                                QString& theErrorMsg )
+                                                QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries )
 {
   theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init;
 
@@ -249,8 +250,8 @@ bool HYDROGUI_GeoreferencementOp::store( QString& theErrorMsg )
         if ( !aProfile->IsValid() ) // Show the profile after it became valid
           aModule->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( aModule ), aProfile, true );
 
-        aProfile->SetLeftPoint( gp_XY( aGeoData.Xg, aGeoData.Yg ) );
-        aProfile->SetRightPoint( gp_XY( aGeoData.Xd, aGeoData.Yd ) );
+        aProfile->SetLeftPoint( gp_XY( aGeoData.Xg, aGeoData.Yg ), false );
+        aProfile->SetRightPoint( gp_XY( aGeoData.Xd, aGeoData.Yd ), false );
       } else {
         aProfile->Invalidate();
         aModule->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( aModule ), aProfile, false );
@@ -299,7 +300,8 @@ void HYDROGUI_GeoreferencementOp::setPanelData(
     HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData( aProfile->GetName() );
 
     gp_XY aFirstPoint, aLastPoint;
-    if ( aProfile->GetLeftPoint( aFirstPoint ) && aProfile->GetRightPoint( aLastPoint ) ) {
+    if ( aProfile->GetLeftPoint( aFirstPoint, false ) &&
+         aProfile->GetRightPoint( aLastPoint, false ) ) {
       aGeoData = 
         HYDROGUI_GeoreferencementDlg::ProfileGeoData( aGeoData.Name, 
                                                       aFirstPoint.X(), aFirstPoint.Y(),
index 6fa244c0b1f937c9b9f114cd36755af1c7459919..753df02cf2366c4fb85abc1c4ff6e1675a140f4a 100644 (file)
@@ -47,7 +47,8 @@ protected:
 
   virtual HYDROGUI_InputPanel*    createInputPanel() const;
 
-  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries );
 
 protected slots:
   void                            onModeActivated( const int theActualMode );
index 405f5f8948253fae783b0a6c4c4b01871f739292..b6c0fd02b4ab084efd0951c861606f00be946af1 100644 (file)
@@ -28,6 +28,7 @@
 #include "HYDROGUI_Shape.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_DataObject.h"
 
 #include <HYDROData_Bathymetry.h>
 #include <HYDROData_Iterator.h>
@@ -128,7 +129,8 @@ HYDROGUI_InputPanel* HYDROGUI_ImmersibleZoneOp::createInputPanel() const
 }
 
 bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags,
-                                              QString& theErrorMsg )
+                                              QString& theErrorMsg,
+                                              QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_ImmersibleZoneDlg* aPanel = ::qobject_cast<HYDROGUI_ImmersibleZoneDlg*>( inputPanel() );
   if ( !aPanel )
@@ -194,7 +196,11 @@ bool HYDROGUI_ImmersibleZoneOp::processApply( int& theUpdateFlags,
   closePreview();
 
   if( !myIsEdit )
+  {
     module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aZoneObj, true );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aZoneObj );
+    theBrowseObjectsEntries.append( anEntry );
+  }
 
   module()->setIsToUpdate( aZoneObj );
 
index 20cddaca872716a121a1411b66642be2afbe912b..d69d2a267cbf258223252a78527e11609e39b4cc 100644 (file)
@@ -44,7 +44,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
   virtual HYDROGUI_Shape*   getPreviewShape() const { return myPreviewPrs; };
 
index 60ae9a44e734a48dcf163936b55d69b888d50318..4e8280554f9db623297af278e8acff78c9f2b1ef 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_ImportBathymetryOp.h"
 
 #include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_ImportBathymetryDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Tool.h"
@@ -96,7 +97,8 @@ HYDROGUI_InputPanel* HYDROGUI_ImportBathymetryOp::createInputPanel() const
 }
 
 bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags,
-                                                QString& theErrorMsg )
+                                                QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_ImportBathymetryDlg* aPanel = 
     ::qobject_cast<HYDROGUI_ImportBathymetryDlg*>( inputPanel() );
@@ -196,6 +198,13 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags,
   }
 
   theUpdateFlags = UF_Model | UF_VTKViewer | UF_VTK_Init | UF_VTK_Forced;
+
+  if( !myIsEdit )
+  {
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aBathymetryObj );
+    theBrowseObjectsEntries.append( anEntry );
+  }
+
   return true;
 }
 
index cdf6a39b455a07a6dfc3328ea7f4ccb95a4336bd..5713e31d6637da09043ce70ac120f390a0dcee34 100644 (file)
@@ -43,7 +43,8 @@ protected:
 
   virtual HYDROGUI_InputPanel*    createInputPanel() const;
 
-  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries );
 
 
 protected slots:
index 7832f3b35dc8fe796c58453b128c849ffaff22b7..e8cb3e0328bd6e32262eb90c12842a415e2eab82 100644 (file)
@@ -23,7 +23,7 @@
 #include "HYDROGUI_ImportGeomObjectOp.h"
 
 #include "HYDROGUI_GeomObjectDlg.h"
-
+#include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Tool.h"
@@ -145,7 +145,8 @@ void HYDROGUI_ImportGeomObjectOp::commitOperation()
 }
 
 bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags,
-                                                QString& theErrorMsg )
+                                                QString& theErrorMsg,
+                                                QStringList& theBrowseObjectsEntries )
 {
   // Get active SalomeApp_Study
   SalomeApp_Study* aStudy = 
@@ -264,6 +265,8 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags,
       if ( anIsOk ) {
         anObject->Update();
         module()->setIsToUpdate( anObject );
+        QString aHydroObjEntry = HYDROGUI_DataObject::dataObjectEntry( anObject );
+        theBrowseObjectsEntries.append( aHydroObjEntry );
         theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
       }
     }
index b8830f9fa155d6a72c2b62d6420a15dc296a73b1..75d701281be4ebae92c3277988328ab88fbd1c67 100644 (file)
@@ -58,7 +58,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 protected slots:
   void                       onExternalOperationFinished( const QString&, const QString&, 
index 58ca39f3bcef537c399e36802742ff456b55668e..72f2ac2dcac15953dfdaa5a200062fc9cef8791a 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_ImportImageOp.h"
 
 #include "HYDROGUI_DataModel.h"
+#include <HYDROGUI_DataObject.h>
 #include "HYDROGUI_ImportImageDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_PrsImage.h"
@@ -344,7 +345,8 @@ bool HYDROGUI_ImportImageOp::checkPoints( const QPointF& thePointA,
 }
 
 bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
-                                           QString& theErrorMsg )
+                                           QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
 
@@ -446,7 +448,11 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
   if( myIsEdit )
     anImageObj = myEditedObject;
   else
+  {
     anImageObj = Handle(HYDROData_Image)::DownCast( doc()->CreateObject( KIND_IMAGE ) );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( anImageObj );
+    theBrowseObjectsEntries.append( anEntry );
+  }
 
   if( anImageObj.IsNull() )
     return false;
index 0acdd0bc9b7aa8ab8ffb01817f67747708ca3302..7a2c399c24e0179874322fac41fd5249fd45057e 100644 (file)
@@ -49,7 +49,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
   bool                       isReferenceCorrect() const;
 
 protected slots:
index 301e826d7e3088d3bf0baaf83ffec34057e64f55..432ef681db1e6de079183cce869e2fc5757be955 100644 (file)
@@ -23,7 +23,7 @@
 #include "HYDROGUI_ImportObstacleFromFileOp.h"
 
 #include "HYDROGUI_GeomObjectDlg.h"
-
+#include <HYDROGUI_DataObject.h>
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Tool.h"
@@ -98,7 +98,8 @@ void HYDROGUI_ImportObstacleFromFileOp::commitOperation()
 }
 
 bool HYDROGUI_ImportObstacleFromFileOp::processApply( int& theUpdateFlags,
-                                                      QString& theErrorMsg )
+                                                      QString& theErrorMsg,
+                                                      QStringList& theBrowseObjectsEntries )
 {
   QString aFileName;
   QString anObstacleName;
@@ -176,6 +177,10 @@ bool HYDROGUI_ImportObstacleFromFileOp::processApply( int& theUpdateFlags,
       anIsOk = true;
       module()->setIsToUpdate( anObstacle );
       theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+      QString anEntry = HYDROGUI_DataObject::dataObjectEntry( anObstacle );
+      theBrowseObjectsEntries.append( anEntry );
+
+
     } else {
       theErrorMsg = tr( "BAD_IMPORTED_OBSTACLE_FILE" ).arg( aFileName );
     }
index e264729300fe8044288b9db828f4bfef0d5fedab..b32d0dd0f54eebce0779d19cba833e1a440b2ef7 100644 (file)
@@ -42,7 +42,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
 
 private:
   SUIT_FileDlg* myFileDlg;
index 2e05ab91315e0ec50dbc81b7e49b457f92ddecaf..9d637fc351f0efe95469b212e243cdf46ba36e70 100644 (file)
@@ -81,6 +81,8 @@ void HYDROGUI_ImportProfilesOp::onApply()
   }
 
   QApplication::setOverrideCursor( Qt::WaitCursor );
+  QStringList aBrowseObjectsEntries;
+  //TODO: to implement the addition of imported profiles' entries to the list
 
   startDocOperation();
 
@@ -141,6 +143,7 @@ void HYDROGUI_ImportProfilesOp::onApply()
     commit();
 
     module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
+    browseObjects( aBrowseObjectsEntries );
   }
 
   QApplication::restoreOverrideCursor();
diff --git a/src/HYDROGUI/HYDROGUI_LocalCSDlg.cxx b/src/HYDROGUI/HYDROGUI_LocalCSDlg.cxx
new file mode 100644 (file)
index 0000000..2b0168b
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_LocalCSDlg.h>
+#include <QtxDoubleSpinBox.h>
+#include <QLayout>
+#include <QLabel>
+
+const double RANGE = 1E+10;
+const double STEP = 1.00;
+const double PREC = 2;
+
+HYDROGUI_LocalCSDlg::HYDROGUI_LocalCSDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+  QFrame* aFrame = new QFrame( mainFrame() );
+  addWidget( aFrame, 1 );
+
+  QGridLayout* aLayout = new QGridLayout( aFrame );
+
+  myLX = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
+  myLX->setValue( 0.0 );
+  myLY = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
+  myLY->setValue( 0.0 );
+
+  aLayout->addWidget( new QLabel( tr( "LX" ), aFrame ), 0, 0 );
+  aLayout->addWidget( myLX, 0, 1 );
+  aLayout->addWidget( new QLabel( tr( "LY" ), aFrame ), 1, 0 );
+  aLayout->addWidget( myLY, 1, 1 );
+  aLayout->setColumnStretch( 0, 0 );
+  aLayout->setColumnStretch( 1, 1 );
+  aLayout->setRowStretch( 2, 1 );
+}
+
+HYDROGUI_LocalCSDlg::~HYDROGUI_LocalCSDlg()
+{
+}
+
+double HYDROGUI_LocalCSDlg::GetLocalX() const
+{
+  return myLX->value();
+}
+
+double HYDROGUI_LocalCSDlg::GetLocalY() const
+{
+  return myLY->value();
+}
+
+void HYDROGUI_LocalCSDlg::SetLocalCS( double theLX, double theLY )
+{
+  myLX->setValue( theLX );
+  myLY->setValue( theLY );
+}
+
diff --git a/src/HYDROGUI/HYDROGUI_LocalCSDlg.h b/src/HYDROGUI/HYDROGUI_LocalCSDlg.h
new file mode 100644 (file)
index 0000000..f0fd13c
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_LocalCSDlg_H
+#define HYDROGUI_LocalCSDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QtxDoubleSpinBox;
+
+class HYDROGUI_LocalCSDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_LocalCSDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_LocalCSDlg();
+
+  double GetLocalX() const;
+  double GetLocalY() const;
+  void SetLocalCS( double theLX, double theLY );
+
+private:
+  QtxDoubleSpinBox* myLX;
+  QtxDoubleSpinBox* myLY;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_LocalCSOp.cxx b/src/HYDROGUI/HYDROGUI_LocalCSOp.cxx
new file mode 100644 (file)
index 0000000..228a9fa
--- /dev/null
@@ -0,0 +1,72 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_LocalCSOp.h>
+#include <HYDROGUI_LocalCSDlg.h>
+#include <HYDROData_Document.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <gp_Pnt2d.hxx>
+
+HYDROGUI_LocalCSOp::HYDROGUI_LocalCSOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+  setName( tr( "EDIT_LOCAL_CS" ) );
+}
+
+HYDROGUI_LocalCSOp::~HYDROGUI_LocalCSOp()
+{
+}
+
+void HYDROGUI_LocalCSOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast<HYDROGUI_LocalCSDlg*>( inputPanel() );
+  if ( !aPanel )
+    return;
+
+  double aLX, aLY;
+  doc()->GetLocalCS( aLX, aLY );
+  aPanel->SetLocalCS( aLX, aLY );
+}
+
+HYDROGUI_InputPanel* HYDROGUI_LocalCSOp::createInputPanel() const
+{
+  return new HYDROGUI_LocalCSDlg( module(), getName() );
+}
+
+bool HYDROGUI_LocalCSOp::processApply( int& theUpdateFlags,
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
+{
+  HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast<HYDROGUI_LocalCSDlg*>( inputPanel() );
+  if ( !aPanel )
+    return false;
+
+  double aLX = aPanel->GetLocalX();
+  double aLY = aPanel->GetLocalY();
+  doc()->SetLocalCS( aLX, aLY );
+
+  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+
+  return true;
+}
diff --git a/src/HYDROGUI/HYDROGUI_LocalCSOp.h b/src/HYDROGUI/HYDROGUI_LocalCSOp.h
new file mode 100644 (file)
index 0000000..6ec1be1
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_LocalCSOp_H
+#define HYDROGUI_LocalCSOp_H
+
+#include "HYDROGUI_Operation.h"
+
+class HYDROGUI_LocalCSOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_LocalCSOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_LocalCSOp();
+
+protected:
+  virtual void startOperation();
+
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
+};
+
+#endif
index 5e03c1293bc9f618117c01a2533da0bd0b0c711c..4aef231e67efa6884f518361b1249f7195367b76 100644 (file)
@@ -332,6 +332,18 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsDummyObject3D = false;
   bool anIsGroup = false;
   bool anIsObjectCanBeColored = false;
+  bool isRoot = false;
+
+  SUIT_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
+  SUIT_DataOwnerPtrList anOwners;
+  aSelectionMgr->selected( anOwners );
+  if( anIsObjectBrowser && anOwners.size()==1 )
+  {
+    QString anEntry = anOwners[0]->keyString();
+    LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( getApp()->activeStudy() );
+    if( aStudy )
+      isRoot = aStudy->isComponent( anEntry );
+  }
 
   // Check the selected GEOM objects (take into account the Object Browser only)
   if ( anIsObjectBrowser ) {
@@ -668,6 +680,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     theMenu->addSeparator();
     theMenu->addAction( action( CopyViewerPositionId ) );
   }
+
+  if( isRoot )
+    theMenu->addAction( action( EditLocalCSId ) );
 }
 
 void HYDROGUI_Module::update( const int flags )
@@ -1486,21 +1501,31 @@ void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
 
 void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* )
 {
-  double aX, aY, aZ;
+  double X, Y, Z;
   bool doShow = false;
   HYDROGUI_Displayer* aDisplayer = getDisplayer();
   if ( aDisplayer )
     aDisplayer->SaveCursorViewPosition( theViewWindow );
-    doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, aX, aY, aZ );
+    doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, X, Y, Z );
 
   if ( doShow )
   {
     // Show the coordinates in the status bar
     SUIT_Desktop* aDesktop = getApp()->desktop();
-    if ( aDesktop && aDesktop->statusBar() ) {
-      QString aXStr = HYDROGUI_Tool::GetCoordinateString( aX );
-      QString anYStr = HYDROGUI_Tool::GetCoordinateString( aY );
-      aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aXStr ).arg( anYStr ) );
+    if ( aDesktop && aDesktop->statusBar() )
+    {
+      gp_Pnt aWPnt( X, Y, Z );
+      int aStudyId = application()->activeStudy()->id();
+      HYDROData_Document::Document( aStudyId )->Transform( aWPnt, false );
+      double WX = aWPnt.X(), WY = aWPnt.Y();
+
+      QString aXStr = HYDROGUI_Tool::GetCoordinateString( X );
+      QString anYStr = HYDROGUI_Tool::GetCoordinateString( Y );
+      QString aWXStr = HYDROGUI_Tool::GetCoordinateString( WX );
+      QString aWYStr = HYDROGUI_Tool::GetCoordinateString( WY );
+      QString aMsg = tr( "COORDINATES_INFO" );
+      aMsg = aMsg.arg( aXStr ).arg( anYStr ).arg( aWXStr ).arg( aWYStr );
+      aDesktop->statusBar()->showMessage( aMsg );
     }
   }
 }
index 6c9d4ed9f7fd0cd0a0a3aa01e7253b1860e927ac..442b6e7d383eea1caf424124421c8c4d7390c704 100644 (file)
@@ -233,7 +233,8 @@ void HYDROGUI_Operation::closeInputPanel()
 }
 
 bool HYDROGUI_Operation::processApply( int& theUpdateFlags,
-                                       QString& theErrorMsg )
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
 {
   return false;
 }
@@ -290,10 +291,11 @@ void HYDROGUI_Operation::onApply()
   QString anErrorMsg;
 
   bool aResult = false;
-  
+  QStringList aBrowseObjectsEntries;
+
   try
   {
-    aResult = processApply( anUpdateFlags, anErrorMsg );
+    aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries );
   }
   catch ( Standard_Failure )
   {
@@ -313,6 +315,7 @@ void HYDROGUI_Operation::onApply()
     module()->update( anUpdateFlags );
     commitDocOperation();
     commit();
+    browseObjects( aBrowseObjectsEntries );
   }
   else
   {
@@ -377,4 +380,9 @@ QString HYDROGUI_Operation::getHelpContext() const
    return QString();
 }
 
-
+void HYDROGUI_Operation::browseObjects( const QStringList& theBrowseObjectsEntries )
+{
+  bool isApplyAndClose = true;
+  bool isOptimizedBrowse = true;
+  module()->getApp()->browseObjects( theBrowseObjectsEntries, isApplyAndClose, isOptimizedBrowse );
+}
index 05879abfc0ad272539dc1f61a88d7f58dd860160..44a77d875090dd480074c1a4d1835cd2ca30e223 100644 (file)
@@ -71,7 +71,8 @@ protected:
   virtual HYDROGUI_InputPanel*        createInputPanel() const;
   virtual void                        closeInputPanel();
 
-  virtual bool                        processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                        processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                                    QStringList& theBrowseObjectsEntries );
   virtual void                        processCancel();
 
   void                                startDocOperation();
@@ -85,6 +86,8 @@ protected:
   void                                printErrorMessage( const QString& theErrorMsg );
   void                                setPrintErrorMessage( const bool theIsPrint );
 
+  void                                browseObjects( const QStringList& theBrowseObjectsEntries );
+
 protected slots:
 
   virtual void                        onApply();
index a2d1f3f6111657421bb743793bbb90963e2c1818..8c0eb523701762af6cc5f2f476235e6d82be97c7 100644 (file)
@@ -56,6 +56,7 @@
 #include "HYDROGUI_BathymetryBoundsOp.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_ZLevelsOp.h"
+#include "HYDROGUI_LocalCSOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -172,6 +173,7 @@ void HYDROGUI_Module::createActions()
 
   createAction( SetColorId, "COLOR" );
   createAction( SetZLevelId, "ZLEVEL" );
+  createAction( EditLocalCSId, "EDIT_LOCAL_CS" );
 
   createAction( ShowId, "SHOW" );
   createAction( ShowOnlyId, "SHOW_ONLY" );
@@ -200,6 +202,7 @@ void HYDROGUI_Module::createMenus()
   createMenu( ImportBathymetryId, aHydroId, -1, -1 );
   createMenu( CreatePolylineId, aHydroId, -1, -1 );
   createMenu( CreatePolyline3DId, aHydroId, -1, -1 );
+  createMenu( EditLocalCSId, aHydroId, -1, -1 );
 
   int aNewProfileId = createMenu( tr( "MEN_DESK_PROFILE" ), aHydroId, -1 );
   createMenu( CreateProfileId, aNewProfileId, -1, -1 );
@@ -499,6 +502,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case SetZLevelId:
     anOp = new HYDROGUI_ZLevelsOp( aModule );
     break;
+  case EditLocalCSId:
+    anOp = new HYDROGUI_LocalCSOp( aModule );
+    break;
   case ShowId:
   case ShowOnlyId:
   case ShowAllId:
index a03a34d8748ae41347c6afa34ecae364eaf99756..d307d7a79aa485d9a51a980eb8cfdf6a6dd969a1 100644 (file)
@@ -105,6 +105,7 @@ enum OperationId
 
   SetColorId,
   SetZLevelId,
+  EditLocalCSId,
 
 };
 
index 8259381af1ee2d4767cf1fdd1a0842c11ec95a49..5c8ff2f2a0606a5e0a0912ad13562c6de37b83c8 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_Poly3DOp.h"
 
 #include "HYDROGUI_Module.h"
+#include <HYDROGUI_DataObject.h>
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_Poly3DDlg.h"
 #include "HYDROGUI_UpdateFlags.h"
@@ -108,7 +109,8 @@ void HYDROGUI_Poly3DOp::startOperation()
 }
 
 bool HYDROGUI_Poly3DOp::processApply( int& theUpdateFlags,
-                                         QString& theErrorMsg )
+                                      QString& theErrorMsg,
+                                      QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_Poly3DDlg* aPanel = dynamic_cast<HYDROGUI_Poly3DDlg*>( inputPanel() );
 
@@ -149,6 +151,8 @@ bool HYDROGUI_Poly3DOp::processApply( int& theUpdateFlags,
   else
   {
     aResult = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aResult );
+    theBrowseObjectsEntries.append( anEntry );
   }
 
   if( aResult.IsNull() )
index 572e179a43d9f31d4856928211726674cd02e589..d8fd16d507febc834ac925294acdce8950d8fb08 100644 (file)
@@ -40,7 +40,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 private:
   bool                       myIsEdit;
index 47b25a1233b9769803854985c2caa4e4ab4dbcff..a97508ef261b4073a2d426e0371419965d2c1580 100755 (executable)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_PolylineOp.h"
 
 #include "HYDROGUI_Module.h"
+#include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_PolylineDlg.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
@@ -211,7 +212,8 @@ HYDROGUI_InputPanel* HYDROGUI_PolylineOp::createInputPanel() const
 }
 
 bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
-                                        QString& theErrorMsg )
+                                        QString& theErrorMsg,
+                                        QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_PolylineDlg* aPanel = ::qobject_cast<HYDROGUI_PolylineDlg*>( inputPanel() );
   if ( !aPanel )
@@ -321,6 +323,8 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
   if( !myIsEdit )
   {
     module()->setObjectVisible( anActiveViewId, aPolylineObj, true );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aPolylineObj );
+    theBrowseObjectsEntries.append( anEntry );
   }  
 
   return true;
index d79d582dff2cd5f89f3b416494f20a39bf7262d5..25b2f8dc178b341e03bce0e443ca1f08c72e1862 100755 (executable)
@@ -49,7 +49,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 protected slots:
   void                       onEditorSelectionChanged();
index 53700cc00c215c311a563b32773585944f142182..609bdafdf98cca622bbcfa9f42d153daee9234d9 100644 (file)
@@ -24,7 +24,7 @@
 #include "HYDROGUI_ProfileDlg.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
-
+#include <HYDROGUI_DataObject.h>
 #include "HYDROData_Document.h"
 #include "HYDROData_Profile.h"
 #include "CurveCreator_Profile.hxx"
@@ -155,7 +155,8 @@ HYDROGUI_InputPanel* HYDROGUI_ProfileOp::createInputPanel() const
 }
 
 bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
-                                        QString& theErrorMsg )
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_ProfileDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileDlg*>( inputPanel() );
   if ( !aPanel )
@@ -239,6 +240,11 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   theUpdateFlags = UF_Model;
   if ( myIsEdit )
     theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+  else
+  {
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aProfileObj );
+    theBrowseObjectsEntries.append( anEntry );
+  }
 
   return true;
 }
index dd5e2370a7ed754baedc71ece1a77933b6d01bca..d93311a1da5cc6c40cd325da9e0c2e70af334d4e 100644 (file)
@@ -47,7 +47,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 private:
   void                       displayPreview();
index fa24977fa50617448340f140640f298382b402cf..464434b6b61f6363fa182368d84e8768c7c0e3f0 100644 (file)
@@ -118,7 +118,8 @@ void HYDROGUI_SetColorOp::startOperation()
 }
 
 bool HYDROGUI_SetColorOp::processApply( int& theUpdateFlags,
-                                        QString& theErrorMsg )
+                                        QString& theErrorMsg,
+                                        QStringList& theBrowseObjectsEntries )
 {
   if ( !myColorDlg || myEditedObject.IsNull() )
     return false;
index 9fce5bd1baf625add529393719403cb1ea2dc9a7..08729bd39551bc46c1dbdee83083bf08adedfbc1 100644 (file)
@@ -43,7 +43,8 @@ public:
 protected:
   virtual void startOperation();
 
-  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
 
 private:
   HYDROGUI_ColorDlg* myColorDlg;
index d855380c871baf64c856243a082a85fbf7d268f7..550deb933ce983a086f350241eece45b1430f94d 100644 (file)
@@ -307,6 +307,12 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer )
       gp_Pnt aPnt3( aRect.bottomRight().x(), aRect.bottomRight().y(), 0 );
       gp_Pnt aPnt4( aRect.bottomLeft().x(), aRect.bottomLeft().y(), 0 );
 
+      Handle_HYDROData_Document aDoc = HYDROData_Document::Document( anImageObj->Label() );
+      aDoc->Transform( aPnt1, true );
+      aDoc->Transform( aPnt2, true );
+      aDoc->Transform( aPnt3, true );
+      aDoc->Transform( aPnt4, true );
+
       TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
       TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge( aPnt2, aPnt3 ).Edge();
       TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge( aPnt3, aPnt4 ).Edge();
index cabf8c677b047fd4c88830eb661c316e840234ae..ca39e32e83dffbae41c6a5a3f9286a7b8db9a7c7 100755 (executable)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_StreamOp.h"
 
 #include "HYDROGUI_Module.h"
+#include <HYDROGUI_DataObject.h>
 #include "HYDROGUI_Shape.h"
 #include "HYDROGUI_StreamDlg.h"
 #include "HYDROGUI_Tool.h"
@@ -184,7 +185,8 @@ HYDROGUI_InputPanel* HYDROGUI_StreamOp::createInputPanel() const
 }
 
 bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
-                                      QString& theErrorMsg )
+                                      QString& theErrorMsg,
+                                      QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
   if ( !aPanel )
@@ -260,6 +262,8 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
   // Show the object in case of creation mode of the operation
   if( !myIsEdit ) {
     module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), myEditedObject, true );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( myEditedObject );
+    theBrowseObjectsEntries.append( anEntry );
   }
 
   module()->setIsToUpdate( myEditedObject );
index 1173b67989c714dd07f9f106897e5ac3e74c4658..300e269eba799ac1c0c5efe921514c81a338796a 100755 (executable)
@@ -46,7 +46,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                             QStringList& theBrowseObjectsEntries );
 
   virtual bool                 isToAbortOnApply() const { return false; }
 
index 5c45c8baa7e4d5deb346ce5dea38db58d3e887bf..5252cb2fb2b45d02ba8b53c3930604cbe5504c3e 100644 (file)
@@ -709,5 +709,8 @@ QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Docu
 
 QString HYDROGUI_Tool::GetCoordinateString( const double theNumber )
 {
-  return QString::number( theNumber, 'f', 2 );
-}
\ No newline at end of file
+  //return QString::number( theNumber, 'f', 2 );
+  static QLocale aLocale( QLocale::English, QLocale::France );
+  return aLocale.toString( theNumber, 'f', 2 );
+}
+
index 7275fe0a4f0158db1b0fb905489429022fb148dd..27be271fa85e18bb665df5bdf5fa6a842d100a7b 100644 (file)
@@ -101,7 +101,8 @@ HYDROGUI_InputPanel* HYDROGUI_TranslateObstacleOp::createInputPanel() const
 }
 
 bool HYDROGUI_TranslateObstacleOp::processApply( int& theUpdateFlags,
-                                                 QString& theErrorMsg )
+                                                 QString& theErrorMsg,
+                                                 QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_TranslateObstacleDlg* aPanel = ::qobject_cast<HYDROGUI_TranslateObstacleDlg*>( inputPanel() );
   if ( !aPanel || myEditedObject.IsNull() ) {
index d2fa5e683f40d2af219e85c50533e3845a411e2b..c005d78f936a7c081e00a96bb32ffa03096d171a 100644 (file)
@@ -46,7 +46,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                             QStringList& theBrowseObjectsEntries );
 
   virtual HYDROGUI_Shape*   getPreviewShape() const { return myPreviewPrs; };
 
index f57f39c0d181620bb66d20856170486dae44a941..990673a64a649ebcf7070fc41513c59d85d7f571 100644 (file)
@@ -26,6 +26,7 @@
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_TwoImagesDlg.h"
 #include "HYDROGUI_UpdateFlags.h"
+#include <HYDROGUI_DataObject.h>
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
@@ -151,7 +152,8 @@ void HYDROGUI_TwoImagesOp::onAlreadySelected( const QString& theName )
 }
 
 bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags,
-                                         QString& theErrorMsg )
+                                         QString& theErrorMsg,
+                                         QStringList& theBrowseObjectsEntries )
 {
   HYDROGUI_TwoImagesDlg* aPanel = dynamic_cast<HYDROGUI_TwoImagesDlg*>( inputPanel() );
 
@@ -208,6 +210,8 @@ bool HYDROGUI_TwoImagesOp::processApply( int& theUpdateFlags,
     anOperator = aFactory->Operator( anOperatorName );
 
     aResult = aFactory->CreateImage( doc(), anOperator );
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aResult );
+    theBrowseObjectsEntries.append( anEntry );
   }
 
   if( aResult.IsNull() || !anOperator )
index 095d47f100cae27538e2b148d3040e45bbcacec7..274224a19c3d721fed166549fb86451be2a64558 100644 (file)
@@ -43,7 +43,8 @@ protected:
 
   virtual HYDROGUI_InputPanel* createInputPanel() const;
 
-  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
 
 protected slots:
   /** Show warning if the name has already been selected 
index 1b9fba2d2251bcedcfc071f5792bb450c057ad1c..3f7c1eaf732e55ca72ae2f5dbaee49911b2edf11 100644 (file)
@@ -95,7 +95,8 @@ void HYDROGUI_ZLevelsOp::startOperation()
 /**
 */
 bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,
-                                       QString& theErrorMsg )
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
 {
   bool aRes = false;
 
index 7bb84ebc231bd979a708a7250d8c992df7b60fc1..7d43033bad2b0a3236848299403f2cd314ba2cf6 100644 (file)
@@ -43,7 +43,8 @@ public:
 
 protected:
   virtual void startOperation();
-  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
+                             QStringList& theBrowseObjectsEntries );
   virtual void processCancel();
 
 private:
index 4dbe13fbc5298a279bffa351e91dae13d44d2c45..574b4ddabb2eb29bb0f6e5c2a2e6650da74b4b87 100644 (file)
@@ -195,7 +195,7 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
     </message>
     <message>
       <source>COORDINATES_INFO</source>
-      <translation>X: %1, Y: %2</translation>
+      <translation>Local CS: (%1, %2); Global CS: (%3, %4)</translation>
     </message>
     <message>
       <source>POLYLINE3D_POLYLINE</source>
@@ -830,6 +830,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_ZLEVEL</source>
       <translation>Change layer order</translation>
     </message>
+    <message>
+      <source>DSK_EDIT_LOCAL_CS</source>
+      <translation>Change local CS</translation>
+    </message>
     <message>
       <source>MEN_CREATE_CALCULATION</source>
       <translation>Create calculation case</translation>
@@ -1078,6 +1082,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_ZLEVEL</source>
       <translation>Change layer order</translation>
     </message>
+    <message>
+      <source>MEN_EDIT_LOCAL_CS</source>
+      <translation>Change local CS</translation>
+    </message>
     <message>
       <source>STB_CREATE_CALCULATION</source>
       <translation>Create calculation case</translation>
@@ -1298,6 +1306,10 @@ Would you like to remove all references from the image?</translation>
       <source>STB_ZLEVEL</source>
       <translation>Change layer order</translation>
     </message>
+    <message>
+      <source>STB_EDIT_LOCAL_CS</source>
+      <translation>Change local CS</translation>
+    </message>
   </context>
   
   <context>
@@ -1620,6 +1632,14 @@ Would you like to remove all references from the image?</translation>
     </message>
   </context>
 
+  <context>
+    <name>HYDROGUI_LocalCSOp</name>
+    <message>
+      <source>EDIT_LOCAL_CS</source>
+      <translation>Local CS transformation</translation>
+    </message>
+  </context>
+
   <context>
     <name>HYDROGUI_ImportGeomObjectOp</name>
     <message>
index 56c7e5fdae0e95ee94589ec3a402a1bfc4351f3f..c2a71f9404956ac20ae7544cc359bac126ef5869 100644 (file)
@@ -298,6 +298,8 @@ public:
   HYDROData_SequenceOfObjects FindObjectsByNames( const QStringList& theNames,
                                                   const ObjectKind   theKind = KIND_UNKNOWN );
 
+  void SetLocalCS( double, double );
+
 protected:
 
   //! Creates new document: private because "Document" method must be used instead of direct creation.