ilog.views
Class IlvLinkImage

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.IlvLinkImage
All Implemented Interfaces:
IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvConstraintGraphic, IlvDoubleLinkImage, IlvOneLinkImage, IlvPolylineLinkImage, IlvSplineLinkImage

public class IlvLinkImage
extends IlvGraphic
implements IlvPolyPointsInterface

IlvLinkImage is the base class for links, that is, graphic objects that are the visual representation of a connection between two nodes in an IlvGrapher instance.

Overview

IlvLinkImage draws a straight line between the connection points of the origin and destination nodes in a grapher instance. See Connection Points for more information. You retrieve the origin node by calling getFrom() and the destination node by calling getTo(). You can control the graphic appearance of the link by calling the methods setForeground(Color), setLineWidth(float), setLineStyle(float[]), setLineJoin(int) and setEndCap(int). A link can be oriented or nonoriented. An An oriented link has an arrow drawn at the destination. You can specify this attribute when calling the constructor IlvLinkImage(IlvGraphic, IlvGraphic, boolean), and you can change it afterwards by calling setOriented(boolean). Use subclasses of IlvLinkImage, such as IlvEnhancedPolylineLinkImage for more complex graphical representations of a link.

Example

The following code example shows how to connect two nodes in a grapher with an IlvLinkImage instance:

  IlvGrapher grapher = new IlvGrapher();
  
  // Create new ellipse node and add it to the grapher.
  IlvGraphic node1 = new IlvEllipse(new IlvRect(30, 10, 50, 50), true, false);
  grapher.addNode(node1, false);
  
  // Add a new rectangular node to the grapher.
  IlvGraphic node2 = new IlvRectangle(new IlvRect(220, 80, 50, 50), false, true);
  grapher.addNode(node2, true);
  
  // Link the two nodes and add them to a grapher.
  IlvLinkImage link = new IlvLinkImage(node1, node2, true);
  grapher.addLink(link, false);
  
  // Connect the grapher to the view.
  IlvManagerView view = new IlvManagerView(grapher);
  view.setBackground(Color.WHITE);
  
  JFrame frame = new JFrame("IlvLinkImage");
  frame.setLayout(new BorderLayout(2, 2));
  frame.getContentPane().add(view);
  frame.setSize(320, 200);
  frame.setVisible(true);
 

The following image shows the link created in the code example:

IlvLinkImage

Connection Points

When a link is created between two nodes, it is attached to the default connection point of each node. Each node has five default connection points, one at the center of each side of its bounding rectangle and one at the center of the bounding rectangle. The connection point used depends on the location and size of the origin and destination node.

Note: subclasses of IlvLinkConnector can be used to obtain connection points different to the default ones.

Visibility

By default, the visibility of nodes and links is controlled independently. You can set a link to be visible even when its origin and destination nodes are invisible.

The visibility a link can be coupled to the visibility of its end nodes, such that it becomes invisible when its origin or destination node becomes invisible. To enable this, install an IlvLinkVisibilityHandler as the manager listener for the grapher holding your link:

 IlvGrapher grapher = new IlvGrapher();
 IlvLinkImage link = ...
 ...
 // Install a link visibility handler. All links are managed by the handler.
 grapher.addManagerContentChangedListener(new IlvLinkVisibilityHandler());
 

When the link visibility handler is installed, it is possible to select which links are managed by the handler and which links are not managed:

 // Mark a link as unmanaged.
 IlvLinkVisibilityHandler.setManaged(link, false);
 

The visibility of link is now independent of the visibility of its end nodes. It is is controlled by calling IlvManager.setVisible(IlvGraphic, boolean, boolean).

Intergraph Links

A grapher can be nested inside another grapher. Links that cross grapher boundaries, that is, links for who the origin and destination nodes are in different graphers, are called intergraph links. The intergraph link between a node stored in grapher A and a node stored in grapher B must be stored in a common ancestor of A and B. For optimal performance, the intergraph link should be stored in the first common ancestor. The following code example shows how this is done:

   IlvGraphic origin, destination;
   ...
   // Add the origin and destination nodes to different graphers.
   ...
   IlvLinkImage link = new IlvLinkImage(origin, destination, false);
   // Use this static method to add the link to the first common
   // ancestor of the origin and destination nodes.
   IlvGrapher.addInterGraphLink(link, false);
 

Input and Output

