31 #ifndef vtkControlPointsItem_h 32 #define vtkControlPointsItem_h 34 #include "vtkChartsCoreModule.h" 66 void GetBounds(
double bounds[4])
override;
74 vtkSetVector4Macro(UserBounds,
double);
75 vtkGetVector4Macro(UserBounds,
double);
84 vtkSetVector4Macro(ValidBounds,
double);
85 vtkGetVector4Macro(ValidBounds,
double);
93 vtkGetMacro(ScreenPointRadius,
float);
94 vtkSetMacro(ScreenPointRadius,
float);
114 void SelectPoint(
double* currentPoint);
119 void SelectAllPoints();
131 void DeselectPoint(
double* currentPoint);
136 void DeselectAllPoints();
142 void ToggleSelectPoint(
vtkIdType pointId);
149 void ToggleSelectPoint(
double* currentPoint);
159 vtkIdType GetNumberOfSelectedPoints()
const;
172 bool IsOverPoint(
double* pos,
vtkIdType pointId);
177 vtkIdType GetControlPointId(
double* pos);
185 bool excludeFirstAndLast =
false)
const;
193 vtkGetMacro(StrokeMode,
bool);
203 vtkSetMacro(SwitchPointsMode,
bool);
204 vtkGetMacro(SwitchPointsMode,
bool);
212 vtkSetMacro(EndPointsXMovable,
bool);
213 vtkGetMacro(EndPointsXMovable,
bool);
214 vtkSetMacro(EndPointsYMovable,
bool);
215 vtkGetMacro(EndPointsYMovable,
bool);
216 virtual bool GetEndPointsMovable();
224 vtkSetMacro(EndPointsRemovable,
bool);
225 vtkGetMacro(EndPointsRemovable,
bool);
233 vtkSetMacro(ShowLabels,
bool);
234 vtkGetMacro(ShowLabels,
bool);
241 vtkSetStringMacro(LabelFormat);
242 vtkGetStringMacro(LabelFormat);
250 virtual vtkIdType AddPoint(
double* newPos) = 0;
257 virtual vtkIdType RemovePoint(
double* pos) = 0;
268 inline void RemoveCurrentPoint();
273 virtual vtkIdType GetNumberOfPoints()
const = 0;
320 void SpreadPoints(
float factor,
bool dontSpreadFirstAndLast =
false);
337 vtkGetObjectMacro(SelectedPointPen,
vtkPen);
345 vtkGetObjectMacro(SelectedPointBrush,
vtkBrush);
378 void StartInteraction();
379 void StartInteractionIfNotStarted();
381 void EndInteraction();
382 int GetInteractionsCount()
const;
383 virtual void emitEvent(
unsigned long event,
void* params =
nullptr) = 0;
385 static void CallComputePoints(
vtkObject* sender,
unsigned long event,
void* receiver,
void* params);
392 virtual void ComputePoints();
408 virtual void TransformScreenToData(
const double inX,
const double inY,
409 double &outX,
double &outY);
410 virtual void TransformDataToScreen(
const double inX,
const double inY,
411 double &outX,
double &outY);
419 virtual bool ClampPos(
double pos[2],
double bounds[4]);
420 bool ClampValidDataPos(
double pos[2]);
421 bool ClampValidScreenPos(
double pos[2]);
434 void SetCurrentPointPos(
const vtkVector2f& newPos);
439 inline vtkVector2f GetSelectionCenterOfMass()
const;
443 virtual void EditPoint(
float vtkNotUsed(tX),
float vtkNotUsed(tY));
460 bool IsEndPointPicked();
465 bool IsPointRemovable(
vtkIdType pointId);
473 virtual void ComputeBounds(
double* bounds);
484 double UserBounds[4];
485 double ValidBounds[4];
508 void ComputeBounds();
516 this->RemovePoint(this->GetCurrentPoint());
522 return this->GetCenterOfMass(this->Selection);
Wrapper around std::string to keep symbols short.
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.
bool PointAboutToBeToggled
virtual bool KeyReleaseEvent(const vtkContextKeyEvent &key)
Key release event.
vtkVector2f GetSelectionCenterOfMass() const
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
vtkPen * SelectedPointPen
void RemoveCurrentPoint()
Remove the current point.
vtkBrush * SelectedPointBrush
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.
vtkTransform2D * Transform
a simple class to control print indentation
represent and manipulate 2D points
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
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.
bool EnforceValidFunction
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
bool PointAboutToBeDeleted
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &mouse)
Mouse button double click event.
vtkCallbackCommand * Callback