Search this API

y.view
Class ArcEdgeRealizer

java.lang.Object
  extended by y.view.EdgeRealizer
      extended by y.view.ArcEdgeRealizer
All Implemented Interfaces:
EdgeLayout

public class ArcEdgeRealizer
extends EdgeRealizer

An edge realizer that displays an edge as an arc. Depending on the behavior of the radius of the arc, there are two possible modes for the realizer. In one mode the radius is always fixed independent of the distance of the two adjacent nodes, in the other mode the radius and the distance have a fixed ratio.

This realizer does have exactly one bend. Deleting or inserting bends does not have any effects.

 

Field Summary
static byte FIXED_HEIGHT
          Arc type specifier constant.
static byte FIXED_RATIO
          Arc type specifier constant.
 
Fields inherited from class y.view.EdgeRealizer
bends, path, PATH_CLIPPED_AT_SOURCE, PATH_CLIPPED_AT_SOURCE_AND_TARGET, PATH_CLIPPED_AT_TARGET, PATH_INVISBLE, PATH_UNCLIPPED
 
Constructor Summary
ArcEdgeRealizer()
          Instantiates a new ArcEdgeRealizer.
ArcEdgeRealizer(byte type)
          Instantiates a new ArcEdgeRealizer with a given arc type.
ArcEdgeRealizer(EdgeRealizer er)
          Instantiates a new ArcEdgeRealizer as a copy of the given edge realizer.
 
Method Summary
static java.util.Map arcTypeToStringMap()
          Returns a map whose keys are the arc type constants wrapped in Byte objects.
 void bendChanged(Bend b, double oldX, double oldY)
          Recalculates the arc path after the bend of this edge has been moved.
protected  byte calculatePath(java.awt.geom.Point2D sourceIntersectionOut, java.awt.geom.Point2D targetIntersectionOut)
          Recalculates the arc path after this realizer has been marked as dirty.
 void clearBends()
          This implementation will not do anything since arcs will always have one single bend.
 Bend createBend(double x, double y, Bend refBend, int dir)
          Has no effect, because arcs have no bends.
 EdgeRealizer createCopy(EdgeRealizer er)
          Creates a copy of this realizer type that is initialized with the attributes of the given realizer.
 byte getArcType()
          Returns the arc type of this realizer.
 float getHeight()
          Returns the height of the arc.
 int getMinBendCount()
          Returns the minimal number of bends for this realizer, which is 1.
 float getRatio()
          Returns the ratio between the distance of the end nodes of the edges and the height of the arc.
 Bend insertBend(double x, double y)
          Has no effect, because arcs have no bends
 void read(java.io.ObjectInputStream in)
          Deprecated. Use the GraphML format instead.
 void reInsertBend(Bend bend, Bend refBend, int dir)
          Has no effect, because arcs have no bends
 Bend removeBend(Bend b)
          Has no effect, because arcs have no bends
 void setArcType(byte t)
          Sets the arc type for this realizer.
 void setHeight(float h)
          Sets the height of the arc.
 void setRatio(float r)
          Sets the ratio between the distance of the end nodes of the edges and the height of the arc.
 void write(java.io.ObjectOutputStream out)
          Deprecated. Use the GraphML format instead.
 
Methods inherited from class y.view.EdgeRealizer
addLabel, addPoint, appendBend, bendCount, bendPos, bends, bindEdge, calculateClippingAndIntersection, calcUnionRect, clearPoints, contains, containsSeg, createCopy, createEdgeLabel, firstBend, getArrow, getArrowScaleFactor, getBend, getEdge, getHighlightedBendColor, getLabel, getLabel, getLabelText, getLayer, getLineColor, getLineType, getMouseInputEditorProvider, getPath, getPoint, getSelectionColor, getSelectionStroke, getSourceArrow, getSourceIntersection, getSourcePoint, getSourcePort, getSourceRealizer, getTargetArrow, getTargetIntersection, getTargetPoint, getTargetPort, getTargetRealizer, hasVisiblePath, intersects, isDirty, isLabelRenderingOrderInverted, isPathClippedAtSource, isPathClippedAtTarget, isReversedPathRenderingEnabled, isSelected, isVisible, labelBoundsChanged, labelCount, lastBend, paint, paintArrows, paintBends, paintHighlightedBends, paintLabels, paintPorts, paintSloppy, pathIntersects, pointCount, recalculateFeatures, registerObstacles, removeLabel, removeLabel, repaint, setArrow, setDirty, setHighlightedBendColor, setLabelRenderingOrderInverted, setLabelText, setLayer, setLineColor, setLineType, setPoint, setPorts, setReversedPathRenderingEnabled, setSelected, setSelectionColor, setSelectionStroke, setSourceArrow, setSourcePoint, setSourcePort, setTargetArrow, setTargetPoint, setTargetPort, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXED_HEIGHT

public static final byte FIXED_HEIGHT
Arc type specifier constant. This type of arc preserves the height of the arc independent of node distance.

See Also:
Constant Field Values

FIXED_RATIO

public static final byte FIXED_RATIO
Arc type specifier constant. This type of arc preserves the ratio between arc height and node distance.

See Also:
Constant Field Values
Constructor Detail

