home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / astronmy / astro / sky_plot.pas < prev   
Pascal/Delphi Source File  |  1985-11-19  |  24KB  |  562 lines

  1.  
  2.  
  3.                     {   S K Y  P L O T . P A S   }
  4.  
  5. {This menu choice is perhaps the most useful for beginning astronomers and any
  6.  people who have a moderate interest in astronomy. This section will produce
  7.  three different maps of the sky, all equally useful, and, with the proper
  8.  printer selection from the main menu, screen dumps may be made which allow the
  9.  observer to actually use the data generated by this program and look for the
  10.  actual objects in the night sky. Along with the HORIZON, ZENITH and STAR ATLAS
  11.  maps, there is also a ALMANAC choice which will allow the user to obtain a
  12.  list of altitudes, azimuths, right ascensions and declinations of all the
  13.  objects that this program supports.}
  14.  
  15.  
  16.  
  17. procedure Do_Sky_Plot (choice : integer) ;           {sky plot sub menu choice}
  18.  
  19. var   skymenu     : menu_ptr ;                                   {menu pointer}
  20.  
  21. function Hor_Enter : integer ;                 {return inputted horizon centre}
  22.  
  23. var
  24.    ok         : boolean ;        x : integer ;            {temporary variables}
  25.    hor_str    : string[255] ;
  26.  
  27. begin
  28.    hor_str := '180' ;                                  {default horizon centre}
  29.    prompt := 'Enter horizon centre:' ;
  30.    editfld := '___ deg.' ;
  31.    values := '999' ;
  32.    ok := Multi_Dial (prompt,editfld,values,hor_str) ;
  33.    if ok then begin
  34.       x := round (Val (hor_str)) ;                      {return horizon centre}
  35.       if x > 359 then x := 359 ;                         {check if idiot value}
  36.    end
  37.    else x := -1 ;                          {if cancelled, return negative flag}
  38.    Hor_Enter := x ;
  39. end ;  {Hor_Enter}
  40.  
  41.  
  42. procedure Make_Table ;               {get values for a solar system data table}
  43.  
  44. var
  45.    temporary      : fullstr ;                  {hold the current output device}
  46.    l              : integer ;                           {loop control variable}
  47.  
  48. begin
  49.    temporary := device ;
  50.    device := 'NUL:' ;                      {nul device for no output to screen}
  51.    for l := 1 to 19 do begin             {calculate RA and Dec for each object}
  52.       case l of
  53.          1,2,4,5,6,7,8,9             : begin
  54.                                           obname[l] :=
  55.                                concat (planet[l],'                    ') ;
  56.                                           p := l ;
  57.                                           Planets ;
  58.                                        end ;
  59.          3                           : begin
  60.                                           obname[l]:='Sun                    ';
  61.                                           Sun ;
  62.                                        end ;
  63.          10                          : begin
  64.                                           obname[l]:='Moon                   ';
  65.                                           Moon ;
  66.                                        end ;
  67.          otherwise                   : begin
  68.                                          obname[l] :=
  69.                                concat (comet[l-10],'                    ') ;
  70.                                          c := (l - 10) ;
  71.                                          Comets ;
  72.                                        end ;
  73.       end ;     {case}
  74.  
  75.       right [l] := RA ;             {store results in arrays}
  76.       decl  [l] := Dec ;   {next calculate Altitude and Azimuth of each object}
  77.       alts  [l] := round (Calc_Alt (t_univ,decl[l],right[l])) ;
  78.       azim  [l] := round (Calc_Azi (t_univ,decl[l],right[l])) ;
  79.    end ;
  80.    device := temporary ;                                {restore output device}
  81.    close (outfile) ;
  82.    for l := 1 to 166 do begin         {calculate star positions for later maps}
  83.       salts[l] := round (Calc_Alt (t_univ,sdecl[l],sright[l])) ;
  84.       sazim[l] := round (Calc_Azi (t_univ,sdecl[l],sright[l])) ;
  85.    end ;
  86.    did_current := True ;     {don't bother recalculating if data already found}
  87. end ;  {Make_Table}
  88.  
  89.  
  90. procedure Sky_Table ;             {output data table (RA,Dec,altitude,azimuth)}
  91.  
  92. var
  93.    s,t,u,spaces   : fullstr ;                               {temporary strings}
  94.    l,x            : integer ;                                   {loop variable}
  95.    wname          : Window_Title ;
  96.  
  97. begin
  98.    wname := '  Solar System Data Table  ' ;
  99.    wind_open (wname) ;
  100.    if not did_current then begin
  101.       PrintAt (10,20);  writeln (output,'Please wait ... Calculating Values') ;
  102.       Make_Table ;
  103.       PrintAt (10,20);  writeln (output,'                                  ') ;
  104.    end ;
  105.    spaces := '                                                              ' ;
  106.    rewrite (outfile,device) ;
  107.    PrintAt (3,1)  ; write   (outfile,'Object                  ') ;
  108.    PrintAt (3,24) ; write   (outfile,'R.A. (h m)     Dec. (d m)     ') ;
  109.    PrintAt (3,54) ; writeln (outfile,'Alt. (deg)     Azi. (deg)') ;
  110.    PrintAt (4,1)  ; writeln (outfile) ;
  111.    for l := 1 to 19 do begin               {output all the data as big strings}
  112.       s := Copy (obname[l],1,23) ;
  113.       itoa (Hours(right[l]),t) ;                         {convert RA to string}
  114.       x := 5 - length(t) ;                u := Copy (spaces,1,x) ;
  115.       s := Concat (s,u,t) ;
  116.       itoa (Minutes (right[l]),t) ;
  117.       x := 3 - length (t) ;               u := Copy (spaces,1,x) ;
  118.       s := Concat (s,u,t) ;
  119.       itoa (Hours(decl[l]),t) ;                         {convert Dec to string}
  120.       x := 11 - length (t) ;              u := Copy (spaces,1,x) ;
  121.       s := Concat (s,u,t) ;
  122.       itoa (Minutes (decl[l]),t) ;
  123.       x := 4 - length (t) ;               u := Copy (spaces,1,x) ;
  124.       s := Concat (s,u,t) ;
  125.       itoa (alts[l],t) ;                         {convert alt to string}
  126.       x := 12 - length (t) ;              u := Copy (spaces,1,x) ;
  127.       s := Concat (s,u,t) ;
  128.       itoa (azim[l],t) ;                       {convert azim to string}
  129.       x := 15 - length (t) ;              u := Copy (spaces,1,x) ;
  130.       s := Concat (s,u,t) ;
  131.       PrintAt (l+3,1) ; writeln (outfile,s) ;
  132.    end ;
  133.    close (outfile) ;
  134.    l := txtcol ; txtcol := black ;  wind_close ;  txtcol := l ;
  135. end ;  {Sky_Table}
  136.  
  137.  
  138. procedure Horizon_Plot ;               {produce a horizon star and planet plot}
  139.  
  140. label 1234 ;
  141.  
  142. const
  143.    yscale  =  4.285714286 ;          {y scale factor}
  144.    xscale  =  2.307692308 ;          {x scale factor}
  145.    gyscale =  0.535714285 ;          {graphics y scale factor}
  146.    gxscale =  0.288461538 ;          {graphics x scale factor}
  147.  
  148. var
  149.    object_str     : string [19] ;      {string contains symbol for each object}
  150.    obj            : string [ 1] ;            {one of the objects in object_str}
  151.    l              : integer ;                                    {loop control}
  152.    horizon        : integer ;                          {horizon values: centre}
  153.    lhor,rhor      : integer ;                                  {left and right}
  154.    xpos,ypos      : integer ;                                {plotting co-ords}
  155.    wname          : Window_Title ;                                {window name}
  156.  
  157. begin
  158.    horizon := Hor_Enter ;
  159.    if horizon = -1 then goto 1234 ;    {if horizon input cancelled, get out!!!}
  160.    wname := '  Horizon Map  ' ;
  161.    wind_open (wname) ;
  162.    Clearxy ;                                   {clear a window for information}
  163.    if not did_current then begin                 {check if data calculated yet}
  164.       PrintAt (10,20);  writeln (output,'Please wait ... Calculating Values') ;
  165.       Make_Table ;
  166.       PrintAt (10,20);  writeln (output,'                                  ') ;
  167.    end ;
  168.    object_str := 'mV*MJSUNP(ET\!HCnsh' ;              {symbols for each object}
  169.    lhor    := (horizon + 360 - 90) mod 360 ;      {horizon is 180 degrees wide}
  170.    rhor    := (horizon + 360 + 90) mod 360 ;       {horizon is 60 degrees tall}
  171.    PrintAt (18,1) ;                            {horizon and legend for planets}
  172.    write (output,'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^') ;
  173.    write (output,'^^^^^^^^^^^^^^^^^^^^^^^') ;                          {ground}
  174.    PrintAt (19,2) ;                              {output the legend of the map}
  175.    write (output,'m - Mercury    V - Venus      M - Mars       J - Jupiter') ;
  176.    write (output,'    S - Saturn     ') ;
  177.    PrintAt (20,2) ;
  178.    write (output,'U - Uranus     N - Neptune    P - Pluto      ( - Moon   ') ;
  179.    write (output,'    * - Sun        ') ;
  180.    PrintAt (21,2) ;
  181.    write (output,'E - Encke      T - Temple 2   ! - S. W. 1    \ - S. W. 2') ;
  182.    write (output,'    H - Halley     ') ;
  183.    PrintAt (22,2) ;
  184.    write (output,'C - Crommelin  s - Schaumase  h - H. Campos  n - Neujmin') ;
  185.    write (output,' 1') ;                                 {scale around the map}
  186.    PrintAt (18,1) ;
  187.    write (output,lhor:3) ;
  188.    PrintAt (18,39) ;
  189.    write (output,horizon) ;
  190.    PrintAt (18,76) ;
  191.    write (output,rhor:3) ;
  192.    PrintAt (4,1)   ; write (output,'60') ;               {scale at side of map}
  193.    PrintAt (4,77)  ; write (output,'60') ;
  194.    PrintAt (11,1)  ; write (output,'30') ;
  195.    PrintAt (11,77) ; write (output,'30') ;
  196.    PrintAt (17,1)  ; write (output,'0') ;
  197.    PrintAt (17,78) ; write (output,'0') ;
  198.    PrintAt (3,1) ;                {output relevant data: date, time, lat, long}
  199.    write (output,'Date: Y ',year:4,' M ',month:2,' D ',day:2) ;
  200.    PrintAt (3,25) ;
  201.    write (output,'Time: ',Hours(t_univ):2,' h ',Minutes(t_univ):2,' m U.T.') ;
  202.    PrintAt (3,49) ;
  203.    write (output,'Lat: ',round(latitude):3,' deg. Long: ',
  204.          round (longitude):4,' deg.') ;
  205.    for l := 1 to 19 do begin                   {routine to plot objects on map}
  206.       if ((alts [l] > 0) and (alts [l] < 55)
  207.                   and (((azim[l]-lhor+360) mod 360) <= 175)) then begin
  208.         ypos := 17 - round (alts [l] / yscale) ;
  209.         xpos := 2 + round (((azim[l]-lhor+360) mod 360)/xscale) ;
  210.         obj  := Copy (object_str,l,1) ;
  211.         PrintAt (ypos,xpos) ;                              {plot the object!!!}
  212.         write (output,obj) ;
  213.       end ;
  214.    end ;
  215.    for l := 1 to 166 do begin                    {routine to plot stars on map}
  216.       if ((salts [l]> 0) and (((sazim[l]-lhor+360) mod 360) <= 175)) then begin
  217.         ypos := (124*resolution) - ((round (salts [l] / gyscale))*resolution) ;
  218.         xpos := 16 + round (((sazim[l]-lhor+360) mod 360)/gxscale) ;
  219.         Plot (xpos,ypos)   ; Plot (xpos+1,ypos) ; Plot (xpos,ypos-1) ;
  220.         Plot (xpos,ypos+1) ; Plot (xpos-1,ypos) ;{plot scaled for med/high res}
  221.       end ;
  222.    end ;
  223.    wind_close ;
  224. 1234:
  225. end ;  {Horizon_Plot}
  226.  
  227.  
  228. procedure Zenith_Plot ;                       {make an overhead map of the sky}
  229.                                           {map too small scale to show planets}
  230. const
  231.    c_x    = 320 ;                                         {x centre  of circle}
  232.    c_xsiz = 176 ;                                         {x stretch of circle}
  233.  
  234. var
  235.    wname          : Window_Title ;
  236.    c_ysiz         : integer ;         {y stretch of circle (w.r.t. resolution)}
  237.    c_y,l          : integer ;               {y centre of circle, loop variable}
  238.    xpos,ypos      : integer ;                                {plotting co-ords}
  239.    rad,theta      : real ;      {variables for rectangular -> polar conversion}
  240.  
  241. begin
  242.    wname := '  Zenith (Overhead) Map  ' ;
  243.    wind_open (wname) ;
  244.    Clearxy ;                                   {clear a window for information}
  245.    if not did_current then begin             {check if data not yet calculated}
  246.       PrintAt (10,20);  writeln (output,'Please wait ... Calculating Values') ;
  247.       Make_Table ;
  248.       PrintAt (10,20);  writeln (output,'                                  ') ;
  249.    end ;
  250.    PrintAt (3,1) ;                {output relevant data: date, time, lat, long}
  251.    write (output,'Date: Y ',year:4,' M ',month:2,' D ',day:2) ;
  252.    PrintAt (3,58) ;
  253.    write (output,'Time: ',Hours(t_univ):2,' h ',Minutes(t_univ):2,' m U.T.') ;
  254.    PrintAt (4,1) ;
  255.    write (output,'Lat: ',round(latitude):3,' deg.') ;
  256.    PrintAt (4,63) ;
  257.    write (output,'Long: ',  round (longitude):4,' deg.') ;
  258.    PrintAt ( 3,38) ;  write (output,'North') ;       {output directions of map}
  259.    PrintAt (12,12) ;  write (output,'East') ;    {once a screendump made, the }
  260.    PrintAt (12,65) ;  write (output,'West') ;    {directions will match if you}
  261.    paint_style (1) ; paint_color (scrncol) ;     {hold the map above your head}
  262.    if resolution = 1 then begin                        {y stretch of circle}
  263.       c_ysiz := 58 ;
  264.       c_y := 80 ;
  265.    end                                        {routine to calculate the circle}
  266.    else begin                                    {size in both medium and high}
  267.       c_ysiz :=  126 ;                                         {resolutions!!!}
  268.       c_y := 166 ;
  269.    end ;
  270.    Frame_Oval (c_x,c_y,c_xsiz,c_ysiz) ;                       {draw the circle}
  271.    if resolution = 2 then c_ysiz := 163
  272.    else c_ysiz := 80 ;
  273.    Line (c_x, c_y - c_ysiz, c_x, c_y - c_ysiz + 10) ;             {tick marks!}
  274.    Line (c_x, c_y + c_ysiz, c_x, c_y + c_ysiz - 10) ;
  275.    Line (c_x - c_xsiz, c_y, c_x - c_xsiz + 10, c_y) ;
  276.    Line (c_x + c_xsiz, c_y, c_x + c_xsiz - 10, c_y) ;
  277.    Line (c_x - 5, c_y, c_x + 5, c_y) ;                            {crosshair!!}
  278.    Line (c_x, c_y + 5, c_x, c_y - 5) ;
  279.    for l := 1 to 166 do begin                           {routine to plot stars}
  280.       if salts[l] > 0 then begin
  281.          rad := (90.0 - salts[l]) / 93.0 ;   {polar to rectangular conversion!}
  282.          theta := sazim[l] + 90.0 ;
  283.          if theta > 360.0 then theta := theta - 360.0 ;
  284.          theta := Deg_to_Rad (theta) ;
  285.          xpos := round ((rad * Cos (theta) * c_xsiz)) ;          {get x co-ord}
  286.          xpos := xpos + c_x  ;
  287.          ypos := round ((rad * Sin (theta) * c_ysiz)) ;          {get y co-ord}
  288.          ypos := c_y  - ypos ;
  289.          Plot (xpos,ypos)   ; Plot (xpos+1,ypos) ; Plot (xpos,ypos-1) ;
  290.          Plot (xpos,ypos+1) ; Plot (xpos-1,ypos) ;                {plot star!!}
  291.       end ;
  292.    end ;
  293.    wind_close ;
  294. end ;  {Zenith_Plot}
  295.  
  296.  
  297.  
  298. procedure Star_Atlas ;           {output a highly detailed star atlas type map}
  299.  
  300. var
  301.    s_right, s_decl, s, t : string ;            {input window centre RA and Dec}
  302.    wname                 : Window_Title ;                         {window name}
  303.    ok                    : boolean ;                    {dialog cancel/ok flag}
  304.  
  305. procedure plot_stars (sx,sy : string) ;        {actual routine to plot stars at
  306.                                                         around the point sx,sy}
  307. const
  308.    ra_fact   = 144.404  ;      {plotting factors to scale to ST screen: for RA}
  309.    de_fact   = 9.62464  ;                                             {for Dec}
  310.    rad       = 57.29578 ;                               {number degrees/radian}
  311.    max_x     = 2.209    ;     {number of hours on one side of centre of window}
  312.    max_y     = 18.7     ;     {number of degrees on 1 side of centre of window}
  313.    deg_hr    = 15.0     ;                                 {degrees per hour RA}
  314.    twelve    = 12.0     ;                                  {for readability???}
  315.    rad_hr    = 0.261799 ;                                 {radians per hour RA}
  316.  
  317. var
  318.    a,x,y,w,h,win           : integer ;      {loop, plot co-ords, width, height}
  319.    x1,y1,z1,cx,cy          : real ;                 {used in rotation formulas}
  320.    x2,y2,z2                : real ;                 {used in rotation formulas}
  321.    theta,c_theta,s_theta   : real ;                 {used in rotation formulas}
  322.    c_phi,s_phi,r,d,m       : real ;                 {used in rotation formulas}
  323.    loc_string              : string ;          {string for Draw_String routine}
  324.  
  325.  
  326. function rot_x (a,b,c,d : real) : real ;     {rotate x by precalculated factors
  327.                                        c and d. Need a,b (old x and y co-ords)}
  328. begin
  329.    rot_x := a * c - b * d ;
  330. end ;  {rot_x}
  331.  
  332.  
  333. function rot_y (a,b,c,d : real) : real ;     {rotate y by precalculated factors
  334.                                        c and d. Need a,b (old x and y co-ords)}
  335. begin
  336.    rot_y := a * d + b * c ;
  337. end ;  {rot_y}
  338.  
  339.  
  340. procedure plotter (x,y : integer) ;        {produce a blob of pixels on screen}
  341.  
  342. begin
  343.          Plot (x + w,y + h) ;
  344.          Plot (x + w + 1,y + h) ;  Plot (x + w - 1,y + h) ;
  345.          Plot (x + w,y + h + 1) ;  Plot (x + w,y + h - 1) ;
  346. end ;  {plotter}
  347.  
  348.  
  349. procedure Mag_Zero (x,y : integer) ;       {make very big blob - < magnitude 0}
  350.  
  351. begin
  352.    plotter (x,y) ;   plotter (x,y+2) ;
  353.    plotter (x,y-2) ; plotter (x+2,y) ;
  354.    plotter (x-2,y) ;
  355.    plotter (x,y+1) ; plotter (x,y-1) ;
  356.    plotter (x+1,y) ; plotter (x-1,y) ;
  357. end ;  {Mag_Zero}
  358.  
  359.  
  360. procedure Mag_One (x,y : integer) ;      {make almost big blob - < magnitude 1}
  361.  
  362. begin
  363.    plotter (x,y) ;
  364.    plotter (x,y+2) ; plotter (x,y-2) ;
  365.    plotter (x+2,y) ; plotter (x-2,y) ;
  366. end ;  {Mag_One}
  367.  
  368.  
  369. procedure Mag_Two (x,y : integer) ;                             {< magnitude 2}
  370.  
  371. begin
  372.    plotter (x,y) ;
  373.    plotter (x+1,y) ; plotter (x-1,y) ;
  374.    plotter (x,y+1) ; plotter (x,y-1) ;
  375. end ;  {Mag_Two}
  376.  
  377.  
  378. procedure Mag_Three (x,y : integer) ;                           {< magnitude 3}
  379.  
  380. begin
  381.    plotter (x,y) ;
  382.    plotter (x+1,y) ;
  383. end ;  {Mag_Three}
  384.  
  385.  
  386. procedure Mag_Four (x,y : integer) ;                            {< magnitude 4}
  387.  
  388. begin
  389.    plotter (x,y) ;
  390. end ;  {Mag_Four}
  391.  
  392.  
  393. procedure Mag_Five (x,y : integer) ;                            {< magnitude 5}
  394.  
  395. begin
  396.    Plot (x+w,y+h) ;
  397.    Plot (x+w+1,y+h) ;
  398. end ;  {Mag_Five}
  399.  
  400.  
  401. procedure Mag_Six (x,y : integer) ;                  {all remaining magnitudes}
  402.  
  403. begin
  404.    Plot (x + w,y + h) ;
  405. end ;  {Mag_Six}
  406.  
  407.  
  408. procedure show_legend ;                   {output a legend in corner of screen}
  409.  
  410. var
  411.    x,y,u,m,f : integer ;                                  {temporary variables}
  412.    s         : string  ;                                        {output string}
  413.  
  414. begin
  415.    if resolution = 1 then f := 2 else f := 1; {scaling factor for med/high res}
  416.    Paint_Rect (2,2,83,168 div f) ;                {clear a box for information}
  417.    Draw_String (13,20 div f,'Legend') ;
  418.    Text_Style (Normal|Underlined) ;
  419.    Draw_String (4,38 div f,'Magnitudes') ;
  420.    Text_Style (Normal) ;
  421.    m := 0 ;  x := -w + 15 ;
  422.    for y := (58 div f) to (170 div f) do begin
  423.       s  := Concat ('<  ',chr (48 + m)) ;    {output '< ' and magnitude number}
  424.       Draw_String (33,y,s) ;
  425.       u := y - h - (7 div 2) ;
  426.       case m of
  427.          0 : Mag_Zero  (x,u) ;         {plot a star corresponding to magnitude}
  428.          1 : Mag_One   (x,u) ;
  429.          2 : Mag_Two   (x,u) ;
  430.          3 : Mag_Three (x,u) ;
  431.          4 : Mag_Four  (x,u) ;
  432.          5 : Mag_Five  (x,u) ;
  433.          6 : Mag_Six   (x,u) ;
  434.       end ;  {case}
  435.       y  := y + (16 div f) ;
  436.       m  := m + 1 ;
  437.    end ;
  438.    Frame_Rect (2,2,83,168 div f) ;                                   {draw box}
  439. end ;  {show_legend}
  440.  
  441.  
  442. begin
  443.    Clearxy ;
  444.    Text_Style (Outlined) ;
  445.    win := Get_Window ;                              {get current output window}
  446.    Work_Rect (win,x,y,w,h) ;        {get width and height for scaling purposes}
  447.    w  := w div 2 ;
  448.    h  := h div 2 ;
  449.    cx := Val (sx) ;                      {convert input strings to real values}
  450.    cy := Val (sy) ;
  451.  
  452.    theta := (twelve - cx) * deg_hr / rad ;   {calculate predetermined rotation}
  453.    c_theta := Cos (theta) ;   s_theta := Sin (theta) ;                {amounts}
  454.    c_phi   := Cos (cy / rad) ;  s_phi := Sin (cy / rad) ;
  455.    for a := 1 to stars do begin                   {loop through all 1500 stars}
  456.       r := s_ra[a] * rad_hr  ;
  457.       d := s_de[a] / rad ;
  458.       z1 := Cos (d) ;   {convert RA and Dec to 3 dimensional cartesian co-ords}
  459.       x1 := Cos(r) * z1 ;  y1 := Sin(r) * z1 ;  z1 := Sin(d) ;
  460.  
  461.       x2 := rot_x (x1,y1,c_theta,s_theta) ;    {rotate x,y plane theta degrees}
  462.       y2 := rot_y (x1,y1,c_theta,s_theta) ;
  463.       x1 := rot_x (x2,z1,c_phi,s_phi) ;          {rotate x,z plane phi degrees}
  464.       z2 := rot_y (x2,z1,c_phi,s_phi) ;
  465.  
  466.       r := Ambiguity (ArcTan (y2 / x1), x1, y2) ;  {convert back to ra and dec}
  467.       d := ArcSin (z2) ;
  468.  
  469.       r := r / rad_hr ;
  470.       d := d * rad ;
  471.  
  472. {r and d now contain rotated co-ords to make plotting very easy and distortion
  473.  free. Rotation now centred on 12h RA and 0 d Dec (ie: old window centre is now
  474.  rotated to 12h and 0 d!!)}
  475.  
  476.       x1 := twelve - r ;
  477.       if abs (x1) < max_x then begin   {if star greater than 2.2 h from centre}
  478.          m := s_mag[a] ; {get magnitude of star}                   {don't plot}
  479.          x  := round ((x1 * ra_fact) * Cos (d / rad)) ;    {calculate x co-ord}
  480.          if resolution = 1 then x := x * 2 ;      {change x scaling due to res}
  481.          y  := round (-d * de_fact) ;                      {calculate y co-ord}
  482.          if m < 0 then Mag_Zero (x,y)             {plot according to magnitude}
  483.          else if m < 1 then Mag_One (x,y)
  484.             else if m < 2 then Mag_Two (x,y)
  485.                else if m < 3 then Mag_Three (x,y)
  486.                   else if m < 4 then Mag_Four (x,y)
  487.                      else if m < 5 then Mag_Five (x,y)
  488.                         else Mag_Six (x,y) ;
  489.       end ;
  490.    end ;                                         {output centre of window data}
  491.    loc_string := Concat ('Centre of Window: ',sx,' h RA, ',sy,' d Dec') ;
  492.    if resolution = 1 then Text_Color(green) else Text_Color (txtcol) ;
  493.    Draw_String (175,10 * resolution,loc_string) ;
  494.    show_legend ;                                                  {draw legend}
  495.    if not scrnwhite then write (chr(27),'p') ;
  496. end ;  {plot_stars}
  497.  
  498. begin
  499.    s_right := '055' ;
  500.    prompt := 'Window Centre R.A.:' ;       {get window centre (2 dialog boxes)}
  501.    editfld := '__._ hours' ;
  502.    values := '999' ;
  503.    ok := Multi_Dial (prompt,editfld,values,s_right) ;
  504.    if ok then begin
  505.       s_decl := '+02' ;
  506.       prompt := 'Window Centre Dec.:' ;
  507.       editfld := '___ deg.' ;
  508.       values := 'X99' ;
  509.       ok := Multi_Dial (prompt,editfld,values,s_decl) ;
  510.       if ok then begin          {if box not cancelled, parse strings, and plot}
  511.          s := Copy (s_decl,1,1) ;
  512.          if s <> '-' then Delete (s_decl,1,1) ;
  513.          dummy := round (Val (s_decl)) ;          {get integer value of declin}
  514.          if dummy > 89 then dummy := 89 ;              {check for idiot values}
  515.          if dummy < -89 then dummy := - 89 ;
  516.          itoa (dummy,s_decl) ;              {reduce it and reconvert to string}
  517.          s := Copy (s_right,1,2) ;
  518.          dummy := round (Val (s)) ;          {get integer value of right ascen}
  519.          if dummy > 23 then dummy := 23 ;              {check for idiot values}
  520.          itoa (dummy,s) ;                   {reduce it and reconvert to string}
  521.          t := Copy (s_right,3,1) ;
  522.          s_right := Concat (s,'.',t) ;
  523.          wname := '  Star Atlas  ' ;
  524.          wind_open (wname) ;
  525.          plot_stars (s_right,s_decl) ;                 {do the plot at RA, Dec}
  526.          wind_close ;
  527.       end ;
  528.    end ;
  529. end ;  {Star_Atlas}
  530.  
  531.  
  532. begin                                             {do sky plot sub menu choice}
  533.   if choice = SOLAR then Sky_Table
  534.   else begin
  535.     Find_Menu (SKY_MENU, skymenu) ;
  536.     repeat
  537.       what_event := 0 ;  {reset event}
  538.       Show_Mouse ;
  539.       Draw_Menu (skymenu);
  540.       Event (E_Message);              {wait until mouse makes a menu selection}
  541.       Hide_Mouse;
  542.       Erase_Menu (skymenu) ;
  543.  
  544.       if msg[3] = SKY_INFO  then About_The_Desktop_Astronomer      {do choice}
  545.       else case msg[4] of
  546.          IT_HOR : Horizon_Plot ;
  547.          IT_ZEN : Zenith_Plot ;
  548.          IT_ATL : Star_Atlas ;
  549.       end ;                                                              {case}
  550.  
  551.       Menu_Normal (skymenu,SKY_INFO) ;                {restore menus to normal}
  552.       Menu_Normal (skymenu,M_FUNC) ;
  553.       Menu_Normal (skymenu,M_QUIT) ;
  554.  
  555.     until msg[3] = M_QUIT;
  556.     Delete_Menu (skymenu) ;
  557.   end ;
  558. end ;  {Do_Sky_Plot}
  559.  
  560.  
  561.  
  562.