19 #ifndef vtkControlPointsItem_h
20 #define vtkControlPointsItem_h
24 #include "vtkChartsCoreModule.h"
31 VTK_ABI_NAMESPACE_BEGIN
34 class vtkControlPointsAddPointItem;
61 void GetBounds(
double bounds[4])
override;
69 vtkSetVector4Macro(UserBounds,
double);
70 vtkGetVector4Macro(UserBounds,
double);
79 vtkSetVector4Macro(ValidBounds,
double);
80 vtkGetVector4Macro(ValidBounds,
double);
88 vtkGetMacro(ScreenPointRadius,
float);
89 vtkSetMacro(ScreenPointRadius,
float);
97 vtkGetMacro(DrawPoints,
bool);
98 vtkSetMacro(DrawPoints,
bool);
99 vtkBooleanMacro(DrawPoints,
bool);
119 void SelectPoint(
double* currentPoint);
124 void SelectAllPoints();
136 void DeselectPoint(
double* currentPoint);
141 void DeselectAllPoints();
147 void ToggleSelectPoint(
vtkIdType pointId);
154 void ToggleSelectPoint(
double* currentPoint);
164 vtkIdType GetNumberOfSelectedPoints()
const;
177 bool IsOverPoint(
double* pos,
vtkIdType pointId);
182 vtkIdType GetControlPointId(
double* pos);
189 void GetControlPointsIds(
vtkIdTypeArray* ids,
bool excludeFirstAndLast =
false)
const;
197 vtkSetMacro(StrokeMode,
bool);
198 vtkGetMacro(StrokeMode,
bool);
208 vtkSetMacro(SwitchPointsMode,
bool);
209 vtkGetMacro(SwitchPointsMode,
bool);
217 vtkSetMacro(EndPointsXMovable,
bool);
218 vtkGetMacro(EndPointsXMovable,
bool);
219 vtkSetMacro(EndPointsYMovable,
bool);
220 vtkGetMacro(EndPointsYMovable,
bool);
221 virtual bool GetEndPointsMovable();
229 vtkSetMacro(EndPointsRemovable,
bool);
230 vtkGetMacro(EndPointsRemovable,
bool);
238 vtkSetMacro(ShowLabels,
bool);
239 vtkGetMacro(ShowLabels,
bool);
247 vtkSetStringMacro(LabelFormat);
248 vtkGetStringMacro(LabelFormat);
256 virtual vtkIdType AddPoint(
double* newPos) = 0;
263 virtual vtkIdType RemovePoint(
double* pos) = 0;
274 void RemoveCurrentPoint();
279 virtual vtkIdType GetNumberOfPoints()
const = 0;
326 void SpreadPoints(
float factor,
bool dontSpreadFirstAndLast =
false);
343 vtkGetObjectMacro(SelectedPointPen,
vtkPen);
351 vtkGetObjectMacro(SelectedPointBrush,
vtkBrush);
361 vtkGetMacro(UseAddPointItem,
bool);
362 vtkSetMacro(UseAddPointItem,
bool);
363 vtkBooleanMacro(UseAddPointItem,
bool);
398 void StartInteraction();
399 void StartInteractionIfNotStarted();
401 void EndInteraction();
402 int GetInteractionsCount()
const;
403 virtual void emitEvent(
unsigned long event,
void* params =
nullptr) = 0;
405 static void CallComputePoints(
406 vtkObject* sender,
unsigned long event,
void* receiver,
void* params);
413 virtual void ComputePoints();
429 bool ClampValidDataPos(
double pos[2]);
430 bool ClampValidScreenPos(
double pos[2]);
443 void SetCurrentPointPos(
const vtkVector2f& newPos);
452 virtual void EditPoint(
float vtkNotUsed(tX),
float vtkNotUsed(tY));
465 bool IsEndPointPicked();
470 bool IsPointRemovable(
vtkIdType pointId);
478 virtual void ComputeBounds(
double* bounds);
483 int BlockUpdates = 0;
484 int StartedInteractions = 0;
485 int StartedChanges = 0;
488 double Bounds[4] = { 0., -1., 0., -1. };
489 double UserBounds[4] = { 0., -1., 0., -1. };
490 double ValidBounds[4] = { 0., -1., 0., -1. };
493 float ScreenPointRadius = 6.f;
495 bool DrawPoints =
true;
496 bool StrokeMode =
false;
497 bool SwitchPointsMode =
false;
498 bool MouseMoved =
false;
499 bool EnforceValidFunction =
true;
501 bool PointAboutToBeDeleted =
false;
503 bool PointAboutToBeToggled =
false;
504 bool InvertShadow =
false;
505 bool EndPointsXMovable =
true;
506 bool EndPointsYMovable =
true;
507 bool EndPointsRemovable =
true;
508 bool ShowLabels =
false;
509 char* LabelFormat =
nullptr;
515 void ComputeBounds();
519 bool UseAddPointItem =
false;
522 VTK_ABI_NAMESPACE_END
vtkNew< vtkCallbackCommand > Callback
data structure to represent key events.
abstract base class for most VTK objects
vtkTypeUInt32 vtkMTimeType
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key)
Key release event.
Abstract class for control points items.
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
dynamic, self-adjusting array of vtkIdType
vtkNew< vtkBrush > SelectedPointBrush
vtkNew< vtkPen > SelectedPointPen
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the supplied x, y coordinate is inside the item.
vtkNew< vtkTransform2D > ControlPointsTransform
Class for drawing 2D primitives to a graphical context.
supports function callbacks
a vtkContextItem that draws handles around a point of a piecewise function
provides a brush that fills shapes drawn by vtkContext2D.
data structure to represent mouse events.
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
a simple class to control print indentation
represent and manipulate 2D points
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
const std::string pointIds
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Abstract class for 2D plots.
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
Key press event.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.