Class SourceCoordinates

java.lang.Object
skyview.request.SourceCoordinates
All Implemented Interfaces:
java.lang.Runnable

public class SourceCoordinates
extends java.lang.Object
implements java.lang.Runnable
Converts user input to coordinates and returns a position object that can be used to get a position in any coordinate system. The class attempts to handle most coordinate strings locally, but object name requests are sent to the HEASARC Object name resolver. Some more exotic coordinate strings may also be handled there.
  • Constructor Summary

    Constructors 
    Constructor Description
    SourceCoordinates​(java.lang.String s, java.lang.String csn, double equinox, java.lang.String resolver)
    Constructor
    SourceCoordinates​(java.lang.String lon, java.lang.String lat, java.lang.String coords)  
  • Method Summary

    Modifier and Type Method Description
    boolean convertToCoords()
    convert user input string to coords
    static SourceCoordinates factory​(java.lang.String s, java.lang.String csn, double equinox, java.lang.String resolver)  
    static SourceCoordinates factory​(java.lang.String lon, java.lang.String lat, java.lang.String coords)  
    Position getPosition()
    Get the position associated with these coordinates.
    java.lang.String heasarcResolve()
    Set up and send query to resolve source name
    static void main​(java.lang.String[] args)
    Test functionality.
    boolean parseCoords()
    extract coordinates that match coordinate system of user patch from query return
    void run()
    send query to resolve user input

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SourceCoordinates

      public SourceCoordinates​(java.lang.String s, java.lang.String csn, double equinox, java.lang.String resolver)
      Constructor
      Parameters:
      s - text entered as coordinates or object name
      csn - name of coordinate system
      equinox - equinox of coordinate system
      resolver - resolver to be used to resolve object name
    • SourceCoordinates

      public SourceCoordinates​(java.lang.String lon, java.lang.String lat, java.lang.String coords) throws java.lang.IllegalArgumentException
      Throws:
      java.lang.IllegalArgumentException
  • Method Details

    • factory

      public static SourceCoordinates factory​(java.lang.String s, java.lang.String csn, double equinox, java.lang.String resolver)
    • factory

      public static SourceCoordinates factory​(java.lang.String lon, java.lang.String lat, java.lang.String coords)
    • getPosition

      public Position getPosition()
      Get the position associated with these coordinates. /*----------------------------------------------------------------------
    • convertToCoords

      public boolean convertToCoords()
      convert user input string to coords
      Returns:
      true if coordinates were successfully resolved, false if not
    • run

      public void run()
      send query to resolve user input
      Specified by:
      run in interface java.lang.Runnable
    • parseCoords

      public boolean parseCoords()
      extract coordinates that match coordinate system of user patch from query return
    • heasarcResolve

      public java.lang.String heasarcResolve()
      Set up and send query to resolve source name
      Returns:
      unparsed return from HEASARC query
    • main

      public static void main​(java.lang.String[] args) throws java.lang.Exception
      Test functionality.
      Throws:
      java.lang.Exception