public class Eades84Layout extends PipeBase implements Layout
Modifier and Type | Class and Description |
---|---|
protected class |
Eades84Layout.EadesParticle |
protected class |
Eades84Layout.Spring |
SourceBase.ElementType
Modifier and Type | Field and Description |
---|---|
(package private) double |
c1 |
(package private) double |
c2 |
(package private) double |
c3 |
(package private) double |
c4 |
(package private) Point3 |
high |
(package private) boolean |
is3D |
(package private) Point3 |
low |
(package private) double |
M |
(package private) int |
nodeMoved |
(package private) HashMap<String,Eades84Layout.EadesParticle> |
particles |
(package private) Random |
random |
(package private) HashMap<String,Eades84Layout.Spring> |
springs |
(package private) double |
stabilization |
attrSinks, eltsSinks, eventProcessing, eventQueue, sourceId, sourceTime
Constructor and Description |
---|
Eades84Layout() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the whole nodes and edges structures
|
void |
compute()
Method to call repeatedly to compute the layout.
|
void |
edgeAdded(String sourceId,
long timeId,
String edgeId,
String fromNodeId,
String toNodeId,
boolean directed)
An edge was inserted in graph.
|
void |
edgeRemoved(String sourceId,
long timeId,
String edgeId)
An edge of graph was removed.The nodes the edge connects may already have
been removed from the graph.
|
void |
freezeNode(String id,
boolean frozen)
Freeze or un-freeze a node.
|
double |
getForce()
The current layout force.
|
Point3 |
getHiPoint()
Largest point in space of the layout bounding box.
|
long |
getLastStepTime()
Time in nanoseconds used by the last call to step().
|
String |
getLayoutAlgorithmName()
Name of the layout algorithm.
|
Point3 |
getLowPoint()
Smallest point in space of the layout bounding box.
|
protected Eades84Layout.EadesParticle |
getNewParticle(String id) |
protected Eades84Layout.Spring |
getNewSpring(Eades84Layout.EadesParticle p1,
Eades84Layout.EadesParticle p2) |
int |
getNodeMovedCount()
How many nodes moved during the last step?.
|
double |
getQuality()
The current layout algorithm quality.
|
double |
getStabilization()
Estimate of how close to stabilization the layout algorithm is.
|
double |
getStabilizationLimit()
Above which value a correct stabilization is achieved?
|
int |
getSteps()
Number of calls made to step() so far.
|
void |
inputPos(String filename) |
static void |
main(String... args) |
void |
moveNode(String id,
double x,
double y,
double z)
Move a node by force to a new location.
|
void |
nodeAdded(String sourceId,
long timeId,
String nodeId)
A node was inserted in the given graph.
|
void |
nodeRemoved(String sourceId,
long timeId,
String nodeId)
A node was removed from the graph.
|
void |
outputPos(String filename) |
void |
particleMoved(Object id,
double x,
double y,
double z) |
void |
setForce(double value)
The general "speed" of the algorithm.
|
void |
setQuality(double qualityLevel)
Set the overall quality level, a number between 0 and 1 with 1 the
highest quality available, but often with a slower computation.
|
void |
setSendNodeInfos(boolean send)
If true, node informations messages are sent for every node.
|
void |
setStabilizationLimit(double l)
Change the stabilization limit for this layout algorithm.
|
void |
shake()
Add a random vector whose length is 10% of the size of the graph to all
node positions.
|
edgeAttributeAdded, edgeAttributeChanged, edgeAttributeRemoved, graphAttributeAdded, graphAttributeChanged, graphAttributeRemoved, graphCleared, nodeAttributeAdded, nodeAttributeChanged, nodeAttributeRemoved, stepBegins
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, manageEvents, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
edgeAttributeAdded, edgeAttributeChanged, edgeAttributeRemoved, graphAttributeAdded, graphAttributeChanged, graphAttributeRemoved, nodeAttributeAdded, nodeAttributeChanged, nodeAttributeRemoved
graphCleared, stepBegins
boolean is3D
double c1
double c2
double c3
double c4
double M
HashMap<String,Eades84Layout.Spring> springs
HashMap<String,Eades84Layout.EadesParticle> particles
int nodeMoved
double stabilization
public Eades84Layout()
public String getLayoutAlgorithmName()
Layout
getLayoutAlgorithmName
in interface Layout
public int getNodeMovedCount()
Layout
getNodeMovedCount
in interface Layout
public double getStabilization()
Layout
getStabilization
in interface Layout
public double getStabilizationLimit()
Layout
getStabilizationLimit
in interface Layout
public void setStabilizationLimit(double l)
Layout
The stabilization is a number between 0 and 1 that indicates how close to
stabilization (no nodes need to move) the layout is. The value 1 means
the layout is fully stabilized. Naturally this is often only an
indication only, for some algorithms, it is difficult to determine if the
layout is correct or acceptable enough. You can get the actual
stabilization limit using Layout.getStabilizationLimit()
. You can get
the actual stabilization using Layout.getStabilization()
.
Be careful, most layout classes do not use the stabilization limit, this
number is mostly used the process that control the layout, like the
LayoutRunner
for example. The stabilization limit is only an
indication with a default set for each layout algorithm. However this
default can be changed using this method, or by storing on the graph an
attribute "layout.stabilization-limit" (or "layout.stabilisation-limit").
The convention is that the value 0 means that the process controlling the layout will not stop the layout (will therefore not consider the stabilization limit). In other words the layout will compute endlessly.
setStabilizationLimit
in interface Layout
l
- The new stabilization limit, 0 means no need to stabilize.
Else a value larger than zero or equal to 1 is accepted.public Point3 getLowPoint()
Layout
getLowPoint
in interface Layout
public Point3 getHiPoint()
Layout
getHiPoint
in interface Layout
public int getSteps()
Layout
public long getLastStepTime()
Layout
getLastStepTime
in interface Layout
public double getQuality()
Layout
getQuality
in interface Layout
public double getForce()
Layout
public void clear()
Layout
public void setForce(double value)
Layout
public void setQuality(double qualityLevel)
Layout
setQuality
in interface Layout
qualityLevel
- The quality level, a number between 0 and 1.public void setSendNodeInfos(boolean send)
Layout
setSendNodeInfos
in interface Layout
send
- If true, send node informations to a "layout.info" attribute.public void shake()
Layout
public void moveNode(String id, double x, double y, double z)
Layout
public void freezeNode(String id, boolean frozen)
Layout
freezeNode
in interface Layout
id
- The node identifier.frozen
- If true the node is frozen.public void compute()
Layout
This method implements the layout algorithm proper. It must be called in
a loop, until the layout stabilizes. You can know if the layout is stable
by using the Layout.getNodeMovedCount()
method that returns the number
of node that have moved during the last call to step().
The listener is called by this method, therefore each call to step() will also trigger layout events, allowing to reproduce the layout process graphically for example. You can insert the listener only when the layout stabilized, and then call step() anew if you do not want to observe the layout process.
public void nodeAdded(String sourceId, long timeId, String nodeId)
ElementSink
nodeAdded
in interface ElementSink
nodeAdded
in class PipeBase
sourceId
- Identifier of the graph where the node was added.nodeId
- Identifier of the added node.public void nodeRemoved(String sourceId, long timeId, String nodeId)
ElementSink
nodeRemoved
in interface ElementSink
nodeRemoved
in class PipeBase
sourceId
- Identifier of the graph where the node will be removed.nodeId
- Identifier of the removed node.public void edgeAdded(String sourceId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed)
ElementSink
edgeAdded
in interface ElementSink
edgeAdded
in class PipeBase
sourceId
- Identifier of the graph where the edge was added.edgeId
- Identifier of the added edge.fromNodeId
- Identifier of the first node of the edge.toNodeId
- Identifier of the second node of the edge.directed
- If true, the edge is directed.public void edgeRemoved(String sourceId, long timeId, String edgeId)
ElementSink
edgeRemoved
in interface ElementSink
edgeRemoved
in class PipeBase
sourceId
- The graph where the edge will be removed.edgeId
- The edge that will be removed.public void inputPos(String filename) throws IOException
IOException
public void outputPos(String filename) throws IOException
IOException
public void particleMoved(Object id, double x, double y, double z)
protected Eades84Layout.EadesParticle getNewParticle(String id)
protected Eades84Layout.Spring getNewSpring(Eades84Layout.EadesParticle p1, Eades84Layout.EadesParticle p2)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses