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

Grapher interactor to create links. More...

#include <ilviews/grapher/inters.h>

Inheritance diagram for IlvMakeLinkInteractor:
IlvManagerViewInteractor IlvValueInterface IlvMakeDoubleLinkImageInteractor IlvMakeLabelLinkImageInteractor IlvMakeLinkImageInteractor IlvMakeOneLinkImageInteractor IlvMakeDoubleSplineLinkImageInteractor IlvMakeOneSplineLinkImageInteractor

Public Member Functions

 IlvMakeLinkInteractor (IlvManager *mgr, IlvView *v, IlBoolean oriented=IlTrue)
 Constructor. More...
 
virtual void doIt (IlvGraphic *from, IlvGraphic *to)
 Creates and adds the new link to the grapher. More...
 
IlvMakeLinkInteractorFactorygetFactory () const
 Returns the link factory associated with the instance. More...
 
IlvGraphicgetFrom () const
 Returns the node from which the link begins. More...
 
IlvGraphicgetTo () const
 Returns the node on which the link finishes. More...
 
void handlePointerMoved (IlBoolean b)
 Indicates whether nodes should be highlighted on mouse moves. More...
 
IlBoolean isHandlingPointerMoved () const
 Indicates whether nodes should be highlighted on mouse moves. More...
 
IlBoolean isOriented () const
 Indicates whether created links are oriented. More...
 
IlBoolean isUsingLinkGhost () const
 Indicates whether the ghost is drawn with an image of the created link. More...
 
IlvMakeLinkInteractorFactorysetFactory (IlvMakeLinkInteractorFactory *factory)
 Changes the link factory associated with the instance. More...
 
IlvMakeSelection setMakeNodeSelection (IlvMakeSelection mksel)
 Changes the way nodes are highlighted. More...
 
void setOriented (IlBoolean oriented)
 Indicates whether created links should be oriented. More...
 
void useLinkGhost (IlBoolean useLink)
 Indicates whether the ghost is drawn with an image of the created link. More...
 

Protected Member Functions

virtual IlBoolean acceptFrom (IlvGraphic *obj)
 Checks whether a graphic object is a valid starting node. More...
 
virtual IlBoolean acceptTo (IlvGraphic *obj)
 Checks whether a graphic object is a valid ending node. More...
 
virtual IlvLinkImagecreateLink (IlvGraphic *from, IlvGraphic *to) const
 Creates a new link. More...
 
IlBoolean findFromNode (const IlvPoint &p)
 Finds and stores the starting node. More...
 
IlBoolean findToNode (const IlvPoint &p)
 Finds and stores the ending node. More...
 
virtual void storeLink (IlvLinkImage *link)
 Adds the created link to the grapher. More...
 

Detailed Description

Grapher interactor to create links.

Library: ilvgrapher

IlvMakeLinkInteractor is the base class for interactors that enable the user to interactively create a link between nodes. There are three ways of specifying what type of link should be created by the interactor:

See also
IlvLinkImage, IlvMakeLinkInteractorFactory.

Constructor & Destructor Documentation

◆ IlvMakeLinkInteractor()

IlvMakeLinkInteractor::IlvMakeLinkInteractor ( IlvManager mgr,
IlvView v,
IlBoolean  oriented = IlTrue 
)

Constructor.

The constructor initializes a new instance of the IlvMakeLinkInteractor class for the view v and the grapher mgr.

The mgr parameter is assumed to be of the IlvGrapher type. The oriented parameter is used in the IlvMakeLinkInteractor::createLink() method to create the link.

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

Member Function Documentation

◆ acceptFrom()

virtual IlBoolean IlvMakeLinkInteractor::acceptFrom ( IlvGraphic obj)
protectedvirtual

Checks whether a graphic object is a valid starting node.

This method can be overloaded to add constraints on the starting node. The default implementation returns IlTrue if obj is a node.

Parameters
objThe considered graphic object.
Returns
A Boolean value indicating whether obj can be used as the starting node for the created link.
See also
acceptTo

◆ acceptTo()

virtual IlBoolean IlvMakeLinkInteractor::acceptTo ( IlvGraphic obj)
protectedvirtual

Checks whether a graphic object is a valid ending node.

This method can be overloaded to add constraints on the ending node. The default implementation returns IlTrue if obj is a node.

Parameters
objThe considered graphic object.
Returns
A Boolean value indicating whether obj can be used as the ending node for the created link.
See also
acceptFrom

◆ createLink()

virtual IlvLinkImage* IlvMakeLinkInteractor::createLink ( IlvGraphic from,
IlvGraphic to 
) const
protectedvirtual

Creates a new link.

The default implementation uses the associated factory (see IlvMakeLinkInteractor::setFactory()). If no factory is defined, it returns an instance of the default link class registered with the IlvGrapher::setDefaultLinkClass() method.

Parameters
fromThe starting node.
toThe ending node.
Returns
The created link.
See also
IlvMakeLinkInteractorFactory::createLink().

