ilog.views.graphic.linkpolicy
Class IlvTunnelCrossings

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.linkpolicy.IlvAbstractCrossingGraphic
          extended by ilog.views.graphic.linkpolicy.IlvTunnelCrossings
All Implemented Interfaces:
IlvCrossingGraphic, IlvPersistentObject, Transferable, Serializable

public class IlvTunnelCrossings
extends IlvAbstractCrossingGraphic

An IlvTunnelCrossings is an auxiliary graphic object that is used in combination with an IlvCrossingAwareLinkImage or IlvEnhancedPolylineLinkImage. The tunnel crossing graphic draws the tunnel shapes of the link crossings. It must be in a manager layer that is above all layers that contain links. Normally, the crossing link shape policy take care of this automatically.

Notice that each link needs its own crossing graphic. It cannot be shared among links. A new tunnel crossing graphic together with a crossing link shape policy is automatically installed at an enhanced polyline link image when the tunnel crossing mode is used, via link.setCrossingMode(IlvEnhancedPolylineLinkImage.TUNNEL_CROSSINGS);.

Usually, it is not necessary to install the tunnel graphic explicitly. The following example illustrates how to install a tunnel crossing graphic explicitly that is updated by the crossing link shape policy:

 IlvCrossingLinkShapePolicy policy = new IlvCrossingLinkShapePolicy();
 // the policy can be shared among links, but each link needs its own
 // tunnel crossing object
 IlvCrossingAwareLinkImage link = new IlvCrossingAwareLinkImage(node1, node2, true, null);
 link.setCrossingGraphic(new IlvTunnelCrossings(link));
 link.setLinkShapePolicy(policy);
 ...
 

Since:
JViews 6.0
See Also:
IlvEnhancedPolylineLinkImage, IlvCrossingAwareLinkImage.getCrossingGraphic(), IlvPolicyAwareLinkImage.getLinkShapePolicy(), Serialized Form

Constructor Summary
IlvTunnelCrossings(IlvCrossingAwareLinkImage link)
          Creates a new IlvTunnelCrossings.
