]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
fix broken selection after polyline edit: see GEOM_Displayer
authorPaul RASCLE <paul.rascle@openfields.fr>
Mon, 14 Sep 2020 22:38:14 +0000 (00:38 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:08:09 +0000 (17:08 +0100)
src/HYDROGUI/HYDROGUI_Operation.cxx
src/HYDROGUI/HYDROGUI_Operation.h
src/HYDROGUI/HYDROGUI_PolylineOp.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx

index 90340106c13cf39ad60f30c967a1165ebc7f114f..0a17207817043a4c442d7d58e12b23046d89b821 100644 (file)
@@ -409,12 +409,14 @@ void HYDROGUI_Operation::onApplyAndClose()
 {
   myIsApplyAndClose = true;
   apply();
+  restoreOCCViewerSelection();
 }
 
 void HYDROGUI_Operation::onApply()
 {
   myIsApplyAndClose = false;
   apply();
+  restoreOCCViewerSelection();
 }
 
 void HYDROGUI_Operation::setPrintErrorMessage( const bool theIsPrint )
@@ -445,8 +447,36 @@ void HYDROGUI_Operation::onCancel()
   if ( myPanel )
     abortOperation();
   myIsApplyAndClose = true;
+  restoreOCCViewerSelection();
 }
 
+void HYDROGUI_Operation::restoreOCCViewerSelection()
+{
+  DEBTRACE("restoreOCCViewerSelection");
+  LightApp_Application* anApp = module()->getApp();
+  LightApp_SelectionMgr* sm = anApp->selectionMgr();
+  if(sm)
+  {
+         sm->clearFilters(); // see GEOM_Displayer::GlobalSelection
+  }
+  OCCViewer_ViewManager* aViewManager =
+      dynamic_cast<OCCViewer_ViewManager*>( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
+  if( aViewManager )
+  {
+       if( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
+       {
+         Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+         if( !aCtx.IsNull() )
+         {
+                 DEBTRACE("AIScontext " << aCtx.get());
+                 aCtx->Deactivate();
+                 aCtx->Activate(0);
+                 aCtx->SetAutomaticHilight( Standard_True );
+                 aCtx->RemoveFilters();
+         }
+       }
+  }
+}
 void HYDROGUI_Operation::onHelp()
 {
    emit helpContextModule( getHelpComponent(), getHelpFile(), getHelpContext() );
index 11e38511912cecd5891e3c36fc093089bd6e61b2..92ccf50cf3546d94e7bb15c8ddda031b5d20fd45 100644 (file)
@@ -130,6 +130,8 @@ protected:
    */
   virtual void                        apply();
 
+  virtual void                        restoreOCCViewerSelection();
+
 private:
 
   HYDROGUI_Module*                    myModule;
index 9c3ffd7e27e52ea4b7fee172becc8913b0439f4f..f8f3fe2f3ca4edc03287d5fde8b4bcd05e97cbed 100755 (executable)
@@ -51,6 +51,9 @@
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Wire.hxx>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 //static int ZValueIncrement = 0;
 static const double HYDROGUI_MAXIMAL_DEFLECTION = 1e-2;
 
@@ -113,6 +116,7 @@ void HYDROGUI_PolylineOp::updatePreviewZLayer( int theLayer )
 
 void HYDROGUI_PolylineOp::startOperation()
 {
+  DEBTRACE("startOperation");
   if( myIsEdit )
   {
     if ( isApplyAndClose() )
@@ -276,6 +280,7 @@ void HYDROGUI_PolylineOp::abortOperation()
 
 void HYDROGUI_PolylineOp::commitOperation()
 {
+  DEBTRACE("commitOperation");
   if ( isApplyAndClose() )
   {
     restoreCursor();
@@ -301,6 +306,7 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
                                         QString& theErrorMsg,
                                         QStringList& theBrowseObjectsEntries )
 {
+  DEBTRACE("processApply");
   HYDROGUI_PolylineDlg* aPanel = ::qobject_cast<HYDROGUI_PolylineDlg*>( inputPanel() );
   if ( !aPanel )
     return false;
index 96a2fd197205bdabc2bc9e74f0ae9fc3633d7901..548c2da77dd2cfebaf21fa74fd35043f2de2ce37 100644 (file)
@@ -699,7 +699,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
 
 void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
 {
-  DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode);
+  DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode << " AIScontext " << myContext.get());
 //   if ( myContext->HasOpenedContext() && mySelectionMode > 0 )
 //     myContext->CloseLocalContext();