-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 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
}
*/
-vtkStandardNewMacro(VTKViewer_InteractorStyle);
+vtkStandardNewMacro(VTKViewer_InteractorStyle)
/*!Constructor.*/
::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()
}
-/*!\retval TRUE if needs redrawing*/
+/*!\retval \c true if needs redrawing*/
bool VTKViewer_InteractorStyle::needsRedrawing()
{
return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM ||
{
if (!myCursorState)
setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
- }
+ } // fall through!
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
myOtherPoint = mousePos;
/*! called when user moves mouse inside viewer window and there is no active viewer operation \n
* (!put necessary processing here!)
*/
-void VTKViewer_InteractorStyle::onCursorMove(QPoint mousePos) {
+void VTKViewer_InteractorStyle::onCursorMove(QPoint /*mousePos*/) {
// processing highlighting
// SUIT_Study* anActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
// SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() );
/*!Checks: is valid cell(node) with id \a theId in actor \a theActor.
*\param theActor - VTKViewer_Actor pointer.
*\param theId - cell id.
- *\param theIsNode - boolean flag, if true - node, else - cell.
+ *\param theIsNode - boolean flag, if \c true - node, else - cell.
*/
bool VTKViewer_InteractorStyle::IsValid( VTKViewer_Actor* theActor,
- const int theId,
+ const vtkIdType theId,
const bool theIsNode )
{
std::map<int, Handle(VTKViewer_Filter)>::const_iterator anIter;