vtkTransferFunctionChartHistogram2D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef vtkTransferFunctionChartHistogram2D_h
4 #define vtkTransferFunctionChartHistogram2D_h
5 
6 #include "vtkChartHistogram2D.h"
7 
8 #include "vtkCommand.h" // needed for vtkCommand::UserEvent
9 #include "vtkRemotingViewsModule.h" // needed for export macro
10 #include "vtkWeakPointer.h" // needed for vtkWeakPointer
11 
12 #include <vector> // needed for ivar
13 
14 // Forward declarations
15 class vtkContext2D;
19 
20 class VTKREMOTINGVIEWS_EXPORT vtkTransferFunctionChartHistogram2D : public vtkChartHistogram2D
21 {
22 public:
25 
26  // Events fires by this class (and subclasses).
27  // \li TransferFunctionModified is fired when the 2D transfer function is modified.
28  enum
29  {
30  TransferFunctionModified = vtkCommand::UserEvent + 1000,
31  };
32 
36  bool IsInitialized();
37 
39 
47  const vtkRectd& r, double* color, double alpha, bool addToTF2D = true);
48  void AddBox(vtkSmartPointer<vtkTransferFunctionBoxItem> box, bool addToTF2D = true);
50 
54  virtual void RemoveBox(vtkSmartPointer<vtkTransferFunctionBoxItem> box);
55 
59  bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse) override;
60 
64  bool KeyPressEvent(const vtkContextKeyEvent& key) override;
65 
69  void SetInputData(vtkImageData*, vtkIdType z = 0) override;
70 
72 
75  virtual void SetTransferFunction2D(vtkPVTransferFunction2D* transfer2D);
76  virtual vtkPVTransferFunction2D* GetTransferFunction2D();
78 
80 
84  void SetActiveBox(vtkSmartPointer<vtkTransferFunctionBoxItem> box);
86 
88 
91  void SetActiveBoxColorAlpha(double r, double g, double b, double a);
92  void SetActiveBoxColorAlpha(double color[3], double alpha);
94 
98  bool Paint(vtkContext2D* painter) override;
99 
100 protected:
102  ~vtkTransferFunctionChartHistogram2D() override = default;
103 
107  void UpdateItemsBounds(double xMin, double xMax, double yMin, double yMax);
108 
112  virtual void GenerateTransfer2D();
113 
118  void OnTransferFunctionBoxItemModified(vtkObject* caller, unsigned long eid, void* callData);
119 
120  // Member variables;
123  std::vector<int> BoxesToRemove;
124 
125 private:
128 };
129 
130 #endif // vtkTransferFunctionChartHistogram2D_h
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkContextMouseEvent
vtkContextKeyEvent
vtkTransferFunctionChartHistogram2D::ActiveBox
vtkSmartPointer< vtkTransferFunctionBoxItem > ActiveBox
Definition: vtkTransferFunctionChartHistogram2D.h:122
vtkIdType
int vtkIdType
vtkObject
vtkSmartPointer< vtkTransferFunctionBoxItem >
vtkContext2D
vtkCommand.h
vtkChartHistogram2D.h
vtkRectd
vtkPVTransferFunction2D
Defines a 2D transfer function for mapping to RGBA values for volume rendering.
Definition: vtkPVTransferFunction2D.h:27
vtkTransferFunctionChartHistogram2D
Definition: vtkTransferFunctionChartHistogram2D.h:20
vtkTransferFunctionBoxItem
Definition: vtkTransferFunctionBoxItem.h:18
vtkChartXY::Paint
virtual bool Paint(vtkContext2D *painter)
vtkChartHistogram2D::New
static vtkChartHistogram2D * New()
vtkImageData
vtkChartHistogram2D::SetInputData
virtual void SetInputData(vtkImageData *data, vtkIdType z=0)
vtkWeakPointer.h
vtkChartXY::KeyPressEvent
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
vtkTransferFunctionChartHistogram2D::BoxesToRemove
std::vector< int > BoxesToRemove
Definition: vtkTransferFunctionChartHistogram2D.h:123
vtkChartHistogram2D
vtkAbstractContextItem::MouseDoubleClickEvent
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
vtkTransferFunctionChartHistogram2D::TransferFunction2D
vtkWeakPointer< vtkPVTransferFunction2D > TransferFunction2D
Definition: vtkTransferFunctionChartHistogram2D.h:121
vtkWeakPointer< vtkPVTransferFunction2D >