IlvLinkImage supplies the write method used to write an IlvLinkImage instance to an IlvOutputStream. Do not call this method directly, call IlvManager.write.

Controlling Object Behavior Using Interactors

ILOG JViews Framework provides view interactors so a user can create links between nodes via the graphical interface. For example, IlvMakeLinkInteractor is used to create an IlvLinkImage when a user selects the origin and destination nodes with the mouse.

See Also:
IlvGrapher, Serialized Form

Constructor Summary
IlvLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented)
          Creates a new link image.
IlvLinkImage(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvLinkImage(IlvLinkImage source)
          Creates an IlvLinkImage by copying an existing one.
 
Method Summary
 boolean allowsPointInsertion()
          Indicates if the insertion of intermediate points is allowed.
 boolean allowsPointMove(int index)
          Returns true if the interactors are allowed to move the point with the specified index, and returns false otherwise.
 boolean allowsPointRemoval()
          Indicates if the removal of intermediate points is allowed.
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the link.
protected  IlvRect arrowBBox(IlvPoint from, IlvPoint to, IlvTransformer t)
          Computes the bounding rectangle of the arrow when the link is oriented.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline of the link.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the link.
protected  void drawArrow(Graphics dst, IlvPoint from, IlvPoint to, IlvTransformer t)
          Draws the arrow of the link if the link is oriented.
protected  void finalize()
          Does the necessary operation when the object is garbage collected.
protected  float getArrowSize(float lineWidth, IlvTransformer t)
          Returns the size of the arrow for the corresponding t and lineWidth.
 void getConnectionPoints(IlvPoint src, IlvPoint dst, IlvTransformer t)
          Computes the origin and destination points to draw the link.
 IlvPoint getConnectionReferencePoint(boolean origin, IlvTransformer t)
          Returns the reference connection point.
 int getEndCap()
          Returns the decoration applied at the end of the polyline.
 Color getForeground()
          Returns the color of the object.
 IlvGraphic getFrom()
          Returns the origin object.
 IlvRect getFromBoundingBox(IlvTransformer t)
          Returns the bounding box of the graphic object that is the origin of this link.
 IlvTransformer getFromTransformer(IlvTransformer t)
          Returns the transformer used to draw the origin node of the link, when the link is drawn with the specified transformer.
 int getLineJoin()
          Returns the decoration applied when two segments are joined.
 float[] getLineStyle()
          Returns the array representing the lengths of the dash segments.
 float getLineWidth()
          Returns the line width of the object.
 float getLineWidth(IlvTransformer t)
          Returns the line width that is actually displayed when the object is drawn with the specified transformer.
 boolean getLinkConnectorConnectionPoint(boolean origin, IlvPoint p, IlvTransformer t)
          Returns in p the position of the extremity of the link when a link connector is used to control the connection point of the link.
 IlvPoint[] getLinkPoints(IlvTransformer t)
          Returns the points that define the link.
static IlvTransformer getLocalTransformerOf(IlvGraphic node, IlvGraphicBag linkbag, IlvTransformer t)
          Returns the transformer used to draw the input node which is supposed to be an end node of the link, when the link is drawn with the specified transformer.
 float getMaximumLineWidth()
          Returns the maximum line width of the link.
 IlvGraphic getOpposite(IlvGraphic node)
          If node is the destination object, returns the origin object.
 IlvPoint getPointAt(int index, IlvTransformer t)
          Returns the point at a specified index.
 int getPointsCardinal()
          Returns the number of points of the link, including the connection points.
 IlvGraphic getTo()
          Returns the destination object.
 IlvRect getToBoundingBox(IlvTransformer t)
          Returns the bounding box of the graphic object that is the destination of this link.
 IlvTransformer getToTransformer(IlvTransformer t)
          Returns the transformer used to draw the destination node of the link, when the link is drawn with the specified transformer.
 IlvGraphic getVisibleFrom()
          Returns the origin graphic object visible on the screen if the link is an intergraph link.
 IlvGraphic getVisibleTo()
          Returns the destination graphic object visible on the screen if the link is an intergraph link.
 void insertPoint(int index, float x, float y, IlvTransformer t)
          The insertion of a point is not allowed in IlvLinkImage.
 boolean isOriented()
          Returns true if the link is oriented, and false otherwise.
 boolean isPersistent()
          Returns true when the IlvLinkImage instance can be saved in an IVL file.
 boolean isSpline()
          Returns true if the link has spline routing functionality.
 IlvSelection makeSelection()
          Creates a selection object for this object.
 void movePoint(int index, float x, float y, IlvTransformer t)
          Changes the position of a point.
 boolean pointsInBBox()
          Returns true if all points are contained inside the bounding rectangle of the object.
 void removePoint(int index, IlvTransformer t)
          The removal of a point is not allowed in IlvLinkImage.
 void setEndCap(int endCap)
          Changes the decoration applied at the end of the polyline.
 void setForeground(Color c)
          Changes the color of the object.
 void setFrom(IlvGraphic obj)
          Changes the origin of the link.
 void setIntermediateLinkPoints(IlvPoint[] points, int index, int length)
          Changes the intermediate points that define the link.
 void setLineJoin(int lineJoin)
          Changes the decoration applied when two segments are joined.
 void setLineStyle(float[] lineStyle)
          Changes the array representing the lengths of the dash segments.
 void setLineWidth(float lineWidth)
          Changes the line width of the object.
 void setMaximumLineWidth(float maximumLineWidth)
          Changes the maximum line width of the link.
 void setOriented(boolean oriented)
          Sets the link as oriented or nonoriented.
 void setTo(IlvGraphic obj)
          Changes the destination of the link.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Returns true if the object is zoomable, and false otherwise.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvLinkImage

public IlvLinkImage(IlvGraphic from,
                    IlvGraphic to,
                    boolean oriented)
Creates a new link image.

Parameters:
from - The origin object.
to - The destination object.
oriented - If true, an arrow is drawn at the destination point.

IlvLinkImage

public IlvLinkImage(IlvLinkImage source)
Creates an IlvLinkImage by copying an existing one.

Parameters:
source - The origin of the copy.

IlvLinkImage

public IlvLinkImage(IlvInputStream stream)
             throws IlvReadFileException
Reads the object from an IlvInputStream.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if the format is not correct.
Method Detail

copy

public IlvGraphic copy()
Copies the object.

Specified by:
copy in class IlvGraphic
Returns:
A copy of this IlvGraphic instance.
See Also:
IlvGraphic

getFrom

public final IlvGraphic getFrom()
Returns the origin object.

See Also:
getTo()

setFrom

public final void setFrom(IlvGraphic obj)
Changes the origin of the link. Important Note : You may use this method only when the link is NOT in a grapher, if you want to change the origin of a link that is inside a grapher, you must first remove the link from the grapher and add it back after the modification is done.

Since:
JViews 5.0
See Also:
setTo(ilog.views.IlvGraphic)

getTo

public final IlvGraphic getTo()
Returns the destination object.

See Also:
getFrom()

setTo

public final void setTo(IlvGraphic obj)
Changes the destination of the link. Important Note : You may use this method only when the link is NOT in a grapher, if you want to change the destination of a link that is inside a grapher, you must first remove the link from the grapher and add it back after the modification is done.

Since:
JViews 5.0
See Also:
setFrom(ilog.views.IlvGraphic)

getOpposite

public final IlvGraphic getOpposite(IlvGraphic node)
If node is the destination object, returns the origin object. If node is the origin object, returns the destination object.


getPointsCardinal

public int getPointsCardinal()
Returns the number of points of the link, including the connection points. The default implementation returns 2.

Specified by:
getPointsCardinal in interface IlvPolyPointsInterface

allowsPointInsertion

public boolean allowsPointInsertion()
Indicates if the insertion of intermediate points is allowed.

The default implementation always returns false. Subclasses can override this method to return true, that is, to indicate that the insertion of intermediate points is allowed.

Specified by:
allowsPointInsertion in interface IlvPolyPointsInterface
Returns:
true if the insertion of intermediate points is allowed and false otherwise.
See Also:
insertPoint(int, float, float, ilog.views.IlvTransformer)

allowsPointRemoval

public boolean allowsPointRemoval()
Indicates if the removal of intermediate points is allowed.

The default implementation always returns false. Subclasses can override this method to return true, that is, to indicate that the removal of intermediate points is allowed.

Specified by:
allowsPointRemoval in interface IlvPolyPointsInterface
Returns:
true if the removal of intermediate points is allowed and false otherwise.
See Also:
removePoint(int, ilog.views.IlvTransformer)

allowsPointMove

public boolean allowsPointMove(int index)
Returns true if the interactors are allowed to move the point with the specified index, and returns false otherwise.

If index is the index of the first point, the method returns true if and only if a link connector (see IlvLinkConnector) is attached either to the origin node or to the origin of the link and the method IlvLinkConnector.allowsConnectionPointMove(ilog.views.IlvLinkImage, boolean) called on the link connector returns true. Otherwise, the method returns false.

If index is the index of the last point, the method returns true if and only if a link connector is attached either to the destination node or to the destination of the link and the method IlvLinkConnector.allowsConnectionPointMove(ilog.views.IlvLinkImage, boolean) called on the link connector returns true. Otherwise, the method returns false.

The instance of link connector that actually controls the connection points of the link (if any) is obtained using the method IlvLinkConnector.Get(IlvLinkImage, boolean).

In all other cases, the method returns true.

Specified by:
allowsPointMove in interface IlvPolyPointsInterface
Parameters:
index - The index of the point.
Since:
JViews 5.0

insertPoint

public void insertPoint(int index,
                        float x,
                        float y,
                        IlvTransformer t)
The insertion of a point is not allowed in IlvLinkImage. Therefore this method has an empty implementation and should not be called.

Specified by:
insertPoint in interface IlvPolyPointsInterface
Parameters:
index - The index at which the new point will be inserted.
x - The x coordinate of the new point.
y - The y coordinate of the new point.
t - The transformer used to draw the polypoint.

removePoint

public void removePoint(int index,
                        IlvTransformer t)
The removal of a point is not allowed in IlvLinkImage. Therefore this method has an empty implementation and should not be called.

Specified by:
removePoint in interface IlvPolyPointsInterface
Parameters:
index - The index of the point to remove.
t - The transformer used to draw the polypoint.

getPointAt

public IlvPoint getPointAt(int index,
                           IlvTransformer t)
Returns the point at a specified index.

Specified by:
getPointAt in interface IlvPolyPointsInterface
Parameters:
index - The index of the point.
t - The transformer used to draw the link.

movePoint

public void movePoint(int index,
                      float x,
                      float y,
                      IlvTransformer t)
Changes the position of a point.

If index is the index of the first point, the default implementation calls the method IlvLinkConnector.Get(IlvLinkImage, boolean) (with true for the origin argument) to obtain the link connector instance that actually controls the connection point of the link on the origin node. If a link connector exists, the method IlvLinkConnector.connectLink(ilog.views.IlvLinkImage, ilog.views.IlvPoint, boolean, ilog.views.IlvTransformer) is called on it. Otherwise, the method does nothing.

If index is the index of the last point, the default implementation calls the method IlvLinkConnector.Get(IlvLinkImage, boolean) (with false for the origin argument) to obtain the link connector instance that actually controls the connection point of the link on the destination node. If a link connector exists, the method IlvLinkConnector.connectLink(ilog.views.IlvLinkImage, ilog.views.IlvPoint, boolean, ilog.views.IlvTransformer) is called on it. Otherwise, the method does nothing.

If index is not the index of the first or last point, the default implementation of the method does nothing.

Note that subclasses that support intermediate points on the link must override this method to handle the intermediate points, and must call super.movePoint for the index of the first and last point to ensure that link connectors work properly.

Furthermore, note that this method does not update the manager quadtrees. The method movePoint should be called only if the link object is outside any manager, or if the method is used inside the IlvApplyObject.apply(ilog.views.IlvGraphic, java.lang.Object) of an IlvApplyObject that is passed to IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean). The latter updates the manager quadtrees.

