Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.graphics.positionpaint
Class RectangularCladogramPositioner

    java.lang.Object
      info.bioinfweb.treegraph.graphics.positionpaint.RectangularCladogramPositioner

All Implemented Interfaces:
  TreePositioner

Direct Known Subclasses:
  PhylogramPositioner

    public class RectangularCladogramPositioner

extends Object
implements TreePositioner

Field Summary
`protected Document` | `document`
`private static RectangularCladogramPositioner` | `firstInstance`
`private float` | `maxLeafWidth`
`protected float` | `rescalingFactorX`
`protected PositionPaintType` | `type`

Constructor Summary
`protected` | `RectangularCladogramPositioner()`

Method Summary
`private float` | `alignToOtherLegends(Legends legends, int start, int end, float minLeft, float top, float bottom)`
`protected float` | `calculateCornerRadiusShift(Node node, float y)` Returns the space between the right of the node and the real position of the node line dependant of the y position.
`private void` | `calculateLabelBlockDimensions(Labels labels, boolean above)`
`protected void` | `calculatePaintDimension(float overallWidth, float overallHeight)`
`private DistanceDimension` | `calculateTaxonDimension(Node taxon)`
`private DistanceDimension` | `calculateTextDimension(TextElement textElement)` Calculates the Dimensions of this text element.
`private float` | `calculateWidthsHeights(Node root)`
`ConcretePaintableElement` | `elementToPosition(Document document, float x, float y, float margin)` Determines the element to a position defined by x- and y-coordinates (e.g. to select an element by mouse).
`static RectangularCladogramPositioner` | `getInstance()`
`private float` | `getLegendBottom(LegendFormats f)`
`private float` | `getLegendStartX(LegendFormats f, float treeRight)`
`private float` | `getLegendTop(LegendFormats f)`
`private float` | `labelBlockHeight(Labels labels, boolean above)` Returns the overall height of all rows of labels above or below the branch.
`private float` | `labelBlockWidth(Labels labels)` Returns the maximum width of all lines of labels above and below the branch.
`private float` | `labelLineHeight(Labels labels, boolean above, int lineNo)`
`private float` | `labelLineWidth(Labels labels, boolean above, int lineNo)`
`private void` | `moveAll(float dX, float dY)`
`private float` | `moveForLegends()` Moves the tree down by the legends overlay on the top and calculates the new document height including the possible overlay of the legends.
`private void` | `moveLabels(Labels labels, boolean above, float dX, float dY)`
`private void` | `movePosition(PositionData pd, float dX, float dY)`
`private void` | `moveSubtree(Node root, float dX, float dY)`
`void` | `positionAll(Document document, float rescalingFactorX)`
`private float` | `positionElements(Node root, float overallWidth, float y0)` Positions the subtree under root.
`private void` | `positionLabelBlockX(Branch branch, boolean above)`
`private void` | `positionLabelBlockY(Branch branch)`
`private float` | `positionLegends(float startX)` Positions all legends rigths if `startX`.
`private float` | `positionScaleBar(float treeWidth, float maxTreeY)` Positions the scale bar.
`protected float` | `rescaleBranchWidth(Branch branch, float width)` This methode can be overwritten by extending classes to define a different rescaling process.
`protected float` | `rescaleNodeWidth(Node node, float width)` This methode can be overwritten by extending classes to define a different rescaling process.
`private float` | `rescaleSubtree(Node root, float shift)` Rescales the subtree under root.
`private ConcretePaintableElement` | `searchElementToPosition(Node root, float x, float y, float margin)`
`private ConcretePaintableElement` | `searchLabelBlock(Branch branch, float x, float y, float margin)`
`protected boolean` | `xToHigh(float x, PositionData pd)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### firstInstance

    private static RectangularCladogramPositioner firstInstance

### type

    protected PositionPaintType type

### document

    protected Document document

### maxLeafWidth

    private float maxLeafWidth

### rescalingFactorX

    protected float rescalingFactorX

Constructor Detail

### RectangularCladogramPositioner

    protected RectangularCladogramPositioner()

Method Detail

### getInstance

    public static RectangularCladogramPositioner getInstance()

### calculateTextDimension

    private DistanceDimension calculateTextDimension(TextElement textElement)

  Calculates the Dimensions of this text element. The height is already defined in by the provided formats and the width will calculated from the the text length scaled with the provided height.

  Parameters:
    `text` - the text of the element which dimensions shall be calculated
    `formats` - the text formats of the element
  Returns:
    the dimensions of the element not including optional margins

### calculateTaxonDimension

    private DistanceDimension calculateTaxonDimension(Node taxon)

### calculateLabelBlockDimensions

    private void calculateLabelBlockDimensions(Labels labels,
                                               boolean above)

### labelLineHeight

    private float labelLineHeight(Labels labels,
                                  boolean above,
                                  int lineNo)

### labelBlockHeight

    private float labelBlockHeight(Labels labels,
                                   boolean above)

  Returns the overall height of all rows of labels above or below the branch.

  Returns:
    the width in in millimeters

### labelLineWidth

    private float labelLineWidth(Labels labels,
                                 boolean above,
                                 int lineNo)

### labelBlockWidth

    private float labelBlockWidth(Labels labels)

  Returns the maximum width of all lines of labels above and below the branch.

### calculateWidthsHeights

    private float calculateWidthsHeights(Node root)

### positionLabelBlockX

    private void positionLabelBlockX(Branch branch,
                                     boolean above)

### positionLabelBlockY

    private void positionLabelBlockY(Branch branch)

### calculateCornerRadiusShift

    protected float calculateCornerRadiusShift(Node node,
                                               float y)

  Returns the space between the right of the node and the real position of the node line dependant of the y position.

  Parameters:
    `node` -
    `y` - - the absolute y position (not relative to the top of the node)
  Returns:
    the length in x (between 0 and cornerRadius)

### positionElements

    private float positionElements(Node root,
                                   float overallWidth,
                                   float y0)

  Positions the subtree under root. (Widths ans heights must have been calculated already.)

  Parameters:
    `root` - - the root of the subtree to position
    `overallWidth` -
    `y0` - - the start of the subtree on y
  Returns:
    the y coodinates untl which the positiones subtree reaches

### calculatePaintDimension

    protected void calculatePaintDimension(float overallWidth,
                                           float overallHeight)

### rescaleNodeWidth

    protected float rescaleNodeWidth(Node node,
                                     float width)

  This methode can be overwritten by extending classes to define a different rescaling process. It could e.g. be used to reduce the corner radius of a node

  Parameters:
    `node` - - the node to be rescaled
    `width` - - the old width of the node in millimeters
  Returns:
    the new width of the node in millimeters

### rescaleBranchWidth

    protected float rescaleBranchWidth(Branch branch,
                                       float width)

  This methode can be overwritten by extending classes to define a different rescaling process.

  Parameters:
    `branch` - - the branch to be rescaled
    `width` - - the old width of the branch in millimeters
  Returns:
    the new width of the branch in millimeters

### rescaleSubtree

    private float rescaleSubtree(Node root,
                                 float shift)

  Rescales the subtree under root.

  Parameters:
    `root` -
    `shift` -
  Returns:
    the maximal y cooronate for the end of a branch

### getLegendStartX

    private float getLegendStartX(LegendFormats f,
                                  float treeRight)

### alignToOtherLegends

    private float alignToOtherLegends(Legends legends,
                                      int start,
                                      int end,
                                      float minLeft,
                                      float top,
                                      float bottom)

### getLegendTop

    private float getLegendTop(LegendFormats f)

### getLegendBottom

    private float getLegendBottom(LegendFormats f)

### positionLegends

    private float positionLegends(float startX)

  Positions all legends rigths if `startX`.

  Parameters:
    `startX` - - the left border of the legends sector in the document
  Returns:
    the right border of the legends sector (= new width of the document without margin)

### positionScaleBar

    private float positionScaleBar(float treeWidth,
                                   float maxTreeY)

  Positions the scale bar.

  Parameters:
    `treeWidth` - - the width of the tree positioned above
    `maxTreeY` - - the end of the tree positioned above on y
  Returns:
    the end of the scale bar on y

### movePosition

    private void movePosition(PositionData pd,
                              float dX,
                              float dY)

### moveLabels

    private void moveLabels(Labels labels,
                            boolean above,
                            float dX,
                            float dY)

### moveSubtree

    private void moveSubtree(Node root,
                             float dX,
                             float dY)

### moveAll

    private void moveAll(float dX,
                         float dY)

### moveForLegends

    private float moveForLegends()

  Moves the tree down by the legends overlay on the top and calculates the new document height including the possible overlay of the legends. Additionaly the tree is moves to the left according to the document margin.

  Returns:
    the new overall height of the document (without document margin)

### positionAll

    public void positionAll(Document document,
                            float rescalingFactorX)

  Specified by:
    `positionAll` in interface `TreePositioner`

### searchLabelBlock

    private ConcretePaintableElement searchLabelBlock(Branch branch,
                                                      float x,
                                                      float y,
                                                      float margin)

### xToHigh

    protected boolean xToHigh(float x,
                              PositionData pd)

### searchElementToPosition

    private ConcretePaintableElement searchElementToPosition(Node root,
                                                             float x,
                                                             float y,
                                                             float margin)

### elementToPosition

    public ConcretePaintableElement elementToPosition(Document document,
                                                      float x,
                                                      float y,
                                                      float margin)

  Determines the element to a position defined by x- and y-coordinates (e.g. to select an element by mouse).

  Specified by:
    `elementToPosition` in interface `TreePositioner`
  Parameters:
    `document` - the document where the position should be dertermined.
    `x` - the x-position in mm
    `y` - the y-position in mm
  Returns:
    The element or null if the given koordinates are located araound the elements.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD