Search this API

y.layout
Class LabelLayoutDataRefinement

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

public class LabelLayoutDataRefinement
extends AbstractLayoutStage

A layout stage that improves the placement of edge labels. This layout stage expects that its core layouter calculates initial edge label layout data bound to the data provider key LabelLayoutKeys.EDGE_LABEL_LAYOUT_KEY. Next, this stage tries to improve the position of the labels with respect to the preferred placement specifier of the labels.
Most commonly, this layout stage is used in conjunction with the integrated edge labeling functionality of class HierarchicLayouter. The following code snippet shows how this layout stage can be set up:

 // 'hierarchic' is of type y.layout.hierarchic.HierarchicLayouter.
 
 // String together a label layout process.
 CompositeLayoutStage ll = new CompositeLayoutStage();
 ll.appendStage(new LabelLayoutTranslator());
 ll.appendStage(new LabelLayoutDataRefinement());
 // Set the compound label layout process as the label layouter for 
 // HierarchicLayouter.
 hierarchic.setLabelLayouter(ll);
 hierarchic.setLabelLayouterEnabled(true);
 


Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
LabelLayoutDataRefinement()
          Creates a new instance of LabelLayoutDataImprovement
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true.
 void doLayout(LayoutGraph graph)
          Assigns a new graph layout to the given layout graph.
 AbstractLabelingAlgorithm getInternalLabelingAlgorithm()
          Returns the internal labeling algorithm used to improve the label positions.
 void setInternalLabelingAlgorithm(AbstractLabelingAlgorithm labeler)
          Sets the internal labeling algorithm used to improve the label positions.
 
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
 

Constructor Detail

LabelLayoutDataRefinement

public LabelLayoutDataRefinement()
Creates a new instance of LabelLayoutDataImprovement

Method Detail

setInternalLabelingAlgorithm

public void setInternalLabelingAlgorithm(AbstractLabelingAlgorithm labeler)
Sets the internal labeling algorithm used to improve the label positions.


getInternalLabelingAlgorithm

public AbstractLabelingAlgorithm getInternalLabelingAlgorithm()
Returns the internal labeling algorithm used to improve the label positions.


canLayout

public boolean canLayout(LayoutGraph graph)
Returns true.


doLayout

public void doLayout(LayoutGraph graph)
Assigns a new graph layout to the given layout graph.


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