ilog.views.hypergraph
Class IlvHyperEdge

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.hypergraph.IlvHyperEdge
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvSegmentedHyperEdge

public class IlvHyperEdge
extends IlvGraphic

IlvHyperEdge is the base class of the graphic objects that represent the connection of multiple nodes in an IlvHyperGrapher. A hyperedge is similar to IlvLinkImage. A link image has only a single source node and a single target node, while a hyperedge has multiple source nodes and multiple target nodes. Typically, the target nodes are indicated by arrowheads drawn at the end of the hyperedge branches that point to the target nodes. The source nodes are also called origin nodes (see getFrom()). The target nodes are also called destination nodes (see getTo()).

A hyperedge can have the same node multiple times as source node or as target node. To distinguish the different occurrences, the class IlvHyperEdgeEnd is used, which represents the unique ends of a hyperedge at a node.

Different to IlvLinkImage, it is possible to add or remove source nodes and target nodes while the hyperedge is inside a hypergrapher. See addFrom(ilog.views.IlvGraphic) and addTo(ilog.views.IlvGraphic). When the hyperedge is removed from the hypergrapher, the hyperedge remembers the old end nodes. When a node is removed from the hypergrapher, the hyperedge looses the connection to the node but remains in the hypergrapher. If the hyperedge has no end nodes at all anymore, the hyperedge is not drawn and its location is at the origin of the coordinate system. This is usually not a useful situation. Therefore it is recommended that you remove the hyperedge when removing its last end node.

This class draws a star like shape of straight lines between the connection points on the origin and destination nodes. Subclasses can be used for more complex graphical representations. By default, the connection points are in the center of the nodes. They can be explicitely set by moveConnectionPoint(ilog.views.hypergraph.IlvHyperEdgeEnd, float, float, ilog.views.IlvTransformer). Subclasses of the class IlvHyperEdgeConnector can be used to restrict the connection points, e.g., to use fixed pin points.

Since:
JViews 8.0
See Also:
IlvHyperGrapher, IlvHyperEdgeEnd, Serialized Form

Constructor Summary
IlvHyperEdge()
          Creates a new hyperedge.
IlvHyperEdge(IlvGraphicVector from, IlvGraphicVector to)
          Creates a new hyperedge.
IlvHyperEdge(IlvHyperEdge source)
          Creates an IlvHyperEdge by copying an existing one.