Specified by:
movePoint in interface IlvPolyPointsInterface
Parameters:
index - The index of the point to be moved.
x - The new x coordinate (in manager coordinates).
y - The new y coordinate (in manager coordinates).
t - The transformer used to draw the link.
See Also:
IlvApplyObject, IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)

setIntermediateLinkPoints

public void setIntermediateLinkPoints(IlvPoint[] points,
                                      int index,
                                      int length)
Changes the intermediate points that define the link. This method will take length points in the points array beginning at the index point and will use them for a new intermediate points array. If the array is null or the length parameter is 0, intermediate points are removed.

The default implementation does nothing. Subclasses can override this method to allow reshaping of the intermediate points.

Note that this method usually does not update the manager quadtrees. The method setIntermediateLinkPoints should be called only if the link object is outside any manager, or if the method is used inside apply of an IlvApplyObject that is passed to IlvManager.applyToObject. The latter updates the manager quadtrees.

Parameters:
points - An array of points.
index - The index of the point that will be the first intermediate point.
length - The number of intermediate points taken in the points array.
See Also:
IlvApplyObject, IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)

pointsInBBox

public boolean pointsInBBox()
Returns true if all points are contained inside the bounding rectangle of the object. The default implementation returns true.

Specified by:
pointsInBBox in interface IlvPolyPointsInterface

