Class ConnectorSkeleton
java.lang.Object
org.graphstream.ui.swing.renderer.Skeleton
org.graphstream.ui.swing.renderer.ConnectorSkeleton
- All Implemented Interfaces:
AttributeUtils
,org.graphstream.ui.view.camera.ConnectorSkeleton
,org.graphstream.ui.view.camera.Skeleton
public class ConnectorSkeleton extends Skeleton implements AttributeUtils, org.graphstream.ui.view.camera.ConnectorSkeleton
Skeleton for edges.
Data stored on the edge to retrieve the edge basic geometry and various shared data between
parts of the renderer.
XXX TODO
This part needs much work. The skeleton geometry of an edge can be various things:
- An automatically computed shape (for multi-graphs and loop edges).
- An user specified shape:
- A polyline (points are in absolute coordinates).
- A polycurve (in absolute coordinates).
- A vector representation (points are relative to an origin and the whole may be rotated).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.ui.swing.renderer.Skeleton
Skeleton.EdgeShapeKind, Skeleton.Triplet<X,Y,Z>
Nested classes/interfaces inherited from interface org.graphstream.ui.swing.util.AttributeUtils
AttributeUtils.Tuple<X,Y>
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ConnectorSkeleton()
-
Method Summary
Modifier and Type Method Description org.graphstream.ui.geom.Point3
apply(int i)
The i-th point of the edge shape.org.graphstream.ui.geom.Point3
from()
The first point of the edge shape.boolean
isCurve()
If true the edge shape is a loop defined by four points.boolean
isLoop()
This is only set when the edge is a curve, if true the starting and ending nodes of the edge are the same node.boolean
isMulti()
boolean
isPoly()
If true the edge shape is a polyline made of size points.java.lang.String
kindString()
double
length()
Total length of the polyline defined by the points.int
multi()
If larger than one there are several edges between the two nodes of this edge.org.graphstream.ui.geom.Point3
pointOnShape(double percent)
Compute a point at the given percent on the shape and return it.org.graphstream.ui.geom.Point3
pointOnShape(double percent, org.graphstream.ui.geom.Point3 target)
Compute a point at a given percent on the shape and store it in the target, also returning it.org.graphstream.ui.geom.Point3
pointOnShapeAndPerpendicular(double percent, double perpendicular)
Compute a point at a given percent on the shape and push it from the shape perpendicular to it at a given distance in GU.org.graphstream.ui.geom.Point3
pointOnShapeAndPerpendicular(double percent, double perpendicular, org.graphstream.ui.geom.Point3 target)
Compute a point at a given percent on the shape and push it from the shape perpendicular to it at a given distance in GU.double
segmentLength(int i)
Length of the i-th segment.double[]
segmentsLengths()
Compute the length of each segment between the points making up this edge.void
setCurve(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)
void
setLine(double x0, double y0, double z0, double x1, double y1, double z1)
void
setLoop(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2)
void
setMulti(int aMulti)
void
setPoly(java.lang.Object aSetOfPoints)
void
setPoly(org.graphstream.ui.geom.Point3[] aSetOfPoints)
int
size()
The number of points in the edge shape.org.graphstream.ui.geom.Point3
to()
The last point of the edge shape.java.lang.String
toString()
void
update(int i, org.graphstream.ui.geom.Point3 p)
Change the i-th point in the set of points making up the shape of this edge.Skeleton.Triplet<java.lang.Integer,java.lang.Double,java.lang.Double>
wichSegment(double at)
On which segment of the line shape is the value at.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.graphstream.ui.swing.util.AttributeUtils
boundingBoxOfPoints, getDoubles, getPoints
-
Constructor Details
-
ConnectorSkeleton
public ConnectorSkeleton()
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
kindString
public java.lang.String kindString()- Specified by:
kindString
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
isPoly
public boolean isPoly()If true the edge shape is a polyline made of size points.- Specified by:
isPoly
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
isCurve
public boolean isCurve()If true the edge shape is a loop defined by four points.- Specified by:
isCurve
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
multi
public int multi()If larger than one there are several edges between the two nodes of this edge.- Specified by:
multi
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
isLoop
public boolean isLoop()This is only set when the edge is a curve, if true the starting and ending nodes of the edge are the same node.- Specified by:
isLoop
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setPoly
public void setPoly(java.lang.Object aSetOfPoints)- Specified by:
setPoly
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setPoly
public void setPoly(org.graphstream.ui.geom.Point3[] aSetOfPoints)- Specified by:
setPoly
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setCurve
public void setCurve(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)- Specified by:
setCurve
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setLine
public void setLine(double x0, double y0, double z0, double x1, double y1, double z1)- Specified by:
setLine
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setMulti
public void setMulti(int aMulti)- Specified by:
setMulti
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
isMulti
public boolean isMulti()- Specified by:
isMulti
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
setLoop
public void setLoop(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2)- Specified by:
setLoop
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
size
public int size()The number of points in the edge shape.- Specified by:
size
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
apply
public org.graphstream.ui.geom.Point3 apply(int i)The i-th point of the edge shape.- Specified by:
apply
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
update
public void update(int i, org.graphstream.ui.geom.Point3 p)Change the i-th point in the set of points making up the shape of this edge.- Specified by:
update
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
to
public org.graphstream.ui.geom.Point3 to()The last point of the edge shape.- Specified by:
to
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
from
public org.graphstream.ui.geom.Point3 from()The first point of the edge shape.- Specified by:
from
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
length
public double length()Total length of the polyline defined by the points.- Specified by:
length
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
segmentsLengths
public double[] segmentsLengths()Compute the length of each segment between the points making up this edge. This is mostly only useful for polylines. The results of this method is cached. It is only recomputed when a points changes in the shape. There are size-1 segments if the are size points. The segment 0 is between points 0 and 1.- Specified by:
segmentsLengths
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
segmentLength
public double segmentLength(int i)Length of the i-th segment. There are size-1 segments if there are size points. The segment 0 is between points 0 and 1.- Specified by:
segmentLength
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
pointOnShape
public org.graphstream.ui.geom.Point3 pointOnShape(double percent)Compute a point at the given percent on the shape and return it. The percent must be a number between 0 and 1.- Specified by:
pointOnShape
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
pointOnShape
public org.graphstream.ui.geom.Point3 pointOnShape(double percent, org.graphstream.ui.geom.Point3 target)Compute a point at a given percent on the shape and store it in the target, also returning it. The percent must be a number between 0 and 1.- Specified by:
pointOnShape
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
pointOnShapeAndPerpendicular
public org.graphstream.ui.geom.Point3 pointOnShapeAndPerpendicular(double percent, double perpendicular)Compute a point at a given percent on the shape and push it from the shape perpendicular to it at a given distance in GU. The percent must be a number between 0 and 1. The resulting points is returned.- Specified by:
pointOnShapeAndPerpendicular
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
pointOnShapeAndPerpendicular
public org.graphstream.ui.geom.Point3 pointOnShapeAndPerpendicular(double percent, double perpendicular, org.graphstream.ui.geom.Point3 target)Compute a point at a given percent on the shape and push it from the shape perpendicular to it at a given distance in GU. The percent must be a number between 0 and 1. The result is stored in target and also returned.- Specified by:
pointOnShapeAndPerpendicular
in interfaceorg.graphstream.ui.view.camera.ConnectorSkeleton
-
wichSegment
public Skeleton.Triplet<java.lang.Integer,java.lang.Double,java.lang.Double> wichSegment(double at)On which segment of the line shape is the value at. The value at must be between 0 and 1 and expresses a percentage on the shape. There are size-1 segments if size is the number of points of the shape. The segment 0 is between points 0 and 1. This method both compute the index of the segment, but also the sum of the previous segments lengths (not including the i-th segment), as well as the percent on the segment (a number in 0..1).
-