VTK  9.0.3
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  vtkVector2f* location, vtkIdType* segmentIndex) override;
109 #ifndef VTK_LEGACY_REMOVE
111 #endif // VTK_LEGACY_REMOVE
112 
118  const vtkVector2d& plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex) override;
119 
120 protected:
123 
129  virtual void ComputeBounds(double* bounds);
130 
136  virtual void ComputeTexture() = 0;
137 
138  vtkGetMacro(TextureWidth, int);
139 
145  virtual bool ConfigurePlotBar();
146 
148 
152  virtual void ScalarsToColorsModified(vtkObject* caller, unsigned long eid, void* calldata);
154  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
156 
157  double UserBounds[4];
158 
159  bool Interpolate = true;
161  vtkImageData* Texture = nullptr;
162  vtkTable* HistogramTable = nullptr;
163 
169 
170 private:
172  void operator=(const vtkScalarsToColorsItem&) = delete;
173 };
174 
175 #endif
supports function callbacks
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:53
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
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:47
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)
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
virtual 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.
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...
~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:35
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:338