getConnectionReferencePoint

public IlvPoint getConnectionReferencePoint(boolean origin,
                                            IlvTransformer t)
Returns the reference connection point. The reference connection point is the point from which the connection of the link to a specific node is computed. To locate the connection point to which the link will be attached, the class IlvPinLinkConnector will first call getConnectionReferencePoint and return the pin that is closest to the reference point. For a link that is a simple line, this method returns the center of the destination node for the origin node, and the center of the origin node for the destination node.

Parameters:
origin - If true, the connection point of the origin node is searched for. If origin is false, then the connection point of the destination node is searched for.
t - The transformer used to draw the node. The node is either the origin or the destination node, depending on the value of the argument origin.
See Also:
IlvPinLinkConnector

getConnectionPoints

public void getConnectionPoints(IlvPoint src,
                                IlvPoint dst,
                                IlvTransformer t)
Computes the origin and destination points to draw the link. If link connectors are installed, this method delegates the computation to the link connectors. Otherwise it computes default points at the border of the bounding rectangle of the end nodes of the link. The calculated points are in manager view coordinates, i.e., they are transformed by the input transformer t.

Note that subclasses that override this method should take care of link connectors in a similar way.

Parameters:
src - A point for storing the origin.
dst - A point for storing the destination.
t - The transformer used to draw the link.
See Also:
IlvLinkConnector.getConnectionPoint(ilog.views.IlvLinkImage, boolean, ilog.views.IlvTransformer)

