-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
::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 ||
/*!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,