vitro.grid
Class GridAnnotation

java.lang.Object
  extended by vitro.grid.GridAnnotation
All Implemented Interfaces:
Comparable, Annotation

public class GridAnnotation
extends Object
implements Annotation, Comparable

GridAnnotations allow users to overlay an array of Colors on their Grid's View.


Field Summary
 Map<Point,Color> coloring
          A mapping between positions on the Grid and their Color.
 
Constructor Summary
GridAnnotation(Collection<Location> colored, Color color)
          Create a new GridAnnotation.
GridAnnotation(Map<Location,? extends Number> scaling, Color colorMin, Color colorMax)
          Create a new GridAnnotation.
GridAnnotation(Map<Location,Color> colored)
          Create a new GridAnnotation.
 
Method Summary
protected static
<K> Map<K,Color>
calculateScaling(Map<K,? extends Number> scaling, Color colorMin, Color colorMax)
          Generate a scaled gradient between two colors based on the values specified in the "scaling" table.
 int compareTo(Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coloring

public final Map<Point,Color> coloring
A mapping between positions on the Grid and their Color.

Constructor Detail

GridAnnotation

public GridAnnotation(Collection<Location> colored,
                      Color color)
Create a new GridAnnotation.

Parameters:
colored - the Locations to Color.
color - a Color to apply to every specified Location.

GridAnnotation

public GridAnnotation(Map<Location,Color> colored)
Create a new GridAnnotation.

Parameters:
colored - a mapping from Locations to their desired Color.

GridAnnotation

public GridAnnotation(Map<Location,? extends Number> scaling,
                      Color colorMin,
                      Color colorMax)
Create a new GridAnnotation. Colors will range on a gradient between a minimum and maximum color as dictated by the range of values associated with Locations.

Parameters:
scaling - the values associated with specific Locations.
colorMin - the color to assign to the lowest value in values from scaling.
colorMax - the color to assign to the highest value in value from scaling.
Method Detail

calculateScaling

protected static <K> Map<K,Color> calculateScaling(Map<K,? extends Number> scaling,
                                                   Color colorMin,
                                                   Color colorMax)
Generate a scaled gradient between two colors based on the values specified in the "scaling" table.

Parameters:
scaling - the values associated with specific Locations.
colorMin - the color to assign to the lowest value in values from scaling.
colorMax - the color to assign to the highest value in value from scaling.
Returns:
a mapping from objects to their scaled colors.

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable