]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0023097: EDF GEOM: [HYDRO 513] Fit only on selected objects
authormpa <mpa@opencascade.com>
Tue, 19 May 2015 13:22:24 +0000 (16:22 +0300)
committermpa <mpa@opencascade.com>
Tue, 19 May 2015 13:22:24 +0000 (16:22 +0300)
30 files changed:
doc/salome/gui/images/vtkviewer_toolbar.png
doc/salome/gui/input/occ_3d_viewer.doc
doc/salome/gui/input/vtk_3d_viewer.doc
src/OCCViewer/CMakeLists.txt
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/OCCViewer/resources/OCCViewer_images.ts
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/OCCViewer_msg_fr.ts
src/OCCViewer/resources/OCCViewer_msg_ja.ts
src/OCCViewer/resources/occ_view_fitselection.png [new file with mode: 0644]
src/SVTK/SVTK_Renderer.cxx
src/SVTK/SVTK_Renderer.h
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h
src/SVTK/resources/SVTK_msg_en.ts
src/SVTK/resources/SVTK_msg_fr.ts
src/SVTK/resources/SVTK_msg_ja.ts
src/VTKViewer/CMakeLists.txt
src/VTKViewer/VTKViewer_InteractorStyle.cxx
src/VTKViewer/VTKViewer_InteractorStyle.h
src/VTKViewer/VTKViewer_Utilities.cxx
src/VTKViewer/VTKViewer_Utilities.h
src/VTKViewer/VTKViewer_ViewWindow.cxx
src/VTKViewer/VTKViewer_ViewWindow.h
src/VTKViewer/resources/VTKViewer_images.ts
src/VTKViewer/resources/VTKViewer_msg_en.ts
src/VTKViewer/resources/VTKViewer_msg_fr.ts
src/VTKViewer/resources/VTKViewer_msg_ja.ts
src/VTKViewer/resources/vtk_view_fitselection.png [new file with mode: 0644]

index e97246d60d4cf7b3e076661fb78483fb337b94b9..6ceb9836fff47e50d6199825b3fcbe27ee6688a3 100644 (file)
Binary files a/doc/salome/gui/images/vtkviewer_toolbar.png and b/doc/salome/gui/images/vtkviewer_toolbar.png differ
index d372e793b8412cae23d6c480c3e71632f7325d77..e80bab975bc6524c31022b85afd27a851bb7a418 100644 (file)
@@ -63,6 +63,11 @@ representing all displayed objects in the visible area.
 the contents of a frame drawn with pressed left mouse button.
 <hr>
 
+\image html occ_view_fitselection.png
+
+<b>Fit selection</b> - fits view contents to the current selection.
+<hr>
+
 \image html occ_view_zoom.png
 
 <b>Zoom</b> - allows to zoom in and out.
index 3e50278806c7bd655a139fb4893efe8c120e36df..8923176fa70f8bef686f20c7a2098e678fdc9a3f 100644 (file)
@@ -63,6 +63,11 @@ the Viewer boundaries.
 the contents of a frame drawn with pressed left mouse button.
 <hr>
 
+\image html vtk_view_fitselection.png
+
+<b>Fit selection</b> - fits view contents to the current selection.
+<hr>
+
 \image html vtk_view_zoom.png
 
 <b>Zoom</b> - allows to zoom in and out.
@@ -123,12 +128,12 @@ These buttons orientate the scene strictly about coordinate axes:
 
 \image html vtk_view_anticlockwise.png
 
-<b>Rotate counter-clockwise</b> - rotates view 90° counter-clockwise.
+<b>Rotate counter-clockwise</b> - rotates view 90 counter-clockwise.
 <hr>
 
 \image html vtk_view_clockwise.png
 
-<b>Rotate clockwise</b> - rotates view 90° clockwise.
+<b>Rotate clockwise</b> - rotates view 90 clockwise.
 <hr>
 
 \image html vtk_view_reset.png
