Search this API

y.view
Class SplineEdgeRealizer

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

public class SplineEdgeRealizer
extends EdgeRealizer

This realizer draws an edge as a natural cubic spline curve. The bends are interpreted as control points for the curve. This curve type has the property that all control points actually lie on the curve itself.


Field Summary
 
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
SplineEdgeRealizer()
          Default Constructor.
SplineEdgeRealizer(EdgeRealizer r)
          Constructs a new SplineEdgeRealizer as a copy of the given realizer.
 
Method Summary
protected  byte calculatePath(Point2D sourceIntersectionOut, Point2D targetIntersectionOut)
          Recalculates the spline path after this realizer has been marked as dirty.
 int containsSeg(double dx, double dy)
          like contains(), but returns number of the hit segment, 0 otherwise.
 Bend createBend(double x, double y, Bend refBend, int dir)
          Add a new Bend to the edge
 EdgeRealizer createCopy(EdgeRealizer er)
          Creates a copy of this realizer type that is initialized with the attributes of the given realizer.
 Bend insertBend(double x, double y)
          Adds a new bend to this realizer and returns it.
 void read(ObjectInputStream in)
          Deprecated. Use the GraphML format instead.
 void reInsertBend(Bend bend, Bend refBend, int dir)
          Reinserts a bend to the edge which had been removed before.
 Bend removeBend(Bend b)
          Removes a Bend of this realizer
 void write(ObjectOutputStream out)
          Deprecated. Use the GraphML format instead.
 
Methods inherited from class y.view.EdgeRealizer
addLabel, addPoint, appendBend, bendChanged, bendCount, bendPos, bends, bindEdge, calculateClippingAndIntersection, calcUnionRect, clearBends, clearPoints, contains, createCopy, createEdgeLabel, firstBend, getArrow, getArrowScaleFactor, getBend, getEdge, getHighlightedBendColor, getLabel, getLabel, getLabelText, getLayer, getLineColor, getLineType, getMinBendCount, getMouseInputEditorProvider, getPath, getPoint, getSelectionColor, getSelectionStroke, getSourceArrow, getSourceIntersection, getSourcePoint, getSourcePort, getSourceRealizer, getTargetArrow, getTargetIntersection, getTargetPoint, getTargetPort, getTargetRealizer, hasVisiblePath, intersects, isDirty, 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, 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
 

Constructor Detail

SplineEdgeRealizer

public SplineEdgeRealizer()
Default Constructor.


SplineEdgeRealizer

public SplineEdgeRealizer(EdgeRealizer r)
Constructs a new SplineEdgeRealizer as a copy of the given realizer. If the given realizer is not of the same type as this class only the known values will be copied.

Method Detail

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

createBend

public Bend createBend(double x,
                       double y,
                       Bend refBend,
                       int dir)
Add a new Bend to the edge

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

reInsertBend

public void reInsertBend(Bend bend,
                         Bend refBend,
                         int dir)
Description copied from class: EdgeRealizer
Reinserts a bend to the edge which had been removed before.

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)
Adds a new bend to this realizer and returns it. If the given coordinate lies on an visible segment of the path, then the bend will be inserted in such a way that the segment splits in two parts. Otherwise the bend will be appended to the list of bends.

Specified by:
insertBend in class EdgeRealizer
Parameters:
x - X-coordinates of the bend
y - Y-coordinates of the bend

removeBend

public Bend removeBend(Bend b)
Removes a Bend of this realizer

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

calculatePath

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

Specified by:
calculatePath in class EdgeRealizer
Parameters:
sourceIntersectionOut - a Point2D instance that must be set by the implementation to point to the source intersection point unless the path is empty.
targetIntersectionOut - a Point2D instance that must be set by the implementation to point to the target intersection point unless the path is empty.
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()

containsSeg

public int containsSeg(double dx,
                       double dy)
like contains(), but returns number of the hit segment, 0 otherwise.

Overrides:
containsSeg in class EdgeRealizer

write

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

Writes out this realizer in a serialized form.

Overrides:
write in class EdgeRealizer
Throws:
IOException

read

public void read(ObjectInputStream in)
          throws IOException,
                 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:
IOException
ClassNotFoundException

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