]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Tue, 10 Jun 2008 13:19:53 +0000 (13:19 +0000)
committervsv <vsv@opencascade.com>
Tue, 10 Jun 2008 13:19:53 +0000 (13:19 +0000)
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_ClippingPlaneMgr.cxx
src/VISUGUI/VisuGUI_ClippingPlaneMgr.h
src/VISUGUI/VisuGUI_Sweep.cxx

index dc9c0784b596afa7f7b1d32a916a2bb867ad1177..306fb924c2f8a54d9ff6255a0504b44670697a13 100644 (file)
@@ -3411,6 +3411,14 @@ Please, refer to the documentation.</translation>
             <source>BTN_IMPORT</source>
             <translation>Import...</translation>
         </message>
+        <message>
+            <source>IMPORT_TITLE</source>
+            <translation>Import from...</translation>
+        </message>
+        <message>
+            <source>SELECT_VIEW</source>
+            <translation>Select View window:</translation>
+        </message>
     </context>
     <context>
         <name>VisuGUI_SegmentationMgr</name>
index b101ecff9405e4fe59d17465215b2ba149d793cc..dc89ef24b2fc71d14afee2b2afa0829e4421c19b 100644 (file)
@@ -1642,7 +1642,8 @@ void
 VisuGUI
 ::OnSweep()
 {
-  mySweep->show();
+  mySweep->toggleViewAction()->setChecked(true);
+  mySweep->onPlay(true);
 }
 
 //----------------------------------------------------------------------------
@@ -2644,7 +2645,8 @@ VisuGUI
   mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0" );
 
   // 3D presentations commands
-  QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
+  QString aPrsType    = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
+  //QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
   QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
   QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
   QString aSurfType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
@@ -2655,6 +2657,7 @@ VisuGUI
 
   aRule = "selcount=1";
   mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
+  aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
 
   // "Representation" submenu
   QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
index c75610f6d6147ba9462d477881a30050cd0fe0c4..7c0f47038867938204ca8c57a7a19a13fa79f4e6 100644 (file)
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewExtender.h"
 
 #include "VISU_Actor.h"
 
 #include <LightApp_Application.h>
 #include <SUIT_Desktop.h>
 #include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
 #include <QtxDoubleSpinBox.h>
 #include <SALOME_Actor.h>
 
 #include <VTKViewer_Utilities.h>
+#include <SalomeApp_Application.h>
+#include <SVTK_ViewModel.h>
 
 #include <QVBoxLayout>
 #include <QHBoxLayout>
@@ -46,6 +50,7 @@
 #include <QComboBox>
 #include <QCheckBox>
 #include <QPushButton>
+#include <QInputDialog>
 
 #include <vtkMath.h>
 #include <vtkPlaneSource.h>