IlvHyperEdge(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
protected  void actOnAdjustmentEnd()
          Reacts on adjustment end.
protected  Paint adaptPaint(Shape shape, Paint paint)
          Returns a new Paint object that will fit the shape parameter according to the initial paint parameter.
 IlvHyperEdgeEnd addFrom(IlvGraphic node)
          Adds an origin node to the edge.
 IlvHyperEdgeEnd addTo(IlvGraphic node)
          Adds a destination node to the edge.
protected  void afterAddEnd(IlvHyperEdgeEnd end, boolean fromSide)
          Called after the hyperedge end point is added to the edge.
 void afterDo(IlvOrderedCompoundEdit undo)
          This method must be called if undo support is needed for a specific operation.
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the edge.
protected  IlvRect arrowBBox(IlvPoint from, IlvPoint to, IlvTransformer t)
          Computes the bounding rectangle of the arrow when the edge is oriented.
 IlvOrderedCompoundEdit beforeDo(String undoPresentationName)
          This method must be called if undo support is needed for a specific operation.
protected  void beforeRemoveEnd(IlvHyperEdgeEnd end, boolean fromSide)
          Called before the hyperedge end point is removed from the edge.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the object.
protected  IlvRect calcBoundingBox(IlvTransformer t)
          Calculates the bounding rectangle of the object.
protected  void clearBoundingBoxCache()
          Clears the bounding box cache.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline of the edge.
 IlvGraphic copy()
          Copies the object.
 HashMap copyShapeFrom(IlvHyperEdge source)
          Copies all the ends from the input source edge.
protected  IlvHyperEdgeEnd createEnd(IlvGraphic node, boolean origin)
          Creates a hyperedge end point.
 boolean deleteSelection(boolean redraw)
          Deletes the selection in the inner of the hyperedge.
 void draw(Graphics dst, IlvTransformer t)
          Draws the hyperedge.
protected  void drawArrow(Graphics dst, IlvPoint from, IlvPoint to, IlvTransformer t)
          Draws the arrow of the hyperedge if the edge is oriented.
protected  void finalize()
          Does the necessary operation when the object is garbage collected.
protected  Paint getAdaptedStrokePaint(IlvTransformer t)
          Returns the stroke paint adapted to the input transformer.
protected  float getArrowSize(float lineWidth, IlvTransformer t)
          Returns the size of the arrow for the corresponding IlvTransformer and lineWidth.
 int getBoundingBoxCacheSize()
          Returns the size of the bounding box cache of this hyperedge.
 IlvPoint getCenter(IlvTransformer t)
          Returns the bary center point of the hyperedge.
 IlvHyperEdgeEnd getClosestEnd(float x, float y, IlvTransformer t)
          Returns the end closest to the input point.
 IlvRect getEndNodeBoundingBox(IlvGraphic node, IlvTransformer t)
          Returns the bounding box of the input node which is supposed to be an end node of this hyperedge.
 IlvGraphicEnumeration getFrom()
          Returns the origin nodes.
 IlvGraphic[] getFromArray()
          Returns the origin nodes in an array.
 IlvPoint[] getFromConnectionPoints(IlvTransformer t)
          Returns all origin connection points of the hyperedge.
 int getFromCount()
          Returns the number of origin nodes.
 Iterator getFromEnds()
          Returns the origin ends.
 IlvHyperEdgeEnd[] getFromEndsArray()
          Returns all origin ends in an array.
 IlvHyperEdgeEnd[] getFromEndsArray(IlvGraphic node)
          Returns all origin ends incident to the input node.
 int getFromEndsCount()
          Returns the number of origin ends.
 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.
 float getMaximumLineWidth()
          Returns the maximum line width of the edge.
 Paint getStrokePaint()
          Returns the stroke paint of the object.
 IlvGraphicEnumeration getTo()
          Returns the destination nodes.
 IlvGraphic[] getToArray()
          Returns the destination nodes in an array.
 IlvPoint[] getToConnectionPoints(IlvTransformer t)
          Returns all destination connection points of the hyperedge.
 int getToCount()
          Returns the number of destination nodes.
 Iterator getToEnds()
          Returns the destination ends.
 IlvHyperEdgeEnd[] getToEndsArray()
          Returns all destination ends in an array.
 IlvHyperEdgeEnd[] getToEndsArray(IlvGraphic node)
          Returns all destination ends incident to the input node.
 int getToEndsCount()
          Returns the number of destination ends.
 IlvPoint[] getUnclippedSegmentPoints(IlvHyperEdgeEnd end, IlvTransformer t)
          Returns the end points of the segment that ends at the input hyperedge end.
 IlvGraphic getVisibleEndNode(IlvGraphic node)
          Returns the graphic object visible on the screen if the edge is an intergraph hyperedge and the input node is collapsed in a subgrapher.
 boolean isFromEnd(IlvHyperEdgeEnd end)
          Returns whether the input hyperedge end belongs to the origin ends of this hyperedge.
 boolean isInterGraphHyperEdge()
          Returns whether the hyperedge is an intergraph hyperedge.
 boolean isPaintAbsolute()
          Returns true if the stroke paint is not adapted to the current shape.
 boolean isToEnd(IlvHyperEdgeEnd end)
          Returns whether the input hyperedge end belongs to the destination ends of this hyperedge.
 boolean isVisibleFrom(IlvGraphic node)
          Returns true if the input node is a visible origin node of this hyperedge.
 boolean isVisibleTo(IlvGraphic node)
          Returns true if the input node is a visible destination node of this hyperedge.
 IlvSelection makeSelection()
          Creates a selection object for this object.
 void moveConnectionPoint(IlvHyperEdgeEnd end, float x, float y, IlvTransformer t)
          Move the connection point of the hyperedge at the end point.
protected  void readEnds(IlvInputStream stream)
          Reads the information about the hyperedge ends.
 void removeFrom(IlvGraphic node)
          Removes an origin node from the edge.
 void removeFrom(IlvHyperEdgeEnd end)
          Removes an origin end from the edge.
 void removeTo(IlvGraphic node)
          Removes a destination node from the edge.
 void removeTo(IlvHyperEdgeEnd end)
          Removes an destination end from the edge.
 void setBoundingBoxCacheSize(int size)
          Sets the size of the bounding box cache of this hyperedge.
 void setForeground(Color c)
          Changes the color of the object.
 void setFrom(IlvGraphicVector from)
          Changes the origins of the edge.
 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 edge.
 void setPaintAbsolute(boolean set)
          Sets whether the stroke paint is not adapted to the current shape.
 void setStrokePaint(Paint p)
          Changes the stroke paint of the object.
 void setTo(IlvGraphicVector to)
          Changes the destinations of the edge.
protected  void shortenForArrowDraw(IlvPoint[] pts, float arrowSize)
          Shorten the line between pts[0] and pts[1] by the size of the arrow.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
protected  void writeEnds(IlvOutputStream stream)
          Writes the information about the hyperedge ends.
 boolean zoomable()
          Returns true if the object is zoomable, and false otherwise.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, 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, 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

IlvHyperEdge

public IlvHyperEdge()
Creates a new hyperedge.


IlvHyperEdge

public IlvHyperEdge(IlvGraphicVector from,
                    IlvGraphicVector to)
Creates a new hyperedge.

Parameters:
from - The origin nodes.
to - The destination nodes.

IlvHyperEdge

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

Parameters:
source - The origin of the copy.

IlvHyperEdge

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

readEnds

protected void readEnds(IlvInputStream stream)
                 throws IlvReadFileException
Reads the information about the hyperedge ends.

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

setBoundingBoxCacheSize

public void setBoundingBoxCacheSize(int size)
Sets the size of the bounding box cache of this hyperedge. The bounding box cache increases the performance of the hyperedge because it speeds up calls of boundingBox(IlvTransformer). The optimal size of the bounding box cache is one more than the number of views that display the edge. If the bounding box cache is smaller or larger, it is no harm except that the performance decreases or some memory is wasted.

The default size is 3, which is suitable for the most typical application that displays this hyperedge in one main view and in one overview.

See Also:
getBoundingBoxCacheSize()

getBoundingBoxCacheSize

public int getBoundingBoxCacheSize()
Returns the size of the bounding box cache of this hyperedge.

See Also:
setBoundingBoxCacheSize(int)

copy

public IlvGraphic copy()
Copies the object. An instance of IlvHyperEdge cannot be copied with the copy method. This method returns null.

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

getFrom

public final IlvGraphicEnumeration getFrom()
Returns the origin nodes. Each node occurs only once in the enumeration even if the hyperedge ends multiple times at the node.

See Also:
getTo()

getTo

public final IlvGraphicEnumeration getTo()
Returns the destination nodes. Each node occurs only once in the enumeration even if the hyperedge ends multiple times at the node.

See Also:
getFrom()

getFromArray

public final IlvGraphic[] getFromArray()
Returns the origin nodes in an array. Returns an empty array if no origin nodes exist. The returned array is newly created, hence manipulating the array does not manipulate the set of origin nodes. Each node occurs only once in the array even if the hyperedge ends multiple times at the node.

See Also:
getToArray()

getToArray

public final IlvGraphic[] getToArray()
Returns the destination nodes in an array. Returns an empty array if no destination nodes exist. The returned array is newly created, hence manipulating the array does not manipulate the set of destination nodes. Each node occurs only once in the array even if the hyperedge ends multiple times at the node.

See Also:
getFromArray()

getFromCount

public final int getFromCount()
Returns the number of origin nodes. This is the size of the array returned by getFromArray(). This may be different from the number of origin ends obtained by getFromEndsCount(), if the hyperedge ends multiple times at some nodes.

See Also:
getToCount(), getFromEndsCount()

getToCount

public final int getToCount()
Returns the number of destination nodes. This is the size of the array returned by getToArray(). This may be different from the number of destination ends obtained by getToEndsCount(), if the hyperedge ends multiple times at some nodes.

See Also:
getFromCount(), getToEndsCount()

getFromEnds

public final Iterator getFromEnds()
Returns the origin ends. If the hyperedge ends multiple times at a node, multiple ends are returned that point to the node.

The returned iterator does not support the Iterator.remove() operation. Use removeFrom(ilog.views.IlvGraphic) to remove a hyped edge end.

Returns:
An iterator over IlvHyperEdgeEnd.

getToEnds

public final Iterator getToEnds()
Returns the destination ends. If the hyperedge ends multiple times at a node, multiple ends are returned that point to the node.

The returned iterator does not support the Iterator.remove() operation. Use removeTo(ilog.views.IlvGraphic) to remove a hyped edge end.

Returns:
An iterator over IlvHyperEdgeEnd.

getFromEndsArray

public IlvHyperEdgeEnd[] getFromEndsArray()
Returns all origin ends in an array. The returned array is newly created, hence manipulating the array does not manipulate the set of origin nodes. If the hyperedge ends multiple times at a node, the array contains multiple ends that point to the node.

See Also:
getToEndsArray()

getToEndsArray

public IlvHyperEdgeEnd[] getToEndsArray()
Returns all destination ends in an array. The returned array is newly created, hence manipulating the array does not manipulate the set of destination nodes. If the hyperedge ends multiple times at a node, the array contains multiple ends that point to the node.

See Also:
getFromEndsArray()

getFromEndsArray

public IlvHyperEdgeEnd[] getFromEndsArray(IlvGraphic node)
Returns all origin ends incident to the input node.

See Also:
getToEndsArray(IlvGraphic)

getToEndsArray

public IlvHyperEdgeEnd[] getToEndsArray(IlvGraphic node)
Returns all destination ends incident to the input node.

See Also:
getFromEndsArray(IlvGraphic)

getFromEndsCount

public final int getFromEndsCount()
Returns the number of origin ends. This is the size of the arrays returned by getFromEndsArray().

See Also:
getFromCount(), getToEndsCount()

getToEndsCount

public final int getToEndsCount()
Returns the number of destination ends. This is the size of the arrays returned by getToEndsArray().

See Also:
getToCount(), getFromEndsCount()

isFromEnd

public final boolean isFromEnd(IlvHyperEdgeEnd end)
Returns whether the input hyperedge end belongs to the origin ends of this hyperedge.


isToEnd

public final boolean isToEnd(IlvHyperEdgeEnd end)
Returns whether the input hyperedge end belongs to the destination ends of this hyperedge.


copyShapeFrom

public HashMap copyShapeFrom(IlvHyperEdge source)
Copies all the ends from the input source edge. It adds copies of the ends to this hyperedge. If this hyperedge did not have any ends at the beginning, then its shape looks like a copy of the shape of the input hyperedge afterwards.

If both edges are currently in different graphers, then this edge must be removed from its grapher before calling this method. Otherwise, if this edge can remain inside its grapher, this must be done inside an applyToObject session of the edge (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)).

