Package gov.nasa.worldwindx.examples
Class PathsOnDateline.ExamplePositionColors
- java.lang.Object
-
- gov.nasa.worldwindx.examples.PathsOnDateline.ExamplePositionColors
-
- All Implemented Interfaces:
Path.PositionColors
- Enclosing class:
- PathsOnDateline
public static class PathsOnDateline.ExamplePositionColors extends java.lang.Object implements Path.PositionColors
Example implementation ofPath.PositionColorsthat evenly distributes the specified colors along a path with the specified length. For example, if the Colors array contains red, green, blue (in that order) and the pathLength is 6, this assigns the following colors to each path ordinal: 0:red, 1:red, 2:green, 3:green, 4:blue, 5:blue.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Color[]colorsprotected intpathLength
-
Constructor Summary
Constructors Constructor Description ExamplePositionColors(java.awt.Color[] colors, int pathLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ColorgetColor(Position position, int ordinal)Returns an RGBA color corresponding to the specified position and ordinal.
-
-
-
Method Detail
-
getColor
public java.awt.Color getColor(Position position, int ordinal)
Description copied from interface:Path.PositionColorsReturns an RGBA color corresponding to the specified position and ordinal. This returnsnullif a color cannot be determined for the specified position and ordinal. The specifiedpositionis guaranteed to be one of the same Position references passed to a path at construction or in a call toPath.setPositions(Iterable).The specified
ordinaldenotes the position's ordinal number as it appears in the position list passed to the path. Ordinal numbers start with 0 and increase by 1 for every originally specified position. For example, the first three path positions have ordinal values 0, 1, 2.The returned color's RGB components must not be premultiplied by its Alpha component.
- Specified by:
getColorin interfacePath.PositionColors- Parameters:
position- the path position the color corresponds to.ordinal- the ordinal number of the specified position.- Returns:
- an RGBA color corresponding to the position and ordinal, or
nullif a color cannot be determined.
-
-