ctkVTKRenderView.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.commontk.org/LICENSE
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkVTKRenderView_h
  15. #define __ctkVTKRenderView_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include <ctkPimpl.h>
  20. #include "CTKVisualizationVTKWidgetsExport.h"
  21. class ctkVTKRenderViewPrivate;
  22. class vtkInteractorObserver;
  23. class vtkRenderWindowInteractor;
  24. class vtkRenderWindow;
  25. class vtkRenderer;
  26. class vtkCamera;
  27. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKRenderView : public QWidget
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
  31. Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
  32. Q_PROPERTY(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
  33. Q_PROPERTY(bool orientationWidgetVisible READ orientationWidgetVisible
  34. WRITE setOrientationWidgetVisible)
  35. Q_PROPERTY(double zoomFactor READ zoomFactor WRITE setZoomFactor)
  36. public:
  37. /// Constructors
  38. typedef QWidget Superclass;
  39. explicit ctkVTKRenderView(QWidget* parent = 0);
  40. virtual ~ctkVTKRenderView(){}
  41. public slots:
  42. /// If a render has already been scheduled, this called is a no-op
  43. void scheduleRender();
  44. /// Force a render even if a render is already ocurring
  45. void forceRender();
  46. /// Set background color
  47. void setBackgroundColor(const QColor& newBackgroundColor);
  48. /// Enable/Disable rendering
  49. void setRenderEnabled(bool value);
  50. /// Set corner annotation \a text
  51. void setCornerAnnotationText(const QString& text);
  52. /// Show/Hide Orientation widget
  53. void setOrientationWidgetVisible(bool visible);
  54. /// \brief Set zoom factor
  55. /// zoomFactor is a value between 0.0 and 1.0
  56. void setZoomFactor(double newZoomFactor);
  57. /// Zoom in using the \a zoomfactor
  58. /// \sa setZoomFactor
  59. void zoomIn();
  60. /// Zoom out using the \a zoomfactor
  61. /// \sa setZoomFactor
  62. void zoomOut();
  63. public:
  64. /// Get underlying RenderWindow
  65. vtkRenderWindow* renderWindow()const;
  66. /// Set/Get window interactor
  67. vtkRenderWindowInteractor* interactor()const;
  68. void setInteractor(vtkRenderWindowInteractor* newInteractor);
  69. /// Get current interactor style
  70. vtkInteractorObserver* interactorStyle();
  71. /// Get corner annotation \a text
  72. QString cornerAnnotationText() const;
  73. /// Get background color
  74. QColor backgroundColor() const;
  75. /// Get Orientation widget visibility
  76. bool orientationWidgetVisible();
  77. /// Get active camera
  78. vtkCamera* activeCamera();
  79. /// Reset camera
  80. void resetCamera();
  81. /// Get a reference to the associated vtkRenderer
  82. vtkRenderer* renderer()const;
  83. /// Return if rendering is enabled
  84. bool renderEnabled() const;
  85. /// Return zoom factor
  86. double zoomFactor()const;
  87. private:
  88. CTK_DECLARE_PRIVATE(ctkVTKRenderView);
  89. };
  90. #endif