jview
Class JStarFactory

java.lang.Object
  extended by jview.JStarFactory

public class JStarFactory
extends Object

This class comprises a simple container for displaying star descriptions in a sky survey catalog. It consists of a Shape and a Paint instance. Additionally, to prevent overboarding scaling for bright stars, a #KEY_SCALEDOWN float describes the factor on how to scale down the faintest stars, and also a #KEY_MAXMAGNIFY float that is the maximum growth in size for the brightest star in the sample. The #getShapes method scales the primary shape up to the magnitude of the star and stores it together with the position information in a list of Shape objects that can be queried with #getShapes. Note that the orignal shape must be centered around 0,0.

All methods are static here.


Field Summary
private static Map<String,Color> colors
          The list of principal colors to catalog names.
private static Vector2D DEFSCALE
          The default scaling laws.
private static Shape DEFSHAPE
          The default star shape radius for a circular shape.
private static Map<String,Vector2D> scales
          The list of scaling factors to catalog names.
private static Map<String,Shape> shapes
          The list of principal shapes against catalog names.
 
Constructor Summary
JStarFactory()
           
 
Method Summary
private static String extract(Map catalog)
          Extracts the catalog name as used in our look-up tables for construction in the static section.
static Paint getCatalogColor(StarCatalog scan)
          Returns the color entry for the catalog or null, if catalog is unknown.
private static String getCatalogKey(String fullname)
          Deprtives the full catalog name from anything after the first whitespace.
static Vector2D getCatalogScale(StarCatalog scan)
          Returns scaling laws for this catalog or default scaling laws.
static Shape getCatalogShape(StarCatalog scan)
          Returns the principal shape of the catalog or the default shape, if catalog is unknown.
static List<StarDescription> limit(List<StarDescription> stars, double maxmag)
          Filters the list of stars.
static List<StarDescription> limit(List<StarDescription> stars, double min, double max, String mag)
          Filters the list of stars.
static List<PointDraw> makePoints(List<StarDescription> stars, Shape primary, Vector2D scale, Vector2D minmax, CoordinateTransforming convert, boolean fill)
          Prepares the shapes list by scaling and translating the main shape.
static List<PointDraw> makePoints(List<StarDescription> stars, Shape primary, Vector2D scale, Vector2D minmax, String mag, CoordinateTransforming convert, boolean fill)
          Prepares the shapes list by scaling and translating the main shape.
static List<ShapeDraw> makeShapes(List<StarDescription> stars, Shape primary, Vector2D scale, Vector2D minmax, CoordinateTransforming convert, boolean filled)
          Prepares the shapes list by scaling and translating the main shape.
static List<ShapeDraw> makeShapes(List<StarDescription> stars, Shape primary, Vector2D scale, Vector2D minmax, String mag, CoordinateTransforming convert, boolean filled)
          Prepares the shapes list by scaling and translating the main shape.
private static
<T> T
matchAgainstMap(Map<String,T> lookup, String fullname, T def)
          Tries to find a match in known catalogs.
static Vector2D scanMagnitudes(List<StarDescription> stars)
          Returns the minimum and maximum magnitudes in the entire star list.
static Vector2D scanMagnitudes(List<StarDescription> stars, String magstring)
          Returns the minimum and maximum size indicator in the entire star list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFSHAPE

private static final Shape DEFSHAPE
The default star shape radius for a circular shape.


DEFSCALE

private static final Vector2D DEFSCALE
The default scaling laws.


shapes

private static final Map<String,Shape> shapes
The list of principal shapes against catalog names.


colors

private static final Map<String,Color> colors
The list of principal colors to catalog names.


scales

private static final Map<String,Vector2D> scales
The list of scaling factors to catalog names.

Constructor Detail

JStarFactory

public JStarFactory()
Method Detail

extract

private static String extract(Map catalog)
Extracts the catalog name as used in our look-up tables for construction in the static section.


getCatalogColor

public static Paint getCatalogColor(StarCatalog scan)
Returns the color entry for the catalog or null, if catalog is unknown.


getCatalogShape

public static Shape getCatalogShape(StarCatalog scan)
Returns the principal shape of the catalog or the default shape, if catalog is unknown.


getCatalogScale

public static Vector2D getCatalogScale(StarCatalog scan)
Returns scaling laws for this catalog or default scaling laws.


matchAgainstMap

