VTK: Charts/Core/vtkPlotHistogram2D.h Source File

| VTK 9.3.1

vtkPlotHistogram2D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3
12 #ifndef vtkPlotHistogram2D_h
13 #define vtkPlotHistogram2D_h
14
15 #include "vtkChartsCoreModule.h" // For export macro
16 #include "vtkPlot.h"
17 #include "vtkRect.h" // Needed for vtkRectf
18 #include "vtkSmartPointer.h" // Needed for SP ivars
19
20 #include <string> // Needed for std::string
21
22 VTK_ABI_NAMESPACE_BEGIN
23
24 class vtkDataArray;
25 class vtkImageData;
26 class vtkScalarsToColors;
27
28 class VTKCHARTSCORE_EXPORT vtkPlotHistogram2D : public vtkPlot
29 {
30 public:
31 vtkTypeMacro(vtkPlotHistogram2D, vtkPlot);
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
37 static vtkPlotHistogram2D* New();
38
44 void Update() override;
45
49 bool Paint(vtkContext2D* painter) override;
50
55 virtual void SetInputData(vtkImageData* data, vtkIdType z = 0);
56 void SetInputData(vtkTable*) override {}
57 void SetInputData(vtkTable*, const vtkStdString&, const vtkStdString&) override {}
58
62 vtkImageData* GetInputImageData();
63
68 void SetTransferFunction(vtkScalarsToColors* transfer);
69
73 vtkScalarsToColors* GetTransferFunction();
74
75 void GetBounds(double bounds[4]) override;
76
77 virtual void SetPosition(const vtkRectf& pos);
78 virtual vtkRectf GetPosition();
79
81
86 vtkSetMacro(ArrayName, std::string);
87 vtkGetMacro(ArrayName, std::string);
89
106 vtkStdString GetTooltipLabel(
107 const vtkVector2d& plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex) override;
108
117 vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
118 vtkVector2f* location, vtkIdType* segmentId) override;
119 using vtkPlot::GetNearestPoint;
120
127 bool UpdateCache() override;
128
129 protected:
130 vtkPlotHistogram2D();
131 ~vtkPlotHistogram2D() override;
132
133 vtkSmartPointer<vtkImageData> Input;
134 vtkSmartPointer<vtkImageData> Output;
135 vtkSmartPointer<vtkScalarsToColors> TransferFunction;
136 vtkRectf Position;
137
138 private:
139 vtkPlotHistogram2D(const vtkPlotHistogram2D&) = delete;
140 void operator=(const vtkPlotHistogram2D&) = delete;
141
146 static vtkIdType GetLabelIndexFromValue(double value, vtkAxis* axis);
151 static inline bool CanComputeMagnitude(int nbComponents);
152
157 inline vtkDataArray* GetSelectedArray();
165 void* GetInputArrayPointer(int& nbComponents);
172 double GetInputArrayValue(int x, int y, int z);
173
174 std::string ArrayName;
175 vtkSmartPointer<vtkDataArray> MagnitudeArray;
176 };
177
178 VTK_ABI_NAMESPACE_END
179 #endif // vtkPlotHistogram2D_h
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:70
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkPlotHistogram2D
Definition: vtkPlotHistogram2D.h:29
vtkPlotHistogram2D::GetNearestPoint
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId) override
Function to query a plot for the nearest point to the specified coordinate.
vtkPlotHistogram2D::GetTransferFunction
vtkScalarsToColors * GetTransferFunction()
Get the color transfer function that is used to generate the histogram.
vtkPlotHistogram2D::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever it needs to be drawn.
vtkPlotHistogram2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPlotHistogram2D::Output
vtkSmartPointer< vtkImageData > Output
Definition: vtkPlotHistogram2D.h:134
vtkPlotHistogram2D::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkPlotHistogram2D::GetPosition
virtual vtkRectf GetPosition()
vtkPlotHistogram2D::Position
vtkRectf Position
Definition: vtkPlotHistogram2D.h:136
vtkPlotHistogram2D::~vtkPlotHistogram2D
~vtkPlotHistogram2D() override
vtkPlotHistogram2D::UpdateCache
bool UpdateCache() override
Update the internal cache.
vtkPlotHistogram2D::SetInputData
void SetInputData(vtkTable *, const vtkStdString &, const vtkStdString &) override
This is a convenience function to set the input table and the x, y column for the plot.
Definition: vtkPlotHistogram2D.h:57
vtkPlotHistogram2D::GetTooltipLabel
vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex) override
Generate and return the tooltip label string for this plot The segmentIndex parameter is ignored.
vtkPlotHistogram2D::SetInputData
virtual void SetInputData(vtkImageData *data, vtkIdType z=0)
Set the input.
vtkPlotHistogram2D::GetInputImageData
vtkImageData * GetInputImageData()
Get the input table used by the plot.
vtkPlotHistogram2D::SetInputData
void SetInputData(vtkTable *) override
This is a convenience function to set the input table and the x, y column for the plot.
Definition: vtkPlotHistogram2D.h:56
vtkPlotHistogram2D::New
static vtkPlotHistogram2D * New()
Creates a new object.
vtkPlotHistogram2D::SetTransferFunction
void SetTransferFunction(vtkScalarsToColors *transfer)
Set the color transfer function that will be used to generate the 2D histogram.
vtkPlotHistogram2D::SetPosition
virtual void SetPosition(const vtkRectf &pos)
vtkPlotHistogram2D::Input
vtkSmartPointer< vtkImageData > Input
Definition: vtkPlotHistogram2D.h:133
vtkPlotHistogram2D::GetBounds
void GetBounds(double bounds[4]) override
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
vtkPlotHistogram2D::vtkPlotHistogram2D
vtkPlotHistogram2D()
vtkPlotHistogram2D::TransferFunction
vtkSmartPointer< vtkScalarsToColors > TransferFunction
Definition: vtkPlotHistogram2D.h:135
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:53
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.
vtkRectf
Definition: vtkRect.h:328
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:65
vtkSmartPointer< vtkImageData >
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
vtkVector2d
Definition: vtkVector.h:475
vtkVector2f
Definition: vtkVector.h:463
vtkX3D::point
@ point
Definition: vtkX3D.h:236
vtkX3D::location
@ location
Definition: vtkX3D.h:406
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkPlot.h
vtkRect.h
vtkSmartPointer.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315