VTK  9.3.20240419
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 
46 
48 
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:
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 
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
Control points for vtkColorTransferFunction.
Defines a transfer function for mapping a property to an RGB color value.
Control points for vtkCompositeFunction.
vtkMTimeType GetControlPointsMTime() override
Must be reimplemented by subclasses to calculate the points to draw.
vtkIdType RemovePoint(double *pos) override
Remove a point of the function.
~vtkCompositeControlPointsItem() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType AddPoint(double *newPos) override
Add a point to the function.
virtual void EditPointCurve(vtkIdType idx)
virtual void SetColorTransferFunction(vtkColorTransferFunction *function)
Set the color transfer function to draw its points.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
void EditPoint(float tX, float tY) override
void SetOpacityFunction(vtkPiecewiseFunction *opacity)
Utility function that calls SetPiecewiseFunction()
void emitEvent(unsigned long event, void *params) override
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
static vtkCompositeControlPointsItem * New()
Creates a piecewise control points object.
void SetControlPoint(vtkIdType index, double *point) override
Sets the x and y coordinates as well as the midpoint and sharpness, of the control point correspondin...
vtkIdType GetNumberOfPoints() const override
Returns the total number of points, either from using the superclass implementation or the opacity fu...
bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
void DrawPoint(vtkContext2D *painter, vtkIdType index) override
Internal function that paints a collection of points and optionally excludes some.
void GetControlPoint(vtkIdType index, double point[4]) 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:69
data structure to represent mouse events.
virtual vtkIdType RemovePoint(double *pos)=0
Remove a point of the function.
a simple class to control print indentation
Definition: vtkIndent.h:108
Defines a 1D piecewise function.
a vtkContextItem that draws handles around a point of a piecewise function
@ point
Definition: vtkX3D.h:236
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270