uk.ac.starlink.ast.gui
Class AstTicks

java.lang.Object
  extended by uk.ac.starlink.ast.gui.AbstractPlotControlsModel
      extended by uk.ac.starlink.ast.gui.AstTicks
All Implemented Interfaces:
XMLEncodeDecode

public class AstTicks
extends AbstractPlotControlsModel

AstTicks is a model of the tick mark elements shown in say an AST Plot. It encompasses all the values that describe the representation and returns these in various formats (such as the complete AST Plot options list for drawing it).

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  Color colour
          The colour of the ticks.
protected  boolean isSet
          Whether tick marking is set or unset.
protected  boolean logSpacingSet
          Whether to apply the log spacing values, or leave at the context default (on for logplot, off otherwise).
protected  double majorXTicklen
          Length of the major tick marks of the X axis.
protected  double majorYTicklen
          Length of the major tick marks of the Y axis.
static double MAX_LENGTH
          Suggested maximum length of tick mark.
static double MIN_LENGTH
          Suggested minimum length of tick mark.
protected  int minorXDivisions
          Number of minor divisions to shown between major tick marks on the X axis (0 if not set).
protected  double minorXTicklen
          Length of the minor tick marks of the X axis.
protected  int minorYDivisions
          Number of minor divisions to shown between major tick marks on the Y axis (0 if not set).
protected  double minorYTicklen
          Length of the minor tick marks of the X axis.
protected  boolean show
          Whether ticks mark should be shown (different from unset).
static double STEP_LENGTH
          Suggested step (resolution) between tick mark lengths.
protected  int style
          The style of line used for tickmarks.
protected  boolean tickAll
          Whether to tick all axes, or just the main ones.
protected  double width
          The width of the lines used for tickmarks.
protected  double xGap
          The gap between X axis major ticks (set to BAD if not set).
protected  int xLogGap
          The gap between X axis major ticks (set to 0 if not set), when drawing with log spacing.
protected  boolean xLogSpacing
          Whether X tick mark should be shown with log spacing.
protected  double yGap
          The gap between Y axis major ticks (set to BAD if not set).
protected  int yLogGap
          The gap between Y axis major ticks (set to 0 if not set), when drawing with log spacing.
protected  boolean yLogSpacing
          Whether Y tick mark should be shown with log spacing.
 
Fields inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
listeners
 
Constructor Summary
AstTicks()
          Create a empty instance.
 
