#include <map>
#include <vector>
/*! \class vtkUnstructuredGridToUnstructuredGridFilter
- * \brief For more information see <a href="http://www.vtk.org/">VTK documentation
+ * \brief For more information see <a href="http://www.vtk.org/">VTK documentation</a>
*/
/*! \class vtkUnstructuredGridToUnstructuredGridFilter
* \brief For more information see VTK documentation.
IMPLEMENT_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, MMgt_TShared)
-/*
- Class : VTKViewer_Filter
- Description : Base class of filters of for VTK viewer. Method IsValid
- should be redefined in derived classes
-*/
+/*!
+ * \class VTKViewer_Filter
+ * Description : Base class of filters of for <a href="http://www.vtk.org/">VTK</a> viewer. Method IsValid \n
+ * should be redefined in derived classes
+ */
+/*!Constructor.*/
VTKViewer_Filter::VTKViewer_Filter()
{
myActor = 0;
}
+/*!Virtual Destructor.*/
VTKViewer_Filter::~VTKViewer_Filter()
{
}
+/*!Check correctness of \a theCellId for actor \a theActor by
+ * call virtual method IsValid( const int theId ).
+ * \param theActor - actor
+ * \param theCellId - cell id.
+ * \retval TRUE - if cell id is valid, else false.
+ */
bool VTKViewer_Filter::IsValid( VTKViewer_Actor* theActor, const int theCellId )
{
SetActor( theActor );
return IsValid( theCellId );
}
+/*!Virtual method.Set actor to \a theActor.
+ * \param theActor - actor.
+ */
void VTKViewer_Filter::SetActor( VTKViewer_Actor* theActor )
{
myActor = theActor;
class VTKViewer_Actor;
-DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared);
/*
Class : VTKViewer_Filter
- Description : Base class of filters of for VTK viewer. Method IsValid
+ Description : Base class of filters of for <a href="http://www.vtk.org/">VTK</a> viewer. Method IsValid
should be redefined in derived classes
*/
*/
//----------------------------------------------------------------------------
vtkStandardNewMacro(VTKViewer_InteractorStyle);
-//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+/*!Constructor.*/
VTKViewer_InteractorStyle::VTKViewer_InteractorStyle()
{
m_Trihedron = 0;
}
//----------------------------------------------------------------------------
+/*!Destructor.*/
VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
{
// if(MYDEBUG) INFOS("VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()");
}
//----------------------------------------------------------------------------
+/*!Set preselection properties.
+ *\param theRed - red color.
+ *\param theGreen - green color.
+ *\param theBlue - blue color.
+ *\param theWidth - width..
+ */
void VTKViewer_InteractorStyle::setPreselectionProp(const double& theRed, const double& theGreen,
const double& theBlue, const int& theWidth)
{
}
//----------------------------------------------------------------------------
+/*!Set render window interactor
+ *\param theInteractor - interactor.
+ */
void VTKViewer_InteractorStyle::SetInteractor(vtkRenderWindowInteractor *theInteractor){
m_Interactor = dynamic_cast<VTKViewer_RenderWindowInteractor*>(theInteractor);
Superclass::SetInteractor(theInteractor);
}
//----------------------------------------------------------------------------
+/*!Set view window.
+ *\param theViewWnd - SALOME VTKViewer_ViewWindow
+ */
void VTKViewer_InteractorStyle::setViewWnd(VTKViewer_ViewWindow* theViewWnd ){
m_ViewWnd = theViewWnd;
m_ViewWnd->AddActor(myPreSelectionActor);
}
//----------------------------------------------------------------------------
+/*!Set GUI window.
+ *\param theWindow - QWidget window.
+ */
void VTKViewer_InteractorStyle::setGUIWindow(QWidget* theWindow){
myGUIWindow = theWindow;
}
//----------------------------------------------------------------------------
+/*!Set triedron.
+ *\param theTrihedron - SALOME VTKViewer_Trihedron
+ */
void VTKViewer_InteractorStyle::setTriedron(VTKViewer_Trihedron* theTrihedron){
m_Trihedron = theTrihedron;
}
//----------------------------------------------------------------------------
+/*!Rotate camera.
+ *\param dx -
+ *\param dy -
+ */
void VTKViewer_InteractorStyle::RotateXY(int dx, int dy)
{
double rxf;
//----------------------------------------------------------------------------
+/*! Move the position of the camera along the direction of projection. (dx,dy)*/
void VTKViewer_InteractorStyle::DollyXY(int dx, int dy)
{
if (this->CurrentRenderer == NULL) return;
}
//----------------------------------------------------------------------------
+/*!*/
void VTKViewer_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY)
{
vtkCamera *cam;
//----------------------------------------------------------------------------
+/*!On mouse move event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
void VTKViewer_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl),
int shift,
int x, int y)
//----------------------------------------------------------------------------
+/*!On Left button down event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
void VTKViewer_InteractorStyle::OnLeftButtonDown(int ctrl, int shift,
int x, int y)
{
//----------------------------------------------------------------------------
+/*!On left button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
void VTKViewer_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl),
int shift,
int vtkNotUsed(x),
//----------------------------------------------------------------------------
+/*!On left button up event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
void VTKViewer_InteractorStyle::OnMiddleButtonDown(int ctrl,
int shift,
int x, int y)
//----------------------------------------------------------------------------
+/*!On middle button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
void VTKViewer_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl),
int shift,
int vtkNotUsed(x),
//----------------------------------------------------------------------------
+/*!On right button down event.
+ *\param ctrl - CTRL (on/off - integer 0/1)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate
+ *\param y - y coordinate
+ */
void VTKViewer_InteractorStyle::OnRightButtonDown(int ctrl,
int shift,
int x, int y)
}
//----------------------------------------------------------------------------
+/*!On right button up event.
+ *\param ctrl - CTRL (not used)
+ *\param shift - SHIFT (on/off - integer 0/1)
+ *\param x - x coordinate (not used)
+ *\param y - y coordinate (not used)
+ */
void VTKViewer_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl),
int shift,
int vtkNotUsed(x),
}
//----------------------------------------------------------------------------
-/* XPM */
+/** @name XPM - x pixmaps. */
+//@{
+/*!Image Zoom cursor*/
const char* imageZoomCursor[] = {
"32 32 3 1",
". c None",
"................................",
"................................"};
+/*!Image rotate cursor*/
const char* imageRotateCursor[] = {
"32 32 3 1",
". c None",
"................................",
"................................",
"................................"};
-
+//@}
//----------------------------------------------------------------------------
-// loads cursors for viewer operations - zoom, pan, etc...
+/*! Loads cursors for viewer operations - zoom, pan, etc...*/
void VTKViewer_InteractorStyle::loadCursors()
{
myDefCursor = QCursor(ArrowCursor);
//----------------------------------------------------------------------------
-// event filter - controls mouse and keyboard events during viewer operations
+/*! event filter - controls mouse and keyboard events during viewer operations*/
bool VTKViewer_InteractorStyle::eventFilter(QObject* object, QEvent* event)
{
if (!myGUIWindow) return false;
//----------------------------------------------------------------------------
-// starts Zoom operation (e.g. through menu command)
+/*! starts Zoom operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startZoom()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
//----------------------------------------------------------------------------
-// starts Pan operation (e.g. through menu command)
+/*! starts Pan operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startPan()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
}
//----------------------------------------------------------------------------
-// starts Rotate operation (e.g. through menu command)
+/*! starts Rotate operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startRotate()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
//----------------------------------------------------------------------------
-// starts Spin operation (e.g. through menu command)
+/*! starts Spin operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startSpin()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
//----------------------------------------------------------------------------
-// starts Fit Area operation (e.g. through menu command)
+/*! starts Fit Area operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startFitArea()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
//----------------------------------------------------------------------------
+/*!View fit all.*/
void VTKViewer_InteractorStyle::ViewFitAll() {
int aTriedronWasVisible = false;
if(m_Trihedron){
//----------------------------------------------------------------------------
-// starts Global Panning operation (e.g. through menu command)
+/*! starts Global Panning operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startGlobalPan()
{
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
//----------------------------------------------------------------------------
-// returns TRUE if needs redrawing
+/*!\retval TRUE if needs redrawing*/
bool VTKViewer_InteractorStyle::needsRedrawing()
{
return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM ||
//----------------------------------------------------------------------------
-// fits viewer contents to rect
+/*! fits viewer contents to rectangle
+ *\param left - left side
+ *\param top - top side
+ *\param right - right side
+ *\param bottom - bottom side
+ */
void VTKViewer_InteractorStyle::fitRect(const int left,
const int top,
const int right,
//----------------------------------------------------------------------------
-// starts viewer operation (!internal usage!)
+/*! starts viewer operation (!internal usage!)*/
void VTKViewer_InteractorStyle::startOperation(int operation)
{
switch(operation)
//----------------------------------------------------------------------------
-// sets proper cursor for window when viewer operation is activated
+/*! sets proper cursor for window when viewer operation is activated*/
void VTKViewer_InteractorStyle::setCursor(const int operation)
{
if (!myGUIWindow) return;
//----------------------------------------------------------------------------
-// called when viewer operation started (!put necessary initialization here!)
+/*! called when viewer operation started (!put necessary initialization here!)*/
void VTKViewer_InteractorStyle::onStartOperation()
{
if (!myGUIWindow) return;
//----------------------------------------------------------------------------
-// called when viewer operation finished (!put necessary post-processing here!)
+/*! called when viewer operation finished (!put necessary post-processing here!)*/
void VTKViewer_InteractorStyle::onFinishOperation()
{
if (!myGUIWindow) return;
*/
}
-// called during viewer operation when user moves mouse (!put necessary processing here!)
+/*! called during viewer operation when user moves mouse (!put necessary processing here!)*/
void VTKViewer_InteractorStyle::onOperation(QPoint mousePos)
{
if (!myGUIWindow) return;
this->LastPos[1] = h - mousePos.y() - 1;
}
-// called when selection mode changed (!put necessary initialization here!)
+/*! called when selection mode changed (!put necessary initialization here!)*/
void VTKViewer_InteractorStyle::OnSelectionModeChanged()
{
mySelectedActor = NULL;
}
-// called when user moves mouse inside viewer window and there is no active viewer operation
-// (!put necessary processing here!)
+/*! 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) {
// processing highlighting
// SUIT_Study* anActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
this->LastPos[1] = y;*/
}
-// called on finsh GlobalPan operation
+/*! called on finsh GlobalPan operation */
void VTKViewer_InteractorStyle::Place(const int theX, const int theY)
{
if (this->CurrentRenderer == NULL) {
-// Translates view from Point to Point
+/*! Translates view from Point to Point*/
void VTKViewer_InteractorStyle::TranslateView(int toX, int toY, int fromX, int fromY)
{
vtkCamera *cam = this->CurrentRenderer->GetActiveCamera();
}
-/// Checks: is the given Actor within display coordinates?
+/*! Checks: is the given Actor within display coordinates?*/
bool VTKViewer_InteractorStyle::IsInRect(vtkActor* theActor,
const int left, const int top,
const int right, const int bottom)
}
-/// Checks: is the given Cell within display coordinates?
+/*! Checks: is the given Cell within display coordinates?*/
bool VTKViewer_InteractorStyle::IsInRect(vtkCell* theCell,
const int left, const int top,
const int right, const int bottom)
return ((aMin[0]>left) && (aMax[0]<right) && (aMin[1]>bottom) && (aMax[1]<top));
}
-
+/*!Checks: is given point \a thePoint in rectangle*/
bool VTKViewer_InteractorStyle::IsInRect(float* thePoint,
const int left, const int top,
const int right, const int bottom)
return ((aPnt[0]>left) && (aPnt[0]<right) && (aPnt[1]>bottom) && (aPnt[1]<top));
}
+/*!Set filter \a theFilter*/
void VTKViewer_InteractorStyle::SetFilter( const Handle(VTKViewer_Filter)& theFilter )
{
myFilters[ theFilter->GetId() ] = theFilter;
}
+/*!Checks: is filter present (with id \a theId)
+ *\param theId - filter id.
+ */
bool VTKViewer_InteractorStyle::IsFilterPresent( const int theId )
{
return myFilters.find( theId ) != myFilters.end();
}
+/*!Remove filter with id \a theId.
+ *\param theId - filter id.
+ */
void VTKViewer_InteractorStyle::RemoveFilter( const int theId )
{
if ( IsFilterPresent( theId ) )
myFilters.erase( theId );
}
-
+/*!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.
+ */
bool VTKViewer_InteractorStyle::IsValid( VTKViewer_Actor* theActor,
const int theId,
const bool theIsNode )
return true;
}
+/*!Gets filter handle by filter id \a theId.*/
Handle(VTKViewer_Filter) VTKViewer_InteractorStyle::GetFilter( const int theId )
{
return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)();
}
+/*!Increment pan.
+ *\param incrX - X coordinate increment.
+ *\param incrY - Y coordinate increment.
+ */
void VTKViewer_InteractorStyle::IncrementalPan( const int incrX, const int incrY )
{
this->PanXY( incrX, incrY, 0, 0 );
}
+/*!Increment zoom.
+ *\param incr - zoom increment.
+ */
void VTKViewer_InteractorStyle::IncrementalZoom( const int incr )
{
this->DollyXY( incr, incr );
}
+/*!Increment rotate.
+ *\param incrX - X coordinate increment.
+ *\param incrY - Y coordinate increment.
+ */
void VTKViewer_InteractorStyle::IncrementalRotate( const int incrX, const int incrY )
{
this->RotateXY( incrX, -incrY );
#define VTK_INTERACTOR_STYLE_CAMERA_SELECT 6
#define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7
+/*! Description:\n
+ * This class must be supplied with a vtkRenderWindowInteractor wrapper or\n
+ * parent. This class should not normally be instantiated by application\n
+ * programmers.
+ */
class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInteractorStyle
{
-public:
- // Description:
- // This class must be supplied with a vtkRenderWindowInteractor wrapper or
- // parent. This class should not normally be instantiated by application
- // programmers.
+ public:
static VTKViewer_InteractorStyle *New();
vtkTypeMacro(VTKViewer_InteractorStyle, vtkInteractorStyle);
std::map<int, Handle(VTKViewer_Filter) > myFilters;
- // members from old version
+ /** @name members from old version*/
+ //@{
double DeltaElevation;
double DeltaAzimuth;
int LastPos[2];
+ //@}
};
#endif
vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$");
vtkStandardNewMacro(VTKViewer_PassThroughFilter);
+/*! \class VTKViewer_PassThroughFilter
+ * Passive filter take a dataset as input and create a dataset as output.\n
+ * The form of the input geometry is not changed in these filters, \n
+ * only the point attributes (e.g. scalars, vectors, etc.).
+ */
+
+/*!Execute method.Output calculation.*/
void VTKViewer_PassThroughFilter::Execute()
{
vtkDataSet *input = static_cast<vtkDataSet*>(this->GetInput());
// This has to be here because it initialized all field datas.
output->CopyStructure( input );
- // Pass all. (data object's field data is passed by the
- // superclass after this method)
+ //! Pass all. (data object's field data is passed by the
+ //! superclass after this method)
output->GetPointData()->PassData( input->GetPointData() );
output->GetCellData()->PassData( input->GetCellData() );
}
+/*!Methods invoked by print to print information about the object including superclasses.\n
+ * Typically not called by the user (use Print() instead) but used in the hierarchical \n
+ * print process to combine the output of several classes.
+ *\param os - output stream.
+ */
void VTKViewer_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
vtkTypeRevisionMacro( VTKViewer_PassThroughFilter, vtkDataSetToDataSetFilter );
void PrintSelf( ostream& os, vtkIndent indent );
- // Description:
- // Create a new VTKViewer_PassThroughFilter.
+ /*!Create a new VTKViewer_PassThroughFilter.*/
static VTKViewer_PassThroughFilter *New();
protected:
- VTKViewer_PassThroughFilter() {};
- virtual ~VTKViewer_PassThroughFilter() {};
+ VTKViewer_PassThroughFilter() {};//!< Null body.
+ virtual ~VTKViewer_PassThroughFilter() {};//!< Null body.
void Execute();
private:
- VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); // Not implemented.
- void operator=( const VTKViewer_PassThroughFilter& ); // Not implemented.
+ VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
+ void operator=( const VTKViewer_PassThroughFilter& ); //!< Not implemented.
};
#endif
//----------------------------------------------------------------------------
vtkStandardNewMacro(VTKViewer_RectPicker);
-//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+/*!Constructor. Do nothing*/
VTKViewer_RectPicker::VTKViewer_RectPicker()
{
}
//----------------------------------------------------------------------------
+/*!Perform pick operation with selection rectangle provided. Normally the
+ * first two values for the selection top-left and right-bottom points are
+ * x-y pixel coordinate, and the third value is =0.
+ * \retval Return non-zero if something was successfully picked.
+ */
int VTKViewer_RectPicker::Pick(float selectionX1, float selectionY1, float selectionZ1,
float selectionX2, float selectionY2, float selectionZ2,
vtkRenderer *renderer)
}
//----------------------------------------------------------------------------
+/*! Bounding box intersection with hexahedron. Origin[4][4] starts the ray from corner points,
+ * dir[4][3] is the vector components of the ray in the x-y-z directions.
+ * (Notes: the intersection ray dir[4][3] is NOT normalized.)
+ * \retval The method returns a non-zero value, if the bounding box is hit.
+ */
char VTKViewer_RectPicker::HitBBox (float bounds[6], float origin[4][4], float dir[4][3])
{
int i, j, k, n;
}
//----------------------------------------------------------------------------
+/*! Position of point relative to hexahedron. p1[4][4] is the corner points of top face,
+ * p2[4][4] is the corner points of bottom face.
+ * \retval The method returns a non-zero value, if the point is inside.
+ */
char VTKViewer_RectPicker::PointInside (float p[3], float p1[4][4], float p2[4][4], float tol)
{
int i, j, k;
class VTK_EXPORT VTKViewer_RectPicker : public vtkPicker
{
public:
+ /*!Create new instance of VTKViewer_RectPicker.*/
static VTKViewer_RectPicker *New();
vtkTypeMacro(VTKViewer_RectPicker,vtkPicker);
- /*! \brief Perform pick operation with selection rectangle provided. Normally the
- * first two values for the selection top-left and right-bottom points are
- * x-y pixel coordinate, and the third value is =0.
- * \retval Return non-zero if something was successfully picked.
- */
virtual int Pick(float selectionX1, float selectionY1, float selectionZ1,
float selectionX2, float selectionY2, float selectionZ2,
vtkRenderer *renderer);
/*!
- * \brief Perform pick operation with selection rectangle provided. Normally the first
+ * Perform pick operation with selection rectangle provided. Normally the first
* two values for the selection top-left and right-bottom points are x-y pixel
* coordinate, and the third value is =0.
* \retval Return non-zero if something was successfully picked.
selectionPt2[0], selectionPt2[1], selectionPt2[2],
ren);};
- /*! \brief Bounding box intersection with hexahedron. Origin[4][4] starts the ray from corner points,
- * dir[4][3] is the vector components of the ray in the x-y-z directions.
- * (Notes: the intersection ray dir[4][3] is NOT normalized.)
- * \retval The method returns a non-zero value, if the bounding box is hit.
- */
static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]);
- /*! \brief Position of point relative to hexahedron. p1[4][4] is the corner points of top face,
- * p2[4][4] is the corner points of bottom face.
- * \retval The method returns a non-zero value, if the point is inside.
- */
static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0);
protected:
#include <qcursor.h>
#endif
-//****************************************************************
+/*!Constructor. Create render window with parant \a parent and name \a name.
+ *\param parent - parent window
+ *\param name - render window name.
+ */
VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget* parent, const char* name) :
QWidget(parent, name,
Qt::WStyle_NoBorder | Qt::WDestructiveClose |
setMouseTracking(true);
}
-//****************************************************************
+/*!Destructor.*/
VTKViewer_RenderWindow::~VTKViewer_RenderWindow()
{
myRW->Delete();
}
-//****************************************************************
+/*!Call Render method for render window field.*/
void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent)
{
myRW->Render();
}
-//****************************************************************
+/*!Resize render window.*/
void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* theEvent)
{
int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1];
}
}
-//****************************************************************
+/*!Emit mouse move event.*/
void VTKViewer_RenderWindow::mouseMoveEvent(QMouseEvent* event)
{
emit MouseMove(event) ;
}
-//****************************************************************
+/*!Emit mouse button press event.*/
void VTKViewer_RenderWindow::mousePressEvent(QMouseEvent* event)
{
emit MouseButtonPressed( event );
}
-//****************************************************************
+/*!Emit mouse button release event.*/
void VTKViewer_RenderWindow::mouseReleaseEvent( QMouseEvent *event )
{
emit MouseButtonReleased( event );
}
-//****************************************************************
+/*!Emit mouse button double click event.*/
void VTKViewer_RenderWindow::mouseDoubleClickEvent( QMouseEvent* event )
{
emit MouseDoubleClicked( event );
}
-//****************************************************************
+/*!Emit key pressed event.*/
void VTKViewer_RenderWindow::keyPressEvent (QKeyEvent* event)
{
emit KeyPressed(event) ;
}
-//****************************************************************
+/*!Emit key release event.*/
void VTKViewer_RenderWindow::keyReleaseEvent (QKeyEvent * event)
{
emit KeyReleased(event) ;
}
-//****************************************************************
+/*!Emit wheel move event.*/
void VTKViewer_RenderWindow::wheelEvent(QWheelEvent* event)
{
emit WheelMoved(event) ;
}
-//****************************************************************
+/*!Reaction on change background color.*/
void VTKViewer_RenderWindow::onChangeBackgroundColor()
{
//float red, green, blue;
}
}
-//****************************************************************
+/*!Emit content menu requested.*/
void VTKViewer_RenderWindow::contextMenuEvent ( QContextMenuEvent * e )
{
if ( e->reason() != QContextMenuEvent::Mouse )
public:
VTKViewer_RenderWindow(QWidget *parent, const char *name);
virtual ~VTKViewer_RenderWindow() ;
-
+
+ /*!Get render window pointer.*/
vtkRenderWindow* getRenderWindow() { return myRW; }
protected:
virtual void contextMenuEvent( QContextMenuEvent * e );
signals:
+ /*!On mouse move signal.*/
void MouseMove( QMouseEvent* );
+ /*!On mouse button pressed signal.*/
void MouseButtonPressed( QMouseEvent* );
+ /*!On mouse button released signal.*/
void MouseButtonReleased( QMouseEvent* );
+ /*!On mouse double click signal.*/
void MouseDoubleClicked( QMouseEvent* );
+ /*!On wheel moved signal.*/
void WheelMoved( QWheelEvent* );
+ /*!On left button pressed signal.*/
void LeftButtonPressed(const QMouseEvent *event) ;
+ /*!On left button released signal.*/
void LeftButtonReleased(const QMouseEvent *event) ;
+ /*!On middle button pressed signal.*/
void MiddleButtonPressed(const QMouseEvent *event) ;
+ /*!On middle button released signal.*/
void MiddleButtonReleased(const QMouseEvent *event) ;
+ /*!On right button pressed signal.*/
void RightButtonPressed(const QMouseEvent *event) ;
+ /*!On right button released signal.*/
void RightButtonReleased(const QMouseEvent *event) ;
+
+ /*!On button pressed signal.*/
void ButtonPressed(const QMouseEvent *event);
+ /*!On button released signal.*/
void ButtonReleased(const QMouseEvent *event);
+ /*!On key pressed signal.*/
void KeyPressed( QKeyEvent* );
+ /*!On key released signal.*/
void KeyReleased( QKeyEvent* );
+ /*!On content menu requested signal.*/
void contextMenuRequested( QContextMenuEvent *e );
protected:
// QT Includes
#include <qkeycode.h>
-//****************************************************************
+/*! Create new instance of VTKViewer_RenderWindowInteractor*/
VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New()
{
vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
return new VTKViewer_RenderWindowInteractor;
}
-//****************************************************************
+/*!Constructor.*/
VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor()
{
this->Enabled = 0 ;
connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ;
}
-//****************************************************************
+/*!Destructor.*/
VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor()
{
delete mTimer ;
myPointPicker->Delete();
}
-//****************************************************************
void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
{
vtkRenderWindowInteractor::PrintSelf(os, indent) ;
//
}
-//****************************************************************
-// We never allow the VTKViewer_RenderWindowInteractor to control
-// the event loop. The application always has the control.
-//
+/*!Description:\n
+ * Initializes the event handlers without an XtAppContext. This is \n
+ * good for when you don`t have a user interface, but you still \n
+ * want to have mouse interaction.\n
+ * We never allow the VTKViewer_RenderWindowInteractor to control \n
+ * the event loop. The application always has the control.
+ */
void VTKViewer_RenderWindowInteractor::Initialize()
{
//
return ;
}
-
-//----------------------------------------------------------------------------
+/*!Sets view window and add to it selection actors.*/
void VTKViewer_RenderWindowInteractor::setViewWindow(VTKViewer_ViewWindow* theViewWnd){
myViewWnd = theViewWnd;
}
}
-//----------------------------------------------------------------------------
+/*!Move selection actors to view window.*/
void VTKViewer_RenderWindowInteractor::MoveInternalActors()
{
myViewWnd->MoveActor(myCellActor);
myViewWnd->MoveActor(myPointActor);
}
-//----------------------------------------------------------------------------
+/*!Sets interactor style.*/
void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyle*>(theInteractor);
vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
}
-/*void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
+/*
+void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
{
myCellActor->SetVisibility(false);
myEdgeActor->SetVisibility(false);
}
myInteractorStyle->OnSelectionModeChanged();
-}*/
+}
+*/
-//****************************************************************
+/*!Sets selection properties.
+ *\param theRed - red component of color
+ *\param theGreen - green component of color
+ *\param theBlue - blue component of color
+ *\param theWidth - point size and line width
+ */
void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen,
const double& theBlue, const int& theWidth)
{
myPointActor->GetProperty()->SetPointSize(theWidth);
}
-//****************************************************************
+/*!Sets selection tolerance
+ *\param theTolNodes - nodes selection tolerance
+ *\param theTolItems - selection tolerance for basic and cell pickers.
+ */
void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems)
{
myTolNodes = theTolNodes;
}
-//****************************************************************
+/*! Description:\n
+ * Enable/Disable interactions. By default interactors are enabled when \n
+ * initialized. Initialize() must be called prior to enabling/disabling \n
+ * interaction. These methods are used when a window/widget is being \n
+ * shared by multiple renderers and interactors. This allows a "modal" \n
+ * display where one interactor is active when its data is to be displayed \n
+ * and all other interactors associated with the widget are disabled \n
+ * when their data is not displayed.
+ */
void VTKViewer_RenderWindowInteractor::Enable()
{
//
this->Modified() ;
}
-//****************************************************************
+/*!See Enable().*/
void VTKViewer_RenderWindowInteractor::Disable()
{
if( ! this->Enabled ) {
this->Modified() ;
}
-//****************************************************************
+/*!Description:\n
+ * This will start up the X event loop and never return. If you \n
+ * call this method it will loop processing X events until the \n
+ * application is exited.
+ */
void VTKViewer_RenderWindowInteractor::Start()
{
//
vtkErrorMacro(<<"VTKViewer_RenderWindowInteractor::Start() not allowed to start event loop.") ;
}
-//****************************************************************
+/*! Description:\n
+ * Event loop notification member for Window size change
+ */
void VTKViewer_RenderWindowInteractor::UpdateSize(int w, int h)
{
// if the size changed send this on to the RenderWindow
}
}
-//****************************************************************
+/*! Description:
+ * Timer methods must be overridden by platform dependent subclasses.
+ * flag is passed to indicate if this is first timer set or an update
+ * as Win32 uses repeating timers, whereas X uses One shot more timer
+ * if flag == VTKXI_TIMER_FIRST Win32 and X should createtimer
+ * otherwise Win32 should exit and X should perform AddTimeOut
+ * \retval 1
+ */
int VTKViewer_RenderWindowInteractor::CreateTimer(int vtkNotUsed(timertype))
{
- //
- // Start a one-shot timer for 10ms.
- //
+ ///
+ /// Start a one-shot timer for 10ms.
+ ///
mTimer->start(10, TRUE) ;
return 1 ;
}
-//****************************************************************
+/**@see CreateTimer(int )
+ *\retval 1
+ */
int VTKViewer_RenderWindowInteractor::DestroyTimer(void)
{
//
// :TRICKY: Tue May 2 00:17:32 2000 Pagey
//
- // QTimer will automatically expire after 10ms. So
- // we do not need to do anything here. In fact, we
- // should not even Stop() the QTimer here because doing
- // this will skip some of the processing that the TimerFunc()
- // does and will result in undesirable effects. For
- // example, this will result in vtkLODActor to leave
- // the models in low-res mode after the mouse stops
- // moving.
- //
+ /*! QTimer will automatically expire after 10ms. So
+ * we do not need to do anything here. In fact, we
+ * should not even Stop() the QTimer here because doing
+ * this will skip some of the processing that the TimerFunc()
+ * does and will result in undesirable effects. For
+ * example, this will result in vtkLODActor to leave
+ * the models in low-res mode after the mouse stops
+ * moving.
+ */
return 1 ;
}
-//****************************************************************
+/*! Not all of these slots are needed in VTK_MAJOR_VERSION=3,\n
+ * but moc does not understand "#if VTK_MAJOR_VERSION". Hence, \n
+ * we have to include all of these for the time being. Once,\n
+ * this bug in MOC is fixed, we can separate these.
+ */
void VTKViewer_RenderWindowInteractor::TimerFunc()
{
if( ! this->Enabled ) {
emit RenderWindowModified() ;
}
+/*!Emit render window modified on mouse move,\n
+ *if interactor style needs redrawing and render window enabled.*/
void VTKViewer_RenderWindowInteractor::MouseMove(QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
emit RenderWindowModified() ;
}
+/*!Reaction on left button pressed.\n
+ *Same as left button down for interactor style.\n
+ *If render window enabled.
+ */
void VTKViewer_RenderWindowInteractor::LeftButtonPressed(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
event->x(), event->y());
}
+/*!Reaction on left button releases.\n
+ *Same as left button up for interactor style.\n
+ *If render window enabled.
+ */
void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
event->x(), event->y() ) ;
}
+/*!Reaction on middle button pressed.\n
+ *Same as middle button down for interactor style.\n
+ *If render window enabled.
+ */
void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
event->x(), event->y() ) ;
}
+/*!Reaction on middle button released.\n
+ *Same as middle button up for interactor style.\n
+ *If render window enabled.
+ */
void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
event->x(), event->y() ) ;
}
+/*!Reaction on right button pressed.\n
+ *Same as right button down for interactor style.\n
+ *If render window enabled.
+ */
void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
event->x(), event->y() ) ;
}
+/*!Reaction on right button released.\n
+ *Same as right button up for interactor style.If render window enabled.\n
+ *Emit context menu requested, if interactor style state equal VTK_INTERACTOR_STYLE_CAMERA_NONE.
+ */
void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
if( ! this->Enabled ) {
return ;
}
}
+/*!Reaction on button pressed.
+ *\warning Do nothing.
+ */
void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) {
return ;
}
+/*!Reaction on button released..
+ *\warning Do nothing.
+ */
void VTKViewer_RenderWindowInteractor::ButtonReleased(const QMouseEvent *event) {
return ;
}
-
+/*!Gets display mode.*/
int VTKViewer_RenderWindowInteractor::GetDisplayMode() {
return myDisplayMode;
}
+/*!Sets display mode.*/
void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) {
if(theMode == 0)
ChangeRepresentationToWireframe();
myDisplayMode = theMode;
}
-//****************************************************************
+/*!Change all actors to wireframe*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe()
-// change all actors to wireframe
{
ChangeRepresentationToWireframe(GetRenderer()->GetActors());
}
-//****************************************************************
+/*!Change all actors to surface*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
{
ChangeRepresentationToSurface(GetRenderer()->GetActors());
}
-
+/*!Change all actors from \a theCollection to wireframe and
+ * emit render window modified.
+ */
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
{
using namespace VTK;
emit RenderWindowModified();
}
+/*!Change all actors from \a theCollection to surface and
+ * emit render window modified.
+ */
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
{
using namespace VTK;
emit RenderWindowModified();
}
-//****************************************************************
+/*!Gets renderer.*/
vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer()
{
vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers();
return theRenderers->GetNextItem();
}
-//****************************************************************
+/*!Do nothing*/
void VTKViewer_RenderWindowInteractor::EraseAll()
{
}
-//****************************************************************
+/*!Display all actors.
+ *Sets visible for all actors from renderer collection and emit render window modified.
+ */
void VTKViewer_RenderWindowInteractor::DisplayAll()
{
using namespace VTK;
emit RenderWindowModified() ;
}
-//****************************************************************
+/*!Do nothing*/
void VTKViewer_RenderWindowInteractor::Erase( VTKViewer_Actor* SActor, bool update)
{
}
+/*!Remove \a SActor from renderer and emit update window, if \a updateViewer - true*/
void VTKViewer_RenderWindowInteractor::Remove( VTKViewer_Actor* SActor, bool updateViewer )
{
if ( SActor != 0 )
}
}
+/*!Remove actors from render window collection(not implemented).
+ *Emit render window modified, if \a updateViewer - true.
+ */
void VTKViewer_RenderWindowInteractor::RemoveAll( const bool updateViewer )
{
vtkRenderer* aRenderer = GetRenderer();
}
}
-
-
-
+/*!\brief Display the \a theActor.*/
+/*! Add actor to renderer and set visibility to true.
+ * Emit render window modified, if \a update - true.
+ */
void VTKViewer_RenderWindowInteractor::Display( VTKViewer_Actor* theActor, bool update)
{
GetRenderer()->AddActor(theActor);
void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event)
{
- // NOT_IMPLEMENTED
+ /// NOT_IMPLEMENTED
}
-
+/*!Structure with one function "operator()", which call apply properties for actor.*/
struct TUpdateAction{
+ /*!Apply properties for \a theActor.*/
void operator()(vtkActor* theActor){
theActor->ApplyProperties();
}
};
+/*!Update all actors from renderer and emit render window modified.*/
void VTKViewer_RenderWindowInteractor::Update() {
using namespace VTK;
vtkRenderer* aRen = GetRenderer();
emit RenderWindowModified();
}
-
+/*!Unhighlight all selection actors.*/
void VTKViewer_RenderWindowInteractor::unHighlightSubSelection(){
myPointActor->SetVisibility(false);
myEdgeActor->SetVisibility(false);
myCellActor->SetVisibility(false);
}
+/*!@see unHighlightSubSelection()
+ * Also emit render window modified.
+ */
bool VTKViewer_RenderWindowInteractor::unHighlightAll(){
unHighlightSubSelection();
}
-//----------------------------------------------------------------------------
+/*! \li Sets actors data and sets visibility to true, if flag \a hilight - true,
+ * else sets visibility to false.
+ * \li Emit render window modified, if flag \a update - true.
+ */
bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex,
VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor,
TUpdateActor theFun, bool hilight, bool update)
return false;
}
+/*!Sets actors data.*/
void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex,
VTKViewer_Actor * theMapActor,
VTKViewer_Actor * theActor,
void PrintSelf(ostream& os, vtkIndent indent);
- // Description:
- // Initializes the event handlers without an XtAppContext. This is
- // good for when you don`t have a user interface, but you still
- // want to have mouse interaction.
virtual void Initialize();
virtual void SetInteractorStyle(vtkInteractorObserver *);
+ /*!Return interactor style pointer.*/
VTKViewer_InteractorStyle* GetInteractorStyle() const
{
return myInteractorStyle;
}
- // Description:
- // This will start up the X event loop and never return. If you
- // call this method it will loop processing X events until the
- // application is exited.
virtual void Start();
- // Description:
- // Enable/Disable interactions. By default interactors are enabled when
- // initialized. Initialize() must be called prior to enabling/disabling
- // interaction. These methods are used when a window/widget is being
- // shared by multiple renderers and interactors. This allows a "modal"
- // display where one interactor is active when its data is to be displayed
- // and all other interactors associated with the widget are disabled
- // when their data is not displayed.
virtual void Enable();
virtual void Disable();
- // Description:
- // Event loop notification member for Window size change
virtual void UpdateSize(int x,int y);
- // Description:
- // Timer methods must be overridden by platform dependent subclasses.
- // flag is passed to indicate if this is first timer set or an update
- // as Win32 uses repeating timers, whereas X uses One shot more timer
- // if flag==VTKXI_TIMER_FIRST Win32 and X should createtimer
- // otherwise Win32 should exit and X should perform AddTimeOut()
- virtual int CreateTimer(int ) ;
+ /** @name Timer options*/
+ //@{
+ virtual int CreateTimer(int ) ;
virtual int DestroyTimer() ;
+ //@}
- // Description:
- // This function is called on 'q','e' keypress if exitmethod is not
- // specified and should be overidden by platform dependent subclasses
- // to provide a termination procedure if one is required.
+ /*! Description:\n
+ * This function is called on 'q','e' keypress if exitmethod is not\n
+ * specified and should be overidden by platform dependent subclasses\n
+ * to provide a termination procedure if one is required.
+ */
virtual void TerminateApp(void) { /* empty */ }
// Description:
//virtual void StartPickCallback();
//virtual void EndPickCallback();
- /* Selection Management */
+ /** @name Selection Management */
+ //@{
bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex,
VTKViewer_Actor* theMapActor,
bool hilight,
void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1,
const double& theBlue = 0, const int& theWidth = 5);
void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001);
+ //@}
- // Displaymode management
+ /** @name Displaymode management*/
+ //@{
int GetDisplayMode();
void SetDisplayMode(int);
+ //@}
- // Change all actors to wireframe or surface
+ /** @name Change all actors to wireframe or surface*/
+ //@{
void ChangeRepresentationToWireframe();
void ChangeRepresentationToSurface();
+ //@}
- // Change to wireframe or surface a list of vtkactor
+ /** @name Change to wireframe or surface a list of vtkactor*/
+ //@{
void ChangeRepresentationToWireframe(vtkActorCollection* ListofActors);
void ChangeRepresentationToSurface(vtkActorCollection* ListofActors);
+ //@}
- // Erase Display functions
+ /** @name Erase Display functions*/
+ //@{
void EraseAll();
void DisplayAll();
void RemoveAll( const bool immediatly );
void Display( VTKViewer_Actor* SActor, bool immediatly = true );
void Erase( VTKViewer_Actor* SActor, bool immediatly = true );
void Remove( VTKViewer_Actor* SActor, bool updateViewer = true );
+ //@}
void Update();
VTKViewer_Actor *theActor,
TUpdateActor theFun);
- // Timer used during various mouse events to figure
- // out mouse movements.
+ /*! Timer used during various mouse events to figure
+ * out mouse movements.
+ */
QTimer *mTimer ;
int myDisplayMode;
vtkCellPicker* myCellPicker;
vtkPointPicker* myPointPicker;
- // User for switching to stereo mode.
+ /*! User for switching to stereo mode.*/
int PositionBeforeStereo[2];
public slots:
void KeyPressed(QKeyEvent *event) ;
private slots:
- // Not all of these slots are needed in VTK_MAJOR_VERSION=3,
- // but moc does not understand "#if VTK_MAJOR_VERSION". Hence,
- // we have to include all of these for the time being. Once,
- // this bug in MOC is fixed, we can separate these.
void TimerFunc() ;
signals:
friend class VTKViewer_ViewWindow;
VTKViewer_ViewWindow* myViewWnd;
+ /** Selection node tolerance.*/
double myTolNodes;
+ /** Selection cell tolerance.*/
double myTolItems;
};