getLinkConnectorConnectionPoint

public final boolean getLinkConnectorConnectionPoint(boolean origin,
                                                     IlvPoint p,
                                                     IlvTransformer t)
Returns in p the position of the extremity of the link when a link connector is used to control the connection point of the link. If there is no link connector, that is the method IlvLinkConnector.Get(IlvLinkImage, boolean) returns null, the method returns false.

Parameters:
origin - If true, the position of the connection point for the link origin is determined. Otherwise the position of the connection point for the link destination is determined.
p - A point for storing the result.
t - The transformer that is used to draw the link.
Since:
JViews 5.0
See Also:
IlvLinkConnector.getConnectionPoint(ilog.views.IlvLinkImage, boolean, ilog.views.IlvTransformer)

getToBoundingBox

public final IlvRect getToBoundingBox(IlvTransformer t)
Returns the bounding box of the graphic object that is the destination of this link. Note that if the destination object is not in the same manager as the link (intergraph link) the method computes the correct transformation.

Parameters:
t - The transformer used to draw the link.
Since:
JViews 5.0
See Also:
getFromBoundingBox(ilog.views.IlvTransformer)

getFromBoundingBox

public final IlvRect getFromBoundingBox(IlvTransformer t)
Returns the bounding box of the graphic object that is the origin of this link. Note that if the origin object is not in the same manager as the link (intergraph link) the method computes the correct transformation.

Parameters:
t - The transformer used to draw the link.
Since:
JViews 5.0
See Also:
getToBoundingBox(ilog.views.IlvTransformer)

getVisibleFrom

public final IlvGraphic getVisibleFrom()
Returns the origin graphic object visible on the screen if the link is an intergraph link. Note that this method returns the same object as the method getFrom() if the link is not an intergraph link. When the link is an intergraph link and its origin node is in a collapsed grapher or if a parent grapher is collapsed, the returned object is the topmost collapsed grapher and not the origin node, which is not visible on the screen.

Since:
JViews 5.0
See Also:
getVisibleTo(), getFromBoundingBox(ilog.views.IlvTransformer), getFromTransformer(ilog.views.IlvTransformer), getFrom()

getVisibleTo

public final IlvGraphic getVisibleTo()
Returns the destination graphic object visible on the screen if the link is an intergraph link. Note that this method returns the same object as the method getTo() if the link is not an intergraph link. When the link is an intergraph link and its destination node is in a collapsed grapher or if a parent grapher is collapsed, the returned object is the topmost collapsed grapher and not the destination node, which is not visible on the screen.