IlvTunnelCrossings(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvTunnelCrossings(IlvTunnelCrossings source)
          Creates a new IlvTunnelCrossings by copying an existing one.
 
Method Summary
 void addCrossingBound(IlvRect boundingRect, IlvTransformer t, IlvLinkImage link1, IlvLinkImage link2, IlvPoint p0, IlvPoint p1, IlvPoint p2, IlvPoint p3, float startGap, float endGap, float normalGap)
          Adds the bound of the crossing to the input bounding rectangle.
protected  IlvRect calcBoundingBox(IlvTransformer t)
          Calculate the bounding rectangle of the object.
 boolean containsAtCrossing(IlvPoint p, IlvPoint tp, IlvTransformer t, IlvLinkImage link1, IlvLinkImage link2, IlvPoint p0, IlvPoint p1, IlvPoint p2, IlvPoint p3, float startGap, float endGap, float normalGap)
          Tests if a point lies within the drawing of a crossing.
 IlvGraphic copy()
          Copies the crossing graphic.
 void drawCrossing(Graphics dst, IlvTransformer t, IlvLinkImage link1, IlvLinkImage link2, IlvPoint p0, IlvPoint p1, IlvPoint p2, IlvPoint p3, float startGap, float endGap, float normalGap)
          Draws the crossing between the input links.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Returns true if the object is zoomable; otherwise it returns false.
 
Methods inherited from class ilog.views.graphic.linkpolicy.IlvAbstractCrossingGraphic
applyTransform, boundingBox, calcBoundingBoxOfLink, contains, crossingChanged, draw, getBoundingBoxCacheSize, getRelatedLinkImage, setBoundingBoxCacheSize, setGraphicBag, setRelatedLinkImage
 
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, isPersistent, isSelectable, isVisible, makeSelection, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setEditable, setFillOn, setForeground, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvTunnelCrossings

public IlvTunnelCrossings(IlvCrossingAwareLinkImage link)
Creates a new IlvTunnelCrossings.

Parameters:
link - The link this object belongs to.

IlvTunnelCrossings

public IlvTunnelCrossings(IlvTunnelCrossings source)
Creates a new IlvTunnelCrossings by copying an existing one. It does not copy the reference to the link this object belongs to.

Parameters:
source - The origin object for the copy.

IlvTunnelCrossings

public IlvTunnelCrossings(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 crossing graphic. It does not copy the reference to the link this object belongs to.

Specified by:
copy in class IlvGraphic
Returns:
A copy of the object.
See Also:
IlvGraphic

drawCrossing

public void drawCrossing(Graphics dst,
                         IlvTransformer t,
                         IlvLinkImage link1,
                         IlvLinkImage link2,
                         IlvPoint p0,
                         IlvPoint p1,
                         IlvPoint p2,
                         IlvPoint p3,
                         float startGap,
                         float endGap,
                         float normalGap)
Draws the crossing between the input links. The input points and gaps are transformed by the input transformer.

Parameters:
dst - The destination Graphics.
t - The transformation used to draw the first link.
link1 - The first link, which is the link containing this crossing graphic.
link2 - The second link.
p0 - The point before the start point of the crossing picture inside the first link.
p1 - The start point of the crossing picture inside the first link.
p2 - The end point of the crossing picture inside the first link.
p3 - The point after the end point of the crossing picture inside the first link.
startGap - The real gap between start point and the link crossing.
endGap - The real gap between end point and the link crossing.
normalGap - The desired normal gap at the link crossing. The start gap and end gap may be smaller than the normal gap.

containsAtCrossing

public boolean containsAtCrossing(IlvPoint p,
                                  IlvPoint tp,
                                  IlvTransformer t,
                                  IlvLinkImage link1,
                                  IlvLinkImage link2,
                                  IlvPoint p0,
                                  IlvPoint p1,
                                  IlvPoint p2,
                                  IlvPoint p3,
                                  float startGap,
                                  float endGap,
                                  float normalGap)
Tests if a point lies within the drawing of a crossing. The input points and gaps are transformed by the input transformer.

Specified by:
containsAtCrossing in interface IlvCrossingGraphic
Overrides:
containsAtCrossing in class IlvAbstractCrossingGraphic
Parameters:
p - The point to be tested. This point is untransformed.
tp - The point p transformed by the transformer t.
t - The transformation used to draw the first link.
link1 - The first link, which is the link containing this crossing graphic.
link2 - The second link.
p0 - The point before the start point of the crossing picture inside the first link.
p1 - The start point of the crossing picture inside the first link.
p2 - The end point of the crossing picture inside the first link.
p3 - The point after the end point of the crossing picture inside the first link.
startGap - The real gap between start point and the link crossing.
endGap - The real gap between end point and the link crossing.
normalGap - The desired normal gap at the link crossing. The start gap and end gap may be smaller than the normal gap.

calcBoundingBox

protected IlvRect calcBoundingBox(IlvTransformer t)
Calculate the bounding rectangle of the object. This is called by IlvAbstractCrossingGraphic.boundingBox(ilog.views.IlvTransformer) when the bounding box for the input transformer is not internally cached.

Overrides:
calcBoundingBox in class IlvAbstractCrossingGraphic
See Also:
IlvAbstractCrossingGraphic.boundingBox(ilog.views.IlvTransformer), IlvAbstractCrossingGraphic.setBoundingBoxCacheSize(int)

addCrossingBound

public void addCrossingBound(IlvRect boundingRect,
                             IlvTransformer t,
                             IlvLinkImage link1,
                             IlvLinkImage link2,
                             IlvPoint p0,
                             IlvPoint p1,
                             IlvPoint p2,
                             IlvPoint p3,
                             float startGap,
                             float endGap,
                             float normalGap)
Adds the bound of the crossing to the input bounding rectangle. The input points and gaps are transformed by the input transformer.

Parameters:
boundingRect - The bounding rectangle containing the result.
t - The transformation used to draw the first link.
link1 - The first link, which is the link containing this crossing graphic.
link2 - The second link.
p0 - The point before the start point of the crossing picture inside the first link.
p1 - The start point of the crossing picture inside the first link.
p2 - The end point of the crossing picture inside the first link.
p3 - The point after the end point of the crossing picture inside the first link.
startGap - The real gap between start point and the link crossing.
endGap - The real gap between end point and the link crossing.
normalGap - The desired normal gap at the link crossing. The start gap and end gap may be smaller than the normal gap.

zoomable

public boolean zoomable()
Returns true if the object is zoomable; otherwise it returns false. The object is zoomable if the related link is zoomable and the gap is zoomable.

Overrides:
zoomable in class IlvAbstractCrossingGraphic
See Also:
IlvCrossingAwareLinkImage.isGapZoomable()

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


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