Class AbstractOrientation

java.lang.Object
com.realtime.crossfire.jxclient.gui.gauge.AbstractOrientation
All Implemented Interfaces:
Orientation
Direct Known Subclasses:
OrientationEW, OrientationNS, OrientationSN, OrientationWE

public abstract class AbstractOrientation extends Object implements Orientation
Abstract base class for implementing Orientation instances.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static int
    calculate(int val, int max, int size)
    Returns the fraction val/max rounded to [0..size].
    int
    Returns the current value.
    int
    Returns the height of the highlighted part of the image.
    int
    Returns the total height of the image.
    int
    Returns the maximum value.
    int
    Returns the minimum value.
    int
    Returns the width of the highlighted part of the image.
    int
    Returns the total width of the image.
    int
    Returns the x-coordinate of the highlighted part of the image.
    int
    Returns the y-coordinate of the highlighted part of the image.
    boolean
    Returns whether the low image should be shown.
    boolean
    Returns whether the negative image should be shown.
    boolean
    Returns whether the gauge's values are valid.
    protected abstract void
    Recalculate the extents of the highlighted image part.
    boolean
    setExtends(int width, int height)
    Sets the extends of the image.
    protected void
    setExtent(int x, int y, int w, int h)
    Sets the extent of the highlighted part of the image.
    void
    setHasNegativeImage(boolean hasNegativeImage)
    Sets whether the gauge can display negative images.
    boolean
    setValues(int cur, int min, int max)
    Sets the gauge's values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractOrientation

      protected AbstractOrientation()
      Creates a new instance.
  • Method Details

    • setHasNegativeImage

      public void setHasNegativeImage(boolean hasNegativeImage)
      Description copied from interface: Orientation
      Sets whether the gauge can display negative images. By default, negative images are not supported.
      Specified by:
      setHasNegativeImage in interface Orientation
      Parameters:
      hasNegativeImage - whether the gauge can display negative images
    • setValues

      public boolean setValues(int cur, int min, int max)
      Description copied from interface: Orientation
      Sets the gauge's values.
      Specified by:
      setValues in interface Orientation
      Parameters:
      cur - the current value
      min - the minimum value
      max - the maximum value
      Returns:
      whether the values have been updated
    • setExtends

      public boolean setExtends(int width, int height)
      Description copied from interface: Orientation
      Sets the extends of the image.
      Specified by:
      setExtends in interface Orientation
      Parameters:
      width - the width
      height - the height
      Returns:
      true if the size changed, false else
    • getX

      public int getX()
      Description copied from interface: Orientation
      Returns the x-coordinate of the highlighted part of the image.
      Specified by:
      getX in interface Orientation
      Returns:
      the x-coordinate
    • getY

      public int getY()
      Description copied from interface: Orientation
      Returns the y-coordinate of the highlighted part of the image.
      Specified by:
      getY in interface Orientation
      Returns:
      the y-coordinate
    • getW

      public int getW()
      Description copied from interface: Orientation
      Returns the width of the highlighted part of the image.
      Specified by:
      getW in interface Orientation
      Returns:
      the width
    • getH

      public int getH()
      Description copied from interface: Orientation
      Returns the height of the highlighted part of the image.
      Specified by:
      getH in interface Orientation
      Returns:
      the height
    • isNegativeImage

      public boolean isNegativeImage()
      Description copied from interface: Orientation
      Returns whether the negative image should be shown.
      Specified by:
      isNegativeImage in interface Orientation
      Returns:
      whether the negative image should be shown
    • isLowImage

      public boolean isLowImage()
      Description copied from interface: Orientation
      Returns whether the low image should be shown.
      Specified by:
      isLowImage in interface Orientation
      Returns:
      whether the low image should be shown
    • isValid

      public boolean isValid()
      Description copied from interface: Orientation
      Returns whether the gauge's values are valid.
      Specified by:
      isValid in interface Orientation
      Returns:
      whether the values are valid
    • reCalculate

      protected abstract void reCalculate()
      Recalculate the extents of the highlighted image part.
    • calculate

      protected static int calculate(int val, int max, int size)
      Returns the fraction val/max rounded to [0..size].
      Parameters:
      val - the value
      max - the range size
      size - the size of the result
      Returns:
      the fraction in pixels
    • getWidth

      public int getWidth()
      Returns the total width of the image.
      Returns:
      the width
    • getHeight

      public int getHeight()
      Returns the total height of the image.
      Returns:
      the height
    • getCur

      public int getCur()
      Returns the current value.
      Returns:
      the current value
    • getMin

      public int getMin()
      Returns the minimum value.
      Returns:
      the minimum value
    • getMax

      public int getMax()
      Returns the maximum value.
      Returns:
      the maximum value
    • setExtent

      protected void setExtent(int x, int y, int w, int h)
      Sets the extent of the highlighted part of the image.
      Parameters:
      x - the x-coordinate
      y - the y-coordinate
      w - the width
      h - the height