Search this API

y.layout
Class GivenCoordinatesStage

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.GivenCoordinatesStage
All Implemented Interfaces:
Layouter, LayoutStage

public class GivenCoordinatesStage
extends AbstractLayoutStage

GivenCoordinatesStage changes node locations and sizes as well as edge paths to user-specified values before invoking the core layout algorithm.

Use DataProvider-key NODE_LOCATION_DPKEY to specify the locations (top-left coordinate) of nodes, DataProvider-key NODE_SIZE_DPKEY to specify the size of nodes and DataProvider-key EDGE_PATH_DPKEY to specify the path of edges (i.e. the port locations and the bends of edges).

A possible application for this stage are animated incremental layouts where the position of non-incremental elements should be changed/restored without affecting the start position of theses elements in the animation. Therefore, this stage could also be used together with PlaceNodesAtBarycenterStage.

 
Even though this stage moves nodes and paths to the specified coordinates, the core layout algorithm may change these positions.
See Also:
PlaceNodesAtBarycenterStage
 

Field Summary
static java.lang.Object EDGE_PATH_DPKEY
          A DataProvider key for specifying the initial path of edges Each edge can be mapped to an instance of YPointPath.
static java.lang.Object NODE_LOCATION_DPKEY
          A DataProvider key for specifying the initial location of nodes Each node can be mapped to an instance of YPoint.
static java.lang.Object NODE_SIZE_DPKEY
          A DataProvider key for specifying the size of nodes Each node can be mapped to an instance of YDimension.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
GivenCoordinatesStage()
          Creates a new GivenCoordinatesStage instance with default settings.
GivenCoordinatesStage(Layouter coreLayouter)
          Creates a new GivenCoordinatesStage instance using the given core layout algorithm.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs that can be handled by the core layout algorithm.
 void doLayout(LayoutGraph graph)
          Changes node locations and edge paths to user-specified values and then invokes the core layout algorithm.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_LOCATION_DPKEY

public static final java.lang.Object NODE_LOCATION_DPKEY
A DataProvider key for specifying the initial location of nodes

Each node can be mapped to an instance of YPoint. Before calling the core layout algorithm, this stage places the top-left coordinate of each node on the associated YPoint. The location of nodes without associated value isn't changed by this stage (but may be changed by the core layout algorithm).


NODE_SIZE_DPKEY

public static final java.lang.Object NODE_SIZE_DPKEY
A DataProvider key for specifying the size of nodes

Each node can be mapped to an instance of YDimension. Before calling the core layout algorithm, this stage sets the size of each node to the specified size. The size of nodes without associated value isn't changed by this stage.


EDGE_PATH_DPKEY

public static final java.lang.Object EDGE_PATH_DPKEY
A DataProvider key for specifying the initial path of edges

Each edge can be mapped to an instance of YPointPath. Before calling the core layout algorithm, this stage sets the path of each edge to the associated YPointPath. The path must contain the source port location, followed by the bends (if any), followed by the target port location.

If an empty path is specified, the current path will be reset: all bends are cleared and the current source/target port locations are kept. The path of edges without associated value isn't changed by this stage (but may be changed by the core layout algorithm).

Constructor Detail

GivenCoordinatesStage

public GivenCoordinatesStage()
Creates a new GivenCoordinatesStage instance with default settings.


GivenCoordinatesStage

public GivenCoordinatesStage(Layouter coreLayouter)
Creates a new GivenCoordinatesStage instance using the given core layout algorithm.

Parameters:
coreLayouter - the core layout algorithm
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm.

If there is no core layout algorithm, all graphs are accepted.

Parameters:
graph - the input graph
Returns:
true if there is no core layout algorithm or the core layout algorithm accepts the graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Changes node locations and edge paths to user-specified values and then invokes the core layout algorithm.

Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

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