ilog.views.graphic.linkpolicy
Class IlvAbstractCrossingGraphic

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

public abstract class IlvAbstractCrossingGraphic
extends IlvGraphic
implements IlvCrossingGraphic

An IlvAbstractCrossingGraphic serves as the base class of all classes of advanced crossing graphic objects such as IlvTunnelCrossings or IlvBridgeCrossings. These are auxiliary graphic objects that are used in combination with IlvCrossingAwareLinkImage. Their purpose it to draws the crossings.

The abstract crossing graphic contains some useful utilities such as the caching of bounding boxes and the delegation of the drawing functionality to the link image that corresponds to this crossing graphic.

Since:
JViews 6.0
See Also:
Serialized Form

Constructor Summary
IlvAbstractCrossingGraphic(IlvAbstractCrossingGraphic source)
          Creates a new IlvAbstractCrossingGraphic by copying an existing one.
IlvAbstractCrossingGraphic(IlvCrossingAwareLinkImage link)
          Creates a new IlvAbstractCrossingGraphic.
IlvAbstractCrossingGraphic(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
protected  IlvRect calcBoundingBox(IlvTransformer t)
          Calculate the bounding rectangle of the object.
protected  IlvRect calcBoundingBoxOfLink(IlvTransformer t)
          Calculates the bounding box of the related link image.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline 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.
 void crossingChanged()
          This method is called whenever a crossing related to this crossing graphic has changed.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 int getBoundingBoxCacheSize()
          Returns the size of the bounding box cache.
 IlvCrossingAwareLinkImage getRelatedLinkImage()
          Returns the link image that belongs to this crossing graphic.
 void setBoundingBoxCacheSize(int size)
          Sets the size of the bounding box cache.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
 void setRelatedLinkImage(IlvCrossingAwareLinkImage linkImage)
          Sets the link image that belongs to this crossing graphic.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Returns false because the object is not zoomable.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, copy, 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
 
Methods inherited from interface ilog.views.graphic.linkpolicy.IlvCrossingGraphic
addCrossingBound, drawCrossing
 

Constructor Detail

IlvAbstractCrossingGraphic

public IlvAbstractCrossingGraphic(IlvCrossingAwareLinkImage link)
Creates a new IlvAbstractCrossingGraphic.

Parameters:
link - The link this object belongs to.

IlvAbstractCrossingGraphic

public IlvAbstractCrossingGraphic(IlvAbstractCrossingGraphic source)
Creates a new IlvAbstractCrossingGraphic 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.

IlvAbstractCrossingGraphic

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

setGraphicBag

public void setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object. You should not call this method directly.

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

getRelatedLinkImage

public IlvCrossingAwareLinkImage getRelatedLinkImage()
Returns the link image that belongs to this crossing graphic.


setRelatedLinkImage

public void setRelatedLinkImage(IlvCrossingAwareLinkImage linkImage)
Sets the link image that belongs to this crossing graphic. You should call this method only when the crossing graphic is outside of any grapher.


zoomable

public boolean zoomable()
Returns false because the object is not zoomable.

Overrides:
zoomable in class IlvGraphic
See Also:
IlvGraphic, IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.boundingBox(IlvTransformer), IlvManager

draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object. It delegates to the related link image.

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

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the outline of the object. It delegates to the related link image.

Overrides:
contains in class IlvGraphic
Parameters:
p - The point to be tested.
tp - The point p transformed by the transformer t.
t - The transformation that was applied to the object when it was drawn.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvCrossingAwareLinkImage.containsAtCrossingGraphic(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer)

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
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.

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. It delegates to the related link image.

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object.
See Also:
IlvCrossingAwareLinkImage.boundingBoxCrossingGraphic(ilog.views.IlvTransformer), calcBoundingBox(ilog.views.IlvTransformer), setBoundingBoxCacheSize(int)

setBoundingBoxCacheSize

public void setBoundingBoxCacheSize(int size)
Sets the size of the bounding box cache. This object uses a bounding box cache in order to speed up bounding box calculations. For good performance, it is recommended to use a cache size that is at least number of views showing this object + 1.

See Also:
getBoundingBoxCacheSize()

getBoundingBoxCacheSize

public int getBoundingBoxCacheSize()
Returns the size of the bounding box cache. This object uses a bounding box cache in order to speed up bounding box calculations.

See Also:
setBoundingBoxCacheSize(int)

calcBoundingBox

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

See Also:
boundingBox(ilog.views.IlvTransformer), setBoundingBoxCacheSize(int)

calcBoundingBoxOfLink

protected IlvRect calcBoundingBoxOfLink(IlvTransformer t)
Calculates the bounding box of the related link image. Subclasses must used it in implementations of calcBoundingBox(ilog.views.IlvTransformer) if the bounding box of the crossing graphic includes the bounding box of the related link image.

Since:
JViews 8.1

crossingChanged

public void crossingChanged()
This method is called whenever a crossing related to this crossing graphic has changed.

Specified by:
crossingChanged in interface IlvCrossingGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.

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

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.


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