ilog.views.graphic
Class IlvEnhancedPolylineLinkImage

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.IlvLinkImage
          extended by ilog.views.graphic.IlvPolylineLinkImage
              extended by ilog.views.graphic.linkpolicy.IlvPolicyAwareLinkImage
                  extended by ilog.views.graphic.linkpolicy.IlvCrossingAwareLinkImage
                      extended by ilog.views.graphic.IlvEnhancedPolylineLinkImage
All Implemented Interfaces:
IlvPolyPointsInterface, IlvPersistentObject, Transferable, Serializable

public class IlvEnhancedPolylineLinkImage
extends IlvCrossingAwareLinkImage

A link between two nodes of a grapher with several points. The link can have a forward arrow and a backward arrow. The link has various options that control the link shape. The link can automatically stay orthogonal, i.e. its shape is a sequence of horizontal and vertical segments. The link can also show crossings between orthogonal segments with other links of the same type by a tunnel or bridge shape. These crossing shapes are in particular appropriate if the line style is solid, but may be aesthetically less pleasing with a dashed line style of the link.

This link is suitable to be use with graph layout. If orthogonal mode, it is required that the link is connected to free link connectors or clipping link connectors.

Internally, the link utilizes link shape policies to ensure the desired link shape. If the orthogonal mode is switched on, the link installs automatically an orthogonal link shape policy (IlvOrthogonalLinkShapePolicy). If the crossing mode is switched on, the link installs automatically a crossing link shape policy (IlvCrossingLinkShapePolicy). If the multi link bundle mode is switched on, the link installs automatically a bundle link shape policy (IlvBundleLinkShapePolicy).

Since:
JViews 6.0
See Also:
IlvPolicyAwareLinkImage.getLinkShapePolicy(), IlvFreeLinkConnector, IlvClippingLinkConnector, Serialized Form

Field Summary
static int BRIDGE_CROSSINGS
          Crossing mode: crossings are displayed with a bridge shape.
static int NO_CROSSINGS
          Crossing mode: crossings are not displayed in any particular way.
static int TUNNEL_CROSSINGS
          Crossing mode: crossings are displayed with a tunnel shape.
 
Constructor Summary
IlvEnhancedPolylineLinkImage(IlvEnhancedPolylineLinkImage source)
          Creates and initializes a new IlvEnhancedPolylineLinkImage by copying an existing one.
IlvEnhancedPolylineLinkImage(IlvGraphic from, IlvGraphic to, boolean backoriented, boolean oriented, IlvPoint[] points)
          Creates and initializes a new IlvEnhancedPolylineLinkImage.
IlvEnhancedPolylineLinkImage(IlvGraphic from, IlvGraphic to, boolean oriented, IlvPoint[] points)
          Creates and initializes a new IlvEnhancedPolylineLinkImage.
