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
supports function callbacks
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:54
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Definition: vtkPen.h:37
Class for drawing an XY plot given two columns from a vtkTable.
Definition: vtkPlotBar.h:43
Abstract class for 2D plots.
Definition: vtkPlot.h:48
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.
represent and manipulate 2D points
Definition: vtkPoints2D.h:34
Abstract class for ScalarsToColors items.
static void OnScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
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...
virtual void ComputeTexture()=0
Need to be reimplemented by subclasses, ComputeTexture() is called at paint time if the texture is no...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkNew< vtkPlotBar > PlotBar
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...
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() override
void SetHistogramTable(vtkTable *histogramTable)
Set/Get the vtkTable displayed as an histogram using a vtkPlotBar.
bool Paint(vtkContext2D *painter) override
Paint the texture into a rectangle defined by the bounds.
virtual void ScalarsToColorsModified(vtkObject *caller, unsigned long eid, void *calldata)
Called whenever the ScalarsToColors function(s) is modified.
vtkNew< vtkCallbackCommand > Callback
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.
virtual bool ConfigurePlotBar()
Method to configure the plotbar histogram before painting it can be reimplemented by subclasses.
vtkNew< vtkPoints2D > Shape
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:36
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:63
@ point
Definition: vtkX3D.h:242
@ location
Definition: vtkX3D.h:412
int vtkIdType
Definition: vtkType.h:332