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

Grapher interactor to create links defined by several points. More...

#include <ilviews/grapher/polylink.h>

Inheritance diagram for IlvMakePolyLinkInteractor:
IlvMakePolyPointsInteractor IlvManagerViewInteractor IlvValueInterface IlvMakePolylineLinkInteractor

Public Member Functions

 IlvMakePolyLinkInteractor (IlvManager *manager, IlvView *view, IlBoolean oriented=IlFalse)
 Constructor. More...
 
virtual void abort ()
 Resets the interactor to an inactive state.
 
virtual IlBoolean accept (IlvPoint &point)
 Checks if a point is valid. More...
 
virtual IlBoolean acceptEnd (IlUInt count, IlvPoint *allPoints)
 Validates the link creation. More...
 
virtual void doIt (IlUInt count, IlvPoint *allPoints)
 Creates and adds a new link to the grapher. More...
 
IlvGraphicgetEndNode () const
 Returns the ending node. More...
 
IlvGraphergetGrapher () const
 Returns the grapher to which the interactor is attached. More...
 
IlvGraphicgetStartNode () const
 Returns the starting node. More...
 
virtual void init ()
 Resets the interactor to an active state.
 
IlBoolean isOriented () const
 Indicates whether created links are oriented. More...
 
virtual void react (IlvPoint &point, IlUShort modifiers=0)
 Highlights the nodes under a given point. More...
 
void setEndNode (IlvGraphic *end)
 Sets the ending node. More...
 
void setStartNode (IlvGraphic *start)
 Sets the starting node. More...
 

Protected Member Functions

virtual IlvLinkImagemakeLink (IlUInt count, IlvPoint *points)=0
 Factory method to create the new link instance. More...
 
virtual void storeLink (IlvLinkImage *link)
 Adds the new link instance to the grapher. More...
 

Detailed Description

Grapher interactor to create links defined by several points.

Library: ilvgrapher

This is an interactor abstract class. You need to subtype this class to create the links. In particular, the IlvMakePolyLinkInteractor::makeLink() method should be redefined to create links of the appropriate type.

See also
IlvPolylineLinkImage.

Constructor & Destructor Documentation

◆ IlvMakePolyLinkInteractor()

IlvMakePolyLinkInteractor::IlvMakePolyLinkInteractor ( IlvManager manager,
IlvView view,
IlBoolean  oriented = IlFalse 
)

Constructor.

The constructor initializes a new instance of the IlvMakePolyLinkInteractor class for the view view and the grapher manager.

The manager parameter is assumed to be of type IlvGrapher. The oriented parameter is used to create the link in the IlvMakePolyLinkInteractor::makeLink() method.

Parameters
managerThe grapher to which the interactor is attached.
viewThe view to which the interactor is attached.
orientedIlTrue if created links are oriented and IlFalse otherwise.

Member Function Documentation

◆ accept()

virtual IlBoolean IlvMakePolyLinkInteractor::accept ( IlvPoint point)
virtual

Checks if a point is valid.

If the point point is the first of the link, it is accepted only if there is a node containing this point. In this case, the node is registered as the starting node of the link that will be created by the IlvMakePolyLinkInteractor::makeLink() method.

This method can be overloaded to add specific constraints on the starting node or on the intermediate points that will define the link.

Parameters
pointThe point to validate, in manager coordinates.
Returns
IlTrue if the point that the user provides is acceptable. Otherwise, it returns IlFalse.
See also
getStartNode().

Reimplemented from IlvMakePolyPointsInteractor.

◆ acceptEnd()

virtual IlBoolean IlvMakePolyLinkInteractor::acceptEnd ( IlUInt  count,
IlvPoint allPoints 
)
virtual

Validates the link creation.

Called by the member function IlvMakePolyLinkInteractor::doIt() before creating the link. If this method returns IlTrue, the doIt() method proceeds. Otherwise, it is aborted and no link is created. The default implementation returns IlTrue.

Parameters
countThe number of points specified by the user.
allPointsThe points specified by the user.

◆ doIt()

virtual void IlvMakePolyLinkInteractor::doIt ( IlUInt  count,
IlvPoint allPoints 
)
virtual

Creates and adds a new link to the grapher.

Called when the user ends the interaction (usually through a double-click). The allPoints array gives all the points drawn by the user. The default implementation first calls the IlvMakePolyLinkInteractor::makeLink() method with the intermediate points of the link (that is, all the points of allPoints except the first and the last). It then calls IlvMakePolyLinkInteractor::storeLink() with the created instance to add it to the grapher.

Parameters
countThe number of points specified by the user.
allPointsThe points specified by the user.

Implements IlvMakePolyPointsInteractor.

◆ getEndNode()

IlvGraphic* IlvMakePolyLinkInteractor::getEndNode ( ) const

Returns the ending node.

The ending node is registered by the IlvMakePolyLinkInteractor::react member function each time the mouse passes over a new node.

Returns
The ending node.

◆ getGrapher()

IlvGrapher* IlvMakePolyLinkInteractor::getGrapher ( ) const

Returns the grapher to which the interactor is attached.

Returns
The grapher to which the interactor is attached.

◆ getStartNode()

IlvGraphic* IlvMakePolyLinkInteractor::getStartNode ( ) const

Returns the starting node.

The starting node is stored by the IlvMakePolyLinkInteractor::accept() member function when the first mouse click occurs.

Returns
The starting node.

◆ isOriented()

IlBoolean IlvMakePolyLinkInteractor::isOriented ( ) const

Indicates whether created links are oriented.

Returns
IlTrue if created links are oriented and IlFalse otherwise.

◆ makeLink()

virtual IlvLinkImage* IlvMakePolyLinkInteractor::makeLink ( IlUInt  count,
IlvPoint points 
)
protectedpure virtual

Factory method to create the new link instance.

The points array specifies the intermediate points of the link (that is, the two endpoints of the link are not given in this array).
This method must be redefined to create the appropriate link instance. The link is created using the information given by the IlvMakePolyLinkInteractor::getStartNode(), IlvMakePolyLinkInteractor::getEndNode(), and IlvMakePolyLinkInteractor::isOriented() methods.

Parameters
countThe number of intermediate points defining the link.
pointsThe intermediate points defining the link.
See also
getStartNode(), getEndNode(), isOriented().

Implemented in IlvMakePolylineLinkInteractor.

◆ react()

virtual void IlvMakePolyLinkInteractor::react ( IlvPoint point,
IlUShort  modifiers = 0 
)
virtual

Highlights the nodes under a given point.

Highlights (by selecting and deselecting) the nodes over which the mouse passes. The last selected node is registered as the ending node of the link. If the node uses connection pins, these are highlighted and the closest pin to point point is stored.

Parameters
pointThe point in manager coordinates.
modifiersThe modifier keys that were active when the user created the current point.
See also
IlvGrapherPin, IlvGrapherPin::getClosest(), getEndNode().

Reimplemented from IlvMakePolyPointsInteractor.

◆ setEndNode()

void IlvMakePolyLinkInteractor::setEndNode ( IlvGraphic end)

Sets the ending node.

Parameters
endThe new ending node.

◆ setStartNode()

void IlvMakePolyLinkInteractor::setStartNode ( IlvGraphic start)

Sets the starting node.

Parameters
startThe new starting node.

◆ storeLink()

virtual void IlvMakePolyLinkInteractor::storeLink ( IlvLinkImage link)
protectedvirtual

Adds the new link instance to the grapher.

If connection pins were registered during the interaction, this method connects them to link before it is added to the grapher.

Parameters
linkThe new link.
See also
IlvGrapherPin, IlvGrapherPin::setPinIndex().