Parameters:
source - The source hyperedge
Returns:
A mapping from copied inner objects to original inner objects. This implementation contains a mapping from copied hyperedge ends to original hyperedge ends.

setFrom

public void setFrom(IlvGraphicVector from)
Changes the origins of the edge. Nodes can occur multiple times in the input vector. For each occurrence of a node in the input vector, a new origin end is created.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). If the edge is inside a grapher, all nodes of the input vector must also be inside a grapher. However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

See Also:
setTo(ilog.views.IlvGraphicVector)

setTo

public void setTo(IlvGraphicVector to)
Changes the destinations of the edge. Nodes can occur multiple times in the input vector. For each occurrence of a node in the input vector, a new destination end is created.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). If the edge is inside a grapher, all nodes of the input vector must also be inside a grapher. However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

See Also:
setFrom(ilog.views.IlvGraphicVector)

addFrom

public IlvHyperEdgeEnd addFrom(IlvGraphic node)
Adds an origin node to the edge. This creates a new origin end at the node.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). If the edge is inside a grapher, the node must also be inside a grapher. However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Parameters:
node - The origin node
Returns:
The new end of this hyperedge at the origin node
See Also:
addTo(ilog.views.IlvGraphic), removeFrom(ilog.views.IlvGraphic)

addTo