@@ -158,6 +163,7 @@ VisuGUI_ClippingPlaneMgr::VisuGUI_ClippingPlaneMgr(VisuGUI* theModule,
 
   myShowPreview = new QCheckBox(tr("CHK_SHOW_PREVIEW"), this);
   myShowPreview->setCheckState(Qt::Checked);
+  connect(myShowPreview, SIGNAL(stateChanged(int)), this, SLOT(onShowPreview(int)));
   aManageBox->addWidget(myShowPreview);
 
   // Dialog buttons
@@ -590,6 +596,71 @@ void VisuGUI_ClippingPlaneMgr::setDirection(double theVal[3])
 //****************************************************************
 void VisuGUI_ClippingPlaneMgr::onImportPlane()
 {
+  SalomeApp_Application* aApp = myModule->getApp();
+  if (!aApp) return;
+  
+  ViewManagerList aManagers;
+  aApp->viewManagers(SVTK_Viewer::Type(), aManagers);
+  
+  QStringList aTitles;
+  QList<SUIT_ViewWindow*> aViews;
+  for (int i = 0; i < aManagers.size(); i++) {
+    SUIT_ViewManager* aVMgr = aManagers.at(i);
+    QVector<SUIT_ViewWindow*> aWinList = aVMgr->getViews();
+    for (int j = 0; j < aWinList.size(); j++) {
+      if (aWinList[j] != myViewWindow) {
+       aViews.append(aWinList[j]);
+       aTitles.append(aWinList[j]->windowTitle());
+      }
+    }
+  }
+  if (aTitles.size() == 0) return;
+  
+  bool aOk = false;
+  QString aSelected = QInputDialog::getItem(this, tr("IMPORT_TITLE"), 
+                                           tr("SELECT_VIEW"), aTitles, 
+                                           0, false, &aOk);
+  if (aOk) {
+    int aId = aTitles.indexOf(aSelected);
+    if (aId < 0) return;
+    SVTK_ViewWindow* aWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(aId));
+    if (!aWindow) return;
+    
+    VisuGUI_ViewExtender* aExtender = (VisuGUI_ViewExtender*) myModule->getViewExtender();
+    VisuGUI_SegmentationMgr* aSegmentMgr = aExtender->getSegmentationMgr(aWindow);
+    if (!aSegmentMgr) return;
+    const QListOfPlanes& aPlanes = aSegmentMgr->getPlanes();
+    for (int i = 0; i < aPlanes.size(); i++) {
+      const PlaneDef& aSource = aPlanes.at(i);
+      PlaneDef aDest;
+      aDest.plane = CutPlaneFunction::New();
+      aDest.isAuto = aSource.isAuto;
+      aDest.name = aSource.name;
+      aDest.plane->SetOrigin(aSource.plane->GetOrigin());
+      aDest.plane->SetNormal(aSource.plane->GetNormal());
+      
+      myPlanes.append(aDest);
+      PreviewPlane* aPreview = new PreviewPlane(myViewWindow, aDest, myBounds);
+      aPreview->setVisible(myShowPreview->checkState() == Qt::Checked);
+      myPreviewList.append(aPreview);
+      
+      myPlanesList->addItem(aDest.name);
+      myMethodTab->setEnabled(true);
+      
+    }
+    myPlanesList->setCurrentRow(myPlanes.size() - 1);
+    myViewWindow->getRenderer()->ResetCameraClippingRange();
+    myViewWindow->Repaint();
+  }
+}
+
+//****************************************************************
+void VisuGUI_ClippingPlaneMgr::onShowPreview(int theVal)
+{
+  bool isVisible = (theVal == Qt::Checked);
+  for (int i = 0; i < myPreviewList.size(); i++)
+    myPreviewList.at(i)->setVisible(isVisible);
+  myViewWindow->Repaint();
 }
 
 
@@ -614,3 +685,4 @@ void VisuGUI_ClippingPlaneMgr::onHelp()
   }
 }
 
+
index b6c57ba10e1e5d66b5d81695683881ebd45dd4cd..013d646a417cf86fee3167f99543f6b35b079032 100644 (file)
@@ -74,6 +74,7 @@ private slots:
   void onDeletePlane();
   void onValueChanged();
   void onImportPlane();
+  void onShowPreview(int);
 
  private:
   QWidget* createVectorTab(QWidget* theParent);
index 11c0569bee13cfadf62ac56ad503744fdad4e3bb..1f457d7ca80720b67f445a6bb691ebc7ffec7098 100644 (file)
@@ -234,6 +234,7 @@ VisuGUI_Sweep::VisuGUI_Sweep( VisuGUI* theModule,
   aQtxDockWidget->setVisible( false );
 
   connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) );
+  connect( myToggleViewAction, SIGNAL( toggled( bool ) ), aQtxDockWidget, SLOT( setVisible( bool ) ) );
 
   //----------------------------------------------------------------------------
   myTimer = new QTimer( this );
@@ -496,6 +497,9 @@ void VisuGUI_Sweep::onStop( bool on )
 
   myNextButton->setEnabled( !on );
   myLastButton->setEnabled( !on );
+
+  if (myViewWindow)
+    myViewWindow->Repaint();
 }