#undef max
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_Renderer);
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_Renderer
::SVTK_Renderer():
myDevice(vtkRenderer::New()),
myPriority);
}
+/*!
+ Destructor
+*/
SVTK_Renderer
::~SVTK_Renderer()
{
}
+/*!
+ Main process event method
+*/
void
SVTK_Renderer
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
-//----------------------------------------------------------------------------
+/*!
+ \return renderer's device
+*/
vtkRenderer*
SVTK_Renderer
::GetDevice()
return myDevice.GetPointer();
}
+/*!
+ Initialize renderer
+*/
void
SVTK_Renderer
::Initialize(vtkRenderWindowInteractor* theInteractor,
mySelector = theSelector;
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes pointed actor into the renderer
+*/
void
SVTK_Renderer
::AddActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Removes pointed actor from the renderer
+*/
void
SVTK_Renderer
::RemoveActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Get special container that keeps scaling of the scene
+*/
VTKViewer_Transform*
SVTK_Renderer
::GetTransform()
return myTransform.GetPointer();
}
+/*!
+ Allows to get a scale that is applied on the whole scene
+*/
void
SVTK_Renderer
::GetScale( double theScale[3] )
myTransform->GetMatrixScale( theScale );
}
+/*!
+ Allows to apply a scale on the whole scene
+*/
void
SVTK_Renderer
::SetScale( double theScale[3] )
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in selection mode
+*/
void
SVTK_Renderer
::SetSelectionProp(const double& theRed,
myHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in preselection mode
+*/
void
SVTK_Renderer
::SetPreselectionProp(const double& theRed,
myPreHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Setup requested tolerance for the picking
+*/
void
SVTK_Renderer
::SetSelectionTolerance(const double& theTolNodes,
}
-//----------------------------------------------------------------------------
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
inline
bool
-CheckBndBox(const float theBounds[6])
+CheckBndBox(const vtkFloatingPointType theBounds[6])
{
if(theBounds[0] > -VTK_LARGE_FLOAT && theBounds[1] < VTK_LARGE_FLOAT &&
theBounds[2] > -VTK_LARGE_FLOAT && theBounds[3] < VTK_LARGE_FLOAT &&
return false;
}
+/*!
+ Adjusts size of actors
+*/
bool
SVTK_Renderer
::OnAdjustActors()
bool aTDisplayed = IsTrihedronDisplayed();
bool aCDisplayed = IsCubeAxesDisplayed();
- float aNewBndBox[6];
+ vtkFloatingPointType aNewBndBox[6];
aNewBndBox[ 0 ] = aNewBndBox[ 2 ] = aNewBndBox[ 4 ] = VTK_LARGE_FLOAT;
aNewBndBox[ 1 ] = aNewBndBox[ 3 ] = aNewBndBox[ 5 ] = -VTK_LARGE_FLOAT;
myCubeAxes->VisibilityOff();
// if the new trihedron size have sufficient difference, then apply the value
- double aSize = myTrihedron->GetSize();
+ vtkFloatingPointType aSize = myTrihedron->GetSize();
if ( IsTrihedronRelative() )
{
ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
if(anActor->IsResizable())
anActor->SetSize(0.5*aSize);
if(anActor->GetVisibility() && !anActor->IsInfinitive()){
- float *aBounds = anActor->GetBounds();
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
if(CheckBndBox(aBounds))
for(int i = 0; i < 5; i = i + 2){
if(aBounds[i] < aNewBndBox[i])
return false;
}
+/*!
+ Adjusts size of actors
+*/
void
SVTK_Renderer
::AdjustActors()
::ResetCameraClippingRange(GetDevice());
}
+/*!
+ Set size of the trihedron
+ \param theSize - new size
+ \param theRelative - if it is true, then size is mesured in percents from bounding box of the scene,
+ otherwise - in viewer units
+*/
void
SVTK_Renderer
::SetTrihedronSize(int theSize, const bool theRelative)
}
}
+/*!
+ \return size of the trihedron in percents from bounding box of the scene
+*/
int
SVTK_Renderer
::GetTrihedronSize() const
return myTrihedronSize;
}
+/*!
+ \return true if the size of the trihedron is relative
+*/
bool
SVTK_Renderer
::IsTrihedronRelative() const
return myIsTrihedronRelative;
}
-//----------------------------------------------------------------------------
+/*!
+ \return trihedron control
+*/
VTKViewer_Trihedron*
SVTK_Renderer
::GetTrihedron()
return myTrihedron.GetPointer();
}
+/*!
+ \return true if trihedron is displayed
+*/
bool
SVTK_Renderer
::IsTrihedronDisplayed()
return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn;
}
+/*!
+ Toggle trihedron visibility
+*/
void
SVTK_Renderer
::OnViewTrihedron()
myTrihedron->VisibilityOn();
}
+/*!
+ Adjust size of the trihedron to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustTrihedron()
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return graduated rules control
+*/
SVTK_CubeAxesActor2D*
SVTK_Renderer
::GetCubeAxes()
return myCubeAxes.GetPointer();
}
+/*!
+ \return true if graduated rules displayed
+*/
bool
SVTK_Renderer
::IsCubeAxesDisplayed()
return myCubeAxes->GetVisibility() == 1;
}
+/*!
+ Toggle graduated rules visibility
+*/
void
SVTK_Renderer
::OnViewCubeAxes()
myCubeAxes->VisibilityOn();
}
+/*!
+ Adjust size of the graduated rules to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnAdjustCubeAxes()
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Sets camera into predefined state
+*/
void
SVTK_Renderer
::OnResetView()
else
myCubeAxes->VisibilityOff();
- static float aCoeff = 3.0;
+ static vtkFloatingPointType aCoeff = 3.0;
aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Fit all presentation in the scene into the window
+*/
void
SVTK_Renderer
::OnFitAll()
::ResetCameraClippingRange(GetDevice());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Reset camera clipping range to adjust the range to the bounding box of the scene
+*/
void
SVTK_Renderer
::OnResetClippingRange()
::ResetCameraClippingRange(GetDevice());
}
-
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to front view
+*/
void
SVTK_Renderer
::OnFrontView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to back view
+*/
void
SVTK_Renderer
::OnBackView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to top view
+*/
void
SVTK_Renderer
::OnTopView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to bottom view
+*/
void
SVTK_Renderer
::OnBottomView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to left view
+*/
void
SVTK_Renderer
::OnLeftView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
+/*!
+ To reset direction of the camera to right view
+*/
void
SVTK_Renderer
::OnRightView()