private static <T> T matchAgainstMap(Map<String,T> lookup,
                                     String fullname,
                                     T def)
Tries to find a match in known catalogs. The catalog name is first deprieved of its additions, i.e. only the first part of the name to the first whitespace survives. Then, the provided map is scanned for a match to this remaining name. If none is found, the default is returned.


getCatalogKey

private static String getCatalogKey(String fullname)
Deprtives the full catalog name from anything after the first whitespace.


limit

public static List<StarDescription> limit(List<StarDescription> stars,
                                          double maxmag)
Filters the list of stars. Only stars brighter than the magnitude limit passed over are returned.

Parameters:
maxmag - The maximum magnitude to consider.
Returns:
A list of stars in the defined magnitude range.

limit

public static List<StarDescription> limit(List<StarDescription> stars,
                                          double min,
                                          double max,
                                          String mag)
Filters the list of stars. Only stars that have a valid magnitude field, which ponts to a number between min and max are retained.

Parameters:
stars - The entire list of stars
min - The maximum magnitude to consider.
max - The maximum magnitude to consider.
mag - The value to consider, normally magnitude
Returns:
A list of stars in the defined magnitude range.

scanMagnitudes

public static Vector2D scanMagnitudes(List<StarDescription> stars)
Returns the minimum and maximum magnitudes in the entire star list.

Parameters:
stars - A List of StarDescriptions.
Returns:
A vector, index zer = min, index 1 = max

scanMagnitudes

public static Vector2D scanMagnitudes(List<StarDescription> stars,
                                      String magstring)
Returns the minimum and maximum size indicator in the entire star list.

Parameters:
stars - A List of StarDescriptions.
magstring - The key to the star description size ID, normally mag.
Returns:
A vector, index zer = min, index 1 = max, null if no info

makeShapes

public static List<ShapeDraw> makeShapes(List<StarDescription> stars,
                                         Shape primary,
                                         Vector2D scale,
                                         Vector2D minmax,
                                         CoordinateTransforming convert,
                                         boolean filled)
Prepares the shapes list by scaling and translating the main shape.

Parameters:
stars - The list of StarDescriptions.
primary - The normalized Drawing shape for stars.
scale - Converts magnitudes to normalized sizes.
minmax - The minmum/maximum of the magnitudes in the list.
mag - The magnitude key in the list of stars.
convert - The translation of ra/dec into normalized pixels.
Returns:
A list of shapes.

makeShapes

public static List<ShapeDraw> makeShapes(List<StarDescription> stars,
                                         Shape primary,
                                         Vector2D scale,
                                         Vector2D minmax,
                                         String mag,
                                         CoordinateTransforming convert,
                                         boolean filled)
Prepares the shapes list by scaling and translating the main shape.

Parameters:
stars - The list of StarDescriptions.
primary - The normalized Drawing shape for stars.
scale - Converts magnitudes to normalized sizes.
minmax - The minmum/maximum of the magnitudes in the list.
mag - The magnitude key in the list of stars.
convert - The translation of ra/dec into normalized pixels.
Returns:
A list of shapes.

makePoints

public static List<PointDraw> makePoints(List<StarDescription> stars,
                                         Shape primary,
                                         Vector2D scale,
                                         Vector2D minmax,
                                         CoordinateTransforming convert,
                                         boolean fill)
Prepares the shapes list by scaling and translating the main shape.

Parameters:
stars - The list of StarDescriptions.
primary - The normalized Drawing shape for stars.
scale - Converts magnitudes to normalized sizes.
minmax - The minmum/maximum of the magnitudes in the list.
mag - The magnitude key in the list of stars.
convert - The translation of ra/dec into normalized pixels.
Returns:
A list of shapes.

makePoints

public static List<PointDraw> makePoints(List<StarDescription> stars,
                                         Shape primary,
                                         Vector2D scale,
                                         Vector2D minmax,
                                         String mag,
                                         CoordinateTransforming convert,
                                         boolean fill)
Prepares the shapes list by scaling and translating the main shape.

Parameters:
stars - The list of StarDescriptions.
primary - The normalized Drawing shape for stars.
scale - Converts magnitudes to normalized sizes.
minmax - The minmum/maximum of the magnitudes in the list.
mag - The magnitude key in the list of stars.
convert - The translation of ra/dec into normalized pixels.
Returns:
A list of shapes.