30 #ifndef __vtkControlPointsItem_h
31 #define __vtkControlPointsItem_h
33 #include "vtkChartsCoreModule.h"
36 #include "vtkVector.h"
50 CurrentPointChangedEvent = vtkCommand::UserEvent,
62 vtkSetVector4Macro(UserBounds,
double);
63 vtkGetVector4Macro(UserBounds,
double);
70 vtkSetVector4Macro(ValidBounds,
double);
71 vtkGetVector4Macro(ValidBounds,
double);
76 vtkGetMacro(ScreenPointRadius,
float);
77 vtkSetMacro(ScreenPointRadius,
float);
83 virtual bool Paint(vtkContext2D *painter);
91 void SelectPoint(
double* currentPoint);
94 void SelectAllPoints();
102 void DeselectPoint(
double* currentPoint);
105 void DeselectAllPoints();
109 void ToggleSelectPoint(
vtkIdType pointId);
114 void ToggleSelectPoint(
double* currentPoint);
117 virtual bool SelectPoints(
const vtkVector2f& min,
const vtkVector2f& max);
120 vtkIdType GetNumberOfSelectedPoints()
const;
129 bool IsOverPoint(
double* pos,
vtkIdType pointId);
133 vtkIdType GetControlPointId(
double* pos);
140 bool excludeFirstAndLast =
false)
const;
146 vtkGetMacro(StrokeMode,
bool);
154 vtkSetMacro(SwitchPointsMode,
bool);
155 vtkGetMacro(SwitchPointsMode,
bool);
161 vtkSetMacro(EndPointsXMovable,
bool);
162 vtkGetMacro(EndPointsXMovable,
bool);
163 vtkSetMacro(EndPointsYMovable,
bool);
164 vtkGetMacro(EndPointsYMovable,
bool);
165 virtual bool GetEndPointsMovable();
171 vtkSetMacro(EndPointsRemovable,
bool);
172 vtkGetMacro(EndPointsRemovable,
bool);
178 virtual vtkIdType AddPoint(
double* newPos) = 0;
183 virtual vtkIdType RemovePoint(
double* pos) = 0;
190 inline void RemoveCurrentPoint();
193 virtual vtkIdType GetNumberOfPoints()
const = 0;
198 virtual void GetControlPoint(
vtkIdType index,
double *point)
const = 0;
202 virtual void SetControlPoint(
vtkIdType index,
double *point) = 0;
210 void MovePoints(
const vtkVector2f& translation,
vtkIdTypeArray* pointIds);
215 void MovePoints(
const vtkVector2f& translation,
bool dontMoveFirstAndLast =
false);
228 void SpreadPoints(
float factor,
bool dontSpreadFirstAndLast =
false);
239 vtkGetObjectMacro(SelectedPointPen, vtkPen);
245 vtkGetObjectMacro(SelectedPointBrush, vtkBrush);
254 virtual bool MouseButtonPressEvent(
const vtkContextMouseEvent &mouse);
255 virtual bool MouseDoubleClickEvent(
const vtkContextMouseEvent &mouse);
259 virtual bool MouseMoveEvent(
const vtkContextMouseEvent &mouse);
261 virtual bool KeyPressEvent(
const vtkContextKeyEvent &key);
262 virtual bool KeyReleaseEvent(
const vtkContextKeyEvent &key);
270 void StartInteraction();
271 void StartInteractionIfNotStarted();
273 void EndInteraction();
274 int GetInteractionsCount()
const;
275 virtual void emitEvent(
unsigned long event,
void* params = 0) = 0;
277 static void CallComputePoints(
vtkObject* sender,
unsigned long event,
void* receiver,
void* params);
282 virtual void ComputePoints();
283 virtual unsigned long int GetControlPointsMTime() =0;
287 virtual bool Hit(
const vtkContextMouseEvent &mouse);
292 bool ClampPos(
double pos[2],
double bounds[4]);
293 bool ClampValidPos(
double pos[2]);
299 void DrawUnselectedPoints(vtkContext2D* painter);
300 void DrawSelectedPoints(vtkContext2D* painter);
301 virtual void DrawPoint(vtkContext2D* painter,
vtkIdType index);
304 void SetCurrentPointPos(
const vtkVector2f& newPos);
306 void MoveCurrentPoint(
const vtkVector2f& translation);
309 inline vtkVector2f GetSelectionCenterOfMass()
const;
312 void Stroke(
const vtkVector2f& newPos);
313 virtual void EditPoint(
float vtkNotUsed(tX),
float vtkNotUsed(tY));
315 virtual bool MouseButtonReleaseEvent(
const vtkContextMouseEvent &mouse);
321 bool IsEndPointPicked();
324 bool IsPointRemovable(
vtkIdType pointId);
334 double UserBounds[4];
335 double ValidBounds[4];
356 void ComputeBounds();
357 void ComputeBounds(
double* bounds);
abstract base class for most VTK objects
vtkIdType GetCurrentPoint() const
bool PointAboutToBeToggled
vtkVector2f GetSelectionCenterOfMass() const
Abstract class for control points items.
virtual void GetBounds(double bounds[4])
dynamic, self-adjusting array of vtkIdType
vtkPen * SelectedPointPen
vtkVector2f GetCenterOfMass(vtkIdTypeArray *pointIDs) const
vtkIdTypeArray * Selection
void RemoveCurrentPoint()
vtkBrush * SelectedPointBrush
supports function callbacks
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
vtkTransform2D * Transform
a simple class to control print indentation
represent and manipulate 2D points
Abstract class for 2D plots.
virtual vtkIdType RemovePoint(double *pos)=0
virtual void PrintSelf(ostream &os, vtkIndent indent)
bool EnforceValidFunction
bool PointAboutToBeDeleted
vtkCallbackCommand * Callback