public IlvHyperEdgeEnd addTo(IlvGraphic node)
Adds a destination node to the edge. This creates a new destination end at the node.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). If the edge is inside a grapher, the node must also be inside a grapher. However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Parameters:
node - The destination node
Returns:
The new end of this hyperedge at the destination node
See Also:
addFrom(ilog.views.IlvGraphic), removeTo(ilog.views.IlvGraphic)

removeFrom

public final void removeFrom(IlvGraphic node)
Removes an origin node from the edge. This removes all origin ends of this edge at the node.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Furthermore you should not use this method while iterating over the origin nodes of the edge via getFrom() or getFromEnds(). However it is safe to iterate over the origin node array obtained by getFromArray() when using this method.

See Also:
removeTo(IlvGraphic), addFrom(ilog.views.IlvGraphic), IlvHyperGrapher.disconnectHyperEdge(ilog.views.IlvGraphic, ilog.views.hypergraph.IlvHyperEdge, boolean, boolean, boolean)

removeTo

public final void removeTo(IlvGraphic node)
Removes a destination node from the edge. This removes all destination ends of this edge at the node.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Furthermore, you should not use this method while iterating over the destination nodes of the edge via getTo() or getToEnds(). However it is safe to iterate over the destination node array obtained by getToArray() when using this method.

