stella.xml
Class ObjectHelper

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.xml.ElementHelper
                  extended by stella.xml.ObjectHelper
All Implemented Interfaces:
Cloneable, UserAdjustable, UserDetails, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
JObjectHelper

public class ObjectHelper
extends ElementHelper

This class allows assignment of xml-target descriptions from object names. It provides methods for retrieving field-of-view entries, as well as object positions. Guiding stars can also be set. Note that guiding offsets are part of the setup constant section rather than in the object. This class does not extend the ElementHelper class because the only required field is the object id and the object name, while resolving of the position and guiding field is done in a very special way.


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.xml.ElementHelper
ElementHelper.Valid
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static Map<String,Map<String,String>> CATALOGS
          A table of catalog-names to catalog properties.
private static String DEFFIELDCATALOG
          The default field-of-view resolving methods.
static String DEFID
          The default id.
private static float DEFMAGLIMIT
          The default mag limit.
private static String DEFMAINCATALOG
          The default field-of-view resolving methods.
private static double DEFMAINFIELD
          The default main field to enhance main-star entry.
private static String DEFREQUIREMENT
          The required entries.
private static long DEFRESOLVETIME
          The default resolve time using simbad services.
private static String DEFSETTABLE
          The settable parameters.
private static String DEFTYPEMAP
          The type map for the object parameters.
private static long DEFUPDATETIME
          The default resolve time using simbad services.
private static String DEFVALUEDETAILS
           
private  StarCatalog fieldcat
          The star catalog to use for the main guide star resolving tasks.
private  List<StarDescription> fov
          A list of field of view stars.
static String KEY_FIELDCATALOG
          The key to the StarCatalog for guide star list.
static String KEY_ID
          The object-id as attribute to the object-xml fragment.
static String KEY_IDGUIDE
          Points to the setup-id carrying guiding info.
static String KEY_MAGLIMIT
          All stars below this magnitude are discarded from FoV.
static String KEY_MAINCATALOG
          The key to the StarCatalog for main star resolving.
static String KEY_MAINFIELD
          The key to the (narrow) field around the main star.
static String KEY_RESOLVETIME
          The key to the time used for resolving the object name.
static String KEY_UPDATETIME
          The key to the time used for updating the object.
private static Map<String,String> LOOKUP
          A look-up table matching DTD names to StarDescription names.
private  StarDescription main
          The entry for the main star.
private  List<StarCatalog> maincat
          The star catalogs to use for the main star resolving tasks.
 
Fields inherited from class stella.xml.ElementHelper
KEY_APPENDIX, KEY_HELPERCLASS, KEY_INIT, KEY_REQUIREMENT, KEY_SETTABLE, KEY_TYPEMAP, KEY_VALUEDETAILS
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
ObjectHelper(Map<String,String> prop)
          Creates a new object helper with the specified properties.
 
Method Summary
static ObjectHelper createObjectHelper(Map<String,String> prop)
          Creates a ElementHelper using the provided properties.
 void erase()
          Erases the field of view and the main star entry.
 String getFieldCatalogName()
          Returns the name of the field-of-view catalog.
 long getFieldCatalogTime(double radius)
          Returns the catalog resolve time for the main method.
 List<StarDescription> getFieldOfView()
          Returns the field-of-view, the guide star being the first entry in the list.
 String getGuiderSetup()
          Returns the id of the setup section that hosts guiding info.
 StarDescription getMain()
          Returns the main star as a StarDescription object.
 long getResolveTime()
          Returns a time estimate for resolving the main object name using the simbad service.
 void init()
          Constructs the main resolving catalog out of KEY_MAINCATALOG and the known catalogs CATALOGS.
 boolean isValid()
          An object is valid if the main star is valid and the field-of-view is set.
 List<StarDescription> resolveFieldOfView(StarDescription around, double view)
          Uses the provided center of the field of view to retrieve star entries from the fieldcat catalog.
 StarDescription resolveObjectName(String simbad)
          Resolves the main star entry.
 void setFieldOfView(List<StarDescription> field)
          Sets the field of view if processed using non-default methods.
 void setFieldOfView(StarDescription around, double field)
          Sets the field of view, using a center star and a circular field of view.
 StarDescription setMain(StarDescription newmain)
          Sets the main object as a StarDescription
 StarDescription setMain(String simbad)
          Sets the main object using the resolveObjectName(java.lang.String) method.
 boolean setValue(String name, Object value)
          Setting one of the settable values re-directs it to setting the main star entry.
 boolean update()
          Updates the variables.
 boolean update(boolean simbad)
          Updates the variables.
 
