Grapher interactor to create links. More...
#include <ilviews/grapher/inters.h>
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... | |
IlvMakeLinkInteractorFactory * | getFactory () const |
Returns the link factory associated with the instance. More... | |
IlvGraphic * | getFrom () const |
Returns the node from which the link begins. More... | |
IlvGraphic * | getTo () 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... | |
IlvMakeLinkInteractorFactory * | setFactory (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 IlvLinkImage * | createLink (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... | |
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:
IlvMakeLinkInteractor::createLink()
method. IlvMakeLinkInteractorFactory
class and overloading its IlvMakeLinkInteractorFactory::createLink()
method to return the appropriate link instance. You can then associate the link factory and the interactor using the IlvMakeLinkInteractor::setFactory()
method. IlvGrapher::setDefaultLinkClass()
method. IlvLinkImage
, IlvMakeLinkInteractorFactory
. 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.
mgr | The grapher to which the interactor is attached. |
v | The view to which the interactor is attached. |
oriented | IlTrue if created links are oriented and IlFalse otherwise. |
|
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.
obj | The considered graphic object. |
acceptTo
|
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.
obj | The considered graphic object. |
acceptFrom
|
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.
from | The starting node. |
to | The ending node. |
Reimplemented in IlvMakeDoubleSplineLinkImageInteractor, IlvMakeDoubleLinkImageInteractor, IlvMakeOneSplineLinkImageInteractor, IlvMakeOneLinkImageInteractor, IlvMakeLabelLinkImageInteractor, and IlvMakeLinkImageInteractor.
|
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.
from | The starting node. |
to | The ending node. |
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.
p | The point used to find the node. |
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.
p | The point used to find the node. |
IlvMakeLinkInteractorFactory* IlvMakeLinkInteractor::getFactory | ( | ) | const |
Returns the link factory associated with the instance.
IlvGraphic* IlvMakeLinkInteractor::getFrom | ( | ) | const |
Returns the node from which the link begins.
IlvGraphic* IlvMakeLinkInteractor::getTo | ( | ) | const |
Returns the node on which the link finishes.
void IlvMakeLinkInteractor::handlePointerMoved | ( | IlBoolean | b | ) |
Indicates whether nodes should be highlighted on mouse moves.
b | A Boolean value indicating whether node candidates should be highlighted when the mouse passes over them. |
isHandlingPointerMoved
. IlBoolean IlvMakeLinkInteractor::isHandlingPointerMoved | ( | ) | const |
Indicates whether nodes should be highlighted on mouse moves.
handlePointerMoved
. IlBoolean IlvMakeLinkInteractor::isOriented | ( | ) | const |
Indicates whether created links are oriented.
IlBoolean IlvMakeLinkInteractor::isUsingLinkGhost | ( | ) | const |
Indicates whether the ghost is drawn with an image of the created link.
useLinkGhost
. 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.
factory | The new link factory. |
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.
mksel | The new factory function. |
void IlvMakeLinkInteractor::setOriented | ( | IlBoolean | oriented | ) |
Indicates whether created links should be oriented.
oriented | IlTrue if the created links should be oriented and IlFalse otherwise. |
|
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.
link | The created link. |
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.
useLink | A Boolean value indicating whether the ghost is drawn with an image of the created link. |
isUsingLinkGhost
.