public class IlvMapUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INTERVALS
The default number of intervals to be used in
computeTransformedBounds(IlvMathTransform, double, double, double, double)
Default value is 3 (two extremities and center) |
Modifier and Type | Method and Description |
---|---|
static boolean |
addLatLonBounds(IlvRect rect,
IlvMathTransform transform,
IlvRect managerBounds,
boolean fullComputation,
int intervals)
Computes the lat/lon enclosed bounds when applying the transformation to the rectangle in manager coordinates.
|
static IlvRect |
computeLatLonBounds(IlvMathTransform transformation,
IlvRect managerBounds)
Computes the lat/lon enclosed bounds when applying the transformation to the rectangle in manager coordinates.
|
static IlvRect |
computeTransformedBounds(IlvMathTransform transformation,
double lon1,
double lat1,
double lon2,
double lat2)
Computes the bounds necessary on a manager to display a lat/lon defined rectangle.
|
static IlvRect |
computeTransformedBounds(IlvMathTransform transformation,
double lon1,
double lat1,
double lon2,
double lat2,
boolean fullComputation,
int intervals)
Computes the bounds necessary on a manager to display a lat/lon defined rectangle.
|
static double |
computeViewScale(IlvManagerView view)
Utility to compute the view scale, i.e. the ratio between centimeters on
the screen and centimeters in the real world.
|
static void |
freeMemoryNow(String msg)
Runs the garbage collector and finalizer in order to release memory.
|
static ExceptionHandler |
getExceptionHandler()
Retrieves the current
ExceptionHandler . |
static Point2D.Double |
getIntersection(Line2D segment1,
Line2D segment2)
Computes and returns the intersection point (if it exists) between two
segments.
|
static String |
getString(Class<?> objectClass,
String key)
Returns the resource string for this key.
|
static String |
getString(Class<?> objectClass,
String key,
Locale locale)
Returns the resource string for this key.
|
static void |
handleException(Exception e)
Handles an exception using the current
ExceptionHandler . |
static Color |
RandomDarkColor()
Returns a random dark color.
|
static Color |
RandomLightColor()
Returns a random dark color.
|
static Paint |
readPaint(IlvInputStream stream,
String fieldName)
Reads a previously saved paint
|
static void |
resetRandomColorGeneration()
Resets the random color generator to its initial state.
|
static void |
setExceptionHandler(ExceptionHandler exceptionHandler)
Sets the default
ExceptionHandler . |
static IlvRect[] |
splitRectangle(IlvRect rect,
int regionCount)
Splits a rectangle into an array of regionCount*regionCount adjacent subrectangles.
|
static IlvPoint |
transform(IlvPoint p,
IlvCoordinateTransformation transform)
Transforms an
IlvPoint . |
static IlvRect |
transform(IlvRect r,
IlvCoordinateTransformation transform)
Transforms an
IlvRect , that is, transform each corner and rebuild a IlvRect
with these transformed corners. |
static void |
writePaint(IlvOutputStream stream,
Paint paint,
String fieldName)
Writes a
Paint on an output stream. |
public static int DEFAULT_INTERVALS
computeTransformedBounds(IlvMathTransform, double, double, double, double)
Default value is 3 (two extremities and center)public static IlvRect computeTransformedBounds(IlvMathTransform transformation, double lon1, double lat1, double lon2, double lat2)
DEFAULT_INTERVALS
intervals.
The returned rectangle is the enclosing rectangle of all transformed points.transformation
- Transformation to use (usually built from the coordinate system of a manager)lon1
- First longitude in radians.lat1
- First latitude in radians.lon2
- Last longitude in radians.lat2
- Last latitude in radians.computeTransformedBounds(IlvMathTransform, double, double, double, double, boolean, int)
public static IlvRect computeTransformedBounds(IlvMathTransform transformation, double lon1, double lat1, double lon2, double lat2, boolean fullComputation, int intervals)
fullComputation
is chosen), dividing the area into the number of intervals specified.
The returned rectangle is the enclosing rectangle of all transformed points.transformation
- Transformation to use (usually built from the coordinate system of a manager)lon1
- First longitude in radians.lat1
- First latitude in radians.lon2
- Last longitude in radians.lat2
- Last latitude in radians.fullComputation
- if true
, takes also into account the rectangle interior.intervals
- Number of intervals into which to divide the rectangle.public static double computeViewScale(IlvManagerView view)
view
- The view for which to compute the ratio.Toolkit.getScreenResolution()
,
IlvCoordinateSystemProperty.GetCoordinateSystem(ilog.views.IlvManager)
,
IlvGeographicCoordinateSystem.equivalentLinearUnit()
,
IlvCoordinateSystem.getUnit(int)
public static final void freeMemoryNow(String msg)
null
, nothing is
printed otherwise the specified message and the available memory is
displayed.msg
- The message to be displayed.public static Point2D.Double getIntersection(Line2D segment1, Line2D segment2)
segment1
- First segment.segment2
- Second segment.null
or the exact intersection point.public static String getString(Class<?> objectClass, String key)
ResourceBundle
classes, for each package known. objectClass
- Object classkey
- name of the resourcepublic static String getString(Class<?> objectClass, String key, Locale locale)
ResourceBundle
classes, for each package known. objectClass
- Object classkey
- name of the resourcelocale
- locale used to retrieve the bundle.public static IlvRect[] splitRectangle(IlvRect rect, int regionCount)
rect
- Rectangle to split into subrectangles.regionCount
- Number of subrectangles on each dimension.public static IlvPoint transform(IlvPoint p, IlvCoordinateTransformation transform) throws IlvCoordinateTransformationException
IlvPoint
. This point is supposed to
be in manager coordinate (descending y coordinate).p
- The point to transform.transform
- The transformation.IlvCoordinateTransformationException
public static IlvRect transform(IlvRect r, IlvCoordinateTransformation transform) throws IlvCoordinateTransformationException
IlvRect
, that is, transform each corner and rebuild a IlvRect
with these transformed corners. This rectangle is supposed to
be in manager coordinate (descending y coordinate).r
- The rect to transform.transform
- The transformation.IlvCoordinateTransformationException
public static IlvRect computeLatLonBounds(IlvMathTransform transformation, IlvRect managerBounds)
transformation
- Transformation to apply.
It will first compute the lat/lon bounds of the 4 corners. managerBounds
- Manager bounds used.public static boolean addLatLonBounds(IlvRect rect, IlvMathTransform transform, IlvRect managerBounds, boolean fullComputation, int intervals)
rect
- lat/lon rectangle containing bounds after method call.transform
- Transformation to apply.managerBounds
- Manager bounds used.fullComputation
- indicate if points in the inside of the area should be checked for lat/lon bounds.intervals
- number of points taken in each direction.public static void writePaint(IlvOutputStream stream, Paint paint, String fieldName) throws IOException
Paint
on an output stream.
This static method is used when saving parameters in the style of components that can be either colors, paints, gradients, ...stream
- Stream to write to.paint
- Paint to save.fieldName
- Base name of the field.IOException
public static Paint readPaint(IlvInputStream stream, String fieldName) throws IlvReadFileException
stream
- Stream to read from.fieldName
- Base field name.Paint
.IlvReadFileException
writePaint(IlvOutputStream, Paint, String)
public static ExceptionHandler getExceptionHandler()
ExceptionHandler
.ExceptionHandler
.public static void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler
.
By default, the exception is thrown.exceptionHandler
- The ExceptionHandler
.public static void handleException(Exception e) throws Exception
ExceptionHandler
.e
- The exception.Exception
public static Color RandomDarkColor()
public static Color RandomLightColor()
public static void resetRandomColorGeneration()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.