IlvEnhancedPolylineLinkImage(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 IlvGraphic copy()
          Copies the object.
protected  IlvGraphic createCrossingGraphic(int mode)
          Creates the appropriate crossing graphic.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
protected  void drawCore(Graphics2D dst, IlvTransformer t)
          Draws the object.
 float getAlpha()
          Returns the alpha value of this object.
 int getCrossingMode()
          Returns the crossing mode of the link.
protected  IlvLinkShapePolicy getDefaultLinkShapePolicy(IlvGraphicBag bag)
          Returns the default link shape policy of the link.
 boolean isAlphaBufferEnabled()
          Returns true if an additional buffer is used to draw the object when the alpha composition value is not 1.0.
 boolean isBackOriented()
          Returns true if the link is backward oriented, and false otherwise.
 boolean isMultiLinkBundled()
          Returns true if the automatic bundling of multi links is enabled, and false otherwise.
 boolean isOrthogonal()
          Returns true if the orthogonal mode of the link is enabled, and false otherwise.
 void setAlpha(float alpha)
          Changes the alpha value of this object.
 void setAlphaBufferEnabled(boolean enable)
          Sets whether an additional buffer is used to draw the object when the alpha composition value is not 1.0.
 void setBackOriented(boolean oriented)
          Sets whether the link is backward oriented.
 void setCrossingMode(int mode)
          Sets the crossing mode of the link.
 void setForeground(Color c)
          Changes the foreground color of the object.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
 void setLineWidth(float lineWidth)
          Changes the line width of the object.
 void setMaximumLineWidth(float maximumLineWidth)
          Changes the maximum line width of the link.
 void setMultiLinkBundled(boolean bundled)
          Enables the automatic bundling of multi links.
 void setOrthogonal(boolean orthogonal)
          Enables the orthogonal mode of the link.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.graphic.linkpolicy.IlvCrossingAwareLinkImage
applyTransform, arrowBBox, backArrowBBox, boundingBox, boundingBoxCacheContains, boundingBoxCrossingGraphic, calcBoundingBox, contains, containsAtCrossingGraphic, drawBackArrow, drawCrossingGraphic, drawPolyline, getBackArrowSize, getBoundingBoxCacheSize, getCrossingGraphic, getCrossingPolicy, getDrawingLinkPoints, getGap, getLayerOfCrossingGraphic, getSimpleShape, getStrokeShape, hasCrossings, insertPoint, invalidateBoundingBoxCache, isCrossingEnabled, isGapZoomable, mergeCrossings, movePoint, removePoint, setBoundingBoxCacheSize, setCrossingEnabled, setCrossingGraphic, setCrossingGraphic, setEndCap, setGap, setGapZoomable, setIntermediateLinkPoints, setLayerOfCrossingGraphic, setLineJoin, setOriented
 
Methods inherited from class ilog.views.graphic.linkpolicy.IlvPolicyAwareLinkImage
getLinkPoints, getLinkShapePolicy, getPointAt, setLinkShapePolicy
 
Methods inherited from class ilog.views.graphic.IlvPolylineLinkImage
allowsPointInsertion, allowsPointRemoval, getPointsCardinal
 
Methods inherited from class ilog.views.IlvLinkImage
allowsPointMove, drawArrow, finalize, getArrowSize, getConnectionPoints, getConnectionReferencePoint, getEndCap, getForeground, getFrom, getFromBoundingBox, getFromTransformer, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getLinkConnectorConnectionPoint, getLocalTransformerOf, getMaximumLineWidth, getOpposite, getTo, getToBoundingBox, getToTransformer, getVisibleFrom, getVisibleTo, isOriented, isPersistent, isSpline, makeSelection, pointsInBBox, setFrom, setLineStyle, setTo, zoomable
 
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, 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
 

Field Detail

NO_CROSSINGS

public static final int NO_CROSSINGS
Crossing mode: crossings are not displayed in any particular way.

See Also:
setCrossingMode(int), Constant Field Values

TUNNEL_CROSSINGS

public static final int TUNNEL_CROSSINGS
Crossing mode: crossings are displayed with a tunnel shape.

See Also:
setCrossingMode(int), Constant Field Values

BRIDGE_CROSSINGS

public static final int BRIDGE_CROSSINGS
Crossing mode: crossings are displayed with a bridge shape.

See Also:
setCrossingMode(int), Constant Field Values
Constructor Detail

IlvEnhancedPolylineLinkImage

public IlvEnhancedPolylineLinkImage(IlvGraphic from,
                                    IlvGraphic to,
                                    boolean oriented,
                                    IlvPoint[] points)
Creates and initializes a new IlvEnhancedPolylineLinkImage.

Parameters:
from - The origin object.
to - The destination object.
oriented - Specifies whether an arrow is drawn at the end of the link or not.
points - The intermediate points of the polylink.

IlvEnhancedPolylineLinkImage

public IlvEnhancedPolylineLinkImage(IlvGraphic from,
                                    IlvGraphic to,
                                    boolean backoriented,
                                    boolean oriented,
                                    IlvPoint[] points)
Creates and initializes a new IlvEnhancedPolylineLinkImage.

Parameters:
from - The origin object.
to - The destination object.
backoriented - Specifies whether an arrow is drawn at the start of the link or not.
oriented - Specifies whether an arrow is drawn at the end of the link or not.
points - The intermediate points of the polylink.

IlvEnhancedPolylineLinkImage

public IlvEnhancedPolylineLinkImage(IlvEnhancedPolylineLinkImage source)
Creates and initializes a new IlvEnhancedPolylineLinkImage by copying an existing one.

Parameters:
source - The copied object.

IlvEnhancedPolylineLinkImage

public IlvEnhancedPolylineLinkImage(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

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 IlvCrossingAwareLinkImage
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

copy

public IlvGraphic copy()
Copies the object.

Overrides:
copy in class IlvCrossingAwareLinkImage
Returns:
A copy of this IlvGraphic instance.
See Also:
IlvGraphic

setLineWidth

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

Overrides:
setLineWidth in class IlvCrossingAwareLinkImage
Parameters:
lineWidth - The new line width.
See Also:
IlvLinkImage.getLineWidth()

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.

Overrides:
setMaximumLineWidth in class IlvCrossingAwareLinkImage
Parameters:
maximumLineWidth - The maximum line width, or 0 to indicate no limit.
See Also:
IlvLinkImage.getMaximumLineWidth()

setAlpha

public void setAlpha(float alpha)
Changes the alpha value of this object. The alpha composition value is used to render the wrapped object in a transparent way. The value must be in the range of [0.0, 1.0], the value of 1 means that the object is not transparent.

Parameters:
alpha - The new transparency level in the range [0.0, 1.0].
Since:
JViews 8.1
See Also:
getAlpha()

getAlpha

public float getAlpha()
Returns the alpha value of this object. The alpha composition value is used to render the wrapped object in a transparent way. The value is in the range of [0.0, 1.0], the value of 1 means that the object is not transparent.

Since:
JViews 8.1
See Also:
setAlpha(float)

setAlphaBufferEnabled

public void setAlphaBufferEnabled(boolean enable)
Sets whether an additional buffer is used to draw the object when the alpha composition value is not 1.0. This option has no effect if the alpha value is 1.0. If the alpha buffer is enabled, the drawing routine first draws into the alpha buffer and then copies the result into the drawing. This results into a transparent display of this object that is visually closer to its nontransparent display. If the alpha buffer is disabled, drawing is slightly faster, but the transparent display may differ from the nontransparent display. The alpha buffer is enabled by default.

Parameters:
enable - Whether the alpha buffer is enabled.
Since:
JViews 8.1
See Also:
getAlpha(), isAlphaBufferEnabled()

isAlphaBufferEnabled

public boolean isAlphaBufferEnabled()
Returns true if an additional buffer is used to draw the object when the alpha composition value is not 1.0.

Since:
JViews 8.1
See Also:
getAlpha(), setAlphaBufferEnabled(boolean)

setOrthogonal

public void setOrthogonal(boolean orthogonal)
Enables the orthogonal mode of the link. In orthogonal mode, the bend points of the link cannot be moved anymore arbitrarily, but they are always moved in a way so that the link segments remain orthogonal.

The orthogonal mode is disabled by default.

See Also:
isOrthogonal(), setMultiLinkBundled(boolean)

isOrthogonal

public final boolean isOrthogonal()
Returns true if the orthogonal mode of the link is enabled, and false otherwise.

See Also:
setOrthogonal(boolean)

setMultiLinkBundled

public void setMultiLinkBundled(boolean bundled)
Enables the automatic bundling of multi links. Multi links are links between the same pair of end nodes. Self links are links that have the same node as source and destination node.

If the multi link bundling is enabled, nodes should have link connectors of type IlvClippingLinkConnector. It bundles only those links that are straight, because these links would otherwise overlap. It bundles only self links that have less than 4 bends, because these self links would otherwise be hidden by the nodes. This mode does not work well when the orthogonal mode is enabled, because the orthogonal mode creates bends automatically, hence the links are no straight and don't stay bundled.

The automatic bundling of multi links is disabled by default. You can set this mode before inserting the link into the grapher. You should not change this mode while the link is in the grapher.

See Also:
isMultiLinkBundled(), setOrthogonal(boolean)

isMultiLinkBundled

public final boolean isMultiLinkBundled()
Returns true if the automatic bundling of multi links is enabled, and false otherwise.

See Also:
setMultiLinkBundled(boolean)

setCrossingMode

public void setCrossingMode(int mode)
Sets the crossing mode of the link. The options are: The default value is NO_CROSSINGS

See Also:
getCrossingMode()

getCrossingMode

public final int getCrossingMode()
Returns the crossing mode of the link.

See Also:
setCrossingMode(int)

getDefaultLinkShapePolicy

protected IlvLinkShapePolicy getDefaultLinkShapePolicy(IlvGraphicBag bag)
Returns the default link shape policy of the link. The enhanced polyline link uses link shape policies to implement the crossing mode, the orthogonal mode and the link bundling mode. If you try to install your own link shape policy via IlvPolicyAwareLinkImage.setLinkShapePolicy(ilog.views.graphic.linkpolicy.IlvLinkShapePolicy), these modes won't work anymore. Therefore it is recommended to avoid calling IlvPolicyAwareLinkImage.setLinkShapePolicy(ilog.views.graphic.linkpolicy.IlvLinkShapePolicy) directly.

If you want to install your own link shape policy in addition to the predefined link shape policies, you should derive your link shape policy from IlvAbstractLinkShapePolicy and override this method in the following way:

 protected IlvLinkShapePolicy getDefaultLinkShapePolicy(IlvGraphicBag bag)
 {
   IlvAbstractLinkShapePolicy p = ... your code ...
   p.setChildPolicy(super.getDefaultLinkShapePolicy(bag));
   return p;
 }
 
Your link shape policy is automatically installed in this way, when the link is inserted into a grapher, when the crossing mode, orthogonal mode, or link bundling mode changes, or when you explicitly call:
 setLinkShapePolicy(getDefaultLinkShapePolicy(bag));
 

Since:
JViews 6.5
See Also:
setCrossingMode(int), setOrthogonal(boolean), setMultiLinkBundled(boolean)

createCrossingGraphic

protected IlvGraphic createCrossingGraphic(int mode)
Creates the appropriate crossing graphic. This can be overridden in subclasses.


setGraphicBag

public void setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object. You should not call this method directly unless you are creating a new type of bag.

Overrides:
setGraphicBag in class IlvCrossingAwareLinkImage
Parameters:
bag - The graphic bag.
See Also:
IlvGraphic

setBackOriented

public void setBackOriented(boolean oriented)
Sets whether the link is backward oriented. A backward oriented link has an arrow drawn at the origin.

Overrides:
setBackOriented in class IlvCrossingAwareLinkImage
See Also:
isBackOriented()

isBackOriented

public boolean isBackOriented()
Returns true if the link is backward oriented, and false otherwise. A backward oriented link has an arrow drawn at the origin.

Overrides:
isBackOriented in class IlvCrossingAwareLinkImage
See Also:
setBackOriented(boolean)

setForeground

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

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

draw

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

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

drawCore

protected void drawCore(Graphics2D dst,
                        IlvTransformer t)
Draws the object. This method is called from draw(java.awt.Graphics, ilog.views.IlvTransformer) after processing the alpha transparency. It can be overridden in subclasses.

Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
Since:
JViews 8.1
See Also:
setAlpha(float)


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