Class AbstractOrientation
java.lang.Object
com.realtime.crossfire.jxclient.gui.gauge.AbstractOrientation
- All Implemented Interfaces:
Orientation
- Direct Known Subclasses:
OrientationEW,OrientationNS,OrientationSN,OrientationWE
Abstract base class for implementing
Orientation instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static intcalculate(int val, int max, int size) Returns the fractionval/maxrounded to [0..size].intgetCur()Returns the current value.intgetH()Returns the height of the highlighted part of the image.intReturns the total height of the image.intgetMax()Returns the maximum value.intgetMin()Returns the minimum value.intgetW()Returns the width of the highlighted part of the image.intgetWidth()Returns the total width of the image.intgetX()Returns the x-coordinate of the highlighted part of the image.intgetY()Returns the y-coordinate of the highlighted part of the image.booleanReturns whether the low image should be shown.booleanReturns whether the negative image should be shown.booleanisValid()Returns whether the gauge's values are valid.protected abstract voidRecalculate the extents of the highlighted image part.booleansetExtends(int width, int height) Sets the extends of the image.protected voidsetExtent(int x, int y, int w, int h) Sets the extent of the highlighted part of the image.voidsetHasNegativeImage(boolean hasNegativeImage) Sets whether the gauge can display negative images.booleansetValues(int cur, int min, int max) Sets the gauge's values.
-
Constructor Details
-
AbstractOrientation
protected AbstractOrientation()Creates a new instance.
-
-
Method Details
-
setHasNegativeImage
public void setHasNegativeImage(boolean hasNegativeImage) Description copied from interface:OrientationSets whether the gauge can display negative images. By default, negative images are not supported.- Specified by:
setHasNegativeImagein interfaceOrientation- Parameters:
hasNegativeImage- whether the gauge can display negative images
-
setValues
public boolean setValues(int cur, int min, int max) Description copied from interface:OrientationSets the gauge's values.- Specified by:
setValuesin interfaceOrientation- Parameters:
cur- the current valuemin- the minimum valuemax- the maximum value- Returns:
- whether the values have been updated
-
setExtends
public boolean setExtends(int width, int height) Description copied from interface:OrientationSets the extends of the image.- Specified by:
setExtendsin interfaceOrientation- Parameters:
width- the widthheight- the height- Returns:
- true if the size changed, false else
-
getX
public int getX()Description copied from interface:OrientationReturns the x-coordinate of the highlighted part of the image.- Specified by:
getXin interfaceOrientation- Returns:
- the x-coordinate
-
getY
public int getY()Description copied from interface:OrientationReturns the y-coordinate of the highlighted part of the image.- Specified by:
getYin interfaceOrientation- Returns:
- the y-coordinate
-
getW
public int getW()Description copied from interface:OrientationReturns the width of the highlighted part of the image.- Specified by:
getWin interfaceOrientation- Returns:
- the width
-
getH
public int getH()Description copied from interface:OrientationReturns the height of the highlighted part of the image.- Specified by:
getHin interfaceOrientation- Returns:
- the height
-
isNegativeImage
public boolean isNegativeImage()Description copied from interface:OrientationReturns whether the negative image should be shown.- Specified by:
isNegativeImagein interfaceOrientation- Returns:
- whether the negative image should be shown
-
isLowImage
public boolean isLowImage()Description copied from interface:OrientationReturns whether the low image should be shown.- Specified by:
isLowImagein interfaceOrientation- Returns:
- whether the low image should be shown
-
isValid
public boolean isValid()Description copied from interface:OrientationReturns whether the gauge's values are valid.- Specified by:
isValidin interfaceOrientation- 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 fractionval/maxrounded to [0..size].- Parameters:
val- the valuemax- the range sizesize- 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-coordinatey- the y-coordinatew- the widthh- the height
-