Methods inherited from class stella.xml.ElementHelper
createElementHelper, createElementHelpers, createElementHelpers, createHelperMap, createHelperMap, debug, error, fatal, fromResourceName, fromResourceName, getDefined, getDetails, getID, getMissing, getRequired, getSettable, getType, getValue, getVariables, info, toLongString, toString, warn
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_ID

public static final String KEY_ID
The object-id as attribute to the object-xml fragment.

See Also:
Constant Field Values

KEY_RESOLVETIME

public static final String KEY_RESOLVETIME
The key to the time used for resolving the object name.

See Also:
Constant Field Values

KEY_UPDATETIME

public static final String KEY_UPDATETIME
The key to the time used for updating the object.

See Also:
Constant Field Values

KEY_MAINFIELD

public static final String KEY_MAINFIELD
The key to the (narrow) field around the main star.

See Also:
Constant Field Values

KEY_MAINCATALOG

public static final String KEY_MAINCATALOG
The key to the StarCatalog for main star resolving.

See Also:
Constant Field Values

KEY_FIELDCATALOG

public static final String KEY_FIELDCATALOG
The key to the StarCatalog for guide star list.

See Also:
Constant Field Values

KEY_IDGUIDE

public static final String KEY_IDGUIDE
Points to the setup-id carrying guiding info.

See Also:
Constant Field Values

KEY_MAGLIMIT

public static final String KEY_MAGLIMIT
All stars below this magnitude are discarded from FoV.

See Also:
Constant Field Values

CATALOGS

public static final Map<String,Map<String,String>> CATALOGS
A table of catalog-names to catalog properties.


DEFID

public static final String DEFID
The default id.

See Also:
Constant Field Values

DEFRESOLVETIME

private static final long DEFRESOLVETIME
The default resolve time using simbad services.

See Also:
Constant Field Values

DEFUPDATETIME

private static final long DEFUPDATETIME
The default resolve time using simbad services.

See Also:
Constant Field Values

DEFMAINFIELD

private static final double DEFMAINFIELD
The default main field to enhance main-star entry.

See Also:
Constant Field Values

DEFMAINCATALOG

private static final String DEFMAINCATALOG
The default field-of-view resolving methods.

See Also:
Constant Field Values

DEFFIELDCATALOG

private static final String DEFFIELDCATALOG
The default field-of-view resolving methods.

See Also:
Constant Field Values

DEFMAGLIMIT

private static final float DEFMAGLIMIT
The default mag limit.

See Also:
Constant Field Values

DEFREQUIREMENT

private static final String DEFREQUIREMENT
The required entries.

See Also:
Constant Field Values

DEFVALUEDETAILS

private static final String DEFVALUEDETAILS
See Also:
Constant Field Values

DEFTYPEMAP

private static final String DEFTYPEMAP
The type map for the object parameters.

See Also:
Constant Field Values

DEFSETTABLE

private static final String DEFSETTABLE
The settable parameters. All astrometric data for the main star.

See Also:
Constant Field Values

LOOKUP

private static final Map<String,String> LOOKUP
A look-up table matching DTD names to StarDescription names.


main

private StarDescription main
The entry for the main star.


maincat

private List<StarCatalog> maincat
The star catalogs to use for the main star resolving tasks.


