ilog.views.hypergraph.crossing
Class IlvAbstractCrossingGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.hypergraph.crossing.IlvAbstractCrossingGraphic
All Implemented Interfaces:
IlvCrossingGraphic, IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvBridgeCrossings, 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 IlvCrossingAwareObject. 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 crossing aware object that corresponds to this crossing graphic.

Since:
JViews 8.1
See Also:
Serialized Form

Constructor Summary
IlvAbstractCrossingGraphic(IlvAbstractCrossingGraphic source)
          Creates a new IlvAbstractCrossingGraphic by copying an existing one.
IlvAbstractCrossingGraphic(IlvCrossingAwareObject obj)
          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 crossing aware object.
 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, IlvCrossingAwareObject obj1, IlvCrossingAwareObject obj2, 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.
 IlvCrossingAwareObject getRelatedObject()
          Returns the crossing aware object that belongs to this crossing graphic.
 boolean isInsideCalcBoundingBoxOfLink()
          Returns true if we are inside the method calcBoundingBoxOfLink(ilog.views.IlvTransformer).
 void setBoundingBoxCacheSize(int size)
          Sets the size of the bounding box cache.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
 void setRelatedObject(IlvCrossingAwareObject obj)
          Sets the crossing aware object 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.hypergraph.crossing.IlvCrossingGraphic
addCrossingBound, drawCrossing
 

Constructor Detail

IlvAbstractCrossingGraphic

public IlvAbstractCrossingGraphic(IlvCrossingAwareObject obj)
Creates a new IlvAbstractCrossingGraphic.

Parameters:
obj - The object this crossing graphic belongs to.

IlvAbstractCrossingGraphic

public IlvAbstractCrossingGraphic(IlvAbstractCrossingGraphic source)
Creates a new IlvAbstractCrossingGraphic by copying an existing one. It does not copy the reference to the related crossing aware object.

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

getRelatedObject

public IlvCrossingAwareObject getRelatedObject()
Returns the crossing aware object that belongs to this crossing graphic.


setRelatedObject

public void setRelatedObject(IlvCrossingAwareObject obj)
Sets the crossing aware object 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 object.

Specified by:
draw in class IlvGraphic
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvCrossingAwareObject.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 object.

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:
IlvCrossingAwareObject.containsAtCrossingGraphic(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvTransformer)

containsAtCrossing

public boolean containsAtCrossing(IlvPoint p,
                                  IlvPoint tp,
                                  IlvTransformer t,
                                  IlvCrossingAwareObject obj1,
                                  IlvCrossingAwareObject obj2,
                                  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 object.
obj1 - The first object, which is the object containing this crossing graphic.
obj2 - The second object.
p0 - The point before the start point of the crossing picture inside the first object.
p1 - The start point of the crossing picture inside the first object.
p2 - The end point of the crossing picture inside the first object.
p3 - The point after the end point of the crossing picture inside the first object.
startGap - The real gap between start point and the crossing.
endGap - The real gap between end point and the crossing.
normalGap - The desired normal gap at the 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 object.

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object.
See Also:
IlvCrossingAwareObject.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 object.

Parameters:
t - The transformer to draw the related object.
See Also:
boundingBox(ilog.views.IlvTransformer), setBoundingBoxCacheSize(int)

calcBoundingBoxOfLink

protected IlvRect calcBoundingBoxOfLink(IlvTransformer t)
Calculates the bounding box of the related crossing aware object. 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 crossing aware object.


isInsideCalcBoundingBoxOfLink

public boolean isInsideCalcBoundingBoxOfLink()
Returns true if we are inside the method calcBoundingBoxOfLink(ilog.views.IlvTransformer). This method exists for internal reasons. You should not use it.


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.