index eefdd3f503f7d6d9127130344fd87cf2552884a1..4afead732a202cc8e4a7aec8526ebf8d3c222e05 100755 (executable)
@@ -115,6 +115,7 @@ SET(_other_RESOURCES
   resources/occ_view_clone.png
   resources/occ_view_fitall.png
   resources/occ_view_fitarea.png
+  resources/occ_view_fitselection.png
   resources/occ_view_front.png
   resources/occ_view_glpan.png
   resources/occ_view_graduated_axes.png
index 98ae2107b3d762f9126aefb8a6cfdf96aaf6061a..57a571e477afef89a44c5afd359796c6d3b7c7eb 100755 (executable)
@@ -1171,6 +1171,13 @@ void OCCViewer_ViewWindow::createActions()
   connect(aAction, SIGNAL(triggered()), this, SLOT(activateWindowFit()));
   toolMgr()->registerAction( aAction, FitRectId );
   
+  // FitSelection
+  aAction = new QtxAction(tr("MNU_FITSELECTION"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITSELECTION" ) ),
+                           tr( "MNU_FITSELECTION" ), 0, this);
+  aAction->setStatusTip(tr("DSC_FITSELECTION"));
+  connect(aAction, SIGNAL(triggered()), this, SLOT(onFitSelection()));
+  toolMgr()->registerAction( aAction, FitSelectionId );
+
   // Zoom
   aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ZOOM" ) ),
                            tr( "MNU_ZOOM_VIEW" ), 0, this);
@@ -1419,6 +1426,9 @@ void OCCViewer_ViewWindow::createToolBar()
   QtxMultiAction* aScaleAction = new QtxMultiAction( this );
   aScaleAction->insertAction( toolMgr()->action( FitAllId ) );
   aScaleAction->insertAction( toolMgr()->action( FitRectId ) );
+#if OCC_VERSION_LARGE > 0x06090000
+  aScaleAction->insertAction( toolMgr()->action( FitSelectionId ) );
+#endif
   aScaleAction->insertAction( toolMgr()->action( ZoomId ) );
   toolMgr()->append( aScaleAction, tid );
 
@@ -1590,6 +1600,18 @@ void OCCViewer_ViewWindow::onFitAll()
   emit vpTransformationFinished( FITALLVIEW );
 }
 
