Rogue Wave Views
Manager Package API Reference Guide
Product Documentation:

Rogue Wave 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)
 Constructor. 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
 Visual feedback during interaction. More...
 
virtual void drawHull ()
 
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 modifier=0)
 Calback 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)
 
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
IlvPolyPoint, IlvPolySelectInteractor, IlvMakePolylineInteractor, IlvMakeArrowPolylineInteractor, IlvMakePolygonInteractor, IlvMakeOutlinePolygonInteractor, IlvMakeSplineInteractor, IlvMakeFilledSplineInteractor, IlvMakeClosedSplineInteractor.

Constructor & Destructor Documentation

IlvMakePolyPointsInteractor::IlvMakePolyPointsInteractor ( IlvManager manager,
IlvView view 
)

Constructor.

Since this is an abstract class, the constructor does nothing.

Parameters
managerThe manager.
viewThe manager view.

Member Function Documentation

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.

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.

Returns
IlTrue if the point is accepted and IlFalse if it is not. 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.

Reimplemented in IlvMakeSplineInteractor.

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.

IlUInt IlvMakePolyPointsInteractor::count ( )

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

Returns
The number of points chosen by the user.
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. This function is not defined for this base class, which makes this an abstract 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.

virtual void IlvMakePolyPointsInteractor::drawGhost ( )
pure virtual

Visual feedback during interaction.

Ghost-draws the object. Since this is an abstract base class, the function is not defined for this class.

Reimplemented from IlvManagerViewInteractor.

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

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.

IlUShort IlvMakePolyPointsInteractor::getThreshold ( ) const

Returns the threshold.

Returns
The current threshold used in the member function accept.
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.

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.

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 protected member function. The returned arrays must be not modified or deleted by the programmer.
virtual void IlvMakePolyPointsInteractor::react ( IlvPoint p,
IlUShort  modifier = 0 
)
virtual

Calback 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 point p passed as a parameter can be modified if needed. The default implementation does nothing.

Parameters
pThe point, in the object coordinate system.
modifierThe 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.

Parameters
valThe new threshold value.
IlvPoint* IlvMakePolyPointsInteractor::transformPoints ( ) const
protected

Returns the array of points in the coordinate system of the view.

This protected 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.

© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.