NASA World Wind

gov.nasa.worldwindx.examples
Class PathPositionColors.ExamplePositionColors

java.lang.Object
  extended by gov.nasa.worldwindx.examples.PathPositionColors.ExamplePositionColors
All Implemented Interfaces:
Path.PositionColors
Enclosing class:
PathPositionColors

public static class PathPositionColors.ExamplePositionColors
extends Object
implements Path.PositionColors

Example implementation of Path.PositionColors that 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
protected  Color[] colors
           
protected  int pathLength
           
 
Constructor Summary
PathPositionColors.ExamplePositionColors(Color[] colors, int pathLength)
           
 
Method Summary
 Color getColor(Position position, int ordinal)
          Returns an RGBA color corresponding to the specified position and ordinal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colors

protected Color[] colors

pathLength

protected int pathLength
Constructor Detail

PathPositionColors.ExamplePositionColors

public PathPositionColors.ExamplePositionColors(Color[] colors,
                                                int pathLength)
Method Detail

getColor

public Color getColor(Position position,
                      int ordinal)
Description copied from interface: Path.PositionColors
Returns an RGBA color corresponding to the specified position and ordinal. This returns null if a color cannot be determined for the specified position and ordinal. The specified position is guaranteed to be one of the same Position references passed to a path at construction or in a call to Path.setPositions(Iterable).

The specified ordinal denotes 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:
getColor in interface Path.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 null if a color cannot be determined.

NASA World Wind