ctkVTKScalarsToColorsWidget.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 __ctkVTKScalarsToColorsWidget_h
  15. #define __ctkVTKScalarsToColorsWidget_h
  16. //Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include <ctkVTKObject.h>
  20. #include "ctkVisualizationVTKWidgetsExport.h"
  21. class ctkVTKScalarsToColorsView;
  22. class ctkVTKScalarsToColorsWidgetPrivate;
  23. // VTK includes
  24. class vtkControlPointsItem;
  25. class vtkPlot;
  26. /// \ingroup Visualization_VTK_Widgets
  27. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKScalarsToColorsWidget : public QWidget
  28. {
  29. Q_OBJECT
  30. QVTK_OBJECT
  31. Q_PROPERTY(bool horizontalSliderVisible READ isHorizontalSliderVisible WRITE setHorizontalSliderVisible)
  32. Q_PROPERTY(bool verticalSliderVisible READ isVerticalSliderVisible WRITE setVerticalSliderVisible)
  33. Q_PROPERTY(bool editColors READ editColors WRITE setEditColors)
  34. public:
  35. ctkVTKScalarsToColorsWidget(QWidget* parent = 0);
  36. virtual ~ctkVTKScalarsToColorsWidget();
  37. ctkVTKScalarsToColorsView* view()const;
  38. vtkControlPointsItem* currentControlPointsItem()const;
  39. bool isHorizontalSliderVisible()const;
  40. void setHorizontalSliderVisible(bool visible);
  41. bool isVerticalSliderVisible()const;
  42. void setVerticalSliderVisible(bool visible);
  43. bool editColors()const;
  44. void setEditColors(bool edit);
  45. void xRange(double* range)const;
  46. void yRange(double* range)const;
  47. ///
  48. /// Return the top-left corner widget if any.
  49. QWidgetList extraWidgets()const;
  50. ///
  51. /// Add a widget in the top-left corner.
  52. /// ctkVTKScalarsToColorsWidget takes ownership of the widget
  53. void addExtraWidget(QWidget* extraWidget);
  54. public Q_SLOTS:
  55. void setCurrentControlPointsItem(vtkControlPointsItem* item);
  56. void setCurrentPoint(int pointId);
  57. void setXRange(double min, double max);
  58. void setYRange(double min, double max);
  59. Q_SIGNALS:
  60. /// Be carefull, axesModified() can be fired inside the Render() function
  61. /// of the view. You might want to connect the slot using Qt::QueuedConnection
  62. void axesModified();
  63. protected Q_SLOTS:
  64. void onPlotAdded(vtkPlot*);
  65. void onBoundsChanged();
  66. void setCurrentPoint(vtkObject* controlPointsItem, void* pointId);
  67. void updateNumberOfPoints();
  68. void updateCurrentPoint();
  69. void onCurrentPointChanged(int pointId);
  70. void onColorChanged(const QColor& color);
  71. void onXChanged(double x);
  72. void onOpacityChanged(double opacity);
  73. void onMidPointChanged(double midPoint);
  74. void onSharpnessChanged(double sharpness);
  75. void onAxesModified();
  76. void restorePalette();
  77. void onExpandButton(bool state);
  78. protected:
  79. QScopedPointer<ctkVTKScalarsToColorsWidgetPrivate> d_ptr;
  80. private:
  81. Q_DECLARE_PRIVATE(ctkVTKScalarsToColorsWidget);
  82. Q_DISABLE_COPY(ctkVTKScalarsToColorsWidget);
  83. };
  84. #endif