public class Coordinate
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Coordinate.RoundingMode
Identifiers denoting rounding mode used in the UI logic.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_CHUI_CH
Maximum character coordinate value for ChUI environments.
|
static double |
MAX_GUI_CH
Maximum character coordinate value for GUI environments.
|
static int |
MAX_GUI_HEIGHT_PIXELS
Maximum pixel height for a realized widget in GUI mode.
|
static int |
MAX_GUI_PIXEL
Maximum pixel coordinate value for a realized widget.
|
static int |
MAX_GUI_WIDTH_PIXELS
Maximum pixel width for a realized widget in GUI mode.
|
static int |
MIN_CHUI_CH
Minimum character coordinate value for ChUI environments.
|
static double |
MIN_GUI_CH
Minimum character coordinate value for GUI environments.
|
static int |
MIN_GUI_PIXEL
Minimum pixel coordinate value for a realized widget.
|
Constructor and Description |
---|
Coordinate() |
Modifier and Type | Method and Description |
---|---|
static double |
adjustMinMaxChuiChar(double value)
The input value is adjusted according to minimum and maximum possible
character coordinate values for ChUI environments.
|
static double |
adjustMinMaxGuiChar(double value)
The input value is adjusted according to minimum and maximum possible
character coordinate values for ChUI environments.
|
static int |
adjustMinMaxGuiPixel(int value)
The input value is adjusted according to minimum and maximum possible
character coordinate values for ChUI environments.
|
static double |
chuiRound(double ch)
Performs half-up rounding of a character coordinate value.
|
static boolean |
equals(double coordinate1,
double coordinate2)
Returns
true if the input coordinates equal. |
static double |
guiRound(double ch)
Performs half-up rounding of a character coordinate value.
|
static Dimension |
scale(Dimension dim)
/**
Sets the input value to the default scale (of two decimal places) for the character
coordinate type.
|
static double |
scale(double ch)
Sets the input value to the default scale (of two decimal places) for the character
coordinate type.
|
static Insets |
scale(Insets insets)
Sets the input value to the default scale (of two decimal places) for the character
coordinate type.
|
static Point |
scale(Point point)
Sets the input value to the default scale (of two decimal places) for the character
coordinate type.
|
static Rectangle |
scale(Rectangle rect)
Sets the input value to the default scale (of two decimal places) for the character
coordinate type.
|
static int |
toInt(double val)
Convert a double value to integer.
|
private static void |
validate(double ch)
Validates the input value.
|
public static final int MIN_CHUI_CH
public static final int MAX_CHUI_CH
public static final double MIN_GUI_CH
public static final double MAX_GUI_CH
public static final int MIN_GUI_PIXEL
public static final int MAX_GUI_PIXEL
public static final int MAX_GUI_WIDTH_PIXELS
public static final int MAX_GUI_HEIGHT_PIXELS
public static double chuiRound(double ch)
ch
- The coordinate value in character units.public static double guiRound(double ch)
ch
- The coordinate value in character units.public static double scale(double ch)
Note that the result of this method - the default scale for a character coordinate value - doesn't depend on the UI mode. It is the same for both GUI and ChUI.
ch
- The coordinate value in character units.public static Insets scale(Insets insets)
Note that the result of this method - the default scale for a character coordinate value - doesn't depend on the UI mode. It is the same for both GUI and ChUI.
public static Point scale(Point point)
Note that the result of this method - the default scale for a character coordinate value - doesn't depend on the UI mode. It is the same for both GUI and ChUI.
public static Rectangle scale(Rectangle rect)
Note that the result of this method - the default scale for a character coordinate value - doesn't depend on the UI mode. It is the same for both GUI and ChUI.
public static Dimension scale(Dimension dim)
Note that the result of this method - the default scale for a character coordinate value - doesn't depend on the UI mode. It is the same for both GUI and ChUI.
public static boolean equals(double coordinate1, double coordinate2)
true
if the input coordinates equal.coordinate1
- A coordinate value.coordinate2
- A coordinate value.private static void validate(double ch)
RuntimeException
if the input value is:
Double.NaN,
ch
- Coordinate value in character units.java.lang.RuntimeException
- When the ch
is not a valid coordinate value.public static int toInt(double val)
val
- Double value.public static double adjustMinMaxChuiChar(double value)
If the input value is less than MIN_CHUI_CH then MIN_CHUI_CH is returned. If the input value is greater than MAX_CHUI_CH then MAX_CHUI_CH is returned. Otherwise the input value is returned.
value
- Character coordinate value being adjusted.public static double adjustMinMaxGuiChar(double value)
If the input value is less than MIN_GUI_CH then MIN_GUI_CH is returned. If the input value is greater than MAX_GUI_CH then MAX_GUI_CH is returned. Otherwise the input value is returned.
value
- Character coordinate value being adjusted.public static int adjustMinMaxGuiPixel(int value)
If the input value is less than MIN_GUI_PIXEL then MIN_GUI_PIXEL is returned. If the input value is greater than MAX_GUI_PIXEL then MAX_GUI_PIXEL is returned. Otherwise the input value is returned.
value
- Character coordinate value being adjusted.