Method Summary
 void encode(Element rootElement)
          Description of the Method
 String getAstOptions()
          Get the AST plot options description of this object.
 Color getColour()
          Get the colour of the tick marks.
 boolean getLogSpacingSet()
          Get whether the log spacing values are being applied.
 double getMajorXTicklength()
          Get the length of the X axis major tick marks.
 double getMajorYTicklength()
          Get the length of the Y axis major tick marks.
 int getMinorXDivisions()
          Get the number of minor divisions between major ticks on the X axis.
 double getMinorXTicklength()
          Get the length of the X axis minor tick marks.
 int getMinorYDivisions()
          Get the number of minor divisions between major ticks on the Y axis.
 double getMinorYTicklength()
          Get the length of the Y axis minor tick marks.
 boolean getShown()
          Get whether the tick marks are to be shown.
 boolean getState()
          Return whether values are set.
 double getStyle()
          Get the line style.
 String getTagName()
          The name of our enclosing tag.
 boolean getTickAll()
          Get whether we're ticking all the axes or just the ones adjacent to the number labels.
 double getWidth()
          Get the line width.
 double getXGap()
          Get the X gap between major ticks.
 int getXLogGap()
          Get the gap power of 10 for the major ticks on an X log axis.
 boolean getXLogSpacing()
          Get whether to use log spacing along X axis.
 double getYGap()
          Get the Y gap between major ticks.
 int getYLogGap()
          Get the gap power of 10 for the major ticks on an Y log axis.
 boolean getYLogSpacing()
          Get whether to use log spacing along Y axis.
 void setColour(Color colour)
          Set the colour of the tick marks.
 void setDefaults()
          Set all values to their defaults.
 void setFromString(String name, String value)
          Set the value of a member variable by matching its name to a known local property string.
 void setLogSpacingSet(boolean logSpacingSet)
          Set whether to apply log spacing setting to axes.
 void setMajorXTicklength(double majorXTicklen)
          Set the length of the X axis major ticks.
 void setMajorYTicklength(double majorYTicklen)
          Set the length of the Y axis major ticks.
 void setMinorXDivisions(int minorXDivisions)
          Set the number of minor divisions, between major ticks, along the X axis.
 void setMinorXTicklength(double minorXTicklen)
          Set the length of the X axis minor ticks.
 void setMinorYDivisions(int minorYDivisions)
          Set the number of minor divisions, between major ticks, along the Y axis.
 void setMinorYTicklength(double minorYTicklen)
          Set the length of the Y axis minor ticks.
 void setShown(boolean show)
          Set whether the tick marks should be shown or not.
 void setState(boolean isSet)
          Set whether any of these values are set, It not set then all tick marking remains at the default configuration.
 void setStyle(int style)
          Set the line style.
 void setTickAll(boolean tickAll)
          Set whether to tick all the axes, or just the ones adjacent to the number labels.
 void setWidth(double width)
          Set the line width.
 void setXGap(double xGap)
          Set the major gap along the X axis.
 void setXLogGap(int xLogGap)
          Set log spacing power of 10 for major ticks along the X axis.
 void setXLogSpacing(boolean xLogSpacing)
          Set whether to display ticks using log spacing along X axis.
 void setYGap(double yGap)
          Set the major gap along the Y axis.
 void setYLogGap(int yLogGap)
          Set log spacing power of 10 for major ticks along the X axis.
 void setYLogSpacing(boolean yLogSpacing)
          Set whether to display ticks using log spacing along Y axis.
 String toString()
          Get a string representation of the AST options.
 
Methods inherited from class uk.ac.starlink.ast.gui.AbstractPlotControlsModel
addChangeListener, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, addChildElement, booleanFromString, booleanToString, colorFromString, colorToString, decode, doubleFromString, doubleToString, fireChanged, fontFromString, fontToString, getChildren, getElementName, getElementValue, intFromString, intToString, longFromString, longToString, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isSet

protected boolean isSet
Whether tick marking is set or unset.


show

protected boolean show
Whether ticks mark should be shown (different from unset).


logSpacingSet

protected boolean logSpacingSet
Whether to apply the log spacing values, or leave at the context default (on for logplot, off otherwise).


xLogSpacing

protected boolean xLogSpacing
Whether X tick mark should be shown with log spacing.


yLogSpacing

protected boolean yLogSpacing
Whether Y tick mark should be shown with log spacing.


colour

protected Color colour
The colour of the ticks.


xGap

protected double xGap
The gap between X axis major ticks (set to BAD if not set). This is in units of the X axis.


yGap

protected double yGap
The gap between Y axis major ticks (set to BAD if not set). This is in units of the Y axis.


xLogGap

protected int xLogGap
The gap between X axis major ticks (set to 0 if not set), when drawing with log spacing. This is a power of 10, not the actual gap.


yLogGap

protected int yLogGap
The gap between Y axis major ticks (set to 0 if not set), when drawing with log spacing. This is a power of 10, not the actual gap.


majorXTicklen

protected double majorXTicklen
Length of the major tick marks of the X axis. Set as a fraction of the displayed plot size.


majorYTicklen

protected double majorYTicklen
Length of the major tick marks of the Y axis. Set as a fraction of the displayed plot size.


minorXTicklen

protected double minorXTicklen
Length of the minor tick marks of the X axis. Set as a fraction of the displayed plot size.


minorYTicklen

