public class ExampleUtil
extends java.lang.Object
Constructor and Description |
---|
ExampleUtil() |
Modifier and Type | Method and Description |
---|---|
static double[] |
createRandomGridValues(int width,
int height,
double min,
double max,
int numIterations,
double smoothness)
Creates a 2D grid of random values with an optional smoothing parameter.
|
static void |
goTo(WorldWindow wwd,
Sector sector)
Causes the View attached to the specified WorldWindow to animate to the specified sector.
|
static double[] |
readCommaDelimitedNumbers(java.lang.String path)
Reads the file at the specified path as a list of floating point numbers encoded as comma delimited plain text,
|
static java.io.File |
saveResourceToTempFile(java.lang.String path,
java.lang.String suffix)
Saves the file at the specified path in a temporary directory and returns a File to the temporary location.
|
protected static void |
scaleValues(double[] values,
int count,
double minValue,
double maxValue) |
protected static void |
smoothBand(double[] values,
int start,
int stride,
int count,
double smoothness) |
protected static void |
smoothValues(int width,
int height,
double[] values,
double smoothness) |
static java.io.File |
unzipAndSaveToTempFile(java.lang.String path,
java.lang.String suffix)
Unzips the sole entry in the specified zip file, and saves it in a temporary directory, and returns a File to the
temporary location.
|
public static double[] createRandomGridValues(int width, int height, double min, double max, int numIterations, double smoothness)
width
- the grid width.height
- the grid height.min
- the minimum random value.max
- the maximum random value.numIterations
- the number of random iterations to perform, a larger number decreases grid uniformity.smoothness
- the amount of smoothing to apply to the random values. 0 indicates no smoothing, while 1
indicates the most smoothing.public static void goTo(WorldWindow wwd, Sector sector)
wwd
- the WorldWindow who's View animates.sector
- the sector to go to.java.lang.IllegalArgumentException
- if either the wwd
or the sector
are
null
.public static double[] readCommaDelimitedNumbers(java.lang.String path)
path
- the path to the source file.java.lang.IllegalArgumentException
- if the path
is null
or empty.public static java.io.File saveResourceToTempFile(java.lang.String path, java.lang.String suffix)
InputStream
URL
URI
File
String
containing a valid URL
description or a file or resource name available on the classpath.path
- the path to the source file.suffix
- the suffix to give the temp file.File
for the temp file.java.lang.IllegalArgumentException
- if the path
is null
or empty.protected static void scaleValues(double[] values, int count, double minValue, double maxValue)
protected static void smoothBand(double[] values, int start, int stride, int count, double smoothness)
protected static void smoothValues(int width, int height, double[] values, double smoothness)
public static java.io.File unzipAndSaveToTempFile(java.lang.String path, java.lang.String suffix)
path
- the path to the source file.suffix
- the suffix to give the temp file.File
for the temp file.java.lang.IllegalArgumentException
- if the path
is null
or empty.