rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Manager Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvMakePolyPointsInteractor Class Reference

Manager interactor class. More...

#include <ilviews/manager/mkpolyin.h>

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

List of all members.

Public Member Functions

 IlvMakePolyPointsInteractor (IlvManager *manager, IlvView *view)
 Constructor.
void abort ()
 Aborts the interaction.
virtual IlBoolean accept (IlvPoint &p)
 Lets the interactor accept or refuse a new point location.
IlUInt count ()
 Returns the number of elements in the current array of points.
virtual void doIt (IlUInt count, IlvPoint *points)=0
 Finalizes the interaction by creating a graphic object from an array of points.
virtual void drawGhost ()=0
 Visual feedback during interaction.
virtual void drawHull ()
IlUShort getThreshold () const
 Returns the threshold.
virtual void handleEvent (IlvEvent &event)
 Handles events for the manager view.
void init ()
 Initialization, when the interactor is attached to a view.
IlvPointpoints ()
 Returns the current array of points.
virtual void react (IlvPoint &p, IlUShort modifier=0)
 Calback called after a new point has been added to the array of points.
void setThreshold (IlUShort val)
 Sets the threshold.

Protected Member Functions

virtual void commit (IlBoolean removeExtraPoints)
IlvPointtransformPoints () const
 Returns the array of points in the coordinate system of the view.

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:
manager The manager.
view The 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:
p The point, in the object coordinate system.

Reimplemented in IlvMakeSplineInteractor.

virtual void IlvMakePolyPointsInteractor::commit ( IlBoolean  removeExtraPoints  )  [protected, virtual]

Called by handleEvent when the polypoint is terminated. This method should call doIt() and post an undoable command if need be.

Parameters:
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 IlvMakeSplineInteractor, and IlvMakeFilledSplineInteractor.

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:
count The number of points in the array.
points The array of points provided during the interaction.

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

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 IlvMakePolylineInteractor, IlvMakeArrowPolylineInteractor, IlvMakePolygonInteractor, IlvMakeSplineInteractor, IlvMakeFilledSplineInteractor, and IlvMakeClosedSplineInteractor.

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 void 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.

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:
p The point, in the object coordinate system.
modifier The modifier keys that were depressed when the user created the current point

Reimplemented in IlvMakeSplineInteractor, and IlvMakeFilledSplineInteractor.

void IlvMakePolyPointsInteractor::setThreshold ( IlUShort  val  ) 

Sets the threshold.

Sets the threshold used in the member function accept.

Parameters:
val The 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.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.