See Also:
removeFrom(IlvGraphic), addTo(ilog.views.IlvGraphic), IlvHyperGrapher.disconnectHyperEdge(ilog.views.IlvGraphic, ilog.views.hypergraph.IlvHyperEdge, boolean, boolean, boolean)

removeFrom

public final void removeFrom(IlvHyperEdgeEnd end)
Removes an origin end from the edge.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Furthermore you should not use this method while iterating over the origin nodes of the edge via getFrom() or getFromEnds(). However it is safe to iterate over the origin end array obtained by getFromEndsArray() when using this method.

See Also:
removeTo(IlvHyperEdgeEnd), addFrom(ilog.views.IlvGraphic)

removeTo

public final void removeTo(IlvHyperEdgeEnd end)
Removes an destination end from the edge.

If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)). However, you should not use this method while iterating over the hyperedge of the grapher via IlvHyperGrapher.getHyperEdges(), IlvHyperGrapher.getInterGraphHyperEdges(), or IlvHyperGrapher.getExternalInterGraphHyperEdges().

Furthermore you should not use this method while iterating over destination nodes of the edge via getTo() or getToEnds(). However it is safe to iterate over the destination end array obtained by getToEndsArray() when using this method.

See Also:
removeFrom(IlvHyperEdgeEnd), addTo(ilog.views.IlvGraphic)

createEnd

protected IlvHyperEdgeEnd createEnd(IlvGraphic node,
                                    boolean origin)
Creates a hyperedge end point. This creates an object of type IlvDefaultHyperEdgeEnd. This method can be overridden if a different type is needed.

Parameters:
node - The end node that is connected to the hyperedge by the new end point.
origin - Whether the new end will be an origin end point or a destination end point.
Returns:
The new end at the node.

afterAddEnd

protected void afterAddEnd(IlvHyperEdgeEnd end,
                           boolean fromSide)
Called after the hyperedge end point is added to the edge. This method can be overridden if special handling is required when a hyperedge end is added.

Parameters:
end - The hyperedge end.
fromSide - Whether the hyperedge end is origin or destination.

beforeRemoveEnd

protected void beforeRemoveEnd(IlvHyperEdgeEnd end,
                               boolean fromSide)
Called before the hyperedge end point is removed from the edge. This method can be overridden if special handling is required when a hyperedge end is removed.

Parameters:
end - The hyperedge end.
fromSide - Whether the hyperedge end is origin or destination.

isInterGraphHyperEdge

public final boolean isInterGraphHyperEdge()
Returns whether the hyperedge is an intergraph hyperedge. An intergraph hyperedge has its end nodes in different graphers.

This method returns a meaningful result if this hyperedge was already added to a hypergrapher. Otherwise, this method works only if all end nodes of the edge are already added to their grapher. If a new end node is added or removed later, or an end node is inserted into a different grapher, it may happen that a regular edge becomes an intergraph edge or vice versa.


getFromConnectionPoints

public final IlvPoint[] getFromConnectionPoints(IlvTransformer t)
Returns all origin connection points of the hyperedge.

Parameters:
t - The transformer that is used to draw the edge.

getToConnectionPoints

public final IlvPoint[] getToConnectionPoints(IlvTransformer t)
Returns all destination connection points of the hyperedge.

Parameters:
t - The transformer that is used to draw the edge.

moveConnectionPoint

public void moveConnectionPoint(IlvHyperEdgeEnd end,
                                float x,
                                float y,
                                IlvTransformer t)
Move the connection point of the hyperedge at the end point. If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)).

Parameters:
end - The end of the hyperedge.
x - The new x coordinate (in view coordinate system).
y - The new y coordinate (in view coordinate system).
t - The transformer that is used to draw the hyperedge.

