VTK  9.3.1
vtkCompositeControlPointsItem.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 
21 #ifndef vtkCompositeControlPointsItem_h
22 #define vtkCompositeControlPointsItem_h
23 
24 #include "vtkChartsCoreModule.h" // For export macro
26 
27 VTK_ABI_NAMESPACE_BEGIN
30 
32 {
33 public:
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
41 
45  virtual void SetColorTransferFunction(vtkColorTransferFunction* function);
46 
48 
51  void SetOpacityFunction(vtkPiecewiseFunction* opacity);
52  vtkGetObjectMacro(OpacityFunction, vtkPiecewiseFunction);
54 
56  {
57  ColorPointsFunction = 1,
58  OpacityPointsFunction = 2,
59  ColorAndOpacityPointsFunction = 3
60  };
61 
63 
75  vtkSetMacro(PointsFunction, int);
76  vtkGetMacro(PointsFunction, int);
78 
84  vtkIdType AddPoint(double* newPos) override;
85 
92  vtkIdType RemovePoint(double* pos) override;
93 
95 
102  vtkSetMacro(UseOpacityPointHandles, bool);
103  vtkGetMacro(UseOpacityPointHandles, bool);
105 
107 
110  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
111  bool MouseDoubleClickEvent(const vtkContextMouseEvent& mouse) override;
112  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
114 
120  vtkIdType GetNumberOfPoints() const override;
121 
128  void GetControlPoint(vtkIdType index, double point[4]) const override;
129 
136  void SetControlPoint(vtkIdType index, double* point) override;
137 
138 protected:
140  ~vtkCompositeControlPointsItem() override;
141 
142  void emitEvent(unsigned long event, void* params) override;
143 
145 
146  void DrawPoint(vtkContext2D* painter, vtkIdType index) override;
147  void EditPoint(float tX, float tY) override;
148  virtual void EditPointCurve(vtkIdType idx);
149 
150  void MergeTransferFunctions();
151  void SilentMergeTransferFunctions();
152 
154  vtkPiecewiseFunction* OpacityFunction = nullptr;
155  vtkPiecewisePointHandleItem* OpacityPointHandle = nullptr;
156  bool UseOpacityPointHandles = false;
157 
158 private:
160  void operator=(const vtkCompositeControlPointsItem&) = delete;
161 };
162 
163 VTK_ABI_NAMESPACE_END
164 #endif
static vtkColorTransferControlPointsItem * New()
Creates a piecewise control points object.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse and key events.
Defines a 1D piecewise function.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
int vtkIdType
Definition: vtkType.h:315
vtkMTimeType GetControlPointsMTime() override
Must be reimplemented by subclasses to calculate the points to draw.
void GetControlPoint(vtkIdType index, double *point) const override
Returns the x and y coordinates as well as the midpoint and sharpness of the control point correspond...
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
a vtkContextItem that draws handles around a point of a piecewise function
vtkIdType GetNumberOfPoints() const override
Return the number of points in the color transfer function.
bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse) override
Mouse and key events.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:28
Control points for vtkCompositeFunction.
vtkIdType AddPoint(double *newPos) override
Add a point to the function.
void EditPoint(float tX, float tY) override
vtkIdType RemovePoint(double *pos) override
Remove a point of the function.
Control points for vtkColorTransferFunction.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetColorTransferFunction(vtkColorTransferFunction *function)
Set the piecewise function to draw its points.
virtual vtkIdType RemovePoint(double *pos)=0
Remove a point of the function.
Defines a transfer function for mapping a property to an RGB color value.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse and key events.
void SetControlPoint(vtkIdType index, double *point) override
Sets the x and y coordinates as well as the midpoint and sharpness of the control point corresponding...
void emitEvent(unsigned long event, void *params) override
void DrawPoint(vtkContext2D *painter, vtkIdType index) override
Internal function that paints a collection of points and optionally excludes some.