Since:
JViews 5.0
See Also:
getVisibleFrom(), getToBoundingBox(ilog.views.IlvTransformer), getToTransformer(ilog.views.IlvTransformer), getTo()

getFromTransformer

public final IlvTransformer getFromTransformer(IlvTransformer t)
Returns the transformer used to draw the origin node of the link, when the link is drawn with the specified transformer. Note that the transformer used to draw the node might be different from the transformer used to draw the link, but only if the link is an intergraph link. If the manager that contains the node is collapsed, the result is the transformer used to draw the collapsed grapher, that is, the visible origin node of the link.

Parameters:
t - The transformer used to draw the link.
Since:
JViews 5.0
See Also:
getToTransformer(ilog.views.IlvTransformer), getVisibleFrom(), getFromBoundingBox(ilog.views.IlvTransformer), getFrom()

getToTransformer

public final IlvTransformer getToTransformer(IlvTransformer t)
Returns the transformer used to draw the destination node of the link, when the link is drawn with the specified transformer. Note that the transformer used to draw the node might be different from the transformer used to draw the link, but only if the link is an intergraph link. If the manager that contains the node is collapsed, the result is the transformer used to draw the collapsed grapher, that is, the visible origin node of the link.

Parameters:
t - The transformer used to draw the link.
Since:
JViews 5.0
See Also:
getFromTransformer(ilog.views.IlvTransformer), getVisibleTo(), getToBoundingBox(ilog.views.IlvTransformer), getTo()

getLocalTransformerOf

public static IlvTransformer getLocalTransformerOf(IlvGraphic node,
                                                   IlvGraphicBag linkbag,
                                                   IlvTransformer t)
Returns the transformer used to draw the input node which is supposed to be an end node of the link, when the link is drawn with the specified transformer. Note that the transformer used to draw the node might be different from the transformer used to draw the link, but only if the link is an intergraph link.

Parameters:
node - An origin or destination node of the link.
linkbag - The graphic bag of the link.
t - The transformer used to draw the link.
Since:
JViews 8.0

isSpline

public boolean isSpline()
Returns true if the link has spline routing functionality. The default implementation always returns false.

Since:
JViews 8.1

drawArrow

protected void drawArrow(Graphics dst,
                         IlvPoint from,
                         IlvPoint to,
                         IlvTransformer t)
Draws the arrow of the link if the link is oriented. This method is called to draw the arrow of the link. The arrow is drawn on the line defined by the points from and to. The head of the arrow is on point to. Note that the points are already transformed by the transformer.

See Also:
arrowBBox(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer)

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the link.

Specified by:
draw in class IlvGraphic
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

getArrowSize

protected float getArrowSize(float lineWidth,
                             IlvTransformer t)
Returns the size of the arrow for the corresponding t and lineWidth. By default, the arrow is proportional to the link line width and the transformer zoom factor. By overriding this method the subclass can change the size of the arrow. If the overridden method returns a size that is no longer proportional to the transformer's zoom factor, you may need to override the zoomable() method to return false.

Parameters:
lineWidth - The line width used to drawn the object.
t - The transformer used to draw the link.
Returns:
The size of the arrow for the corresponding t and lineWidth.
Since:
JViews 6.0
See Also:
getLineWidth()

arrowBBox

protected IlvRect arrowBBox(IlvPoint from,
                            IlvPoint to,
                            IlvTransformer t)
Computes the bounding rectangle of the arrow when the link is oriented. The arrow is drawn on the line defined by the points from and to. The head of the arrow is on point to. Note that the points are already transformed by the transformer.

See Also:
drawArrow(java.awt.Graphics, ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer)

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.

Specified by:
boundingBox in interface IlvPolyPointsInterface
Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the link.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the link. This method does nothing since connection points are automatically computed.

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - The transformation to be applied.
See Also:
IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the outline of the link.

Overrides:
contains in class IlvGraphic
Parameters:
p - The point to be tested.
tp - The point p transformed by the transformer t.
t - The transformation used to draw the link.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGraphic

zoomable

public boolean zoomable()
Returns true if the object is zoomable, and false otherwise. Note that the link is zoomable if the origin node, the destination node, and the link connectors eventually used to control its connection points are zoomable.

