|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.tree.AbstractRotatableNodePlacer
public abstract class AbstractRotatableNodePlacer
This is an abstract base class for NodePlacers that supports rotations.
"Supporting rotation" means that the NodePlacers only implement the default direction (e.g. bottom-down).
The other directions are calculated using the modification matrix within the constructor.
But take care! Using rotatable NodePlacers contains some pitfalls. Especially calculations must be aware of
that. Especially operations on BorderLine
s should not be called directly (e.g. mergeWithMin, mergeWithMax).
Use the corresponding methods on AbstractRotatableNodePlacer instead.
Nested Class Summary | |
---|---|
static class |
AbstractRotatableNodePlacer.Matrix
Instances of this class may be used to configure the AbstractRotatableNodePlacer . |
static class |
AbstractRotatableNodePlacer.RootAlignment
This class represents the horizontal alignment of the root node. |
Field Summary | |
---|---|
protected List |
createdChildren
List containing the created children |
protected LayoutGraph |
graph
The graph instance this class is working on |
protected AbstractRotatableNodePlacer.Matrix |
modificationMatrix
The active modification matrix. |
protected DataProvider |
nodeShapeProvider
The actual node shape provider |
protected double |
spacing
This is the "default" spacing for the different move operations. |
protected DataProvider |
subtreeShapeProvider
The actual subtree shape provider |
Fields inherited from interface y.layout.tree.NodePlacer |
---|
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST |
Constructor Summary | |
---|---|
protected |
AbstractRotatableNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Default constructor. |
Method Summary | |
---|---|
Comparator |
createComparator()
|
Comparator |
createFromSketchComparator()
Creates a comparator for edges. |
Processor |
createProcessor(GenericTreeLayouter layouter,
LayoutGraph graph,
Node currentRoot)
Creates an optional Processor for pre- and post-processing. |
protected y.layout.tree.SubtreeShapeRotated |
createRootNodeShape(Node node)
Convenience method that queries the DataProvider for the shape of a single node as a SubtreeShape instance. |
protected y.layout.tree.SubtreeShapeRotated |
createSubtreeShape(Node node)
Convenience method that queries the DataProvider for a SubtreeShape. |
protected abstract byte |
determineChildConnector(Node child)
This method must be implemented by subclasses. |
void |
determineChildConnectors(Node localRoot,
DataMap connectorMap)
This method initializes internal data structures, then uses the abstract method determineChildConnector(y.base.Node)
to determine the child node connector directions. |
AbstractRotatableNodePlacer.Matrix |
getModificationMatrix()
The actual modification matrix |
protected PortConstraint |
getPortConstraint(Node localRoot)
Lookup method to get the PortConstraint for the local root translated. |
protected YPoint |
getSourcePointAbs(Edge edge)
Translates the absolute source point of the given edge to the "view coordinates" (translated by the modification matrix) |
double |
getSpacing()
Returns the spacing between subtrees this NodePlacer is
arranging. |
GenericTreeLayouter.SubtreeShape |
placeSubtree(DataProvider nodeShapeProvider,
DataProvider subtreeShapeProvider,
LayoutGraph graph,
Node localRoot,
byte parentConnectorDirection)
This method initializes the local data structures and then delegates the work to the abstract variant. |
protected abstract y.layout.tree.SubtreeShapeRotated |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
This method must be implemented by subclasses. |
void |
setSpacing(double spacing)
Specifies the spacing between subtrees this NodePlacer is
arranging. |
protected byte |
translateDirectionToModel(byte realDirection)
Translates a "real" direction into a directionModel direction |
protected byte |
translateDirectionToReal(byte modelDirection)
Translates a modelDirectionModel into the "real" directionModel |
static YPoint |
translatePoint(AbstractRotatableNodePlacer.Matrix modificationMatrix,
YPoint realWorldPoint)
Translates a "real world point" to a "model point" |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double spacing
protected LayoutGraph graph
protected final AbstractRotatableNodePlacer.Matrix modificationMatrix
protected DataProvider subtreeShapeProvider
protected DataProvider nodeShapeProvider
protected List createdChildren
Constructor Detail |
---|
protected AbstractRotatableNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
modificationMatrix
- the translation for the NodePlacerMethod Detail |
---|
public Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
createProcessor
in interface NodePlacer
layouter
- graph
- the actual graphcurrentRoot
- the actual root node for this node placer
protected YPoint getSourcePointAbs(Edge edge)
edge
- the source point for is returned
protected abstract y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
localRoot
- the local root nodeparentConnectorDirection
- the direction of the connector shape
protected y.layout.tree.SubtreeShapeRotated createRootNodeShape(Node node)
placeSubtree(Node, byte)
node
- the node whose shape will be returned in the form of a SubtreeShape instance
protected y.layout.tree.SubtreeShapeRotated createSubtreeShape(Node node)
placeSubtree(y.base.Node, byte)
node
- the root node whose subtree shape will be returned in the form of a SubtreeShape instance
public void determineChildConnectors(Node localRoot, DataMap connectorMap)
determineChildConnector(y.base.Node)
to determine the child node connector directions.
determineChildConnectors
in interface NodePlacer
localRoot
- the local root nodeconnectorMap
- the map that will be used to store the valuesdetermineChildConnector(Node)
protected PortConstraint getPortConstraint(Node localRoot)
localRoot
- the local root
protected byte translateDirectionToReal(byte modelDirection)
modelDirection
- the model direction
protected byte translateDirectionToModel(byte realDirection)
realDirection
- the "real" direction
protected abstract byte determineChildConnector(Node child)
child
- the child node
NodePlacer
interfacepublic GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
placeSubtree
in interface NodePlacer
nodeShapeProvider
- this instance can be used to obtain an initial shape
of the root node. This shape can then be merged with all the subtrees' shapes
and finally be returned by this method.subtreeShapeProvider
- provides access to the pre-calculated shapes of
the subtrees. It is guaranteed that at the time of the invocation of this
method for every child node the subtree shape has already been calculatedgraph
- the graph which is to be laid outlocalRoot
- the root of the subtree that should be laid out by this methodparentConnectorDirection
- the direction byte constant as it is defined
in this interface, that must be used for initializing the connector of the
localRoot node to the parent node of the localRoot node
placeSubtree(Node, byte)
public AbstractRotatableNodePlacer.Matrix getModificationMatrix()
public Comparator createComparator()
public static YPoint translatePoint(AbstractRotatableNodePlacer.Matrix modificationMatrix, YPoint realWorldPoint)
modificationMatrix
- the matrix to applyrealWorldPoint
- the point with the coordinates from the real world
public double getSpacing()
NodePlacer
is
arranging.
NodePlacer
.public void setSpacing(double spacing)
NodePlacer
is
arranging.
public Comparator createFromSketchComparator()
FromSketchNodePlacer
createFromSketchComparator
in interface FromSketchNodePlacer
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |