ctkVTKAbstractView.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 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 __ctkVTKAbstractView_h
  15. #define __ctkVTKAbstractView_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include "ctkVisualizationVTKWidgetsExport.h"
  20. class ctkVTKAbstractViewPrivate;
  21. class vtkCornerAnnotation;
  22. class vtkInteractorObserver;
  23. class vtkRenderWindowInteractor;
  24. class vtkRenderWindow;
  25. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKAbstractView : public QWidget
  26. {
  27. Q_OBJECT
  28. Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
  29. Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
  30. Q_PROPERTY(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
  31. public:
  32. typedef QWidget Superclass;
  33. explicit ctkVTKAbstractView(QWidget* parent = 0);
  34. virtual ~ctkVTKAbstractView();
  35. public slots:
  36. /// If a render has already been scheduled, this called is a no-op
  37. void scheduleRender();
  38. /// Force a render even if a render is already ocurring
  39. void forceRender();
  40. /// Set background color
  41. virtual void setBackgroundColor(const QColor& newBackgroundColor) = 0;
  42. /// Enable/Disable rendering
  43. void setRenderEnabled(bool value);
  44. /// Set corner annotation \a text
  45. virtual void setCornerAnnotationText(const QString& text);
  46. public:
  47. /// Get underlying RenderWindow
  48. vtkRenderWindow* renderWindow()const;
  49. /// Set/Get window interactor
  50. vtkRenderWindowInteractor* interactor()const;
  51. virtual void setInteractor(vtkRenderWindowInteractor* interactor);
  52. /// Get current interactor style
  53. vtkInteractorObserver* interactorStyle()const;
  54. /// Get corner annotation \a text
  55. QString cornerAnnotationText() const;
  56. vtkCornerAnnotation* cornerAnnotation()const;
  57. /// Get background color
  58. virtual QColor backgroundColor() const = 0;
  59. /// Return if rendering is enabled
  60. bool renderEnabled() const;
  61. protected:
  62. QScopedPointer<ctkVTKAbstractViewPrivate> d_ptr;
  63. ctkVTKAbstractView(ctkVTKAbstractViewPrivate* pimpl, QWidget* parent);
  64. private:
  65. Q_DECLARE_PRIVATE(ctkVTKAbstractView);
  66. Q_DISABLE_COPY(ctkVTKAbstractView);
  67. };
  68. #endif