getClosestEnd

public IlvHyperEdgeEnd getClosestEnd(float x,
                                     float y,
                                     IlvTransformer t)
Returns the end closest to the input point. The input coordinates are transformed in view coordinates.

Parameters:
x - The x coordinate.
y - The y coordinate.
t - The transformer to draw the edge.
Returns:
The closest end, or null if there are no ends.

deleteSelection

public boolean deleteSelection(boolean redraw)
Deletes the selection in the inner of the hyperedge. Returns true if successful, and false if there was no inner selection to be deleted.


getCenter

public IlvPoint getCenter(IlvTransformer t)
Returns the bary center point of the hyperedge.

Overrides:
getCenter in class IlvGraphic
Parameters:
t - The transformer that is used to draw the edge.
Returns:
The center point of this graphic object. This point can be used as the center point to rotate the object.
See Also:
IlvGraphic

getEndNodeBoundingBox

public final IlvRect getEndNodeBoundingBox(IlvGraphic node,
                                           IlvTransformer t)
Returns the bounding box of the input node which is supposed to be an end node of this hyperedge. Note that if the destination node is not in the same manager as the edge (intergraph hyperedge) the method computes the correct transformation.

Parameters:
node - An origin or destination node of the edge.
t - The transformer used to draw the edge.
See Also:
getFrom(), getTo()

getVisibleEndNode

public final IlvGraphic getVisibleEndNode(IlvGraphic node)
Returns the graphic object visible on the screen if the edge is an intergraph hyperedge and the input node is collapsed in a subgrapher. The input node is supposed to be an end node of this hyperedge. The method returns the input node if the edge is not an intergraph edge, or the end node is not collapsed inside a subgrapher. When the edge is an intergraph hyperedge and its end 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.

Parameters:
node - An origin or destination node of the edge.
See Also:
getEndNodeBoundingBox(ilog.views.IlvGraphic, ilog.views.IlvTransformer), getFrom(), getTo(), isVisibleFrom(ilog.views.IlvGraphic), isVisibleTo(ilog.views.IlvGraphic)

isVisibleFrom

public boolean isVisibleFrom(IlvGraphic node)
Returns true if the input node is a visible origin node of this hyperedge. This means there is an origin node, and getVisibleEndNode(originNode) == node.

If the edge is not an intergraph hyperedge, each origin node of the hyperedge is a "visible from node". If the edge is an intergraph hyperedge, the topmost collapsed graphers that contain origin nodes of the hyperedge but do not contain the entire hyperedge are "visible from nodes".

Parameters:
node - An node to be tested.
See Also:
getVisibleEndNode(ilog.views.IlvGraphic)

isVisibleTo

public boolean isVisibleTo(IlvGraphic node)
Returns true if the input node is a visible destination node of this hyperedge. This means there is a destination node, and getVisibleEndNode(destinationNode) == node.

If the edge is not an intergraph hyperedge, each destination node of the hyperedge is a "visible to node". If the edge is an intergraph hyperedge, the topmost collapsed graphers that contain destination nodes of the hyperedge but do not contain the entire hyperedge are "visible to nodes".

Parameters:
node - An node to be tested.
See Also:
getVisibleEndNode(ilog.views.IlvGraphic)

drawArrow

protected void drawArrow(Graphics dst,
                         IlvPoint from,
                         IlvPoint to,
                         IlvTransformer t)
Draws the arrow of the hyperedge if the edge is oriented. This method is called to draw the arrow of the edge. 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)

getArrowSize

protected float getArrowSize(float lineWidth,
                             IlvTransformer t)
Returns the size of the arrow for the corresponding IlvTransformer and lineWidth. By redefining this method the subclass can change the size of the arrow which by default is proportional to the edge line width and the transformer zoom factor. If this method returns a size that is not anymore proportional to the transformer zoom factor, this may change the zoomability of this object and the zoomable() method may also have to return something different.

Parameters:
lineWidth - the actual line width used to drawn the object in manager coordinates.
t - the transformer used to draw the object.
See Also:
getLineWidth()

arrowBBox

protected IlvRect arrowBBox(IlvPoint from,
                            IlvPoint to,
                            IlvTransformer t)
Computes the bounding rectangle of the arrow when the edge 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)

draw

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

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

shortenForArrowDraw

