VTK  9.1.0
vtkScalarsToColorsItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkScalarsToColorsItem.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
30 #ifndef vtkScalarsToColorsItem_h
31 #define vtkScalarsToColorsItem_h
32 
33 #include "vtkChartsCoreModule.h" // For export macro
34 #include "vtkNew.h" // For vtkNew
35 #include "vtkPlot.h"
36 
37 class vtkCallbackCommand;
38 class vtkImageData;
39 class vtkPlotBar;
40 class vtkPoints2D;
41 
42 class VTKCHARTSCORE_EXPORT vtkScalarsToColorsItem : public vtkPlot
43 {
44 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
52  void GetBounds(double bounds[4]) override;
53 
55 
60  vtkSetVector4Macro(UserBounds, double);
61  vtkGetVector4Macro(UserBounds, double);
63 
69  bool Paint(vtkContext2D* painter) override;
70 
72 
77  vtkGetObjectMacro(PolyLinePen, vtkPen);
79 
81 
84  void SetHistogramTable(vtkTable* histogramTable);
85  vtkGetObjectMacro(HistogramTable, vtkTable);
87 
89 
96  vtkSetMacro(MaskAboveCurve, bool);
97  vtkGetMacro(MaskAboveCurve, bool);
99 
108  vtkIdType* segmentIndex) override;
110 
116  const vtkVector2d& plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex) override;
117 
118 protected:
121 
127  virtual void ComputeBounds(double* bounds);
128 
134  virtual void ComputeTexture() = 0;
135 
136  vtkGetMacro(TextureWidth, int);
137 
143  virtual bool ConfigurePlotBar();
144 
146 
150  virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid, void* calldata);
152  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
154 
155  double UserBounds[4];
156 
157  bool Interpolate = true;
159  vtkImageData* Texture = nullptr;
160  vtkTable* HistogramTable = nullptr;
161 
167 
168 private:
170  void operator=(const vtkScalarsToColorsItem&) = delete;
171 };
172 
173 #endif
vtkPoints2D
represent and manipulate 2D points
Definition: vtkPoints2D.h:34
vtkScalarsToColorsItem
Abstract class for ScalarsToColors items.
Definition: vtkScalarsToColorsItem.h:43
vtkScalarsToColorsItem::SetHistogramTable
void SetHistogramTable(vtkTable *histogramTable)
Set/Get the vtkTable displayed as an histogram using a vtkPlotBar.
vtkPlot.h
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:172
vtkScalarsToColorsItem::OnScalarsToColorsModified
static void OnScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
vtkScalarsToColorsItem::vtkScalarsToColorsItem
vtkScalarsToColorsItem()
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkScalarsToColorsItem::ConfigurePlotBar
virtual bool ConfigurePlotBar()
Method to configure the plotbar histogram before painting it can be reimplemented by subclasses.
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:157
vtkScalarsToColorsItem::Shape
vtkNew< vtkPoints2D > Shape
Definition: vtkScalarsToColorsItem.h:162
vtkVector2d
Definition: vtkVector.h:503
vtkScalarsToColorsItem::~vtkScalarsToColorsItem
~vtkScalarsToColorsItem() override
vtkPlot::GetNearestPoint
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId)
Function to query a plot for the nearest point to the specified coordinate.
vtkPlotBar
Class for drawing an XY plot given two columns from a vtkTable.
Definition: vtkPlotBar.h:62
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkScalarsToColorsItem::PolyLinePen
vtkNew< vtkPen > PolyLinePen
Definition: vtkScalarsToColorsItem.h:165
vtkScalarsToColorsItem::ScalarsToColorsModified
virtual void ScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
vtkScalarsToColorsItem::GetNearestPoint
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &, vtkVector2f *location, vtkIdType *segmentIndex) override
Function to query a plot for the nearest point to the specified coordinate.
vtkScalarsToColorsItem::ComputeBounds
virtual void ComputeBounds(double *bounds)
Bounds of the item, by default (0, 1, 0, 1) but it depends on the range of the ScalarsToColors functi...
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkNew< vtkPoints2D >
vtkScalarsToColorsItem::ComputeTexture
virtual void ComputeTexture()=0
Need to be reimplemented by subclasses, ComputeTexture() is called at paint time if the texture is no...
vtkScalarsToColorsItem::GetTooltipLabel
vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex) override
Generate and return the tooltip label string for this plot The segmentIndex is implemented here.
vtkScalarsToColorsItem::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkScalarsToColorsItem::Paint
bool Paint(vtkContext2D *painter) override
Paint the texture into a rectangle defined by the bounds.
vtkNew.h
vtkScalarsToColorsItem::PlotBar
vtkNew< vtkPlotBar > PlotBar
Definition: vtkScalarsToColorsItem.h:164
vtkScalarsToColorsItem::Callback
vtkNew< vtkCallbackCommand > Callback
Definition: vtkScalarsToColorsItem.h:163
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:154
vtkX3D::location
@ location
Definition: vtkX3D.h:412
vtkScalarsToColorsItem::GetBounds
void GetBounds(double bounds[4]) override
Bounds of the item, use the UserBounds if valid otherwise compute the bounds of the item (based on th...
vtkPen
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:136
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
vtkScalarsToColorsItem::TextureWidth
int TextureWidth
Definition: vtkScalarsToColorsItem.h:158
vtkVector2f
Definition: vtkVector.h:491
vtkScalarsToColorsItem::MaskAboveCurve
bool MaskAboveCurve
Definition: vtkScalarsToColorsItem.h:166