protected double minorYTicklen
Length of the minor tick marks of the X axis. Set as a fraction of the displayed plot size.


minorXDivisions

protected int minorXDivisions
Number of minor divisions to shown between major tick marks on the X axis (0 if not set).


minorYDivisions

protected int minorYDivisions
Number of minor divisions to shown between major tick marks on the Y axis (0 if not set).


style

protected int style
The style of line used for tickmarks. Should be a Grf style.


width

protected double width
The width of the lines used for tickmarks.


tickAll

protected boolean tickAll
Whether to tick all axes, or just the main ones.


MAX_LENGTH

public static final double MAX_LENGTH
Suggested maximum length of tick mark.

See Also:
Constant Field Values

MIN_LENGTH

public static final double MIN_LENGTH
Suggested minimum length of tick mark.

See Also:
Constant Field Values

STEP_LENGTH

public static final double STEP_LENGTH
Suggested step (resolution) between tick mark lengths.

See Also:
Constant Field Values
Constructor Detail

AstTicks

public AstTicks()
Create a empty instance. This indicates that all tick marking should remain at the AST Plot default.

Method Detail

setDefaults

public void setDefaults()
Set all values to their defaults.


setState

public void setState(boolean isSet)
Set whether any of these values are set, It not set then all tick marking remains at the default configuration.

Parameters:
isSet - The new state value

getState

public boolean getState()
Return whether values are set.

Returns:
The state value

setShown

public void setShown(boolean show)
Set whether the tick marks should be shown or not.

Parameters:
show - The new shown value

getShown

public boolean getShown()
Get whether the tick marks are to be shown.

Returns:
The shown value

setLogSpacingSet

public void setLogSpacingSet(boolean logSpacingSet)
Set whether to apply log spacing setting to axes.

Parameters:
logSpacingSet - new value.

getLogSpacingSet

public boolean getLogSpacingSet()
Get whether the log spacing values are being applied.

Returns:
The value

setXLogSpacing

public void setXLogSpacing(boolean xLogSpacing)
Set whether to display ticks using log spacing along X axis.

Parameters:
xLogSpacing - new value.

getXLogSpacing

public boolean getXLogSpacing()
Get whether to use log spacing along X axis.

Returns:
The value

setYLogSpacing

public void setYLogSpacing(boolean yLogSpacing)
Set whether to display ticks using log spacing along Y axis.

Parameters:
yLogSpacing - new value.

getYLogSpacing

public boolean getYLogSpacing()
Get whether to use log spacing along Y axis.

Returns:
The value

setColour

public void setColour(Color colour)
Set the colour of the tick marks.

Parameters:
colour - The new colour value

getColour

public Color getColour()
Get the colour of the tick marks.

Returns:
The colour value

setXGap

public void setXGap(double xGap)
Set the major gap along the X axis. Grf.BAD to indicate that the default value should be used. The units are those of the X axis.

Parameters:
xGap - The new xGap value

getXGap

public double getXGap()
Get the X gap between major ticks.

Returns:
The xGap value

setYGap

public void setYGap(double yGap)
Set the major gap along the Y axis. Grf.BAD to indicate that the default value should be used. The units are those of the Y axis.

Parameters:
yGap - The new yGap value

getYGap

public double getYGap()
Get the Y gap between major ticks.

Returns:
The yGap value

setXLogGap

public void setXLogGap(int xLogGap)
Set log spacing power of 10 for major ticks along the X axis. A setting of 0 indicates that the default value should be used.

Parameters:
xLogGap - The new xLogGap value

getXLogGap

public int getXLogGap()
Get the gap power of 10 for the major ticks on an X log axis.

Returns:
The xLogGap value

setYLogGap

public void setYLogGap(int yLogGap)
Set log spacing power of 10 for major ticks along the X axis. A setting of 0 indicates that the default value should be used.

Parameters:
yLogGap - The new yLogGap value

getYLogGap

