Manager interactor class. More...
#include <ilviews/manager/mkpolyin.h>
Public Member Functions | |
IlvMakePolyPointsInteractor (IlvManager *manager, IlvView *view) | |
Initializes a new IlvMakePolyPointsInteractor instance. More... | |
void | abort () |
Aborts the interaction. More... | |
virtual IlBoolean | accept (IlvPoint &p) |
Lets the interactor accept or refuse a new point location. More... | |
IlUInt | count () |
Returns the number of elements in the current array of points. More... | |
virtual void | doIt (IlUInt count, IlvPoint *points)=0 |
Finalizes the interaction by creating a graphic object from an array of points. More... | |
virtual void | drawGhost ()=0 |
Provides the visual feedback during interaction. More... | |
virtual void | drawHull () |
Draws markers on each of the points that constitute this polygon. More... | |
IlUShort | getThreshold () const |
Returns the threshold. More... | |
virtual IlBoolean | handleEvent (IlvEvent &event) |
Handles events for the manager view. More... | |
void | init () |
Initialization, when the interactor is attached to a view. More... | |
IlvPoint * | points () |
Returns the current array of points. More... | |
virtual void | react (IlvPoint &p, IlUShort modifiers=0) |
Called after a new point has been added to the array of points. More... | |
void | setThreshold (IlUShort val) |
Sets the threshold. More... | |
Public Member Functions inherited from IlvManagerViewInteractor | |
IlvManagerViewInteractor (IlvManager *manager, IlvView *view) | |
Initializes a new IlvManagerViewInteractor . More... | |
virtual void | ensureVisible (const IlvPoint &point) |
Ensures the visibility of a given location. More... | |
IlvDisplay * | getDisplay () const |
Returns the display of the manager view. More... | |
IlvManager * | getManager () const |
Returns the manager. More... | |
IlvTransformer * | getTransformer () const |
Returns the transformer used with the manager view. More... | |
IlvView * | getView () const |
Returns the manager view. More... | |
virtual void | handleExpose (IlvRegion *clip=0) |
Called when the manager view receives an expose event. More... | |
Protected Member Functions | |
virtual void | commit (IlBoolean removeExtraPoints) |
Called by handleEvent when the polypoint is terminated. More... | |
IlvPoint * | transformPoints () const |
Returns the array of points in the coordinate system of the view. More... | |
Manager interactor class.
Library: ilvmgr
This abstract class enables you to collect a set of points in a view controlled by a manager. Select the points by means of a series of IlvButtonDown
, IlvButtonDragged
, and IlvButtonUp
operations. Then terminate the selection by double-clicking anywhere in the work buffer. This class is used to derive subclasses: you redefine the virtual member functions drawGhost()
and doIt()
to create IlvPolyPoints
objects such as IlvPolyline
, IlvPolygon
and IlvSpline
.
IlvMakePolyPointsInteractor::IlvMakePolyPointsInteractor | ( | IlvManager * | manager, |
IlvView * | view | ||
) |
Initializes a new IlvMakePolyPointsInteractor
instance.
manager | The manager. |
view | The manager view. |
|
virtual |
Aborts the interaction.
Called by the manager when the user changes the current interactor. It resets the interactor to a state in which it appears to have never been launched. A common implementation is to erase the ghost image. Call this member function to inhibit the interactor action in particular circumstances.
Reimplemented from IlvManagerViewInteractor.
Lets the interactor accept or refuse a new point location.
Allows the interactor to determine whether a location chosen by the user is valid for the interaction.
In the default implementation, the point is accepted if it is not too close to the previous one. More precisely, the point is accepted if the two following conditions are met:
p | The point, in the object coordinate system. |
IlTrue
if the point is accepted and IlFalse
if it is not. Reimplemented in IlvMakeSplineInteractor.
|
protectedvirtual |
Called by handleEvent
when the polypoint is terminated.
This method should call doIt()
and post an undoable command if need be.
removeExtraPoints | When the curve entry is terminated by a double click, it may be desirable to remove the extra points that have been added in succession by the double click. This flag is set to tell the method that it should get rid of the extraneous points before calling doIt() . |
Reimplemented in IlvMakeFilledSplineInteractor, and IlvMakeSplineInteractor.
IlUInt IlvMakePolyPointsInteractor::count | ( | ) |
Returns the number of elements in the current array of points.
Finalizes the interaction by creating a graphic object from an array of points.
The final action to be performed by the interactor. It receives the array points
of count
points, in the object coordinate system.
Note that this function is not defined for this base class.
count | The number of points in the array. |
points | The array of points provided during the interaction. |
Implemented in IlvMakeClosedSplineInteractor, IlvMakeFilledSplineInteractor, IlvMakeSplineInteractor, IlvMakeOutlinePolygonInteractor, IlvMakePolygonInteractor, IlvMakeArrowPolylineInteractor, and IlvMakePolylineInteractor.
|
pure virtual |
Provides the visual feedback during interaction.
Ghost-draws the object.
Note that this function is not defined for this base class.
Reimplemented from IlvManagerViewInteractor.
Implemented in IlvMakeClosedSplineInteractor, IlvMakeFilledSplineInteractor, IlvMakeSplineInteractor, IlvMakePolygonInteractor, IlvMakeArrowPolylineInteractor, and IlvMakePolylineInteractor.
|
virtual |
Draws markers on each of the points that constitute this polygon.
Subclasses may want to differentiate various kinds of markers to denote the characteristics of each points (control points vs. endpoints, for instance).
Reimplemented in IlvMakeSplineInteractor.
IlUShort IlvMakePolyPointsInteractor::getThreshold | ( | ) | const |
Returns the threshold.
accept()
. Handles events for the manager view.
Called by the manager for which the interactor was created with every event it receives in the interactor view.
IlTrue
if the event is consumed, IlFalse
otherwise. Implements IlvManagerViewInteractor.
|
virtual |
Initialization, when the interactor is attached to a view.
Resets the interactor to its initial state.
Called by the manager whenever the interactor is associated with a view. An association of this kind is established by the member function IlvManager::setInteractor()
.
Reimplemented from IlvManagerViewInteractor.
IlvPoint* IlvMakePolyPointsInteractor::points | ( | ) |
Returns the current array of points.
transformPoints()
member function. The returned array must be not modified or deleted by the programmer. Called after a new point has been added to the array of points.
This method is provided to allow subclasses to add an action when the user drags a new point somewhere in the working area.
The p can be modified if needed.
The default implementation does nothing.
p | The point, in the object coordinate system. |
modifiers | The modifier keys that were depressed when the user created the current point |
Reimplemented in IlvMakeFilledSplineInteractor, and IlvMakeSplineInteractor.
void IlvMakePolyPointsInteractor::setThreshold | ( | IlUShort | val | ) |
Sets the threshold.
Sets the threshold used in the member function accept()
.
val | The new threshold value. |
|
protected |
Returns the array of points in the coordinate system of the view.
This member function projects the points the user has selected in the view coordinate system.