From: asl Date: Thu, 7 Aug 2014 12:00:15 +0000 (+0000) Subject: refs #417: showing new objects X-Git-Tag: master_20140820~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e7225e329739e01faed6682de0bc83cf84c28de6;p=modules%2Fhydro.git refs #417: showing new objects --- diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 9bdfd1cf..dab80218 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -466,14 +466,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"; @@ -508,5 +508,5 @@ bool HYDROData_Bathymetry::CreateBoundaryPolyline() const aResult->AddPoint( 0, HYDROData_IPolyline::Point( Xmax, Ymin ) ); aResult->Update(); - return true; + return aResult; } diff --git a/src/HYDROData/HYDROData_Bathymetry.h b/src/HYDROData/HYDROData_Bathymetry.h index a5dfb35b..72ef4139 100644 --- a/src/HYDROData/HYDROData_Bathymetry.h +++ b/src/HYDROData/HYDROData_Bathymetry.h @@ -6,6 +6,7 @@ class QFile; class gp_XYZ; +class Handle_HYDROData_PolylineXY; DEFINE_STANDARD_HANDLE(HYDROData_Bathymetry, HYDROData_IAltitudeObject) @@ -112,7 +113,7 @@ public: */ HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName ); - HYDRODATA_EXPORT bool CreateBoundaryPolyline() const; + HYDRODATA_EXPORT Handle_HYDROData_PolylineXY CreateBoundaryPolyline() const; private: diff --git a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx index cf042190..1dd589b7 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include 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" ); diff --git a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.h b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.h index 00b92d56..7586c17d 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.h +++ b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.h @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 71f47ea7..954e789f 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -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( 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 { diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index 829c01bb..81c19c61 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx index 0a622785..e820deb6 100644 --- a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_ChannelOp.h" #include "HYDROGUI_DataModel.h" +#include #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( 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 ); diff --git a/src/HYDROGUI/HYDROGUI_ChannelOp.h b/src/HYDROGUI/HYDROGUI_ChannelOp.h index 798d7a89..bb1c5acb 100644 --- a/src/HYDROGUI/HYDROGUI_ChannelOp.h +++ b/src/HYDROGUI/HYDROGUI_ChannelOp.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_DigueOp.cxx b/src/HYDROGUI/HYDROGUI_DigueOp.cxx index f16708f3..60c8119f 100644 --- a/src/HYDROGUI/HYDROGUI_DigueOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DigueOp.cxx @@ -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 ) diff --git a/src/HYDROGUI/HYDROGUI_DigueOp.h b/src/HYDROGUI/HYDROGUI_DigueOp.h index 782626a7..f5c43455 100644 --- a/src/HYDROGUI/HYDROGUI_DigueOp.h +++ b/src/HYDROGUI/HYDROGUI_DigueOp.h @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index 8e3f8522..d91522bb 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -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(), diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h index 1b42f3ff..7cbe6b29 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h @@ -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(); }; diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx index d7b389e6..3b67d475 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h index 6fa244c0..753df02c 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h @@ -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 ); diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx index 405f5f89..b6c0fd02 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx @@ -28,6 +28,7 @@ #include "HYDROGUI_Shape.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_UpdateFlags.h" +#include "HYDROGUI_DataObject.h" #include #include @@ -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( 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 ); diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.h b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.h index 20cddaca..d69d2a26 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.h +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.h @@ -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; }; diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx index 60ae9a44..4e828055 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx @@ -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( 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; } diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h index cdf6a39b..5713e31d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h @@ -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: diff --git a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx index 7832f3b3..e8cb3e03 100644 --- a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx @@ -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; } } diff --git a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h index b8830f9f..75d70128 100644 --- a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.h @@ -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&, diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index 58ca39f3..72f2ac2d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_ImportImageOp.h" #include "HYDROGUI_DataModel.h" +#include #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; diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.h b/src/HYDROGUI/HYDROGUI_ImportImageOp.h index 0acdd0bc..7a2c399c 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.h @@ -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: diff --git a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx index 301e826d..432ef681 100644 --- a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx @@ -23,7 +23,7 @@ #include "HYDROGUI_ImportObstacleFromFileOp.h" #include "HYDROGUI_GeomObjectDlg.h" - +#include #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 ); } diff --git a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.h b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.h index e2647293..b32d0dd0 100644 --- a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.h @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx b/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx index 2e05ab91..9d637fc3 100644 --- a/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportProfilesOp.cxx @@ -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_Operation.cxx b/src/HYDROGUI/HYDROGUI_Operation.cxx index 6c9d4ed9..442b6e7d 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.cxx +++ b/src/HYDROGUI/HYDROGUI_Operation.cxx @@ -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 ); +} diff --git a/src/HYDROGUI/HYDROGUI_Operation.h b/src/HYDROGUI/HYDROGUI_Operation.h index 05879abf..44a77d87 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.h +++ b/src/HYDROGUI/HYDROGUI_Operation.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx index 8259381a..5c8ff2f2 100644 --- a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx +++ b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_Poly3DOp.h" #include "HYDROGUI_Module.h" +#include #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( 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() ) diff --git a/src/HYDROGUI/HYDROGUI_Poly3DOp.h b/src/HYDROGUI/HYDROGUI_Poly3DOp.h index 572e179a..d8fd16d5 100644 --- a/src/HYDROGUI/HYDROGUI_Poly3DOp.h +++ b/src/HYDROGUI/HYDROGUI_Poly3DOp.h @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index 47b25a12..a97508ef 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -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( 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; diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.h b/src/HYDROGUI/HYDROGUI_PolylineOp.h index d79d582d..25b2f8dc 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.h +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index 53700cc0..609bdafd 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -24,7 +24,7 @@ #include "HYDROGUI_ProfileDlg.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_UpdateFlags.h" - +#include #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( 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; } diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.h b/src/HYDROGUI/HYDROGUI_ProfileOp.h index dd5e2370..d93311a1 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.h +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.h @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx index fa24977f..464434b6 100644 --- a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_SetColorOp.h b/src/HYDROGUI/HYDROGUI_SetColorOp.h index 9fce5bd1..08729bd3 100644 --- a/src/HYDROGUI/HYDROGUI_SetColorOp.h +++ b/src/HYDROGUI/HYDROGUI_SetColorOp.h @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_StreamOp.cxx b/src/HYDROGUI/HYDROGUI_StreamOp.cxx index cabf8c67..ca39e32e 100755 --- a/src/HYDROGUI/HYDROGUI_StreamOp.cxx +++ b/src/HYDROGUI/HYDROGUI_StreamOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_StreamOp.h" #include "HYDROGUI_Module.h" +#include #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( 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 ); diff --git a/src/HYDROGUI/HYDROGUI_StreamOp.h b/src/HYDROGUI/HYDROGUI_StreamOp.h index 1173b679..300e269e 100755 --- a/src/HYDROGUI/HYDROGUI_StreamOp.h +++ b/src/HYDROGUI/HYDROGUI_StreamOp.h @@ -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; } diff --git a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx index 7275fe0a..27be271f 100644 --- a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx @@ -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( inputPanel() ); if ( !aPanel || myEditedObject.IsNull() ) { diff --git a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.h b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.h index d2fa5e68..c005d78f 100644 --- a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.h +++ b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.h @@ -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; }; diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx index f57f39c0..990673a6 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx @@ -26,6 +26,7 @@ #include "HYDROGUI_Tool.h" #include "HYDROGUI_TwoImagesDlg.h" #include "HYDROGUI_UpdateFlags.h" +#include #include #include @@ -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( 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 ) diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.h b/src/HYDROGUI/HYDROGUI_TwoImagesOp.h index 095d47f1..274224a1 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesOp.h +++ b/src/HYDROGUI/HYDROGUI_TwoImagesOp.h @@ -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 diff --git a/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx b/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx index 1b9fba2d..3f7c1eaf 100644 --- a/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx @@ -95,7 +95,8 @@ void HYDROGUI_ZLevelsOp::startOperation() /** */ bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags, - QString& theErrorMsg ) + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) { bool aRes = false; diff --git a/src/HYDROGUI/HYDROGUI_ZLevelsOp.h b/src/HYDROGUI/HYDROGUI_ZLevelsOp.h index 7bb84ebc..7d43033b 100644 --- a/src/HYDROGUI/HYDROGUI_ZLevelsOp.h +++ b/src/HYDROGUI/HYDROGUI_ZLevelsOp.h @@ -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: