|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
org.eclipse.zest.layouts.algorithms.ContinuousLayoutAlgorithm
org.eclipse.amp.agf.zest.SpringPartitionLayoutAlgorithm
public class SpringPartitionLayoutAlgorithm
The SpringLayoutAlgorithm has its own data repository and relation repository. A user can populate the repository, specify the layout conditions, do the computation and query the computed results.
Instructions for using SpringLayoutAlgorithm:
1. Instantiate a SpringLayout object;
2. Populate the data repository using add(...);
3. Populate the relation repository using addRelation(...);
4. Execute compute();
5. Execute fitWithinBounds(...);
6. Query the computed results(node size and node position).
| Field Summary | |
|---|---|
static double |
DEFAULT_SPRING_GRAVITATION
The default value for the spring layout gravitation-control. |
static boolean |
DEFAULT_SPRING_IGNORE_UNCON
The default value for ignoring unconnected nodes. |
static int |
DEFAULT_SPRING_ITERATIONS
The default value for the spring layout number of interations. |
static double |
DEFAULT_SPRING_LENGTH
The default value for the spring layout length-control. |
static double |
DEFAULT_SPRING_MOVE
The default value for the spring layout move-control. |
static boolean |
DEFAULT_SPRING_RANDOM
The default value for positioning nodes randomly. |
static boolean |
DEFAULT_SPRING_SEPARATE_COMPONENTS
The default value for separating connected components. |
static double |
DEFAULT_SPRING_STRAIN
The default value for the spring layout strain-control. |
protected static double |
EPSILON
An arbitrarily small value in mathematics. |
static long |
MAX_SPRING_TIME
the default value for the time algorithm runs. |
protected static double |
MIN_DISTANCE
Minimum distance considered between nodes |
| Fields inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm |
|---|
comparator, filter, internalAsynchronous, internalContinuous, layout_styles, layoutStopped, MIN_ENTITY_SIZE, resizeEntitiesAfterLayout |
| Constructor Summary | |
|---|---|
SpringPartitionLayoutAlgorithm()
Creates a sprint layout algoirthm with no style |
|
SpringPartitionLayoutAlgorithm(int styles)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
computeForces(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
Computes the force for each node in this SpringLayoutAlgorithm. |
protected void |
computeOneIteration(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height)
|
protected void |
computePositions(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
Computes the position for each node in this SpringLayoutAlgorithm. |
protected void |
convertNodePositionsBack(int i,
org.eclipse.zest.layouts.dataStructures.InternalNode entityToConvert,
double px,
double py,
double screenWidth,
double screenHeight,
org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle layoutBounds)
|
protected void |
convertToUnitCoordinates(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
Converts the position for each node in this SpringLayoutAlgorithm to unit coordinates in double precision. |
protected int |
getCurrentLayoutStep()
|
int |
getIterations()
Returns the number of iterations to be used. |
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle |
getLayoutBoundsTemp(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
boolean includeNodeSize)
|
boolean |
getRandom()
Returns whether or not this SpringLayoutAlgorithm will layout the nodes randomly before beginning iterations. |
double |
getSpringGravitation()
Returns the gravitation-control value of this SpringLayoutAlgorithm in double presion. |
double |
getSpringLength()
Returns the length-control value of this SpringLayoutAlgorithm in double presion. |
double |
getSpringMove()
Returns the move-control value of this SpringLayoutAlgorithm in double presion. |
double |
getSpringStrain()
Returns the strain-control value of this SpringLayoutAlgorithm in double presion. |
long |
getSpringTimeout()
Gets the max time this algorithm will run for |
protected int |
getTotalNumberOfLayoutSteps()
|
double |
getWeight(java.lang.String relType)
|
protected boolean |
isValidConfiguration(boolean asynchronous,
boolean continueous)
|
protected boolean |
performAnotherNonContinuousIteration()
|
void |
placeRandomly(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
Puts vertices in random places, all between (0,0) and (1,1). |
protected void |
postLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
|
protected void |
preLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height)
|
void |
setDefaultConditions()
Sets the default conditions. |
void |
setIterations(int iterations)
Sets the number of iterations to be used. |
void |
setLayoutArea(double x,
double y,
double width,
double height)
|
void |
setRandom(boolean random)
Sets whether or not this SpringLayoutAlgorithm will layout the nodes randomly before beginning iterations. |
void |
setSpringGravitation(double gravitation)
Sets the spring layout gravitation-control. |
void |
setSpringLength(double length)
Sets the spring layout length-control. |
void |
setSpringMove(double move)
Sets the spring layout move-control. |
void |
setSpringStrain(double strain)
Sets the spring layout strain-control. |
void |
setSpringTimeout(long timeout)
Sets the spring timeout |
void |
setWeight(java.lang.String relType,
double weight)
|
| Methods inherited from class org.eclipse.zest.layouts.algorithms.ContinuousLayoutAlgorithm |
|---|
applyLayoutInternal, getBounds, setBounds |
| Methods inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm |
|---|
addEntity, addProgressListener, addRelationship, applyLayout, defaultFitWithinBounds, defaultFitWithinBounds, fireProgressEnded, fireProgressEvent, fireProgressStarted, getEntityAspectRatio, getLayoutBounds, getLocalLocation, getNumberOfProgressListeners, getStyle, isRunning, removeEntity, removeProgressListener, removeRelationship, removeRelationships, removeRelationships, setComparator, setEntityAspectRatio, setFilter, setStyle, stop, updateBendPoints, updateEntities, updateLayoutLocations, updateRelationships, verifyInput |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SPRING_ITERATIONS
public static final long MAX_SPRING_TIME
public static final boolean DEFAULT_SPRING_RANDOM
public static final boolean DEFAULT_SPRING_IGNORE_UNCON
public static final boolean DEFAULT_SPRING_SEPARATE_COMPONENTS
public static final double DEFAULT_SPRING_MOVE
public static final double DEFAULT_SPRING_STRAIN
public static final double DEFAULT_SPRING_LENGTH
public static final double DEFAULT_SPRING_GRAVITATION
protected static final double MIN_DISTANCE
protected static final double EPSILON
| Constructor Detail |
|---|
public SpringPartitionLayoutAlgorithm(int styles)
public SpringPartitionLayoutAlgorithm()
| Method Detail |
|---|
public void setLayoutArea(double x,
double y,
double width,
double height)
setLayoutArea in class org.eclipse.zest.layouts.algorithms.ContinuousLayoutAlgorithmpublic void setSpringMove(double move)
move - The move-control value.public double getSpringMove()
public void setSpringStrain(double strain)
strain - The strain-control value.public double getSpringStrain()
public void setSpringLength(double length)
length - The length-control value.public long getSpringTimeout()
public void setSpringTimeout(long timeout)
timeout - public double getSpringLength()
public void setSpringGravitation(double gravitation)
gravitation - The gravitation-control value.public double getSpringGravitation()
public void setIterations(int iterations)
gravitation - The number of iterations.public int getIterations()
public void setRandom(boolean random)
random - The random placement value.public boolean getRandom()
public void setWeight(java.lang.String relType,
double weight)
public double getWeight(java.lang.String relType)
public void setDefaultConditions()
protected void preLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height)
preLayoutAlgorithm in class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
protected void postLayoutAlgorithm(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider)
postLayoutAlgorithm in class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
protected org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle getLayoutBoundsTemp(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
boolean includeNodeSize)
protected void convertNodePositionsBack(int i,
org.eclipse.zest.layouts.dataStructures.InternalNode entityToConvert,
double px,
double py,
double screenWidth,
double screenHeight,
org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle layoutBounds)
protected boolean performAnotherNonContinuousIteration()
performAnotherNonContinuousIteration in class org.eclipse.zest.layouts.algorithms.ContinuousLayoutAlgorithmprotected int getCurrentLayoutStep()
getCurrentLayoutStep in class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithmprotected int getTotalNumberOfLayoutSteps()
getTotalNumberOfLayoutSteps in class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
protected void computeOneIteration(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout,
org.eclipse.zest.layouts.dataStructures.InternalRelationship[] relationshipsToConsider,
double x,
double y,
double width,
double height)
computeOneIteration in class org.eclipse.zest.layouts.algorithms.ContinuousLayoutAlgorithmpublic void placeRandomly(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
protected void computeForces(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
protected void computePositions(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
protected void convertToUnitCoordinates(org.eclipse.zest.layouts.dataStructures.InternalNode[] entitiesToLayout)
protected boolean isValidConfiguration(boolean asynchronous,
boolean continueous)
isValidConfiguration in class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||