public int getYLogGap()
Get the gap power of 10 for the major ticks on an Y log axis.

Returns:
The yLogGap value

setWidth

public void setWidth(double width)
Set the line width. The value DefaultGrf.BAD means no value.

Parameters:
width - The new width value

getWidth

public double getWidth()
Get the line width.

Returns:
The width value

setStyle

public void setStyle(int style)
Set the line style. This should be a style known to the Grf class (i.e. Grf.PLAIN, Grf.DASH etc.)

Parameters:
style - The new style value

getStyle

public double getStyle()
Get the line style.

Returns:
The style value

setTickAll

public void setTickAll(boolean tickAll)
Set whether to tick all the axes, or just the ones adjacent to the number labels.

Parameters:
tickAll - The new tickAll value

getTickAll

public boolean getTickAll()
Get whether we're ticking all the axes or just the ones adjacent to the number labels.

Returns:
The tickAll value

setMajorXTicklength

public void setMajorXTicklength(double majorXTicklen)
Set the length of the X axis major ticks. DefaultGrf.BAD means use the default size

Parameters:
majorXTicklen - The new majorXTicklength value

setMajorYTicklength

public void setMajorYTicklength(double majorYTicklen)
Set the length of the Y axis major ticks. DefaultGrf.BAD means use the default size

Parameters:
majorYTicklen - The new majorYTicklength value

getMajorXTicklength

public double getMajorXTicklength()
Get the length of the X axis major tick marks.

Returns:
The majorXTicklength value

getMajorYTicklength

public double getMajorYTicklength()
Get the length of the Y axis major tick marks.

Returns:
The majorYTicklength value

setMinorXTicklength

public void setMinorXTicklength(double minorXTicklen)
Set the length of the X axis minor ticks. DefaultGrf.BAD means use the default size

Parameters:
minorXTicklen - The new minorXTicklength value

setMinorYTicklength

public void setMinorYTicklength(double minorYTicklen)
Set the length of the Y axis minor ticks. DefaultGrf.BAD means use the default size

Parameters:
minorYTicklen - The new minorYTicklength value

getMinorXTicklength

public double getMinorXTicklength()
Get the length of the X axis minor tick marks.

Returns:
The minorXTicklength value

getMinorYTicklength

public double getMinorYTicklength()
Get the length of the Y axis minor tick marks.

Returns:
The minorYTicklength value

setMinorXDivisions

public void setMinorXDivisions(int minorXDivisions)
Set the number of minor divisions, between major ticks, along the X axis. Set to 0 for default number.

Parameters:
minorXDivisions - The new minorXDivisions value

getMinorXDivisions

public int getMinorXDivisions()
Get the number of minor divisions between major ticks on the X axis.

Returns:
The minorXDivisions value

setMinorYDivisions

public void setMinorYDivisions(int minorYDivisions)
Set the number of minor divisions, between major ticks, along the Y axis. Set to 0 for default number.

Parameters:
minorYDivisions - The new minorYDivisions value

getMinorYDivisions

public int getMinorYDivisions()
Get the number of minor divisions between major ticks on the Y axis.

Returns:
The minorYDivisions value

getAstOptions

public String getAstOptions()
Get the AST plot options description of this object.

Returns:
The astOptions value

toString

public String toString()
Get a string representation of the AST options.

Overrides:
toString in class Object
Returns:
Description of the Return Value

getTagName

public String getTagName()
The name of our enclosing tag.

Returns:
the name of the root element.

encode

public void encode(Element rootElement)
Description of the Method

Specified by:
encode in interface XMLEncodeDecode
Specified by:
encode in class AbstractPlotControlsModel
Parameters:
rootElement - Description of the Parameter

setFromString

public void setFromString(String name,
                          String value)
Set the value of a member variable by matching its name to a known local property string.

Specified by:
setFromString in class AbstractPlotControlsModel
Parameters:
name - The new fromString value
value - The new fromString value


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.