public final class IlvUtil extends Object
IlvUtil
regroups some utilities.Modifier and Type | Method and Description |
---|---|
static void |
BoundingBox(IlvRect bbox,
double[] x,
double[] y,
int count)
Computes the bounding rectangle that contains the points.
|
static void |
BoundingBox(IlvRect bbox,
IlvPoint[] points,
int count)
Computes the bounding rectangle that contains the points.
|
static Cursor |
CursorFromDirection(int direction)
Returns the AWT
Cursor from an IlvConstants value. |
static double |
degreesToRadians(double angle)
Transforms the
angle parameter from degrees
into radians. |
static double |
GetDeltaLine()
Returns the size of the margin used by the method
PointInLine(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint) to detect if a point is on a line. |
static Frame |
GetFrame(Component c)
Returns the
java.awt.Frame of the component. |
static int |
GetHeadlessScreenResolution()
Returns the screen resolution used in headless mode.
|
static IlvPoint |
GetLineIntersection(double ax1,
double ay1,
double ax2,
double ay2,
double bx1,
double by1,
double bx2,
double by2,
IlvPoint result)
Returns the intersection point between two lines.
|
static IlvPoint |
GetLineIntersection(IlvPoint p1LA,
IlvPoint p2LA,
IlvPoint p1LB,
IlvPoint p2LB,
IlvPoint result)
Returns the intersection point between two lines.
|
static boolean |
isEqual(double a,
double b)
Test equality between two doubles, using internal absolute precision (1e-13),
and an internal relative precision (1e-7).
|
static boolean |
isEqual(double a,
double b,
double precision)
Same as
isEqual(double, double) except the absolute precision is given by the precision parameter. |
static boolean |
isEqual(double a,
double b,
double precision,
double relativePrecision)
Same as
isEqual(double, double) except the absolute precision is given by the precision parameter. |
static boolean |
isNotEqual(double a,
double b)
Test if two number are different regarding internal absolute and relative precision.
|
static boolean |
isNotEqual(double a,
double b,
double precision)
Test if two number are different regarding given absolute precision.
|
static boolean |
PointInLine(IlvPoint point,
IlvPoint from,
IlvPoint to)
Returns
true if the first specified point is on the line
described by the two other points. |
static boolean |
PointInLine(IlvPoint point,
IlvPoint from,
IlvPoint to,
boolean noMarginAtExtremities)
Returns
true if the first specified point is on the line
described by the two other points. |
static double |
radiansToDegrees(double angle)
Transforms the
angle parameter from radians
into degrees. |
static void |
SetDeltaLine(double val)
Changes the size of the margin used by the method
PointInLine(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint) to detect if a point is on a line. |
static void |
SetHeadlessScreenResolution(int resolution)
Changes the screen resolution used in headless mode as a replacement of
Toolkit.getDefaultToolkit().getScreenResolution()
by classes and methods that need to compute dimensions on the screen. |
public static void BoundingBox(IlvRect bbox, double[] x, double[] y, int count)
count
elements of the specified arrays
of coordinates.
The result is stored in the specified rectangle.public static void BoundingBox(IlvRect bbox, IlvPoint[] points, int count)
count
elements of the
specified array of points.
The result is stored in the specified rectangle.public static Frame GetFrame(Component c)
java.awt.Frame
of the component.
If no Frame
parent is found, the method
returns null
.public static double GetDeltaLine()
PointInLine(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint)
to detect if a point is on a line.
The default value is 3.0
.public static void SetDeltaLine(double val)
PointInLine(ilog.views.IlvPoint, ilog.views.IlvPoint, ilog.views.IlvPoint)
to detect if a point is on a line.
The default value is 3.0
.val
- The new value of the margin.public static int GetHeadlessScreenResolution()
Toolkit.getDefaultToolkit().getScreenResolution()
by classes and methods that need to compute dimensions on the screen.
The default value is 96
.
GetHeadlessScreenResolution()
public static void SetHeadlessScreenResolution(int resolution)
Toolkit.getDefaultToolkit().getScreenResolution()
by classes and methods that need to compute dimensions on the screen.
The default value is 96
.
resolution
- The new resolution.SetHeadlessScreenResolution(int)
public static boolean PointInLine(IlvPoint point, IlvPoint from, IlvPoint to)
true
if the first specified point is on the line
described by the two other points. The default size of the margin
used is 8.0
. To modify the margin, use SetDeltaLine(double)
.point
- The point to test.from
- The first point of the line.to
- The second point of the line.GetDeltaLine()
,
SetDeltaLine(double)
public static boolean PointInLine(IlvPoint point, IlvPoint from, IlvPoint to, boolean noMarginAtExtremities)
true
if the first specified point is on the line
described by the two other points.
The default size of the margin used is 8.0.point
- The point to test.from
- The first point of the line.to
- The second point of the line.noMarginAtExtremities
- if true
, the margin will not
be used at the extremities of the line.GetDeltaLine()
,
SetDeltaLine(double)
public static IlvPoint GetLineIntersection(IlvPoint p1LA, IlvPoint p2LA, IlvPoint p1LB, IlvPoint p2LB, IlvPoint result)
p1LA
- One point on the first line.p2LA
- Another point on the first line.p1LB
- One point on the second line.p2LB
- Another point on the second line.result
- If not null
, this point is used a container
for the return value and is filled with the intersection
point if the lines intersect.
If null
, a new point is allocated internally
and returned, if the lines intersect.null
if the two
lines are parallel.public static IlvPoint GetLineIntersection(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2, IlvPoint result)
ax1
- The x coordinate of the first point on the first line.ay1
- The y coordinate of the first point on the first line.ax2
- The x coordinate of the second point on the first line.ay2
- The y coordinate of the second point on the first line.bx1
- The x coordinate of the first point on the second line.by1
- The y coordinate of the first point on the second line.bx2
- The x coordinate of the second point on the second line.by2
- The y coordinate of the second point on the second line.result
- If not null
, this point is used a container
for the return value and is filled with the intersection
point if the lines intersect.
If null
, a new point is allocated internally
and returned, if the lines intersect.null
if the two
lines are parallel.public static Cursor CursorFromDirection(int direction)
Cursor
from an IlvConstants
value.public static double degreesToRadians(double angle)
angle
parameter from degrees
into radians.
This method is identical to java.lang.Math.toRadians(angle)
.
public static double radiansToDegrees(double angle)
angle
parameter from radians
into degrees.
This method is identical to java.lang.Math.toDegrees(angle)
.
public static boolean isEqual(double a, double b)
a
- the first number.b
- the second number.true
if the two numbers are 'near" regarding absolute and relative precision,
and false
if not.isNotEqual(double, double)
,
isEqual(double, double, double)
public static boolean isNotEqual(double a, double b)
a
- the first number.b
- the second number.false
if the two numbers are 'near" regarding absolute and relative precision,
and true
if not.isEqual(double, double)
public static boolean isEqual(double a, double b, double precision)
isEqual(double, double)
except the absolute precision is given by the precision
parameter.
precision*10
.a
- the first number.b
- the second number.precision
- the given precision to use.true
if the two numbers are 'near" regarding given absolute precision and relative precision,
and false
if not.isEqual(double, double)
,
isNotEqual(double, double, double)
public static boolean isEqual(double a, double b, double precision, double relativePrecision)
isEqual(double, double)
except the absolute precision is given by the precision
parameter.
precision*10
.a
- the first number.b
- the second number.precision
- the given precision to use.relativePrecision
- the given relativePrecision to use.true
if the two numbers are 'near" regarding given absolute precision and relative precision,
and false
if not.isEqual(double, double)
,
isNotEqual(double, double, double)
public static boolean isNotEqual(double a, double b, double precision)
a
- the first number.b
- the second number.precision
- the given precision to use.false
if the two numbers are 'near" regarding given absolute precision and relative precision,
and true
if not.isEqual(double, double, double)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.