ArcEdgeRealizer

public ArcEdgeRealizer()
Instantiates a new ArcEdgeRealizer. FIXED_RATIO will be used as arc type.


ArcEdgeRealizer

public ArcEdgeRealizer(byte type)
Instantiates a new ArcEdgeRealizer with a given arc type. The arc type can be either FIXED_RATIO or FIXED_HEIGHT.


ArcEdgeRealizer

public ArcEdgeRealizer(EdgeRealizer er)
Instantiates a new ArcEdgeRealizer as a copy of the given edge realizer. If the edge realizer is not of type ArcEdgeRealizer only the standard values will be copied.

Method Detail

clearBends

public void clearBends()
This implementation will not do anything since arcs will always have one single bend.

Overrides:
clearBends in class EdgeRealizer

createCopy

public EdgeRealizer createCopy(EdgeRealizer er)
Creates a copy of this realizer type that is initialized with the attributes of the given realizer.

Specified by:
createCopy in class EdgeRealizer

setArcType

public void setArcType(byte t)
Sets the arc type for this realizer.

Parameters:
t - Either FIXED_HEIGHT or FIXED_RATIO

getArcType

public byte getArcType()
Returns the arc type of this realizer.

Returns:
Either FIXED_HEIGHT or FIXED_RATIO

getRatio

public float getRatio()
Returns the ratio between the distance of the end nodes of the edges and the height of the arc.


setRatio

public void setRatio(float r)
Sets the ratio between the distance of the end nodes of the edges and the height of the arc.

By default a ratio of 1.0 is used.


setHeight

public void setHeight(float h)
Sets the height of the arc.

By default a height of 30.0 is used.


getHeight

public float getHeight()
Returns the height of the arc.


createBend

public Bend createBend(double x,
                       double y,
                       Bend refBend,
                       int dir)
Has no effect, because arcs have no bends.

Specified by:
createBend in class EdgeRealizer
Parameters:
x - X-coordinate of the Bend
y - Y-coordinate of the Bend
refBend - Bend which should be neighbor
dir - indicates if the new Bend should be added before Graph.BEFORE or after Graph.AFTER the refBend in the bend sequence of the edge
Returns:
Return value is always null.

reInsertBend

public void reInsertBend(Bend bend,
                         Bend refBend,
                         int dir)
Has no effect, because arcs have no bends

Specified by:
reInsertBend in class EdgeRealizer
Parameters:
bend - the bend to be reinserted
refBend - reference bend already contained in this realizer
dir - indicates whether the bend should be inserted before or after the reference bend.Allowed values are Graph.AFTER and Graph.BEFORE.

insertBend

public Bend insertBend(double x,
                       double y)
Has no effect, because arcs have no bends

Specified by:
insertBend in class EdgeRealizer
Parameters:
x - X-coordinates of the bend
y - Y-coordinates of the bend
Returns:
Return value is always null.

removeBend

public Bend removeBend(Bend b)
Has no effect, because arcs have no bends

Specified by:
removeBend in class EdgeRealizer
Parameters:
b - Bend to be removed

getMinBendCount

public int getMinBendCount()
Returns the minimal number of bends for this realizer, which is 1.

Overrides:
getMinBendCount in class EdgeRealizer

bendChanged

public void bendChanged(Bend b,
                        double oldX,
                        double oldY)
Recalculates the arc path after the bend of this edge has been moved.

Overrides:
bendChanged in class EdgeRealizer
Parameters:
b - Bend which has changed position
oldX - previous x-coordinate
oldY - previous y-coordinate

calculatePath

protected byte calculatePath(java.awt.geom.Point2D sourceIntersectionOut,
                             java.awt.geom.Point2D targetIntersectionOut)
Recalculates the arc path after this realizer has been marked as dirty.

Specified by:
calculatePath in class EdgeRealizer
Parameters:
sourceIntersectionOut - output parameter for the coordinates of the source intersection point calculated by this method.
targetIntersectionOut - output parameter for the coordinates of the target intersection point calculated by this method.
Returns:
either EdgeRealizer.PATH_UNCLIPPED, EdgeRealizer.PATH_CLIPPED_AT_SOURCE, EdgeRealizer.PATH_CLIPPED_AT_TARGET, or EdgeRealizer.PATH_CLIPPED_AT_SOURCE_AND_TARGET
See Also:
EdgeRealizer.path, EdgeRealizer.isPathClippedAtSource(), EdgeRealizer.isPathClippedAtTarget()

arcTypeToStringMap

public static java.util.Map arcTypeToStringMap()
Returns a map whose keys are the arc type constants wrapped in Byte objects. The values of these keys are descriptive strings describing these types.


write

public void write(java.io.ObjectOutputStream out)
           throws java.io.IOException
Deprecated. Use the GraphML format instead.

Writes out this realizer in a serialized form.

Overrides:
write in class EdgeRealizer
Throws:
java.io.IOException

read

public void read(java.io.ObjectInputStream in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Deprecated. Use the GraphML format instead.

Reads in the serialized form of this realizer. The realizer must have been written out before by it's write(ObjectOutputStream) method.

Overrides:
read in class EdgeRealizer
Throws:
java.io.IOException
java.lang.ClassNotFoundException

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.