fieldcat

private StarCatalog fieldcat
The star catalog to use for the main guide star resolving tasks.


fov

private List<StarDescription> fov
A list of field of view stars. The guide star is the first entry.

Constructor Detail

ObjectHelper

public ObjectHelper(Map<String,String> prop)
Creates a new object helper with the specified properties. An object has special requirements and variables, thus we override settings from element helper.

Method Detail

init

public void init()
Constructs the main resolving catalog out of KEY_MAINCATALOG and the known catalogs CATALOGS.

Specified by:
init in interface Initializable
Overrides:
init in class ElementHelper

erase

public void erase()
Erases the field of view and the main star entry.

Overrides:
erase in class ElementHelper

getGuiderSetup

public String getGuiderSetup()
Returns the id of the setup section that hosts guiding info. If no such setup is required, null is returned.


getResolveTime

public long getResolveTime()
Returns a time estimate for resolving the main object name using the simbad service.


getFieldCatalogTime

public long getFieldCatalogTime(double radius)
Returns the catalog resolve time for the main method.


resolveObjectName

public StarDescription resolveObjectName(String simbad)
Resolves the main star entry.


getFieldCatalogName

public String getFieldCatalogName()
Returns the name of the field-of-view catalog.


resolveFieldOfView

public List<StarDescription> resolveFieldOfView(StarDescription around,
                                                double view)
Uses the provided center of the field of view to retrieve star entries from the fieldcat catalog. This list is then considered the field-of-view. If the provided center is null, the main star is used.


isValid

public boolean isValid()
An object is valid if the main star is valid and the field-of-view is set.

Specified by:
isValid in interface UserAdjustable
Overrides:
isValid in class ElementHelper

setValue

public boolean setValue(String name,
                        Object value)
Setting one of the settable values re-directs it to setting the main star entry.

Specified by:
setValue in interface UserAdjustable
Overrides:
setValue in class ElementHelper
Returns:
The previuos value of the constant.

update

public boolean update()
Updates the variables. For an object helper, this means that the name of the main star is used to resolve all other data from simbad. All data that was specified is kept, only undefined values are overwrittn. The field of view is never updated, as the circular area is unknown.

Specified by:
update in interface UserAdjustable
Overrides:
update in class ElementHelper
Returns:
False, if update failed for whatever reason.

update

public boolean update(boolean simbad)
Updates the variables. For an object helper, this means that the name of the main star is used to resolve all other data from simbad. All data that was specified is kept, only undefined values are overwrittn. The field of view is never updated, as the circular area is unknown.

Parameters:
simbad - If true, always try to resolve with Simbad

getMain

public StarDescription getMain()
Returns the main star as a StarDescription object. The name used in the call to resolveObjectName(java.lang.String) is preserved.


setMain

public StarDescription setMain(String simbad)
Sets the main object using the resolveObjectName(java.lang.String) method.


setMain

public StarDescription setMain(StarDescription newmain)
Sets the main object as a StarDescription


getFieldOfView

public List<StarDescription> getFieldOfView()
Returns the field-of-view, the guide star being the first entry in the list. If constructed with resolveFieldOfView(astro.StarDescription, double), it is rather certain that no double entries exist.


setFieldOfView

public void setFieldOfView(StarDescription around,
                           double field)
Sets the field of view, using a center star and a circular field of view. If the central star is invalid, the main star is used, if it was set with setMain(java.lang.String).


setFieldOfView

public void setFieldOfView(List<StarDescription> field)
Sets the field of view if processed using non-default methods.


createObjectHelper

public static ObjectHelper createObjectHelper(Map<String,String> prop)
Creates a ElementHelper using the provided properties. If the properties do not contain a PropertySupplying.KEY_CLASS property the standard ElementHelper class is used. If one wants to create daughter classes of the ElementHelper, e.g. to provide GUI-enhanced functionality, the properties should contain a class entry of this telescope helper subclass.