vtkLightBoxRendererManager.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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.apache.org/licenses/LICENSE-2.0.txt
  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 __vtkLightBoxRendererManager_h
  15. #define __vtkLightBoxRendererManager_h
  16. #include <vtkObject.h>
  17. #include <vtkVersion.h>
  18. #include "ctkVisualizationVTKCoreExport.h"
  19. class vtkRenderWindow;
  20. class vtkRenderer;
  21. class vtkImageData;
  22. class vtkCamera;
  23. class vtkCornerAnnotation;
  24. class vtkAlgorithmOutput;
  25. /// \ingroup Visualization_VTK_Core
  26. class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkLightBoxRendererManager : public vtkObject
  27. {
  28. vtkTypeMacro(vtkLightBoxRendererManager,vtkObject);
  29. void PrintSelf(ostream& os, vtkIndent indent);
  30. static vtkLightBoxRendererManager *New();
  31. void Initialize(vtkRenderWindow* renderWindow);
  32. bool IsInitialized();
  33. /// Set the layer associated with the renderers
  34. /// \note By default, the value is 0
  35. /// \sa vtkRenderer::SetLayer
  36. void SetRendererLayer(int newLayer);
  37. /// Get associated RenderWindow
  38. vtkRenderWindow* GetRenderWindow();
  39. /// Set image data
  40. #if (VTK_MAJOR_VERSION <= 5)
  41. void SetImageData(vtkImageData* newImageData);
  42. #else
  43. void SetImageDataConnection(vtkAlgorithmOutput* newImageDataConnection);
  44. #endif
  45. /// Get active camera
  46. /// Note that the same camera is used with all the renderWindowItem
  47. vtkCamera* GetActiveCamera();
  48. /// Set actice camera
  49. void SetActiveCamera(vtkCamera* newActiveCamera);
  50. /// Reset cameras associated with all renderWindowItem
  51. void ResetCamera();
  52. /// Return number of underlying render window Item
  53. /// \note In the current implementation
  54. int GetRenderWindowItemCount();
  55. /// Get a reference to the associated vtkRenderer(s) identified by its \a id
  56. vtkRenderer* GetRenderer(int id);
  57. /// Get a reference to the associated vtkRenderer(s) given its position in the grid
  58. /// \sa GetRenderer(int)
  59. vtkRenderer* GetRenderer(int rowId, int columnId);
  60. /// The layout type determines how the image slices should be displayed
  61. /// within the different render view items.
  62. /// \sa SetRenderWindowLayout() GetRenderWindowLayoutType()
  63. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  64. /// Get current layout type
  65. int GetRenderWindowLayoutType() const;
  66. /// Set current \a layoutType
  67. void SetRenderWindowLayoutType(int layoutType);
  68. /// Split the current vtkRenderWindow in \a rowCount per \a columnCount grid
  69. void SetRenderWindowLayout(int rowCount, int columnCount);
  70. /// Set the \a rowCount
  71. /// \sa SetRenderWindowLayout
  72. void SetRenderWindowRowCount(int newRowCount);
  73. /// Get number of rows
  74. /// \sa SetRenderWindowLayout
  75. int GetRenderWindowRowCount();
  76. /// Set the \a columnCount
  77. /// \sa SetRenderWindowLayout
  78. void SetRenderWindowColumnCount(int newColumnCount);
  79. /// Get number of columns
  80. /// \sa SetRenderWindowLayout
  81. int GetRenderWindowColumnCount();
  82. /// Return True if the render view item identified by \a id is highlighted
  83. bool GetHighlightedById(int id);
  84. /// \brief Return True if the render view item identified by its position in the grid
  85. /// is highlighted
  86. /// \sa GetHighlightedById(int)
  87. bool GetHighlighted(int rowId, int columnId);
  88. /// Highlight / Unhighlight a render view item given its \a id
  89. void SetHighlightedById(int id, bool highlighted);
  90. /// Highlight / Unhighlight a render view item given its position in the grid
  91. /// \sa setHighlighted(int, bool)
  92. void SetHighlighted(int rowId, int columnId, bool highlighted);
  93. /// \sa SetHighlighted SetHighlightedBoxColorById
  94. void SetHighlightedBoxColor(double highlightedBoxColor[3]);
  95. /// \brief Set the color of the box displayed around the highlighted item
  96. /// identified by \a id
  97. /// The highlightedBox is set with a width of 3 screen units.
  98. /// \sa SetHighlightedById SetHighlighted vtkProperty2D::SetLineWidth
  99. double* GetHighlightedBoxColor()const;
  100. /// Convenient function allowing to compute the renderWindowItemId
  101. /// given \a rowId and \a columnId.
  102. /// The following formula is used: ColumnCount * rowId + columnId
  103. /// \note The \a rowCount and \a columnCount correspond to the one set
  104. /// using setRenderWindowLayout.
  105. inline int ComputeRenderWindowItemId(int rowId, int columnId);
  106. /// Set corner annotation \a text
  107. void SetCornerAnnotationText(const std::string& text);
  108. /// Get current corner annotation
  109. const std::string GetCornerAnnotationText()const;
  110. /// Get corner annotation actor
  111. /// The same annotation is associated with all renderers managed by the light box
  112. vtkCornerAnnotation * GetCornerAnnotation()const;
  113. void SetCornerAnnotation(vtkCornerAnnotation* annotation);
  114. /// Set background color
  115. void SetBackgroundColor(const double newBackgroundColor[3]);
  116. /// Get background color
  117. double* GetBackgroundColor()const;
  118. /// Set color level
  119. void SetColorLevel(double colorLevel);
  120. /// Get color level
  121. double GetColorLevel()const;
  122. /// Set color window
  123. void SetColorWindow(double colorWindow);
  124. /// Get color window
  125. double GetColorWindow()const;
  126. /// Set color Window and color level
  127. void SetColorWindowAndLevel(double colorWindow, double colorLevel);
  128. protected:
  129. vtkLightBoxRendererManager();
  130. ~vtkLightBoxRendererManager();
  131. private:
  132. vtkLightBoxRendererManager(const vtkLightBoxRendererManager&); // Not implemented.
  133. void operator=(const vtkLightBoxRendererManager&); // Not implemented.
  134. //BTX
  135. class vtkInternal;
  136. vtkInternal* Internal;
  137. //ETX
  138. };
  139. #endif