home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-03-05 | 50.1 KB | 1,809 lines |
- Newsgroups: comp.sources.x
- Path: uunet!think.com!mips!msi!dcmartin
- From: e_downey@hwking.cca.cr.rockwell.com (Elwood Downey)
- Subject: v16i112: xephem - astronomical ephemeris program., Part01/24
- Message-ID: <csx-16i112-xephem@uunet.UU.NET>
- Originator: dcmartin@fascet
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Organization: Molecular Simulations, Inc.
- Date: Fri, 6 Mar 1992 13:51:55 GMT
- Approved: dcmartin@msi.com
-
- Submitted-by: e_downey@hwking.cca.cr.rockwell.com (Elwood Downey)
- Posting-number: Volume 16, Issue 112
- Archive-name: xephem/part01
-
- # This is a shell archive (produced by shar 3.49)
- # To extract the files from this archive, save it to a file, remove
- # everything above the "!/bin/sh" line above, and type "sh file_name".
- #
- # made 03/06/1992 13:48 UTC by dcmartin@fascet
- # Source directory /home/fascet/csx/todo/xephem
- #
- # existing files will NOT be overwritten unless -c is specified
- #
- # This is part 1 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 4774 -rw-r--r-- README
- # 12887 -rw-r--r-- xephem.1X
- # 2941 -rw-r--r-- Manifest
- # 1863 -rw-r--r-- Makefile
- # 1249 -rw-r--r-- XEphem
- # 146 -rw-r--r-- ephem.cfg
- # 1922 -rw-r--r-- aa_hadec.c
- # 15399 -rw-r--r-- altaz.c
- # 901 -rw-r--r-- anomaly.c
- # 3113 -rw-r--r-- cal_mjd.c
- # 10858 -rw-r--r-- circum.c
- # 2390 -rw-r--r-- comet.c
- # 16567 -rw-r--r-- compiler.c
- # 20026 -rw-r--r-- constel.c
- # 24197 -rw-r--r-- datamenu.c
- # 1899 -rw-r--r-- eq_ecl.c
- # 3268 -rw-r--r-- flog.c
- # 8556 -rw-r--r-- formats.c
- # 5658 -rw-r--r-- help.c
- # 17844 -rw-r--r-- jupmenu.c
- # 13788 -rw-r--r-- listing.c
- # 36543 -rw-r--r-- mainmenu.c
- # 5143 -rw-r--r-- moon.c
- # 12318 -rw-r--r-- moonmenu.c
- # 1557 -rw-r--r-- moonnf.c
- # 2011 -rw-r--r-- nutation.c
- # 41488 -rw-r--r-- obj.c
- # 421 -rw-r--r-- obliq.c
- # 2301 -rw-r--r-- parallax.c
- # 4797 -rw-r--r-- pelement.c
- # 17647 -rw-r--r-- plans.c
- # 28540 -rw-r--r-- plot.c
- # 9197 -rw-r--r-- plot_aux.c
- # 2952 -rw-r--r-- precess.c
- # 2191 -rw-r--r-- query.c
- # 1691 -rw-r--r-- reduce.c
- # 1857 -rw-r--r-- refract.c
- # 4591 -rw-r--r-- riset.c
- # 8189 -rw-r--r-- riset_c.c
- # 23357 -rw-r--r-- risetmenu.c
- # 23823 -rw-r--r-- sepmenu.c
- # 1183 -rw-r--r-- sex_dec.c
- # 15221 -rw-r--r-- skydome.c
- # 18782 -rw-r--r-- solarsys.c
- # 26324 -rw-r--r-- srch.c
- # 1760 -rw-r--r-- sun.c
- # 3230 -rw-r--r-- time.c
- # 1189 -rw-r--r-- utc_gst.c
- # 14200 -rw-r--r-- version.c
- # 20532 -rw-r--r-- xephem.c
- # 620 -rw-r--r-- astro.h
- # 2856 -rw-r--r-- circum.h
- # 1165 -rw-r--r-- fieldmap.h
- # 307 -rw-r--r-- moreobjs.h
- # 289 -rw-r--r-- patchlevel.h
- # 40159 -rw-r--r-- xephem.hlp
- # 390760 -rw-r--r-- ephem.db
- # 180275 -rw-r--r-- smallfm.xbm
- #
- if test -r _shar_seq_.tmp; then
- echo 'Must unpack archives in sequence!'
- echo Please unpack part `cat _shar_seq_.tmp` next
- exit 1
- fi
- # ============= README ==============
- if test -f 'README' -a X"$1" != X"-c"; then
- echo 'x - skipping README (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting README (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'README' &&
- Welcome to xephem:
- X
- XXephem is an interactive astronomical ephemeris program. It has built-in
- support for all planets plus support for arbitrary objects given their
- heliocentric orbital elements. It generates tabular and schematic views, and
- can plot and search for user-defined circumstances. It is a descendent of
- ephem, the same program originally designed in the late 80's for dumb terminals.
- X
- There is only a small manual, but there is quite a lot of help. So, the first
- thing to do is to build xephem - see below - then start picking the Help
- buttons.
- X
- Note for you ephem users: the configuration and database files, ephem.cfg and
- ephem.db, remain compatible.
- X
- The release level is contained in a string constant in version.c. All patches
- will update this string.
- X
- Building notes:
- X
- Select from two methods of dealing with time from the operating system with
- the TZA/TZB defines in time.c. If you get link undefines related to time
- functions, don't panic; just try changing to the other form. Most AT&T
- derivatives seem to want TZA. On Sun systems running OS 4.0.3 (or BSD 4.3) or
- Apollo SR 10.1 use TZB and change <time.h> to <sys/time.h>.
- X
- Have a look at the Makefile and set up things there like you would for any
- XX11R4/Motif1.1 project on your system: compile everything with the Motif
- include files and link it with the X and Motif libraries; and don't forget
- the math library, -lm. A DCL file to build xephem for VMS/DECWindows MOTIF
- is included at the end of this file.
- X
- Now, make xephem. Everything is in .c and .h files except note that moonmenu.c
- includes a moon bitmap named smallfm.xbm.
- X
- There are fallback resources included in the main program so don't worry about
- putting XEphem anywhere for now. If you set a different font, the many tabular
- displays will work best with one that is fixed width, such as courier.
- X
- Now, go ahead and run xephem and read some of the Help entries. Soon, you will
- want to edit ephem.cfg, the file that contains location information and a few
- other things.
- X
- Let me know what you think!
- Elwood Downey, e_downey@hwking.cca.cr.rockwell.com
- X
- Finally, for your information:
- X
- The following files are pretty much just pure transliterations from BASIC
- into C from machine-readable copies of the programs in Duffett-Smith's book.
- They have nothing to do with the rest of ephem so they may be used for
- completely different applications if so desired.
- X
- X aa_hadec.c anomaly.c astro.h cal_mjd.c comet.c eq_ecl.c moon.c moonnf.c
- X nutation.c obliq.c parallax.c pelement.c plans.c reduce.c refract.c
- X sex_dec.c sun.c utc_gst.c
- X
- If you would like to gut ephem for just its astronomical functionality, start
- with body_cir().
- X
- The following DCL file will build xephem for VMS/DECwindows MOTIF, courtesy
- Ethan VanMatre:
- X
- $!
- $! Makefile.com -- Command file to compile and link Xephem
- $!
- $!
- $! A simple minded command file to compile and link Xephem under VAX/VMS
- $! and DECwindows MOTIF
- $!
- $! when who what
- $!
- $! 2-feb-1992 Ethan VanMatre original from unix makefile
- $!
- $
- $ cc aa_hadec/opt/obj
- $ cc altaz /opt/obj
- $ cc anomaly /opt/obj
- $ cc cal_mjd /opt/obj
- $ cc circum /opt/obj
- $ cc comet /opt/obj
- $ cc compiler/opt/obj
- $ cc constel /opt/obj
- $ cc datamenu/opt/obj
- $ cc eq_ecl /opt/obj
- $ cc flog /opt/obj
- $ cc formats /opt/obj
- $ cc help /opt/obj
- $ cc jupmenu /opt/obj
- $ cc listing /opt/obj
- $ cc mainmenu/opt/obj
- $ cc moon /opt/obj
- $ cc moonmenu/opt/obj
- $ cc moonnf /opt/obj
- $ cc nutation/opt/obj
- $ cc obj /opt/obj
- $ cc obliq /opt/obj
- $ cc parallax/opt/obj
- $ cc pelement/opt/obj
- $ cc plans /opt/obj
- $ cc plot /opt/obj
- $ cc plot_aux/opt/obj
- $ cc precess /opt/obj
- $ cc query /opt/obj
- $ cc reduce /opt/obj
- $ cc refract /opt/obj
- $ cc riset /opt/obj
- $ cc riset_c /opt/obj
- $ cc risetmenu/opt/obj
- $ cc sepmenu /opt/obj
- $ cc sex_dec /opt/obj
- $ cc skydome /opt/obj
- $ cc solarsys/opt/obj
- $ cc srch /opt/obj
- $ cc sun /opt/obj
- $ cc time /opt/obj
- $ cc utc_gst /opt/obj
- $ cc version /opt/obj
- $ cc xephem /opt/obj
- $!
- $ LINK xephem.obj, -
- X aa_hadec.obj, -
- X altaz.obj, -
- X anomaly.obj, -
- X cal_mjd.obj, -
- X circum.obj, -
- X comet.obj, -
- X compiler.obj, -
- X constel.obj, -
- X datamenu.obj, -
- X eq_ecl.obj, -
- X flog.obj, -
- X formats.obj, -
- X help.obj, -
- X jupmenu.obj, -
- X listing.obj, -
- X mainmenu.obj, -
- X moon.obj, -
- X moonmenu.obj, -
- X moonnf.obj, -
- X nutation.obj, -
- X obj.obj, -
- X obliq.obj, -
- X parallax.obj, -
- X pelement.obj, -
- X plans.obj, -
- X plot.obj, -
- X plot_aux.obj, -
- X precess.obj, -
- X query.obj, -
- X reduce.obj, -
- X refract.obj, -
- X riset.obj, -
- X riset_c.obj, -
- X risetmenu.obj, -
- X sepmenu.obj, -
- X sex_dec.obj, -
- X skydome.obj, -
- X solarsys.obj, -
- X srch.obj, -
- X sun.obj, -
- X time.obj, -
- X utc_gst.obj, -
- X version.obj, -
- X sys$input/opt
- sys$share:decw$dxmlibshr/share
- sys$share:decw$xmlibshr/share
- sys$share:decw$xlibshr/share
- sys$share:vaxcrtl/share
- $!
- $!clean:
- $ purge
- $!
- SHAR_EOF
- chmod 0644 README ||
- echo 'restore of README failed'
- Wc_c="`wc -c < 'README'`"
- test 4774 -eq "$Wc_c" ||
- echo 'README: original size 4774, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= xephem.1X ==============
- if test -f 'xephem.1X' -a X"$1" != X"-c"; then
- echo 'x - skipping xephem.1X (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting xephem.1X (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'xephem.1X' &&
- .TH xephem 1X
- .SH Name
- xephem \- an interative astronomical ephemeris for X
- .SH Syntax
- \fBxephem\fP [ \fIoptions\fP ]
- .SH Description
- .PP
- .B Xephem
- is a program that displays ephemerides for all the planets, some moons,
- plus any two additional objects. The additional objects may be fixed or
- specified via heliocentric elliptical, hyperbolic or parabolic orbital
- elements to accommodate solar system objects such as asteroids or comets.
- X
- Information displayed about each object includes RA and Dec precessed to any
- epoch, local azimuth and altitude, heliocentric coordinates, distance from
- sun and earth, solar elongation, angular size, visual magnitude, illumination
- percentage, local rise, transit and set times, length of time up,
- constellation, and angular separations between all combinations of objects.
- A special detail of Earth's moon and and Jupiter's moons and central meridian
- longitude is also available.
- X
- Observing circumstance information includes UTC and local date and time,
- local sidereal time, times of astronomical twilight, length of day and night,
- local temperature, pressure and height above sea level for the refraction
- model and a monthly calendar.
- X
- RA/Dec calculations are geocentric and include the effects of light travel
- time, nutation, aberration and precession. Alt/az and rise/set/transit and,
- optionally, angular separation calculations are topocentric and include the
- additional effects of parallax and refraction.
- X
- Plot and listing files of selected field values may be generated as the
- program runs. The plot files are full precision floating point values in
- ASCII intended for export to other plotting programs. The listing files are
- tables formatted for more general human reading. Xephem includes simple
- quick-look facilities to view plot files.
- X
- One may also watch the sky or the solar system with simple dots displays.
- X
- XXephem may be asked to search for interesting conditions automatically, using
- several algorithms. Most fields displayed on the screens may be used as terms
- in an arbitrary arithmetic expression that can be solved for local zero or
- extrema, or the time of state change of any boolean expression can be found.
- X
- Finally, xephem contains extensive on-line help. Much of that help is not
- duplicated here, so go ahead and run xephem to learn more.
- .SH Options
- .PP
- The following options unique to xephem are supported in addition to the
- usual options for any X program.
- Be sure that all options unique to xephem follow the generic X options.
- .PP
- .B \-c \fIconfig_file\fP
- specifies the name of an alternate configuration file to use.
- The default is ephem.cfg in the current directory.
- This may also be set using the
- .I EPHEMCFG
- environment variable.
- .PP
- .B \-d \fIdb_file\fP
- specifies the name of an alternate database file to use.
- The default is ephem.db in the current directory.
- This may also be set using the
- .I EPHEMDB
- environment variable.
- .PP
- .B \-h \fIhelp_file\fP
- specifies the name of an alternate help file to use.
- The default is xephem.hlp in the current directory.
- This may also be set using the
- .I XEPHEMHELP
- environment variable.
- .PP
- Also, all of the variables that may be set from the configuration file can also
- be set from the command line. This is done in the form KEYWORD=VALUE; be sure
- to quote any meta characters from your shell. See the help on Initialization
- available from within the
- .B xephem
- main menu for the list if available keywords and values.
- .PP
- .SH Files
- .PP
- XXephem uses three auxiliary files: an initial configuration, an object data
- base and the help text.
- .PP
- The default name of the configuration file is
- .I ephem.cfg,
- in the current directory.
- This name can also be set using the -c command line argument or by defining
- the EPHEMCFG environment variable.
- Details of the configuration file format may be found in the main on-line help
- for "Initialization".
- .PP
- The default name of the database file is
- .I ephem.db,
- in the current directory.
- This name can also be set using the -d command line argument or by defining
- the EPHEMDB environment variable.
- Details of the
- database file may be found in the on-line help from the "ObjX/Y" dialog.
- .PP
- The default name of the help file is
- .I xephem.hlp,
- in the current directory.
- This name can also be set using the -h command line argument or by defining
- the XEPHEMHELP environment variable.
- .SH Menus
- .PP
- The
- .B xephem
- application contains the following menus:
- .sp 6p
- .nf
- File
- View
- Control
- ObjX/Y
- Help
- .fi
- .SH File menu
- .PP
- The
- .I File
- menu contains the following items:
- .IP Quit 20
- Ends
- .B xephem.
- .SH View menu
- .PP
- The
- .I View
- menu contains the following items:
- .IP "General Data" 20
- Displays a table of miscellaneous planet and object statistics.
- .IP "Rise/Set" 20
- Displays a table of rise and set times and azimuths and transit times
- and altitudes.
- .IP "Separations" 20
- Displays a matrix of the angular separations between all pairs of objects.
- .IP "Jupiter" 20
- Displays the Jovian central meridian longitude and
- the locations of each Galilean moon.
- The latter are also shown in schematic form.
- .IP "Moon" 20
- Displays a pixmap image of the moon, properly shaded for current phase.
- An alternate schematic view is also selectable.
- .IP "Sky dome" 20
- Displays a schematic representation of the objects, shown as a dome as in the
- center fold of Sky and Telescope.
- .IP "Alt/Az sky" 20
- Displays a schematic representation of the objects, shown as a rectangular
- altitude-azimuth display.
- .IP "Solar system" 20
- Displays a schematic representation of the solar system. The center is always
- the Sun and the eye can be positioned at any desired location.
- .SH Control menu
- .PP
- The
- .I Control
- menu contains the following items:
- .IP Plot 20
- Brings up a dialog allowing data to be saved in a file and later plotted.
- .IP Listing 20
- Brings up a dialog allowing data to be saved in a file in tabular format
- suitable for human consumption.
- .IP Search 20
- Brings up a dialog that controls the search facility of
- .B xephem.
- Arbitrary mathematic functions can be built up from the available displayed
- information, and searches conducted automatically for 0 or maxima of the
- function.
- .SH ObjX/Y Menu
- .PP
- The
- .I ObjX/Y
- selection displays a dialog that allows the two user-defined objects to be
- defined.
- The objects may be defined in terms of their heliocentric orbital elements
- or be fixed objects.
- The descriptive parameters may be entered individually
- or set by making a selection from the database file.
- .SH Help
- .PP
- The
- .I Help
- menu contains the following items:
- .PP
- .IP "on Version" 20
- Displays the current version of xephem, the copyright notice and a dynamic logo.
- .IP "on References" 20
- Displays the reference material used in the construction of xephem.
- .IP "Introduction" 20
- Displays background information about xephem. This is basically the same
- information as appears in the initial portion of this manual page.
- .IP "on Initialization" 20
- Displays information about where are how xephem uses command line and
- configuration file information when it is started.
- .IP "on Operation" 20
- Displays how xephem operates in terms of controlling its automatic looping
- and when time increments are performed.
- .IP "on Date and time" 20
- Displays information on the format of date and time fields in xephem.
- .IP "Notes" 20
- Display miscellaneous information about xephem, such as assumptions, known
- bugs and a wish list of features.
- .SH Resources
- .PP
- The
- .B xephem
- application contains fall-back resources and so requires no special
- resource initialization.
- For reference, a sample XEphem defaults file is
- included with the xephem distribution and
- the widget hierarchy is included in this manual page.
- .PP
- The 10 colors used for plotting are in resources named plotColor[0-9].
- If any color is not so defined or can not be allocated, PlotDA.foreground
- is used.
- .SH Widget Hierarchy
- .nf
- AppShell XEphem
- X MainWindow xephem_main
- X MenuBar menu_bar
- X PulldownMenu file_pane
- X PushButton Quit
- X CascadeButton File
- X PulldownMenu view_pane
- X PushButton GenData
- X PushButton RiSet
- X PushButton Separations
- X Separator ViewSep1
- X PushButton Jupiter
- X PushButton Moon
- X Separator ViewSep2
- X PushButton SkyDome
- X PushButton AltAz
- X PushButton SolSys
- X CascadeButton View
- X PulldownMenu control_pane
- X PushButton Plot
- X PushButton Listing
- X PushButton Search
- X CascadeButton Control
- X CascadeButton ObjX/Y
- X PulldownMenu help_pane
- X PushButton onVersion
- X PushButton onReferences
- X PushButton Introduction
- X PushButton onInitialization
- X PushButton onOperation
- X PushButton onDate
- X PushButton Notes
- X CascadeButton Help
- X Form MainForm
- X PushButton MainButton (many)
- X Label MainLabel (many)
- X Label NewCir
- X PushButton Update
- X Label Status
- X Separator MainCol1
- X Separator MainCol2
- X Separator MainCol3
- X Label Calendar (many)
- X FormDialog Data
- X PushButton DataButton (many)
- X LabelGadget DataLabel (many)
- X ToggleButtonGadget DmObjs (many)
- X PushButtonGadget DataClose
- X PushdButtonGadget DataToggle
- X PushButtonGadget DataHelp
- X FormDialog Riset
- X PushButtonGadget RisetButton (many)
- X LabelGadget RisetLabel (many)
- X ToggleButtonGadget RmObjs (many)
- X PushButtonGadget RisetClose
- X RadioBox HznRadioBox
- X ToggleButtonGadget AdpHznTB
- X ToggleButtonGadget StdHznTB
- X PushdButtonGadget RisetToggle
- X PushButtonGadget RisetHelp
- X FormDialog Separation
- X PushButtonGadget SepButton (many)
- X LabelGadget SepLabel (many)
- X ToggleButtonGadget SmObjs (many)
- X PushButtonGadget SepClose
- X RadioBox CentricRadioBox
- X ToggleButtonGadget TopocentricTB
- X ToggleButtonGadget GeocentricTB
- X PushdButtonGadget SepToggle
- X PushButtonGadget SepHelp
- X FormDialog Jupiter
- X PushButtonGadget JupButton (many)
- X LabelGadget JupLabel (many)
- X PushButtonGadget JupClose
- X Frame JupFrame
- X DrawingArea JupMap
- X FormDialog MoonForm
- X ToggleButtonGadget MEShine
- X ToggleButtonGadget MMapView
- X PushdButtonGadget MClose
- X Frame MoonFrame
- X DrawingArea MoonDA
- X FormDialg SkyDome
- X PushdButtonGadget SDClose
- X ToggleButtonGadget SDBigDots
- X PushdButtonGadget SDToggle
- X ToggleButtonGadget SDTrails
- X ToggleButtonGadget SDPropts (many)
- X LabelGadget SDPickedName
- X LabelGadget North
- X LabelGadget E
- X LabelGadget W
- X LabelGadget South
- X DrawingArea SkyDomeMap
- X FormDialg AltAz
- X PushdButtonGadget AAClose
- X ToggleButtonGadget AABigDots
- X PushdButtonGadget AAToggle
- X ToggleButtonGadget AATrails
- X ToggleButtonGadget AAPropts (many)
- X LabelGadget AAPickedName
- X LabelGadget N
- X LabelGadget E
- X LabelGadget S
- X LabelGadget W
- X LabelGadget N
- X LabelGadget Zenith
- X Frame AltAzFrame
- X DrawingArea AltAzMap
- X FormDialog SolarSystem
- X PushdButtonGadget SSClose
- X PushdButtonGadget SSHelp
- X ToggleButtonGadget SSToggle
- X ToggleButtonGadget SSBigDots
- X ToggleButtonGadget SSTrails
- X ToggleButtonGadget SSPropts (many)
- X LabelGadget SSPickedName
- X Scale HLongScale
- X Scale SSScale
- X Scale HLatScale
- X Frame SolarFrame
- X DrawingArea SolarMap
- X FormDialog Plot - the plot control dialog
- X ToggleButtonGadget PlotSelect
- X ToggleButtonGadget PlotActive
- X ToggleButtonGadget PlotShow
- X PushButtonGadget PlotClose
- X PushButtonGadget PlotHelp
- X Text PlotFilename
- X LabelGadget PlotFnL
- X Text PlotTitle
- X LabelGadget PlotTL
- X LabelGadget PlotPrompt
- X LabelGadget Tag
- X LabelGadget X
- X LabelGadget Z
- X Text PlotTag (many)
- X LabelGadget PlotX (many)
- X LabelGadget PlotY (many)
- X FormDialog PlotD - the dialog containing the actual plot
- X PushButtonGadget Close
- X DrawingArea PlotDA
- X ToggleButtonGadget DAFlipX
- X ToggleButtonGadget DAFlipY
- X ToggleButtonGadget DAGrid
- X FormDialog List
- X ToggleButtonGadget ListSelect
- X ToggleButtonGadget ListActive
- X PushButtonGadget ListClose
- X PushButtonGadget ListHelp
- X Text ListFilename
- X LabelGadget ListFnL
- X Text ListTitle
- X LabelGadget ListTL
- X LabelGadget ListPrompt
- X LabelGadget ListLabel (many)
- X FormDialog Srch
- X SeparatorGadget SrchSep1
- X ToggleButtonGadget On
- X Frame SrchGoalRadioBoxFrame
- X RadioBox SrchGoalRadioBox
- X ToggleButtonGadget SrchExtreme
- X ToggleButtonGadget Srch0
- X ToggleButtonGadget SrchBinary
- X SeparatorGadget SrchSep2
- X LabelGadget SrchAccL
- X PushButtonGadget SrchAcc
- X SeparatorGadget SrchSep3
- X ToggleButtonGadget SrchFields
- X PushButtonGadget SrchCompile
- X Text SrchFunction
- X LabelGadget SrchErrsL
- X PushButtonGadget SrchUse
- X LabelGadget SrchValuL
- X LabelGadget SrchValu
- X PushButtonGadget SrchHelp
- X PushButtonGadget SrchClose
- X FormDialog Obj
- X PushButtonGadget ObjHelp
- X PushButtonGadget Lookup
- X ScrolledList ScrolledList
- X RadioBox ObjXYRadioBox
- X ToggleButtonGadget ObjX
- X ToggleButtonGadget ObjY
- X RadioBox ObjTypeRadioBox
- X ToggleButtonGadget Fixed
- X ToggleButtonGadget Elliptical
- X ToggleButtonGadget Hyperbolic
- X ToggleButtonGadget Parabolic
- X PushButtonGadget ObjClose
- X PushButtonGadget ObjButton (many)
- X PushButtonGadget <fields> (many)
- X FormDialog HelpD
- X PushButton HelpC
- X ScrolledText HelpST
- .SH Author
- .PP
- Elwood Downey
- .SH See also
- .PP
- Ephem, the ancestor of xephem suitable for "dumb" 24x80 character displays.
- SHAR_EOF
- chmod 0644 xephem.1X ||
- echo 'restore of xephem.1X failed'
- Wc_c="`wc -c < 'xephem.1X'`"
- test 12887 -eq "$Wc_c" ||
- echo 'xephem.1X: original size 12887, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Manifest ==============
- if test -f 'Manifest' -a X"$1" != X"-c"; then
- echo 'x - skipping Manifest (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Manifest (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Manifest' &&
- Makefile just say "make"
- Manifest this file.
- README check here for hints before building.
- XXEphem defaults file (basically the same as fallback ones in xephem.c)
- ephem.cfg initialization file
- ephem.db database file
- xephem.1X manual page, written with the nroff -man macros.
- X
- The source files:
- aa_hadec.c convert between alt/az and hour angle/dec.
- altaz.c manage the alt/az menu.
- anomaly.c compute anomaly.
- astro.h unit conversion macros and planet defines.
- cal_mjd.c converters to and from modified julian date.
- circum.c main "astronomy" entry point that finds where anything is.
- circum.h defines Now and Sky structures.
- comet.c compute comet position from elements.
- compiler.c compile and execute general expressions with screen fields.
- constel.c handles determing and printing constellation info.
- datamenu.c manage the general data menu.
- eq_ecl.c convert between equitorial and eclipitic coords.
- fieldmap.h typedef to describe dialog layouts.
- flog.c logs and retrieves screen locations for logging purposes.
- formats.c basic date, time, prompts, etc formats.
- help.c manage the help menu and supporting text file.
- jupmenu.c manage the jupiter moon map menu.
- listing.c manage the listing control menu.
- mainmenu.c manage the main menu.
- moon.c compute moon position.
- moonmenu.c manage the moon display menu.
- moonnf.c compute new and full moon dates.
- moreobjs.h aux include to astro.h.
- nutation.c compute nutation correction.
- obj.c manage the objx/y menu and the database file.
- obliq.c compute obliquity.
- parallax.c functions to compute earth rim parallax correction.
- pelement.c basic planet position polynomial coefficients.
- plans.c use polynomials to find planet location at any certain time.
- plot.c manage the plot control menu and write supporting files.
- plot_aux.c manage the actual plotting menu and read supporting files.
- precess.c compute precession correction.
- query.c general purpose menu query tool.
- reduce.c convert elliptical elements from one epoch to another.
- refract.c atmospheric refraction model.
- riset.c find basic rise/set sideral times of a fixed object.
- riset_c.c iteratively solve for local rise/set times of moving objects.
- risetmenu.c manage the rise/set menu.
- sepmenu.c manage the separations menu.
- sex_dec.c convert between sexagesimal and decimal notation.
- skydome.c manage the circular sky dome menu.
- smallfm.xbm moon bitmap.
- solarsys.c manage the solar system menu.
- srch.c manage the search control menu.
- sun.c compute location of sun at any time.
- time.c manage setting and getting the time from the os
- utc_gst.c convert between UT1 and Greenwich sidereal time
- version.c current version notice, and revision history comments.
- xephem.c main() and misc minor support utility functions.
- xephem.hlp help text file.
- SHAR_EOF
- chmod 0644 Manifest ||
- echo 'restore of Manifest failed'
- Wc_c="`wc -c < 'Manifest'`"
- test 2941 -eq "$Wc_c" ||
- echo 'Manifest: original size 2941, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= Makefile ==============
- if test -f 'Makefile' -a X"$1" != X"-c"; then
- echo 'x - skipping Makefile (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting Makefile (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
- CFLAGS = -D_NO_PROTO -I/usr/include/X11 -O
- LIBS = -lXm -lXt -lX11 -lm
- X
- .PRECIOUS: xephem
- X
- XXEPHEM= aa_hadec.o \
- X altaz.o \
- X anomaly.o \
- X cal_mjd.o \
- X circum.o \
- X comet.o \
- X compiler.o \
- X constel.o \
- X datamenu.o \
- X eq_ecl.o \
- X flog.o \
- X formats.o \
- X help.o \
- X jupmenu.o \
- X listing.o \
- X mainmenu.o \
- X moon.o \
- X moonmenu.o \
- X moonnf.o \
- X nutation.o \
- X obj.o \
- X obliq.o \
- X parallax.o \
- X pelement.o \
- X plans.o \
- X plot.o \
- X plot_aux.o \
- X precess.o \
- X query.o \
- X reduce.o \
- X refract.o \
- X riset.o \
- X riset_c.o \
- X risetmenu.o \
- X sepmenu.o \
- X sex_dec.o \
- X skydome.o \
- X solarsys.o \
- X srch.o \
- X sun.o \
- X time.o \
- X utc_gst.o \
- X version.o \
- X xephem.o
- X
- xephem: $(XEPHEM)
- X $(CC) $(LDFLAGS) -o $@ $(XEPHEM) $(LIBS)
- X
- clean:
- X rm -f $(XEPHEM)
- X
- clobber: clean
- X rm -f xephem
- X
- X
- aa_hadec.o: astro.h
- X
- altaz.o: astro.h circum.h moreobjs.h
- X
- anomaly.o: astro.h
- X
- cal_mjd.o: astro.h
- X
- circum.o: astro.h circum.h moreobjs.h
- X
- comet.o: astro.h
- X
- compiler.o: fieldmap.h
- X
- constel.o: astro.h
- X
- datamenu.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- eq_ecl.o: astro.h
- X
- formats.o: astro.h
- X
- jupmenu.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- listing.o: fieldmap.h
- X
- mainmenu.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- moon.o: astro.h
- X
- moonmenu.o: astro.h circum.h moreobjs.h smallfm.xbm
- X
- moonnf.o: astro.h
- X
- nutation.o: astro.h
- X
- obj.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- obliq.o: astro.h
- X
- parallax.o: astro.h
- X
- pelement.o: astro.h
- X
- plans.o: astro.h
- X
- plot.o: fieldmap.h
- X
- precess.o: astro.h
- X
- reduce.o: astro.h
- X
- refract.o: astro.h
- X
- riset.o: astro.h
- X
- riset_c.o: astro.h circum.h moreobjs.h
- X
- risetmenu.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- sepmenu.o: fieldmap.h astro.h circum.h moreobjs.h
- X
- skydome.o: astro.h circum.h moreobjs.h
- X
- solarsys.o: astro.h circum.h moreobjs.h
- X
- srch.o: fieldmap.h
- X
- sun.o: astro.h
- X
- time.o: astro.h circum.h
- X
- utc_gst.o: astro.h
- X
- version.o: astro.h circum.h moreobjs.h patchlevel.h
- X
- SHAR_EOF
- chmod 0644 Makefile ||
- echo 'restore of Makefile failed'
- Wc_c="`wc -c < 'Makefile'`"
- test 1863 -eq "$Wc_c" ||
- echo 'Makefile: original size 1863, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= XEphem ==============
- if test -f 'XEphem' -a X"$1" != X"-c"; then
- echo 'x - skipping XEphem (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting XEphem (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'XEphem' &&
- XXEphem*traversalOn: false
- X
- XXEphem*highlightOnEnter: false
- XXEphem*highlightThickness: 0
- X
- XXEphem*XmText*traversalOn: true
- XXEphem*XmText*highlightOnEnter: false
- XXEphem*XmText*highlightThickness: 0
- X
- XXEphem*xephem_main.x: 50
- XXEphem*xephem_main.y: 50
- XXEphem*Data.x: 100
- XXEphem*Data.y: 200
- XXEphem*Riset.x: 150
- XXEphem*Riset.y: 250
- XXEphem*Separation.x: 200
- XXEphem*Separation.y: 300
- XXEphem*Jupiter.x: 100
- XXEphem*Jupiter.y: 200
- XXEphem*SkyDome.x: 150
- XXEphem*SkyDome.y: 250
- XXEphem*AltAz.x: 200
- XXEphem*AltAz.y: 300
- XXEphem*SolarSystem.x: 250
- XXEphem*SolarSystem.y: 350
- XXEphem*Plot.x: 100
- XXEphem*Plot.y: 200
- XXEphem*List.x: 150
- XXEphem*List.y: 250
- XXEphem*Srch.x: 200
- XXEphem*Srch.y: 300
- XXEphem*MoonForm.x: 200
- XXEphem*MoonForm.y: 200
- X
- XXEphem*foreground: #fce089
- XXEphem*background: #7c8498
- X
- XXEphem*fontList: fixed
- X
- XXEphem*JupMap*background: navy
- XXEphem*JupMap*foreground: snow
- XXEphem*AltAzMap*background: navy
- XXEphem*AltAzMap*foreground: snow
- XXEphem*SolarMap*background: navy
- XXEphem*SolarMap*foreground: snow
- XXEphem*SkyDomeMap*background: navy
- XXEphem*SkyDomeMap*foreground: snow
- XXEphem*PlotDA*foreground: #fce089
- XXEphem*PlotDA*background: navy
- XXEphem*MoonDA*foreground: snow
- XXEphem*MoonDA*background: navy
- XXEphem*VMap*foreground: snow
- XXEphem*VMap*background: navy
- SHAR_EOF
- chmod 0644 XEphem ||
- echo 'restore of XEphem failed'
- Wc_c="`wc -c < 'XEphem'`"
- test 1249 -eq "$Wc_c" ||
- echo 'XEphem: original size 1249, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= ephem.cfg ==============
- if test -f 'ephem.cfg' -a X"$1" != X"-c"; then
- echo 'x - skipping ephem.cfg (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting ephem.cfg (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ephem.cfg' &&
- UT=Now
- LONG=91:40:0
- LAT=41:51:0
- HEIGHT=800
- TEMP=60
- PRES=29.5
- STPSZ=RTC
- PROPTS=TSMevmjsunpxy
- EPOCH=2000
- NSTEP=1
- PAUSE=60
- X
- OBJX=Mueller
- OBJY=Gaspra
- SHAR_EOF
- chmod 0644 ephem.cfg ||
- echo 'restore of ephem.cfg failed'
- Wc_c="`wc -c < 'ephem.cfg'`"
- test 146 -eq "$Wc_c" ||
- echo 'ephem.cfg: original size 146, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= aa_hadec.c ==============
- if test -f 'aa_hadec.c' -a X"$1" != X"-c"; then
- echo 'x - skipping aa_hadec.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting aa_hadec.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'aa_hadec.c' &&
- #include <stdio.h>
- #include <math.h>
- #include "astro.h"
- X
- /* given latitude (n+, radians), lat, altitude (up+, radians), alt, and
- X * azimuth (angle round to the east from north+, radians),
- X * return hour angle (radians), ha, and declination (radians), dec.
- X */
- aa_hadec (lat, alt, az, ha, dec)
- double lat;
- double alt, az;
- double *ha, *dec;
- {
- X aaha_aux (lat, az, alt, ha, dec);
- }
- X
- /* given latitude (n+, radians), lat, hour angle (radians), ha, and declination
- X * (radians), dec,
- X * return altitude (up+, radians), alt, and
- X * azimuth (angle round to the east from north+, radians),
- X */
- hadec_aa (lat, ha, dec, alt, az)
- double lat;
- double ha, dec;
- double *alt, *az;
- {
- X aaha_aux (lat, ha, dec, az, alt);
- }
- X
- /* the actual formula is the same for both transformation directions so
- X * do it here once for each way.
- X * N.B. all arguments are in radians.
- X */
- static
- aaha_aux (lat, x, y, p, q)
- double lat;
- double x, y;
- double *p, *q;
- {
- X static double lastlat = -1000.;
- X static double sinlastlat, coslastlat;
- X double sy, cy;
- X double sx, cx;
- X double sq, cq;
- X double a;
- X double cp;
- X
- X /* latitude doesn't change much, so try to reuse the sin and cos evals.
- X */
- X if (lat != lastlat) {
- X sinlastlat = sin (lat);
- X coslastlat = cos (lat);
- X lastlat = lat;
- X }
- X
- X sy = sin (y);
- X cy = cos (y);
- X sx = sin (x);
- X cx = cos (x);
- X
- /* define GOODATAN2 if atan2 returns full range -PI through +PI.
- X */
- #ifdef GOODATAN2
- X *q = asin ((sy*sinlastlat) + (cy*coslastlat*cx));
- X *p = atan2 (-cy*sx, -cy*cx*sinlastlat + sy*coslastlat);
- #else
- #define EPS (1e-20)
- X sq = (sy*sinlastlat) + (cy*coslastlat*cx);
- X *q = asin (sq);
- X cq = cos (*q);
- X a = coslastlat*cq;
- X if (a > -EPS && a < EPS)
- X a = a < 0 ? -EPS : EPS; /* avoid / 0 */
- X cp = (sy - (sinlastlat*sq))/a;
- X if (cp >= 1.0) /* the /a can be slightly > 1 */
- X *p = 0.0;
- X else if (cp <= -1.0)
- X *p = PI;
- X else
- X *p = acos ((sy - (sinlastlat*sq))/a);
- X if (sx>0) *p = 2.0*PI - *p;
- #endif
- }
- SHAR_EOF
- chmod 0644 aa_hadec.c ||
- echo 'restore of aa_hadec.c failed'
- Wc_c="`wc -c < 'aa_hadec.c'`"
- test 1922 -eq "$Wc_c" ||
- echo 'aa_hadec.c: original size 1922, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= altaz.c ==============
- if test -f 'altaz.c' -a X"$1" != X"-c"; then
- echo 'x - skipping altaz.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting altaz.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'altaz.c' &&
- /* code to manage the stuff on the altaz display.
- X */
- X
- #include <stdio.h>
- #include <ctype.h>
- #include <math.h>
- #ifdef VMS
- #include <stdlib.h>
- #endif
- #include <X11/Xlib.h>
- #include <Xm/Xm.h>
- #include <Xm/Form.h>
- #include <Xm/Frame.h>
- #include <Xm/DrawingA.h>
- #include <Xm/LabelG.h>
- #include <Xm/PushBG.h>
- #include <Xm/ToggleBG.h>
- #include <Xm/Text.h>
- #include <Xm/Scale.h>
- #include "astro.h"
- #include "circum.h"
- #include "moreobjs.h"
- X
- extern Now *mm_get_now();
- extern char *objname[];
- extern Widget toplevel_w;
- #define XtD XtDisplay(toplevel_w)
- X
- static Widget aaform_w; /* main altaz form dialog */
- static Widget aada_w; /* altaz drawring area */
- static Widget picked_name_w; /* display name of object if picked */
- static Widget objs_w[NOBJ]; /* object selection toggle buttons */
- X
- #define TRAILS 1
- #define BIGDOTS 2
- #define NR 15
- #define NC 36
- X
- static int trails;
- static int bigdots = 1;
- X
- /* use this string to make a label gadget appear empty.
- X * using "" seems to act like unmanaging it altogether!
- X */
- static char no_name[] = " ";
- X
- /* alt/az coordinates, and enough info to locate it on screen */
- typedef struct {
- X double alt, az; /* alt/az coords */
- X int p; /* object code */
- X int sx, sy; /* screen (window) coords */
- } DLoc;
- X
- static DLoc *points; /* malloc'd set of points on screen now */
- static int npoints; /* number of points */
- X
- static unsigned int propts; /* mask of 1<<obj that are on */
- X
- X
- /* called when the altaz view is activated via the main menu pulldown.
- X * if never called before, create and manage all the widgets as a child of a
- X * form. otherwise, just toggle whether the form is managed.
- X */
- aa_manage ()
- {
- X if (!aaform_w) {
- X void aa_activate_cb();
- X void aa_close_cb();
- X void aa_da_exp_cb();
- X void aa_propts_cb();
- X void aa_toggle_cb();
- X Widget close_w;
- X Widget trails_w;
- X Widget toggle_w;
- X Widget w, pw;
- X Widget big_w;
- X Widget frame_w;
- X Widget n_w, z_w;
- X XmString str;
- X Arg args[20];
- X int n;
- X int i, p;
- X
- X /* create form */
- X n = 0;
- X XtSetArg (args[n], XmNautoUnmanage, False); n++;
- X XtSetArg (args[n], XmNdefaultPosition, False); n++;
- X XtSetArg (args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
- X XtSetArg (args[n], XmNwidth, NC*char_width()); n++;
- X XtSetArg (args[n], XmNheight, NR*char_height()); n++;
- X aaform_w = XmCreateFormDialog (toplevel_w, "AltAz", args, n);
- X
- X /* set some stuff in the parent DialogShell.
- X * setting XmNdialogTitle in the Form didn't work..
- X */
- X n = 0;
- X XtSetArg (args[n], XmNtitle, "xephem Altitude/Azimuth View"); n++;
- X XtSetValues (XtParent(aaform_w), args, n);
- X
- X /* "close" push button */
- X
- X str = XmStringCreate("Close", XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X close_w = XmCreatePushButtonGadget (aaform_w, "AAClose", args, n);
- X XtAddCallback (close_w, XmNactivateCallback, aa_close_cb, 0);
- X XtManageChild (close_w);
- X XmStringFree (str);
- X
- X /* "big dots" toggle button */
- X
- X str = XmStringCreate("Big dots", XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNset, bigdots); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, close_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X big_w = XmCreateToggleButtonGadget(aaform_w,"AABigDots",args,n);
- X XmStringFree (str);
- X XtManageChild (big_w);
- X XtAddCallback(big_w, XmNvalueChangedCallback, aa_activate_cb,
- X BIGDOTS);
- X
- X /* "toggle on/off" push button */
- X
- X str = XmStringCreate("Toggle On/off", XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X toggle_w = XmCreatePushButtonGadget (aaform_w, "AAToggle", args, n);
- X XtAddCallback (toggle_w, XmNactivateCallback, aa_toggle_cb, 0);
- X XtManageChild (toggle_w);
- X XmStringFree (str);
- X
- X /* "leave trails" toggle button */
- X
- X str = XmStringCreate("Leave trails", XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, toggle_w); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X trails_w = XmCreateToggleButtonGadget(aaform_w, "AATrails", args,n);
- X XmStringFree (str);
- X XtManageChild (trails_w);
- X XtAddCallback(trails_w, XmNvalueChangedCallback, aa_activate_cb,
- X TRAILS);
- X
- X /* make the object selection buttons */
- X
- X for (i = 0, p = nxtbody(-1); p != -1; i++, p = nxtbody(p)) {
- X str = XmStringCreate (objname[p], XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X XtSetArg (args[n], XmNset, propts & (1<<p) ? True : False); n++;
- X XtSetArg (args[n], XmNindicatorOn, False); n++;
- X XtSetArg (args[n], XmNshadowThickness, 2); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, big_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
- X XtSetArg (args[n], XmNleftPosition, i*100/NOBJ); n++;
- X pw = XmCreateToggleButtonGadget (aaform_w, "AAPropts", args, n);
- X XtAddCallback(pw, XmNvalueChangedCallback, aa_propts_cb, p);
- X XtManageChild (pw);
- X objs_w[p] = pw;
- X XmStringFree (str);
- X }
- X
- X /* make the picked object label */
- X
- X str = XmStringCreate(no_name, XmSTRING_DEFAULT_CHARSET);
- X n = 0;
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, pw); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
- X picked_name_w = XmCreateLabelGadget (aaform_w, "AAPickedName",
- X args, n);
- X XtManageChild (picked_name_w);
- X XmStringFree (str);
- X
- X /* make the orientation labels */
- X
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X n_w = XmCreateLabelGadget (aaform_w, "N", args, n);
- X XtManageChild (n_w);
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
- X XtSetArg (args[n], XmNleftPosition, 23); n++;
- X w = XmCreateLabelGadget (aaform_w, "E", args, n);
- X XtManageChild (w);
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
- X w = XmCreateLabelGadget (aaform_w, "S", args, n);
- X XtManageChild (w);
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
- X XtSetArg (args[n], XmNleftPosition, 73); n++;
- X w = XmCreateLabelGadget (aaform_w, "W", args, n);
- X XtManageChild (w);
- X n = 0;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, picked_name_w); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X w = XmCreateLabelGadget (aaform_w, "N", args, n);
- X XtManageChild (w);
- X n = 0;
- X str = XmStringCreate ("... Zenith ...", XmSTRING_DEFAULT_CHARSET);
- X XtSetArg (args[n], XmNlabelString, str); n++;
- X XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
- X z_w = XmCreateLabelGadget (aaform_w, "Zenith", args, n);
- X XtManageChild (z_w);
- X XmStringFree(str);
- X
- X
- X /* make a frame for the drawing area */
- X
- X n = 0;
- X XtSetArg (args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNtopWidget, z_w); n++;
- X XtSetArg (args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
- X XtSetArg (args[n], XmNbottomWidget, n_w); n++;
- X XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++;
- X XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_OUT); n++;
- X frame_w = XmCreateFrame (aaform_w, "AltAzFrame", args, n);
- X XtManageChild (frame_w);
- X
- X /* make a drawing area in the frame for the sky */
- X
- X n = 0;
- X aada_w = XmCreateDrawingArea (frame_w, "AltAzMap", args, n);
- X XtManageChild (aada_w);
- X XtAddCallback (aada_w, XmNexposeCallback, aa_da_exp_cb, 0);
- X XtAddCallback (aada_w, XmNresizeCallback, aa_da_exp_cb, 0);
- X XtAddCallback (aada_w, XmNinputCallback, aa_da_exp_cb, 0);
- X }
- X
- X if (XtIsManaged(aaform_w))
- X XtUnmanageChild (aaform_w);
- X else {
- X XtManageChild (aaform_w);
- X aa_update (mm_get_now(), 1);
- X }
- }
- X
- aa_set_objs_on(mask)
- int mask;
- {
- X propts = mask;
- }
- X
- aa_ison()
- {
- X return (aaform_w && XtIsManaged(aaform_w));
- }
- X
- /* called when we are to update our view.
- X * don't bother if we are unmanaged unless trails is on - in that case,
- X * compute the new locations but don't display them.
- X */
- aa_update (np, how_much)
- Now *np;
- int how_much;
- {
- X double as = how_much ? 0.0 : 3600.0;
- X Sky sky;
- X DLoc *lp;
- X int up;
- X int p;
- X
- X up = aaform_w && XtIsManaged(aaform_w);
- X if (!up && !trails)
- X return;
- X
- X if (!trails) {
- X if (points)
- X XtFree ((char*)points);
- X points = 0;
- X npoints = 0;
- X }
- X
- X for (p = 0; p < NOBJ; p++) {
- X if ((p==OBJX || p==OBJY) && !obj_ison(p))
- X continue;
- X (void) body_cir (p, as, np, &sky);
- X if (sky.s_alt <= 0.0)
- X continue;
- X npoints++;
- X points = (DLoc *) XtRealloc ((char *)points, npoints*sizeof(DLoc));
- X lp = &points[npoints-1];
- X lp->alt = sky.s_alt;
- X lp->az = sky.s_az;
- X lp->p = p;
- X }
- X
- X if (up)
- X aa_all(!trails);
- X
- }
- X
- /* callback from the toggle buttons
- X */
- void
- aa_activate_cb (w, client, call)
- Widget w;
- caddr_t client;
- caddr_t call;
- {
- X int what = (int) client;
- X
- X switch (what) {
- X case TRAILS:
- X trails = XmToggleButtonGadgetGetState(w);
- X break;
- X case BIGDOTS:
- X bigdots = XmToggleButtonGadgetGetState(w);
- X aa_all(1);
- X break;
- X default:
- X printf ("unknown toggle button\n");
- X break;
- X }
- }
- X
- /* callback from the toggle on/off button
- X */
- void
- aa_toggle_cb (w, client, call)
- Widget w;
- caddr_t client;
- caddr_t call;
- {
- X int p;
- X
- X for (p = nxtbody(-1); p != -1; p = nxtbody(p)) {
- X int s = XmToggleButtonGadgetGetState(objs_w[p]);
- X if (s) propts &= ~(1<<p);
- X else propts |= 1<<p;
- X XmToggleButtonGadgetSetState(objs_w[p], !s, False /*don't invoke*/);
- X }
- X aa_all (1);
- X
- }
- X
- /* callback from the toggle buttons for each object.
- X * set the onoff flag in the points array for the planet whose code is in
- X * client, then redraw.
- X */
- void
- aa_propts_cb (w, client, call)
- Widget w;
- caddr_t client;
- caddr_t call;
- {
- X int p = (int) client;
- X
- X if (XmToggleButtonGadgetGetState(w)) propts |= 1<<p;
- X else propts &= ~(1<<p);
- X aa_all (1);
- }
- X
- /* callback from the Close button.
- X */
- void
- aa_close_cb (w, client, call)
- Widget w;
- caddr_t client;
- caddr_t call;
- {
- X XtUnmanageChild (aaform_w);
- }
- X
- /* expose (or reconfig) of altaz drawing area.
- X * just redraw the scene to the current window size.
- X * also, input callback when picking a dot for identification.
- X */
- static void
- aa_da_exp_cb (w, client, call)
- Widget w;
- caddr_t client;
- caddr_t call;
- {
- X XmDrawingAreaCallbackStruct *c = (XmDrawingAreaCallbackStruct *)call;
- X
- X switch (c->reason) {
- X case XmCR_RESIZE:
- X /* seems we can get one resize before the first expose.
- X * hence, we don't have a good window to use yet. just let it
- X * go; we'll get the expose soon.
- X */
- X if (!XtWindow(w))
- X return;
- X break;
- X case XmCR_EXPOSE: {
- X XExposeEvent *e = &c->event->xexpose;
- X /* wait for the last in the series */
- X if (e->count != 0)
- X return;
- X break;
- X }
- X case XmCR_INPUT:
- X aa_identify (c->event);
- X return;
- X default:
- X printf ("Unexpected aada_w event. type=%d\n", c->reason);
- X return;
- X }
- X
- X aa_update (mm_get_now(), 1);
- }
- X
- /* a dot has been picked: find what it is and report it. */
- static
- aa_identify (ev)
- XXEvent *ev;
- {
- #define PICKRANGE 36 /* sqr of dist allowed from pointer */
- X int x, y, mind, mini;
- X int i;
- X char *name;
- X
- X switch (ev->type) {
- X case ButtonPress:
- X x = ((XButtonPressedEvent *)ev)->x;
- X y = ((XButtonPressedEvent *)ev)->y;
- X mini = -1;
- X for (i = 0; i < npoints; i++) {
- X if (propts & (1<<points[i].p)) {
- X int d = (x-points[i].sx)*(x-points[i].sx) +
- X (y-points[i].sy)*(y-points[i].sy);
- X if (mini < 0 || d < mind) {
- X mini = i;
- X mind = d;
- X }
- X }
- X }
- X if (mini >= 0 && mind <= PICKRANGE) {
- X extern char *obj_getname();
- X static char *onames[] = {
- X /* NB: these must correspond to the astro/morobj defines */
- X "Mercury", "Venus", "Mars", "Jupiter", "Saturn",
- X "Uranus", "Neptune", "Pluto", "Sun", "Moon"
- X };
- X int p = points[mini].p;
- X if (p >= MERCURY && p <= MOON)
- X name = onames[p];
- X else if (p == OBJX || p == OBJY)
- X name = obj_getname(p);
- X else
- X name = "?";
- X } else
- X name = no_name;
- X f_string (picked_name_w, name);
- X break;
- X }
- }
- X
- /* draw everything in the points array to the current screen size.
- X * redraw the background too if preclr is set.
- X */
- static
- aa_all(preclr)
- int preclr;
- {
- X static GC aa_fgc;
- X unsigned int nx, ny;
- X Window root;
- X int x, y;
- X unsigned int bw, d;
- X Display *dsp = XtDisplay(aada_w);
- X Window win = XtWindow(aada_w);
- X int i;
- X
- X if (!aa_fgc) {
- X XGCValues gcv;
- X unsigned int gcm;
- X
- X /* if user set the foreground and background resources for the
- X * AltAzMap use these for our planet gc.
- X */
- X gcm = GCForeground;
- X get_something (aada_w, XmNforeground, (char *)&gcv.foreground);
- X aa_fgc = XCreateGC (dsp, win, gcm, &gcv);
- X }
- X
- X XGetGeometry (dsp, win, &root, &x, &y, &nx, &ny, &bw, &d);
- X
- X if (preclr)
- X XClearWindow (dsp, win);
- X
- X /* display points for objects that are on */
- X for (i = 0; i < npoints; i++)
- X if (propts & (1<<points[i].p))
- X sky_altaz(dsp, win, aa_fgc, i, nx, ny);
- }
- X
- /* draw points[i] on screen of size [nx,ny]. */
- static
- sky_altaz (dsp, win, gc, i, nx, ny)
- Display *dsp;
- Window win;
- GC gc;
- int i; /* points[] index */
- int nx, ny; /* size of drawing area, in pixels */
- {
- X int sx, sy;
- X
- X points[i].sx = sx = (nx-1)*(points[i].az/(2*PI));
- X points[i].sy = sy = (ny-1)*(1.0 - points[i].alt/(PI/2));
- X
- X if (bigdots) {
- X XDrawPoint (dsp, win, gc, sx, sy);
- X XDrawPoint (dsp, win, gc, sx+1, sy);
- X XDrawPoint (dsp, win, gc, sx, sy+1);
- X XDrawPoint (dsp, win, gc, sx+1, sy+1);
- X } else
- X XDrawPoint (dsp, win, gc, sx, sy);
- }
- SHAR_EOF
- chmod 0644 altaz.c ||
- echo 'restore of altaz.c failed'
- Wc_c="`wc -c < 'altaz.c'`"
- test 15399 -eq "$Wc_c" ||
- echo 'altaz.c: original size 15399, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= anomaly.c ==============
- if test -f 'anomaly.c' -a X"$1" != X"-c"; then
- echo 'x - skipping anomaly.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting anomaly.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'anomaly.c' &&
- #include <stdio.h>
- #include <math.h>
- #include "astro.h"
- X
- #define TWOPI (2*PI)
- X
- /* given the mean anomaly, ma, and the eccentricity, s, of elliptical motion,
- X * find the true anomaly, *nu, and the eccentric anomaly, *ea.
- X * all angles in radians.
- X */
- anomaly (ma, s, nu, ea)
- double ma, s;
- double *nu, *ea;
- {
- X double m, fea;
- X
- X m = ma-TWOPI*(long)(ma/TWOPI);
- X if (m > PI) m -= TWOPI;
- X if (m < -PI) m += TWOPI;
- X fea = m;
- X
- X if (s < 1.0) {
- X /* elliptical */
- X double dla;
- X while (1) {
- X dla = fea-(s*sin(fea))-m;
- X if (fabs(dla)<1e-6)
- X break;
- X dla /= 1-(s*cos(fea));
- X fea -= dla;
- X }
- X *nu = 2*atan(sqrt((1+s)/(1-s))*tan(fea/2));
- X } else {
- X /* hyperbolic */
- X double corr = 1;
- X while (fabs(corr) > 0.000001) {
- X corr = (m - s * sinh(fea) + fea) / (s*cosh(fea) - 1);
- X fea += corr;
- X }
- X *nu = 2*atan(sqrt((s+1)/(s-1))*tanh(fea/2));
- X }
- X *ea = fea;
- }
- SHAR_EOF
- chmod 0644 anomaly.c ||
- echo 'restore of anomaly.c failed'
- Wc_c="`wc -c < 'anomaly.c'`"
- test 901 -eq "$Wc_c" ||
- echo 'anomaly.c: original size 901, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= cal_mjd.c ==============
- if test -f 'cal_mjd.c' -a X"$1" != X"-c"; then
- echo 'x - skipping cal_mjd.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting cal_mjd.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'cal_mjd.c' &&
- #include <stdio.h>
- #include <math.h>
- #include "astro.h"
- X
- /* given a date in months, mn, days, dy, years, yr,
- X * return the modified Julian date (number of days elapsed since 1900 jan 0.5),
- X * *mjd.
- X */
- cal_mjd (mn, dy, yr, mjd)
- int mn, yr;
- double dy;
- double *mjd;
- {
- X int b, d, m, y;
- X long c;
- X
- X m = mn;
- X y = (yr < 0) ? yr + 1 : yr;
- X if (mn < 3) {
- X m += 12;
- X y -= 1;
- X }
- X
- X if (yr < 1582 || yr == 1582 && (mn < 10 || mn == 10 && dy < 15))
- X b = 0;
- X else {
- X int a;
- X a = y/100;
- X b = 2 - a + a/4;
- SHAR_EOF
- true || echo 'restore of cal_mjd.c failed'
- fi
- echo 'End of part 1'
- echo 'File cal_mjd.c is continued in part 2'
- echo 2 > _shar_seq_.tmp
- exit 0
- --
- --
- Molecular Simulations, Inc. mail: dcmartin@msi.com
- 796 N. Pastoria Avenue uucp: uunet!dcmartin
- Sunnyvale, California 94086 at&t: 408/522-9236
-