+/*!
+  \brief Perform "fit selection" transformation.
+*/
+void OCCViewer_ViewWindow::onFitSelection()
+{
+  emit vpTransformationStarted( FITSELECTION );
+#if OCC_VERSION_LARGE > 0x06090000
+  myModel->getAISContext()->FitSelected( getViewPort()->getView() );
+#endif
+  emit vpTransformationFinished( FITSELECTION );
+}
+
 /*!
   \brief Called if 'change rotation point' operation is activated.
   \param on action state
index 733385850693c1b4b732e34aadd4b055a5531ddb..9e46e3a907ceb3f9f20c42e32cab479637812bb7 100755 (executable)
@@ -143,7 +143,7 @@ class OCCVIEWER_EXPORT OCCViewer_ViewWindow : public SUIT_ViewWindow
   Q_OBJECT
 
 public:
-  enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
+  enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId,
          ChangeRotationPointId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
         ResetId, CloneId, ClippingId, MemId, RestoreId,
@@ -154,7 +154,7 @@ public:
         UserId };
 
   enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, 
-                      PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
+                      PANGLOBAL, WINDOWFIT, FITALLVIEW, FITSELECTION, RESETVIEW,
                       FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW,
                      CLOCKWISEVIEW, ANTICLOCKWISEVIEW };
 
@@ -248,6 +248,7 @@ public slots:
   virtual void onAntiClockWiseView();
   virtual void onResetView();
   virtual void onFitAll();
+  virtual void onFitSelection();
   virtual void activateZoom();
   virtual void activateWindowFit();
   virtual void activateRotation();
index 94affa31e3b8f3b5bcb0fa3e29d5a0b7efd61186..7e9c06f22a342c242e87680ab8444c422675621d 100644 (file)
         <source>ICON_OCCVIEWER_VIEW_FITAREA</source>
         <translation>occ_view_fitarea.png</translation>
     </message>
+    <message>
+        <source>ICON_OCCVIEWER_VIEW_FITSELECTION</source>
+        <translation>occ_view_fitselection.png</translation>
+    </message>
     <message>
         <source>ICON_OCCVIEWER_CLONE_VIEW</source>
         <translation>occ_view_clone.png</translation>
index 710c6907db8697d55a38ebdf57c5c6eab667b48d..e15325b09011a08f7fd159ab8345ec323bf1dbe4 100644 (file)
         <source>DSC_FITRECT</source>
         <translation>Fit area within the view frame</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation>Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation>Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>MNU_PRESETS_VIEW</source>
         <translation>Restore View</translation>
index 547a90d8b09de6d0c51833198b144e0d1dc36814..9e78d01f1cedb42ccccace109b7447a7847a8b05 100755 (executable)
         <source>DSC_FITRECT</source>
         <translation>Redimensionner la scène pour ne montrer que sa partie choisie par l&apos;encadré</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>MNU_PRESETS_VIEW</source>
         <translation>Restaurer la vue</translation>
index ac86a82a7706ea6c8fe235abdd4344d1847e4e02..406cb87748bfe89d9e2d6e832d6ecfd5581f02b5 100644 (file)
       <source>DSC_FITRECT</source>
       <translation>彼の党をボックスで選択を表示するには、ステージのサイズを変更します。</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
       <source>MNU_PRESETS_VIEW</source>
       <translation>ビューの読み込み</translation>
diff --git a/src/OCCViewer/resources/occ_view_fitselection.png b/src/OCCViewer/resources/occ_view_fitselection.png
new file mode 100644 (file)
index 0000000..748df08
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_fitselection.png differ
index 30cee870b3d8cd8736fa7e88226457817c3599b5..1a251d9e4ebb54c142d0124c61a252fea220101a 100644 (file)
@@ -697,6 +697,30 @@ SVTK_Renderer
   ::ResetCameraClippingRange(GetDevice());
 }
 
+/*!
+  Fit all selected presentation in the scene
+*/
+void SVTK_Renderer::onFitSelection()
+{
+  vtkActorCollection* aSelectedCollection = vtkActorCollection::New();
+
+  VTK::ActorCollectionCopy aCopy( GetDevice()->GetActors() );
+  vtkActorCollection* aCollection = aCopy.GetActors();
+  aCollection->InitTraversal();
+  while ( vtkActor* aProp = aCollection->GetNextActor() )
+    if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( aProp ) )
+      if ( mySelector->IsSelected( anActor ) )
+        aSelectedCollection->AddItem( aProp );
+
+  double bounds[6];
+  ::ComputeBounds( aSelectedCollection, bounds );
+
+  if ( aSelectedCollection->GetNumberOfItems() && ::isBoundValid( bounds ) ) {
+    GetDevice()->ResetCamera( bounds );
+    GetDevice()->ResetCameraClippingRange( bounds );
+  }
+}
+
 /*!
   Reset camera clipping range to adjust the range to the bounding box of the scene
 */
index ba0f4fad1b49a63898a22b62f6e2e3b5ba0951b2..ed9b7a3038f3cf33fbd395a6c53c7ca3d7fa531c 100644 (file)
@@ -182,7 +182,11 @@ class SVTK_EXPORT SVTK_Renderer : public vtkObject
   //----------------------------------------------------------------------------
   //! Fit all presentation in the scene into the window
   void OnFitAll(); 
-  
+
+  //----------------------------------------------------------------------------
+  //! Fit all selected presentation in the scene
+  void onFitSelection();
+
   //! Set camera into predefined state
   void OnResetView(); 
 
index 8814f1c5c3fb38bf1cf9ce18859a211c0de0b07b..26e548d381bfe9dacae0476533d4040bb2fb7f78 100755 (executable)
@@ -443,6 +443,16 @@ void SVTK_ViewWindow::onFitAll()
   emit transformed( this );
 }
 
+/*!
+  Processes transformation "fit selection"
+*/
+void SVTK_ViewWindow::onFitSelection()
+{
+  GetRenderer()->onFitSelection();
+  Repaint();
+  emit transformed( this );
+}
+
 /*!
   SLOT: called if selection is changed
 */
