# Class Orientation

java.lang.Object
uk.ac.starlink.ttools.plot2.Orientation

@Equality public abstract class Orientation extends Object
Defines text orientation for axis labelling.

Since:
  13 Feb 2013
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Orientation`
`ANTI_X`
Orientation suitable for labelling top-edge X axis.
`static final Orientation`
`ANTI_Y`
Orientation suitable for labelling right-hand Y axis.
`static final Orientation`
`X`
Orientation suitable for X axis labelling.
`static final Orientation`
`Y`
Orientation suitable for Y axis labelling.

## Constructor Summary

Constructors
Constructor
Description
`Orientation()`

## Method Summary

Modifier and Type
Method
Description
`abstract AffineTransform`
`captionTransform(Rectangle bounds, int pad)`
Returns a transformation suitable for writing axis captions.
`static Orientation`
`createAngledX(double thetaDeg, boolean isAnti)`
Returns an orientation suitable for X axis labelling, in which labels are rotated by a given angle.
`abstract boolean`
`isDown()`
Indicates whether the positive Y direction points towards the axis.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### X

public static final Orientation X
Orientation suitable for X axis labelling.

### Y

public static final Orientation Y
Orientation suitable for Y axis labelling.

### ANTI_X

public static final Orientation ANTI_X
Orientation suitable for labelling top-edge X axis.

### ANTI_Y

public static final Orientation ANTI_Y
Orientation suitable for labelling right-hand Y axis.

## Constructor Details

### Orientation

public Orientation()

## Method Details

### captionTransform

public abstract AffineTransform captionTransform(Rectangle bounds, int pad)
Returns a transformation suitable for writing axis captions. If a graphics context is positioned with the point to be annotated at the origin, applying the returned transformation gives a graphics context on which a caption with the given bounding box can be painted. The origin of the bounds should be the baseline at the start of the line, its height should reflect the maximum font height, and the width should be the actual width.

Parameters:
  `bounds` - rectangle enclosing caption text
  `pad` - number of pixels gap between caption and axis
Returns:
  transform applied to graphics context for writing caption text

### isDown

public abstract boolean isDown()
Indicates whether the positive Y direction points towards the axis.

Returns:
  true for axis below text, false for axis above text

### createAngledX

public static Orientation createAngledX(double thetaDeg, boolean isAnti)
Returns an orientation suitable for X axis labelling, in which labels are rotated by a given angle.

Parameters:
  `thetaDeg` - rotation angle clockwise in degrees, usually between 0 and 90
  `isAnti` - true for top-edge X axis, false for bottom-edge
Returns:
  new orientation