ADDING HEYWHATSTHAT HORIZONS TO STARDROID    1/30/2012



Patches:   http://www.heywhatsthat.com/stardroid/horizon-patch/patch
New files: http://www.heywhatsthat.com/stardroid/horizon-patch/additions.tgz
2/15 new patch (apply after both of the above): http://www.heywhatsthat.com/stardroid/horizon-patch/patch-api-domain-name

apk:       http://www.heywhatsthat.com/stardroid/horizon-patch/Stardroid-debug.apk



NOTES
In the code, I have a few comments with "??" where I'm not
sure about something.  Also, don't be shy about pointing out
where you'd do things differently.  (Though I freely admit
that I store the horizons as parallel old-fashioned arrays
of azimuths and altitudes because I didn't have the patience
to create the appropriate objects; how big a sin is that?)

You get the horizon via the setting "True Horizon" in the
preferences menu. It opens a dialog that lets you send a
request to my server.  I'm deliberately making it a bit
obscure, and requiring a button rather than, say, a
checkbox, to moderate the hits on my server.  But I'm open
to other UI approaches.

I'd welcome my code being added to your canonical version of
the app (understanding that my server capacity does have its
limits).  All my code can stay under the Apache license,
though as I mention in some of my files, that doesn't mean
my web service will be available to everyone who uses the
code.  I have no idea if there are bigger legal issues here.

The "imports" might be screwy because I couldn't manage to
get the code into eclipse, so I did them manually; but it
does compile with ant.

Perhaps we should drop the horizon by 1/2 degree, because
atmospheric refraction at the horizon lets you see 1/2 degree
below the horizon??

To display the peak markers (inverted red triangles) I use
ImageSources, and found to get them displayed properly
I need to set the up direction to model.getNadir().  I think
many uses of ImageSource just want to display a 2D image
oriented with the screen, which argues for a subclass
of ImageSource that skips all the u/v stuff and just draws
a 2D image at the correct position.


MK
stardroid@heywhatsthat.com


PATCHES
control/AstronomerModel.java
control/AstronomerModelImpl.java
control/LocationController.java
  store location accuracy in addition to lat/lon

  The heywhatsthat mobile app won't run the computation unless you have
  a GPS fix.  I don't think that's as critical here, but I want to track
  the kind of fixes I'm getting to help me ultimatelty decide how to go.


control/AstronomerModel.java
control/AstronomerModelImpl.java
  return celestial coordinates for a given azimuth/altitude observation

  I explicitly give both true and magnetic versions (e.g. azimuths relative to
  True North or to magnetic North).  The True version is always correct;
  I'm frankly not sure what the Magnetic version should do if use_magnetic_correction
  is not set.  Or, for that matter, why anyone would ever unset use_magnetic_correction.


layers/AbstractSourceLayer.java
  bug fix: initialize() wasn't clearing out old sources

  (this only surfaces now because we may call initialize multiple times)


layers/HorizonLayer.java
  add notion of default (flat) horizon, and ability to change the Source


layers/LayerManager.java and stardroid/StardroidApplication.java
  our HwtDialogPreference needs a way to find the HorizonLayer,
  so added a find-by-id to the LayerManager and getLayerManager()
  to the application.

  Not sure whether preferenceId is the right attribute to use for this 


source/impl/LineSourceImpl.java
  just added a constructor


NEW FILES
res/drawable
  hwt_icon_50_50.png: my icon for the DialogPreference
  peak.png: a marker for the peaks in the horizon line

src/com/heywhatsthat/android/api/*
  HwtApiRequest and subclasses talk to the HeyWhatsThat server
  HwtHorizonData is class that holds (in just plain old arrays) the data for drawing a horizon
  HwtHorizonDataFromServer talks to server to get the data  

source/HwtHorizonSource.java
  draws a horizon from the data in a HwtHorizonData

views/HwtDialogPreference.java
  a dialog that lets user request the horizon
  (certainly open to other ways of doing it)