Overrides:
zoomable in class IlvGraphic
See Also:
IlvGraphic.zoomable(), IlvLinkConnector.zoomable()

isOriented

public boolean isOriented()
Returns true if the link is oriented, and false otherwise. An oriented link has an arrow drawn at the destination.

See Also:
setOriented(boolean)

setOriented

public void setOriented(boolean oriented)
Sets the link as oriented or nonoriented. An oriented link has an arrow drawn at the destination.

See Also:
isOriented()

setForeground

public void setForeground(Color c)
Changes the color of the object.

Overrides:
setForeground in class IlvGraphic
Parameters:
c - The new color.
See Also:
getForeground()

getForeground

public Color getForeground()
Returns the color of the object.

See Also:
setForeground(java.awt.Color)

getLineWidth

public float getLineWidth()
Returns the line width of the object. The default value is 0.

See Also:
setLineWidth(float)

getLineWidth

public float getLineWidth(IlvTransformer t)
Returns the line width that is actually displayed when the object is drawn with the specified transformer.

Parameters:
t - The transformer used to draw the link.
See Also:
setLineWidth(float)

setLineWidth

public void setLineWidth(float lineWidth)
Changes the line width of the object.

Parameters:
lineWidth - The new line width.
See Also:
getLineWidth()

getEndCap

public int getEndCap()
Returns the decoration applied at the end of the polyline. The values are defined in the class IlvStroke. The default value is CAP_SQUARE.

See Also:
IlvStroke, setEndCap(int)

setEndCap

public void setEndCap(int endCap)
Changes the decoration applied at the end of the polyline.

Parameters:
endCap - The new decoration style. The values are defined in the class IlvStroke. The default value is CAP_SQUARE.
See Also:
IlvStroke, getEndCap()

getLineJoin

public int getLineJoin()
Returns the decoration applied when two segments are joined. The values are defined in the class IlvStroke. The default value is JOIN_MITER.

See Also:
IlvStroke, setLineJoin(int)

setLineJoin

public void setLineJoin(int lineJoin)
Changes the decoration applied when two segments are joined.

Parameters:
lineJoin - The new decoration style. The values are defined in the class IlvStroke. The default value is JOIN_MITER.
See Also:
IlvStroke, getLineJoin()

getMaximumLineWidth

public float getMaximumLineWidth()
Returns the maximum line width of the link. If the maximum line width is specified and not equal to zero, then the width of the link will stop zooming when the maximum line width is reached.

See Also:
setMaximumLineWidth(float)

setMaximumLineWidth

public void setMaximumLineWidth(float maximumLineWidth)
Changes the maximum line width of the link. If the maximum line width is specified and not equal to zero, then the width of the link will stop zooming when the maximum line width is reached. A value of zero means that there is no limit.

Parameters:
maximumLineWidth - The maximum line width, or 0 to indicate no limit.
See Also:
getMaximumLineWidth()

getLineStyle

public float[] getLineStyle()
Returns the array representing the lengths of the dash segments. Alternate entries in the array represent the user space lengths of the opaque and transparent segments of the dashes.

See Also:
setLineStyle(float[])

setLineStyle

public void setLineStyle(float[] lineStyle)
Changes the array representing the lengths of the dash segments. Alternate entries in the array represent the user space lengths of the opaque and transparent segments of the dashes.

Parameters:
lineStyle - The new line style.
See Also:
getLineStyle()

getLinkPoints

public IlvPoint[] getLinkPoints(IlvTransformer t)
Returns the points that define the link. This class has only two points, so this method calls the getConnectionPoints member function to compute the points. You may override this method to define more points.


makeSelection

public IlvSelection makeSelection()
Creates a selection object for this object. The default implementation creates an instance of IlvLinkImageSelection.

Overrides:
makeSelection in class IlvGraphic
See Also:
IlvLinkImageSelection

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream. You should not call this method directly; instead, you should use the write methods of the manager.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvGraphic
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

isPersistent

public boolean isPersistent()
Returns true when the IlvLinkImage instance can be saved in an IVL file.

Overrides:
isPersistent in class IlvGraphic
Returns:
This method returns true when both the From an To nodes for this IlvLinkImage instance are persistent.
Since:
JViews 6.0

finalize

protected void finalize()
                 throws Throwable
Does the necessary operation when the object is garbage collected.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.