Views
Manager Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvMakePolyPointsInteractor Class Referenceabstract

Manager interactor class. More...

#include <ilviews/manager/mkpolyin.h>

Inheritance diagram for IlvMakePolyPointsInteractor:
IlvManagerViewInteractor IlvValueInterface IlvMakePolylineInteractor IlvMakeSplineInteractor IlvMakeArrowPolylineInteractor IlvMakePolygonInteractor IlvMakeFilledSplineInteractor IlvMakeOutlinePolygonInteractor IlvMakeClosedSplineInteractor

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...
 
IlvPointpoints ()
 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...
 
IlvDisplaygetDisplay () const
 Returns the display of the manager view. More...
 
IlvManagergetManager () const
 Returns the manager. More...
 
IlvTransformergetTransformer () const
 Returns the transformer used with the manager view. More...
 
IlvViewgetView () 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...
 
IlvPointtransformPoints () const
 Returns the array of points in the coordinate system of the view. More...
 

Detailed Description

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.

See also
IlvPolyPoints, IlvPolySelectInteractor, IlvMakePolylineInteractor, IlvMakeArrowPolylineInteractor, IlvMakePolygonInteractor, IlvMakeOutlinePolygonInteractor, IlvMakeSplineInteractor, IlvMakeFilledSplineInteractor, IlvMakeClosedSplineInteractor.

Constructor & Destructor Documentation

◆ IlvMakePolyPointsInteractor()

IlvMakePolyPointsInteractor::IlvMakePolyPointsInteractor ( IlvManager manager,
IlvView view 
)

Initializes a new IlvMakePolyPointsInteractor instance.

Parameters
managerThe manager.
viewThe manager view.

Member Function Documentation

◆ abort()

void IlvMakePolyPointsInteractor::abort ( )
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.

◆ accept()

virtual IlBoolean IlvMakePolyPointsInteractor::accept ( IlvPoint p)
virtual

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:

IlvAbs(cur.x() - prev.x()) >= threshold
IlvAbs(cur.y() - prev.y()) >= threshold
Parameters
pThe point, in the object coordinate system.
Returns
IlTrue if the point is accepted and IlFalse if it is not.

Reimplemented in IlvMakeSplineInteractor.

◆ commit()

virtual void IlvMakePolyPointsInteractor::commit ( IlBoolean  removeExtraPoints)
protectedvirtual

Called by handleEvent when the polypoint is terminated.

This method should call doIt() and post an undoable command if need be.

Parameters
removeExtraPointsWhen 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.

◆ count()

IlUInt IlvMakePolyPointsInteractor::count ( )

Returns the number of elements in the current array of points.

Returns
The number of points chosen by the user.

◆ doIt()

virtual void IlvMakePolyPointsInteractor::doIt ( IlUInt  count,
IlvPoint points 
)
pure virtual

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.

Parameters
countThe number of points in the array.
pointsThe array of points provided during the interaction.

Implemented in IlvMakeClosedSplineInteractor, IlvMakeFilledSplineInteractor, IlvMakeSplineInteractor, IlvMakeOutlinePolygonInteractor, IlvMakePolygonInteractor, IlvMakeArrowPolylineInteractor, and IlvMakePolylineInteractor.

◆ drawGhost()

virtual void IlvMakePolyPointsInteractor::drawGhost ( )
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.

◆ drawHull()

virtual void IlvMakePolyPointsInteractor::drawHull ( )
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.

◆ getThreshold()

IlUShort IlvMakePolyPointsInteractor::getThreshold ( ) const

Returns the threshold.

Returns
The current threshold used in the member function accept().

◆ handleEvent()

virtual IlBoolean IlvMakePolyPointsInteractor::handleEvent ( IlvEvent event)
virtual

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.

Returns
IlTrue if the event is consumed, IlFalse otherwise.

Implements IlvManagerViewInteractor.

◆ init()

void IlvMakePolyPointsInteractor::init ( )
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.

◆ points()

IlvPoint* IlvMakePolyPointsInteractor::points ( )

Returns the current array of points.

Returns
The array of points chosen by the user. These coordinates are given in the object coordinate system. They can be converted to the view coordinate system by means of a call to the transformPoints() member function. The returned array must be not modified or deleted by the programmer.

◆ react()

virtual void IlvMakePolyPointsInteractor::react ( IlvPoint p,
IlUShort  modifiers = 0 
)
virtual

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.

Parameters
pThe point, in the object coordinate system.
modifiersThe modifier keys that were depressed when the user created the current point

Reimplemented in IlvMakeFilledSplineInteractor, and IlvMakeSplineInteractor.

◆ setThreshold()

void IlvMakePolyPointsInteractor::setThreshold ( IlUShort  val)

Sets the threshold.

Sets the threshold used in the member function accept().

Parameters
valThe new threshold value.

◆ transformPoints()

IlvPoint* IlvMakePolyPointsInteractor::transformPoints ( ) const
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.

Returns
The array containing these new coordinates. The array must not be modified or deleted.
IlvAbs
#define IlvAbs