protected void shortenForArrowDraw(IlvPoint[] pts,
                                   float arrowSize)
Shorten the line between pts[0] and pts[1] by the size of the arrow.


getUnclippedSegmentPoints

public IlvPoint[] getUnclippedSegmentPoints(IlvHyperEdgeEnd end,
                                            IlvTransformer t)
Returns the end points of the segment that ends at the input hyperedge end. The returned points are unclipped, and are used by the IlvHyperEdgeClippingConnector to calculate the clipping point.

Parameters:
end - The hyperedge end.
t - The transformer used to draw the hyperedge.
Returns:
An array of two points in view coordinates.

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. This method uses a cache to speedup the calculation of the bounding box. It is recommended not to override this method, but to override calcBoundingBox(ilog.views.IlvTransformer) if necessary.

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

calcBoundingBox

protected IlvRect calcBoundingBox(IlvTransformer t)
Calculates the bounding rectangle of the object. This method does not use any cache (see boundingBox(ilog.views.IlvTransformer)).

Parameters:
t - The transformer used to draw the object.

clearBoundingBoxCache

protected void clearBoundingBoxCache()
Clears the bounding box cache. See boundingBox(ilog.views.IlvTransformer).


applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the edge. 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 edge.

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:
IlvGraphic

zoomable

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

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

setForeground

public void setForeground(Color c)
Changes the color of the object. This changes the stroke paint.

Overrides:
setForeground in class IlvGraphic
Parameters:
c - The new color.
See Also:
setStrokePaint(java.awt.Paint)

setStrokePaint

public void setStrokePaint(Paint p)
Changes the stroke paint of the object. The default stroke paint is black.

Parameters:
p - The new paint.
See Also:
getStrokePaint()

getStrokePaint

public Paint getStrokePaint()
Returns the stroke paint of the object.

See Also:
setStrokePaint(java.awt.Paint)

getAdaptedStrokePaint

protected Paint getAdaptedStrokePaint(IlvTransformer t)
Returns the stroke paint adapted to the input transformer. If the paint mode is not absolute, this returns for gradient paint and textures a different paint, which is adapted to the bounding box of the object.

Parameters:
t - The transformer used to draw the object.

adaptPaint

protected Paint adaptPaint(Shape shape,
                           Paint paint)
Returns a new Paint object that will fit the shape parameter according to the initial paint parameter. This method is called only if isPaintAbsolute() returns false. By default, it deals with GradientPaint and TexturePaint instances to adapt them correctly because they do not automatically fit the shape of the object on which they are drawn. You can override this method to manage your own Paint subclasses if they do not take the shape of the object into account. You will generally call the superclass method for GradientPaint and TexturePaint instances. Other Paint objects such as ilog.views.java2d.IlvLinearGradient automatically take into account the shape of the object and thus are not modified by this method.

Parameters:
shape - The shape parameter that the returned Paint should fit.
paint - The initial Paint object.
See Also:
isPaintAbsolute()

isPaintAbsolute

public boolean isPaintAbsolute()
Returns true if the stroke paint is not adapted to the current shape. This is only important if the paint is a TexturePaint or GradientPaint that is defined in global coordinates. If false, the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object. The default value is false. The parameter does not affect automatically adjusted Paint such as ilog.views.java2d.IlvLinearGradientPaint.

See Also:
setPaintAbsolute(boolean), setStrokePaint(java.awt.Paint), adaptPaint(java.awt.Shape, java.awt.Paint)

setPaintAbsolute

public void setPaintAbsolute(boolean set)
Sets whether the stroke paint is not adapted to the current shape. When set to false, the TexturePaint or GradientPaint will be adapted to the bounding rectangle of the object.

See Also:
isPaintAbsolute(), setStrokePaint(java.awt.Paint), adaptPaint(java.awt.Shape, java.awt.Paint)

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 object.
See Also:
setLineWidth(float)

setLineWidth

public void setLineWidth(float lineWidth)
Changes the line width of the object. If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)).

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

getMaximumLineWidth

public float getMaximumLineWidth()
Returns the maximum line width of the edge. If the maximum line width is specified and not equal to zero, then the width of the edge 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 edge. If the maximum line width is specified and not equal to zero, then the width of the edge will stop zooming when the maximum line width is reached. A value of zero means that there is no limit. If the edge is inside a grapher, this must be done inside an applyToObject session (see IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)).

Paramete