Go to the documentation of this file.
28 #ifndef vtkControlPointsItem_h
29 #define vtkControlPointsItem_h
31 #include "vtkChartsCoreModule.h"
63 void GetBounds(
double bounds[4])
override;
71 vtkSetVector4Macro(UserBounds,
double);
72 vtkGetVector4Macro(UserBounds,
double);
81 vtkSetVector4Macro(ValidBounds,
double);
82 vtkGetVector4Macro(ValidBounds,
double);
90 vtkGetMacro(ScreenPointRadius,
float);
91 vtkSetMacro(ScreenPointRadius,
float);
111 void SelectPoint(
double* currentPoint);
116 void SelectAllPoints();
128 void DeselectPoint(
double* currentPoint);
133 void DeselectAllPoints();
139 void ToggleSelectPoint(
vtkIdType pointId);
146 void ToggleSelectPoint(
double* currentPoint);
156 vtkIdType GetNumberOfSelectedPoints()
const;
169 bool IsOverPoint(
double* pos,
vtkIdType pointId);
174 vtkIdType GetControlPointId(
double* pos);
182 bool excludeFirstAndLast =
false)
const;
190 vtkGetMacro(StrokeMode,
bool);
200 vtkSetMacro(SwitchPointsMode,
bool);
201 vtkGetMacro(SwitchPointsMode,
bool);
209 vtkSetMacro(EndPointsXMovable,
bool);
210 vtkGetMacro(EndPointsXMovable,
bool);
211 vtkSetMacro(EndPointsYMovable,
bool);
212 vtkGetMacro(EndPointsYMovable,
bool);
213 virtual bool GetEndPointsMovable();
221 vtkSetMacro(EndPointsRemovable,
bool);
222 vtkGetMacro(EndPointsRemovable,
bool);
230 vtkSetMacro(ShowLabels,
bool);
231 vtkGetMacro(ShowLabels,
bool);
238 vtkSetStringMacro(LabelFormat);
239 vtkGetStringMacro(LabelFormat);
247 virtual vtkIdType AddPoint(
double* newPos) = 0;
254 virtual vtkIdType RemovePoint(
double* pos) = 0;
265 inline void RemoveCurrentPoint();
270 virtual vtkIdType GetNumberOfPoints()
const = 0;
317 void SpreadPoints(
float factor,
bool dontSpreadFirstAndLast =
false);
334 vtkGetObjectMacro(SelectedPointPen,
vtkPen);
342 vtkGetObjectMacro(SelectedPointBrush,
vtkBrush);
375 void StartInteraction();
376 void StartInteractionIfNotStarted();
378 void EndInteraction();
379 int GetInteractionsCount()
const;
380 virtual void emitEvent(
unsigned long event,
void* params =
nullptr) = 0;
382 static void CallComputePoints(
vtkObject* sender,
unsigned long event,
void* receiver,
void* params);
389 virtual void ComputePoints();
405 virtual void TransformScreenToData(
const double inX,
const double inY,
406 double &outX,
double &outY);
407 virtual void TransformDataToScreen(
const double inX,
const double inY,
408 double &outX,
double &outY);
416 virtual bool ClampPos(
double pos[2],
double bounds[4]);
417 bool ClampValidDataPos(
double pos[2]);
418 bool ClampValidScreenPos(
double pos[2]);
431 void SetCurrentPointPos(
const vtkVector2f& newPos);
436 inline vtkVector2f GetSelectionCenterOfMass()
const;
440 virtual void EditPoint(
float vtkNotUsed(tX),
float vtkNotUsed(tY));
457 bool IsEndPointPicked();
462 bool IsPointRemovable(
vtkIdType pointId);
470 virtual void ComputeBounds(
double* bounds);
481 double UserBounds[4];
482 double ValidBounds[4];
505 void ComputeBounds();
provides a brush that fills shapes drawn by vtkContext2D.
represent and manipulate 2D points
bool EnforceValidFunction
vtkBrush * SelectedPointBrush
data structure to represent mouse events.
data structure to represent key events.
bool PointAboutToBeToggled
virtual bool KeyPressEvent(const vtkContextKeyEvent &key)
Key press event.
bool PointAboutToBeDeleted
abstract base class for most VTK objects
Class for drawing 2D primitives to a graphical context.
Abstract class for 2D plots.
a vtkContextItem that draws handles around a point of a piecewise function
Abstract class for control points items.
vtkVector2f GetSelectionCenterOfMass() const
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
virtual vtkIdType RemovePoint(double *pos)=0
Remove a point of the function.
a simple class to control print indentation
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkTransform2D * Transform
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
vtkVector2f GetCenterOfMass(vtkIdTypeArray *pointIDs) const
dynamic, self-adjusting array of vtkIdType
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
vtkPen * SelectedPointPen
vtkIdType GetCurrentPoint() const
Returns the current point ID selected or -1 if there is no point current.
supports function callbacks
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.
virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key)
Key release event.
void RemoveCurrentPoint()
Remove the current point.
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...
provides a pen that draws the outlines of shapes drawn by vtkContext2D.
Wrapper around std::string to keep symbols short.
virtual void GetBounds(double bounds[4])
Get the bounds for this plot as (Xmin, Xmax, Ymin, Ymax).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCallbackCommand * Callback
vtkTypeUInt32 vtkMTimeType