Class CurvedConnectorShape
java.lang.Object
org.pathvisio.libgpml.model.connector.AbstractConnector
org.pathvisio.libgpml.model.connector.SegmentedConnector
org.pathvisio.libgpml.model.connector.ElbowConnectorShape
org.pathvisio.libgpml.model.connector.CurvedConnectorShape
- All Implemented Interfaces:
ConnectorShape
public class CurvedConnectorShape extends ElbowConnectorShape
Implements a curved connector that draws curved lines between the segments.
- Author:
- thomas
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classCurvedConnectorShape.CurvedSegmentSegment for curved connector, also stores bezier control pointsNested classes/interfaces inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
ConnectorShape.Segment, ConnectorShape.WayPoint -
Field Summary
Fields Modifier and Type Field Description (package private) CurvedConnectorShape.CurvedSegment[]curvedSegments(package private) ConnectorShape.Segment[]curveHigh(package private) ConnectorShape.Segment[]curveLow(package private) ConnectorShape.Segment[]elbowSegments(package private) static intNRSTEP_HIGH(package private) static intNRSTEP_LOWFields inherited from interface org.pathvisio.libgpml.model.connector.ConnectorShape
AXIS_X, AXIS_Y -
Constructor Summary
Constructors Constructor Description CurvedConnectorShape() -
Method Summary
Modifier and Type Method Description private doublebezier(double p0, double p1, double p2, double p3, double t)Function for the cubic bezier curveprotected ConnectorShape.Segment[]calculateCurve(int nrStep)Calculates the bezier curve, using NRSTEP segments for each curvedSegment.protected CurvedConnectorShape.CurvedSegment[]calculateCurvedSegments(ConnectorShape.Segment[] segments)Based on the given elbow segments, calculate a new segment and control points for each bezier curve.protected ConnectorShape.Segment[]calculateSegments(ConnectorRestrictions restrictions, ConnectorShape.WayPoint[] waypoints)Also calculates curvedSegments and curve.protected java.awt.ShapecalculateShape()Calculates shape from the width of the line endings.java.awt.ShapecalculateShape(ConnectorShape.Segment[] segments)Calculates shapes from the width of the line endings.java.awt.geom.Point2DfromLineCoordinate(double l)Translates a 1-dimensional line coordinate to a 2-dimensional view coordinate.private doublepow(double a, double b)Function for the base to the exponent power.protected ConnectorShape.WayPoint[]wayPointsToCenter(ConnectorShape.WayPoint[] waypoints, ConnectorShape.Segment[] segments)Sets all waypoints to the center of the segments.Methods inherited from class org.pathvisio.libgpml.model.connector.ElbowConnectorShape
calculateWayPoint, calculateWayPoints, createStraightSegment, getDirectionX, getDirectionY, getNrSegments, hasValidWaypoints, recalculateShapeMethods inherited from class org.pathvisio.libgpml.model.connector.SegmentedConnector
fromLineCoordinate, getTotalLength, toLineCoordinateMethods inherited from class org.pathvisio.libgpml.model.connector.AbstractConnector
calculateAdjustedShape, getSegments, getShape, getWayPoints, setSegments, setShape, setWayPointsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
elbowSegments
ConnectorShape.Segment[] elbowSegments -
curvedSegments
CurvedConnectorShape.CurvedSegment[] curvedSegments -
curveHigh
ConnectorShape.Segment[] curveHigh -
curveLow
ConnectorShape.Segment[] curveLow -
NRSTEP_LOW
static final int NRSTEP_LOW- See Also:
- Constant Field Values
-
NRSTEP_HIGH
static final int NRSTEP_HIGH- See Also:
- Constant Field Values
-
-
Constructor Details
-
CurvedConnectorShape
public CurvedConnectorShape()
-
-
Method Details
-
calculateShape
protected java.awt.Shape calculateShape()Calculates shape from the width of the line endings.- Overrides:
calculateShapein classElbowConnectorShape- Returns:
- the calculated shape.
-
calculateShape
Calculates shapes from the width of the line endings.- Overrides:
calculateShapein classSegmentedConnector- Parameters:
segments- the segment array.- Returns:
- path the Shape.
-
calculateSegments
protected ConnectorShape.Segment[] calculateSegments(ConnectorRestrictions restrictions, ConnectorShape.WayPoint[] waypoints)Also calculates curvedSegments and curve. See calculateCurvedSegments. See calculateCurve.- Overrides:
calculateSegmentsin classElbowConnectorShape- Parameters:
restrictions- the connector restrictions.waypoints- the waypoint array.- Returns:
- curveLow the segment array.
-
calculateCurvedSegments
protected CurvedConnectorShape.CurvedSegment[] calculateCurvedSegments(ConnectorShape.Segment[] segments)Based on the given elbow segments, calculate a new segment and control points for each bezier curve.- Parameters:
segments- the segment array.- Returns:
- curvedSegments the curvedsegment array
-
calculateCurve
Calculates the bezier curve, using NRSTEP segments for each curvedSegment.- Parameters:
nrStep- the number of steps.- Returns:
- An array with the curve broken down into small segments.
- See Also:
calculateCurvedSegments(org.pathvisio.libgpml.model.connector.ConnectorShape.Segment[])
-
bezier
private double bezier(double p0, double p1, double p2, double p3, double t)Function for the cubic bezier curve- Parameters:
p0- The start coordinatep1- The first helper coordinatep2- The second helper coordinatep3- The end coordinatet- The relative position in the curve (value between 0 and 1)- Returns:
- The coordinate on the curve for t
-
pow
private double pow(double a, double b)Function for the base to the exponent power.- Parameters:
a- the base.b- the exponent.- Returns:
- the base to the exponent power.
-
fromLineCoordinate
public java.awt.geom.Point2D fromLineCoordinate(double l)Description copied from class:SegmentedConnectorTranslates a 1-dimensional line coordinate to a 2-dimensional view coordinate. The 1-dimensional line coordinate is position objects that are attached to the line.- Specified by:
fromLineCoordinatein interfaceConnectorShape- Overrides:
fromLineCoordinatein classSegmentedConnector- Parameters:
l- the double.- Returns:
- ...
-
wayPointsToCenter
protected ConnectorShape.WayPoint[] wayPointsToCenter(ConnectorShape.WayPoint[] waypoints, ConnectorShape.Segment[] segments)Description copied from class:ElbowConnectorShapeSets all waypoints to the center of the segments.- Overrides:
wayPointsToCenterin classElbowConnectorShape- Parameters:
waypoints- the waypoint array.segments- the segment array.- Returns:
- ...
-