Reimplemented in IlvMakeDoubleSplineLinkImageInteractor, IlvMakeDoubleLinkImageInteractor, IlvMakeOneSplineLinkImageInteractor, IlvMakeOneLinkImageInteractor, IlvMakeLabelLinkImageInteractor, and IlvMakeLinkImageInteractor.

◆ doIt()

virtual void IlvMakeLinkInteractor::doIt ( IlvGraphic from,
IlvGraphic to 
)
virtual

Creates and adds the new link to the grapher.

Creates the link object between the two nodes from and to and then adds it to the grapher.
The default implementation uses the IlvMakeLinkInteractor::createLink() method to create the link and the IlvMakeLinkInteractor::storeLink() method to add it to the grapher.

Parameters
fromThe starting node.
toThe ending node.

◆ findFromNode()

IlBoolean IlvMakeLinkInteractor::findFromNode ( const IlvPoint p)
protected

Finds and stores the starting node.

Finds the first node containing the point p. The node must be accepted by the IlvMakeLinkInteractor::acceptFrom() method. If a node is found, it is stored and can be retrieved using the IlvMakeLinkInteractor::getFrom() method.

Parameters
pThe point used to find the node.
Returns
A Boolean value indicating whether a node was found.

◆ findToNode()

IlBoolean IlvMakeLinkInteractor::findToNode ( const IlvPoint p)
protected

Finds and stores the ending node.

Finds the first node containing the point p. The node must be accepted by the IlvMakeLinkInteractor::acceptTo() method. If a node is found, it is stored and can be retrieved using the IlvMakeLinkInteractor::getTo() method.

Parameters
pThe point used to find the node.
Returns
A Boolean value indicating whether a node was found.

◆ getFactory()

IlvMakeLinkInteractorFactory* IlvMakeLinkInteractor::getFactory ( ) const

Returns the link factory associated with the instance.

Returns
The current link factory, or 0 if there is none.

◆ getFrom()

IlvGraphic* IlvMakeLinkInteractor::getFrom ( ) const

Returns the node from which the link begins.

Returns
The starting node.

◆ getTo()

IlvGraphic* IlvMakeLinkInteractor::getTo ( ) const

Returns the node on which the link finishes.

Returns
The ending node.

◆ handlePointerMoved()

void IlvMakeLinkInteractor::handlePointerMoved ( IlBoolean  b)

Indicates whether nodes should be highlighted on mouse moves.

Parameters
bA Boolean value indicating whether node candidates should be highlighted when the mouse passes over them.
See also
isHandlingPointerMoved.

◆ isHandlingPointerMoved()

IlBoolean IlvMakeLinkInteractor::isHandlingPointerMoved ( ) const

Indicates whether nodes should be highlighted on mouse moves.

Returns
A Boolean indicating whether node candidates are highlighted when the mouse passes over them.
See also
handlePointerMoved.

◆ isOriented()

IlBoolean IlvMakeLinkInteractor::isOriented ( ) const

Indicates whether created links are oriented.

Returns
A Boolean value indicating whether created links are oriented.

◆ isUsingLinkGhost()

IlBoolean IlvMakeLinkInteractor::isUsingLinkGhost ( ) const

Indicates whether the ghost is drawn with an image of the created link.

Returns
A Boolean value indicating whether the ghost is drawn with an image of the created link.
See also
useLinkGhost.

◆ setFactory()

IlvMakeLinkInteractorFactory* IlvMakeLinkInteractor::setFactory ( IlvMakeLinkInteractorFactory factory)

Changes the link factory associated with the instance.

Returns the previous factory if there was one. It can therefore be deleted or kept for future use.

Parameters
factoryThe new link factory.
Returns
The old link factory.

◆ setMakeNodeSelection()

IlvMakeSelection IlvMakeLinkInteractor::setMakeNodeSelection ( IlvMakeSelection  mksel)

Changes the way nodes are highlighted.

Sets the factory that creates the selection objects used to highlight nodes during the interaction. If no factory is specified, an instance of IlvGraphNodeSelection is used.

Parameters
mkselThe new factory function.
Returns
The previous factory function.

◆ setOriented()

void IlvMakeLinkInteractor::setOriented ( IlBoolean  oriented)

Indicates whether created links should be oriented.

Parameters
orientedIlTrue if the created links should be oriented and IlFalse otherwise.

◆ storeLink()

virtual void IlvMakeLinkInteractor::storeLink ( IlvLinkImage link)
protectedvirtual

Adds the created link to the grapher.

The default implementation connects the link link to the starting and ending nodes on the registered connection pins. It then adds link in the insertion layer of the grapher.

Parameters
linkThe created link.

◆ useLinkGhost()

void IlvMakeLinkInteractor::useLinkGhost ( IlBoolean  useLink)

Indicates whether the ghost is drawn with an image of the created link.

The ghost drawn during the interaction can either be a straight line or an image of the link that is created by the interactor. If useLink is equal to IlTrue, the ghost is a copy of the link returned by the IlvMakeLinkInteractor::createLink() method. Otherwise, an instance of IlvLinkImage is used.

Parameters
useLinkA Boolean value indicating whether the ghost is drawn with an image of the created link.
See also
isUsingLinkGhost.