@@ -1934,6 +1944,14 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
   connect(anAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
   mgr->registerAction( anAction, FitRectId );
 
+  // FitSelection
+  anAction = new QtxAction(tr("MNU_FITSELECTION"),
+                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITSELECTION" ) ),
+                           tr( "MNU_FITSELECTION" ), 0, this);
+  anAction->setStatusTip(tr("DSC_FITSELECTION"));
+  connect(anAction, SIGNAL(activated()), this, SLOT(onFitSelection()));
+  mgr->registerAction( anAction, FitSelectionId );
+
   // Zoom
   anAction = new QtxAction(tr("MNU_ZOOM_VIEW"), 
                            theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
@@ -2245,6 +2263,7 @@ void SVTK_ViewWindow::createToolBar()
   QtxMultiAction* aScaleAction = new QtxMultiAction( this );
   aScaleAction->insertAction( getAction( FitAllId ) );
   aScaleAction->insertAction( getAction( FitRectId ) );
+  aScaleAction->insertAction( getAction( FitSelectionId ) );
   aScaleAction->insertAction( getAction( ZoomId ) );
   mgr->append( aScaleAction, myToolBar );
 
index c7deb09e02dd229e56d30a7a881723b669c26d2a..9d27ced4f5cf4cdde0df97e51cb6a3cb9bee39b2 100755 (executable)
@@ -367,6 +367,9 @@ public slots:
   //! Redirect the request to #SVTK_Renderer::OnFitAll
   virtual void onFitAll();
 
+  //! Redirect the request to #SVTK_Renderer::OnFitSelection
+  virtual void onFitSelection();
+
   //! Redirect the request to #SVTK_Renderer::OnViewTrihedron
   virtual void onViewTrihedron(bool); 
 
@@ -414,7 +417,7 @@ protected:
   void createToolBar();
   void createActions(SUIT_ResourceMgr* theResourceMgr);
 
-  enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, 
+  enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId,
          ChangeRotationPointId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId, ResetId,
         ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
index e7f237aaef6e8c2905d73a3e9776f3e06c86dac8..614c1656082434cadfc653f719466f72c0826728 100644 (file)
         <source>MNU_FITRECT</source>
         <translation>Fit Area</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation>Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation>Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
         <translation>+OZ View</translation>
index 01ae93dac17a44e87cedb9bb69e319ade6ee0af2..5ea0cdea03f741bebed3199a8ffad9d4dc65d53b 100755 (executable)
         <source>MNU_FITRECT</source>
         <translation>Afficher la zone</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
         <translation>Vue +OZ</translation>
index 477f0987f0227bd3fa128660b5c129a2b28ff26c..7472ff435c152c66711859876a8db14e8dcd125f 100644 (file)
       <source>MNU_FITRECT</source>
       <translation>選択領域の表示</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
       <source>DSC_BOTTOM_VIEW</source>
       <translation>+OZ View</translation>
index 89797f7aa91c90d62769e8198e97ad5bef70d102..8833cb027bf15eb4e350ea1a22a2fbd920310907 100755 (executable)
@@ -104,6 +104,7 @@ SET(_other_RESOURCES
   resources/vtk_view_camera_dump.png
   resources/vtk_view_fitall.png
   resources/vtk_view_fitarea.png
+  resources/vtk_view_fitselection.png
   resources/vtk_view_front.png
   resources/vtk_view_glpan.png
   resources/vtk_view_left.png
index 1553a2e0f7da78ac66d394990a959f54dbc593f8..93b1da18364ef859de1016f43797483c0483356b 100644 (file)
@@ -628,6 +628,28 @@ void  VTKViewer_InteractorStyle::ViewFitAll() {
   ::ResetCameraClippingRange(CurrentRenderer);
 }
 
+/*!View fit selection.*/
+void  VTKViewer_InteractorStyle::ViewFitSelection() {
+
+  vtkActorCollection* aSelectedCollection = vtkActorCollection::New();
+
+  VTK::ActorCollectionCopy aCopy( CurrentRenderer->GetActors() );
+  vtkActorCollection* aCollection = aCopy.GetActors();
+  aCollection->InitTraversal();
+  while ( vtkActor* aProp = aCollection->GetNextActor() )
+    if ( VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast( aProp ) )
+      if ( anActor->isPreselected() )
+        aSelectedCollection->AddItem( aProp );
+
+  double bounds[6];
+  ::ComputeBounds( aSelectedCollection, bounds );
+
+  if ( aSelectedCollection->GetNumberOfItems() && ::isBoundValid( bounds ) ) {
+    CurrentRenderer->ResetCamera( bounds );
+    CurrentRenderer->ResetCameraClippingRange( bounds );
+  }
+}
+
 
 /*! starts Global Panning operation (e.g. through menu command)*/
 void VTKViewer_InteractorStyle::startGlobalPan()
index 3ac3f9d5a81f6295721da513ff8b24fb0db08b8f..2b06e5527484bdbd0a5ca35b81c16673941c6ec3 100644 (file)
@@ -93,7 +93,8 @@ class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInt
 
   void OnSelectionModeChanged();
 
-  void  ViewFitAll();
+  void ViewFitAll();
+  void ViewFitSelection();
 
   void                     SetFilter( const Handle( VTKViewer_Filter)& );
   Handle(VTKViewer_Filter) GetFilter( const int );  
index 8b0d268d18983330a8ca42c20e94dd875fb637e0..235f5f9a1cad5ea9f75022b7cee5c1ff3aea3d27 100755 (executable)
@@ -108,18 +108,25 @@ ResetCamera(vtkRenderer* theRenderer,
 int
 ComputeVisiblePropBounds(vtkRenderer* theRenderer, 
                          double theBounds[6])
+{
+  VTK::ActorCollectionCopy aCopy(theRenderer->GetActors());
+  vtkActorCollection* aCollection = aCopy.GetActors();
+  return ComputeBounds( aCollection, theBounds );
+}
+
+/*! Compute the bounds of actors*/
+int
+ComputeBounds(vtkActorCollection* theCollection, double theBounds[6])
 {
   int aCount = 0;
-  
+
   theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT;
   theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT;
-  
+
   // loop through all props
-  VTK::ActorCollectionCopy aCopy(theRenderer->GetActors());
-  vtkActorCollection* aCollection = aCopy.GetActors();
-  aCollection->InitTraversal();
-  while (vtkActor* aProp = aCollection->GetNextActor()) {
-    // if it's invisible, or has no geometry, we can skip the rest 
+  theCollection->InitTraversal();
+  while (vtkActor* aProp = theCollection->GetNextActor()) {
+    // if it's invisible, or has no geometry, we can skip the rest
     if(aProp->GetVisibility() && aProp->GetMapper() && vtkMath::AreBoundsInitialized(aProp->GetBounds())){
       if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp))
         if(anActor->IsInfinitive())
index 5646e7f2478cd4ee8a5cd491a0a28c8d580e136c..a4f081fa3f75ad3760aec483d753006bf64d0fd0 100755 (executable)
@@ -26,6 +26,7 @@
 #include "VTKViewer.h"
 
 class vtkRenderer;
+class vtkActorCollection;
 
 VTKVIEWER_EXPORT 
 extern
@@ -39,6 +40,12 @@ int
 ComputeVisiblePropBounds(vtkRenderer* theRenderer, 
                          double theBounds[6]);
 
+VTKVIEWER_EXPORT
+extern
+int
+ComputeBounds(vtkActorCollection* theCollection,
+              double theBounds[6]);
+
 VTKVIEWER_EXPORT
 extern
 void
index fbe64ce4b0b3e94a60a2e2ef010be557526e4665..084d961afa8a86162851eeabd226f1e62ddfe4b4 100755 (executable)
@@ -208,6 +208,13 @@ void VTKViewer_ViewWindow::createActions()
   connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
   myActionsMap[ FitRectId ] = aAction;
 
+  //! \li FitSelection
+  aAction = new QtxAction(tr("MNU_FITSELECTION"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITSELECTION" ) ),
+                           tr( "MNU_FITSELECTION" ), 0, this);
+  aAction->setStatusTip(tr("DSC_FITSELECTION"));
+  connect(aAction, SIGNAL(activated()), this, SLOT(onFitSelection()));
+  myActionsMap[ FitSelectionId ] = aAction;
+
   //! \li Zoom
   aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
                            tr( "MNU_ZOOM_VIEW" ), 0, this);
@@ -316,6 +323,7 @@ void VTKViewer_ViewWindow::createToolBar()
   QtxMultiAction* aScaleAction = new QtxMultiAction( this );
   aScaleAction->insertAction( myActionsMap[FitAllId] );
   aScaleAction->insertAction( myActionsMap[FitRectId] );
+  aScaleAction->insertAction( myActionsMap[FitSelectionId] );
   aScaleAction->insertAction( myActionsMap[ZoomId] );
   myToolBar->addAction( aScaleAction );
 
@@ -447,6 +455,13 @@ void VTKViewer_ViewWindow::onFitAll()
   Repaint();
 }
 
+/*!On fit selection slot.*/
+void VTKViewer_ViewWindow::onFitSelection()
+{
+  myRWInteractor->GetInteractorStyle()->ViewFitSelection();
+  Repaint();
+}
+
 /*!Set background color of the viewport [obsolete]*/
 void VTKViewer_ViewWindow::setBackgroundColor( const QColor& c )
 {
index 86cda9edad54e7547bd762be2b2c5d9cf9e2253f..89fabb7d0647f7c61773e30b959621e144559b74 100755 (executable)
@@ -90,6 +90,7 @@ public slots:
   void onAntiClockWiseView();
   void onResetView();
   void onFitAll();
+  void onFitSelection();
   void activateZoom();
   void activateWindowFit();
   void activateRotation();
@@ -114,7 +115,7 @@ private:
   void                              MoveActor( VTKViewer_Actor* theActor );
 
 private:
-  enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
+  enum { DumpId, FitAllId, FitRectId, FitSelectionId, ZoomId, PanId, GlobalPanId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ClockWiseId, AntiClockWiseId,
         ResetId, TrihedronShowId };
   typedef QMap<int, QtxAction*> ActionsMap;
index d92d54b8249ac8abf80eecb72eed3d0e9737df21..0fabcffa31ab32b3c1cccd9a0310b542de2cf7fa 100644 (file)
         <source>ICON_VTKVIEWER_VIEW_FITAREA</source>
         <translation>vtk_view_fitarea.png</translation>
     </message>
+    <message>
+        <source>ICON_VTKVIEWER_VIEW_FITSELECTION</source>
+        <translation>vtk_view_fitselection.png</translation>
+    </message>
     <message>
         <source>ICON_VTKVIEWER_VIEW_FRONT</source>
         <translation>vtk_view_front.png</translation>
index d06699e4d1ca4889b1d48d40cab7a41e3291fd8d..32f5a956ea732d41e663aa73879d5c725225f6a5 100644 (file)
         <source>MNU_FITRECT</source>
         <translation>Fit Area</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation>Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation>Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
         <translation>Bottom View</translation>
index 2d2a9e45c5fb25259b9206d3f16ceff602b96990..1c000abbb1919e5c81b8521d1cc748f2cd7d4e04 100755 (executable)
         <source>MNU_FITRECT</source>
         <translation>Ajuster à la zone</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
         <translation>Vue de dessous</translation>
index 0e419361940470427a57edf0dc9d696d80c20a94..eb9361ce5caa6919a2a145c86478110f69860fd0 100644 (file)
       <source>MNU_FITRECT</source>
       <translation>選択範囲表示</translation>
     </message>
+    <message>
+        <source>MNU_FITSELECTION</source>
+        <translation type="unfinished">Fit Selection</translation>
+    </message>
+    <message>
+        <source>DSC_FITSELECTION</source>
+        <translation type="unfinished">Fit all selected objects inside the view frame</translation>
+    </message>
     <message>
       <source>DSC_BOTTOM_VIEW</source>
       <translation>下から表示します。</translation>
diff --git a/src/VTKViewer/resources/vtk_view_fitselection.png b/src/VTKViewer/resources/vtk_view_fitselection.png
new file mode 100644 (file)
index 0000000..748df08
Binary files /dev/null and b/src/VTKViewer/resources/vtk_view_fitselection.png differ