v11i040: starchart 3.2 Part 12/32
ccount at ATHENA.MIT.EDU
ccount at ATHENA.MIT.EDU
Fri Mar 16 10:35:45 AEST 1990
Posting-number: Volume 11, Issue 40
Submitted-by: ccount at ATHENA.MIT.EDU
Archive-name: starchart/part12
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 12 (of 32)."
# Contents: starchart/starm2.c starchart/starst.c
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'starchart/starm2.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'starchart/starm2.c'\"
else
echo shar: Extracting \"'starchart/starm2.c'\" \(21802 characters\)
sed "s/^X//" >'starchart/starm2.c' <<'END_OF_FILE'
X/*
X * starm2.c, more routines formerly in starchart.c/starmain.c
X * revision 3.1 August, 1989
X *
X * Portions Copyright (c) 1987 by Alan Paeth (awpaeth at watcgl)
X *
X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
X *
X * This software may be redistributed freely, not sold.
X * This copyright notice and disclaimer of warranty must remain
X * unchanged.
X *
X * No representation is made about the suitability of this
X * software for any purpose. It is provided "as is" without express or
X * implied warranty, to the extent permitted by applicable law.
X *
X */
X
X
Xstatic char rcsid[]="$Header: starm2.c,v 1.13 90/03/08 20:20:37 ccount Exp $";
X
X#include <stdio.h>
X#include <math.h>
X#ifndef SYSV
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X#include <ctype.h>
X
X#include "star3.h"
X
X#ifndef READMODE
X#define READMODE "r"
X#endif
X#define OPENFAIL 0
X#define LINELEN 82
X
X#ifndef MAXPATHLEN
X#define MAXPATHLEN 1025
X#endif
X
X/* PI / 180 = .0174532925199 */
X#define DCOS(x) (cos((x)*.0174532925199))
X#define DSIN(x) (sin((x)*.0174532925199))
X#define DTAN(x) (tan((x)*.0174532925199))
X#define DASIN(x) (asin(x)/.0174532925199)
X#define DATAN2(x,y) (atan2(x,y)/.0174532925199)
X#define MAX(a,b) ((a)>(b)?(a):(b))
X#define MIN(a,b) ((a)<(b)?(a):(b))
X
Xextern int cur_function;
Xextern int cur_map_type;
Xextern int cur_map_tag;
Xextern char *cur_tag_field;
Xextern char *cur_file_name;
Xextern user_interact;
Xextern precess;
X
X/* Set by initxform
X One could use elements of the mapwindow structure,
X but these should be faster for the current window */
Xextern int xproj_mode;
Xextern double xwest, xeast, xnorth, xsouth, xbot;
Xextern int cenx, ceny, strty;
Xextern double xracen, sindlcen, cosdlcen, chart_scale;
Xextern double yscale;
Xextern double xc_scale;
Xextern double inv_;
X
X/* xform globals */
Xextern double xf_west, xf_east, xf_north, xf_south, xf_bottom;
Xextern int xf_xcen, xf_ycen, xf_ybot;
Xextern int xf_w_left, xf_w_right, xf_w_top, xf_w_bot;
X
Xextern double xf_c_scale;
X
X
Xextern int htick_lim, htext_lim;
Xextern int htext_xoff, htext_yoff;
Xextern int vtick_lim, vtext_lim;
Xextern int vtext_xoff, vtext_yoff;
X
X
Xextern char *boundfile;
Xextern char boundftype;
Xextern char *patternfile;
Xextern char pattftype;
Xextern char *cnamefile;
Xextern char cnameftype;
Xextern char *mapfiles[];
Xextern int mapftypes[];
Xextern int nummapfiles;
X
Xextern char *progname;
X
X/* read file function indirection to allow for use of alternate file readers */
Xint readstar();
Xint buf_readstar();
Xextern int (*readfile)();
X
X/* Readstar globals */
Xextern double obj_lat, obj_lon, obj_mag;
Xextern char obj_type[], obj_color[], obj_label[];
Xextern char obj_constell[], obj_name[];
Xextern char *obj_commnt, fileline[];
X
X
X/* Chart element routines */
X
X/* Uses xf_north etc. from initxform */
Xchartoutline(win)
X mapwindow *win;
X{
X double start, inc;
X int xloc, xloc2, yloc, yloc2, div, i;
X int inregion;
X int R;
X double phi;
X
X cur_function = CHRTOUTLN;
X
X if (win->proj_mode == STEREOGR) {
X R = MIN(win->height, win->width) / 2 + 1;
X D_move(xf_xcen, xf_ycen+R);
X for (phi = 5.0; phi <= 360.0; phi += 5.0)
X D_draw(xf_xcen + (int)(R*DSIN(phi) + 0.5),
X xf_ycen + (int)(R*DCOS(phi) + 0.5), SOLID);
X } else if (win->proj_mode == SANSONS) {
X xform(xf_south, xf_west, &xloc, &yloc, &inregion);
X xform(xf_south, xf_east, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X xform(xf_north, xf_west, &xloc, &yloc, &inregion);
X xform(xf_north, xf_east, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X
X inc = (xf_north - xf_south);
X div = (int)(inc);
X if (div < 1) div = 1;
X inc /= div;
X start = xf_south;
X xform(start, xf_west, &xloc, &yloc, &inregion);
X D_move(xloc, yloc);
X for (i=0; i < div; i++) {
X start += inc;
X xform(start, xf_west, &xloc, &yloc, &inregion);
X D_draw(xloc, yloc, SOLID);
X }
X start = xf_south;
X xform(start, xf_east, &xloc, &yloc, &inregion);
X D_move(xloc, yloc);
X for (i=0; i < div; i++) {
X start += inc;
X xform(start, xf_east, &xloc, &yloc, &inregion);
X D_draw(xloc, yloc, SOLID);
X }
X charthgrid(win, 15.0, 18);
X charthgrid(win, 5.0, 12);
X charthgrid(win, 1.0, 6);
X chartvgrid(win, 10.0, 18);
X chartvgrid(win, 5.0 , 12);
X chartvgrid(win, 1.0, 6);
X } else if (win->proj_mode == RECTANGULAR) {
X xform(xf_south, xf_west, &xloc, &yloc, &inregion);
X xform(xf_south, xf_east, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X xform(xf_north, xf_west, &xloc, &yloc, &inregion);
X xform(xf_north, xf_east, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X
X xform(xf_north, xf_west, &xloc, &yloc, &inregion);
X xform(xf_south, xf_west, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X xform(xf_north, xf_east, &xloc, &yloc, &inregion);
X xform(xf_south, xf_east, &xloc2, &yloc2, &inregion);
X D_movedraw(xloc, yloc, xloc2, yloc2, SOLID);
X
X charthgrid(win, 15.0, 18);
X charthgrid(win, 5.0, 12);
X charthgrid(win, 1.0, 6);
X chartvgrid(win, 10.0, 18);
X chartvgrid(win, 5.0 , 12);
X chartvgrid(win, 1.0, 6);
X } else { /* GNOMONIC or ORTHOGR */
X D_movedraw(xf_w_left, xf_w_bot, xf_w_right, xf_w_bot, SOLID);
X D_movedraw(xf_w_right, xf_w_bot, xf_w_right, xf_w_top, SOLID);
X D_movedraw(xf_w_right, xf_w_top, xf_w_left, xf_w_top, SOLID);
X D_movedraw(xf_w_left, xf_w_top, xf_w_left, xf_w_bot, SOLID);
X }
X}
X
Xcharthgrid(win, inc, hgt)
X mapwindow *win;
X double inc;
X int hgt;
X{
X double start, stop, ras;
X int xloc, xloc2, yloc, xloc3, yloc3;
X int inregion;
X
X cur_function = CHRTHTICK;
X
X/* r.a. ticks always appear at the bottom, regardless of (invert) */
X/* xf_bottom is the bottom, wether north or south, set in intixform */
X start = modup(xf_west, inc);
X stop = moddown(xf_east, inc);
X xform(xf_bottom, start, &xloc, &yloc, &inregion);
X xform(xf_bottom, start+inc, &xloc2, &yloc, &inregion);
X if (xloc - xloc2 > htick_lim)
X for (ras = start; ras <= stop; ras += inc)
X {
X xform(xf_bottom, ras, &xloc3, &yloc3, &inregion);
X D_movedraw(xloc3, yloc3-hgt, xloc3, yloc3, SOLID);
X if (xloc - xloc2 > htext_lim)
X {
X char tstr[20];
X rastr(tstr, ras);
X D_fontsize(10, HELV);
X D_text(xloc3+htext_xoff, yloc-htext_yoff, tstr, FALSE);
X }
X }
X}
X
Xchartvgrid(win, inc, wid)
X mapwindow *win;
X double inc;
X int wid;
X{
X double start, stop, dl;
X int xloc, yloc, yloc2, xloc3, yloc3;
X int inregion;
X
X cur_function = CHRTVTICK;
X
X start = modup(xf_south, inc);
X stop = moddown(xf_north, inc);
X xform(start, xf_west, &xloc, &yloc, &inregion);
X xform(start+inc, xf_west, &xloc, &yloc2, &inregion);
X if (abs(yloc2 - yloc) > vtick_lim)
X {
X for (dl = start; dl <= stop; dl += inc)
X {
X xform(dl, xf_west, &xloc3, &yloc3, &inregion);
X D_movedraw(xloc3, yloc3, xloc3+wid, yloc3, SOLID);
X if (abs(yloc2 - yloc) > vtext_lim)
X {
X char tstr[20];
X declstr(tstr, dl);
X D_fontsize(10, HELV);
X D_text(xloc3+vtext_xoff, yloc3+vtext_yoff, tstr, FALSE);
X }
X }
X }
X}
X
Xdouble modup(a, b)
X double a, b;
X{
X double new;
X new = ((double)((int)(a/b))*b);
X if (new >= a) return(new);
X return(new += b);
X}
X
Xdouble moddown(a, b)
X double a, b;
X{
X double new;
X new = ((double)((int)(a/b))*b);
X if (new <= a) return(new);
X return (new -= b);
X}
X
X/* return TRUE if a (in degrees) is west of b */
X/* west is towards lower values of RA, e.g. 60 is west of 90 */
Xint westof(a, b)
X double a, b;
X{
X double diff;
X
X diff = b - a;
X if (diff > 180) diff -= 360;
X if (diff < -180) diff += 360;
X
X return (diff > 0);
X}
X
X
X/* return TRUE if a (in degrees) is east of b */
X/* east is towards higher values of RA, e.g. 90 is east of 60 */
Xint eastof(a, b)
X double a, b;
X{
X double diff;
X
X diff = b - a;
X if (diff > 180) diff -= 360;
X if (diff < -180) diff += 360;
X
X return (diff < 0);
X}
X
Xrastr(str, ras)
X char *str;
X double ras;
X{
X int hrs, min;
X if (ras < 0.0) ras += 360.0;
X if (ras > 360.0) ras -= 360.0;
X hrs = (int)(ras/15.0);
X min = (int)((ras - hrs * 15.0) * 4.0);
X sprintf(str, "%2dh", hrs);
X if (min) sprintf(str, "%s%02dm", str, min);
X}
X
Xdeclstr(str, dl)
X char *str;
X double dl;
X{
X int deg, min;
X if (dl == 0.0) sprintf(str, "%s", " ");
X else if (dl > 0.0) sprintf(str, "%s", "+");
X else
X {
X sprintf(str, "%s", "-");
X dl = -dl;
X }
X deg = (int)(dl);
X min = (int)((dl - deg) * 60.0);
X sprintf(str, "%s%02dd", str, deg);
X if (min) sprintf(str, "%s%02dm", str, min);
X}
X
Xchartragrid(win)
X mapwindow *win;
X{
X double glonc, glatc, glon;
X double olon, olat;
X int xloc, yloc, xloc2, yloc2;
X double tlat1, tlon1, tlat2, tlon2;
X
X if (!win->draw_ragrid) return;
X
X cur_function = GRID_RA;
X
X for (glonc = 0.0; glonc <= 360.0; glonc += win->ra_step) {
X glon = glonc + win->ra_strt;
X if (glon < 0.0) glon += 360.0;
X if (glon > 360.0) glon -= 360.0;
X olon = glon;
X olat = glatc = -90.0;
X for (glatc = -90.0; glatc <= 90.0; glatc += 10.0) {
X if (clipr_xform(olat, olon, glatc, glon,
X &xloc, &yloc, &xloc2, &yloc2, TRUE,
X &tlat1, &tlon1, &tlat2, &tlon2)) {
X drawcurveline(tlat1, tlon1, tlat2, tlon2,
X xloc, yloc, xloc2, yloc2, DOTTED, TRUE, 0);
X }
X olat = glatc;
X }
X }
X}
X
Xchartdecgrid(win)
X mapwindow *win;
X{
X double glonc, glatc, glat;
X double olon, olat;
X int xloc, yloc, xloc2, yloc2;
X double tlat1, tlon1, tlat2, tlon2;
X
X if (!win->draw_decgrid) return;
X
X cur_function = GRID_DEC;
X
X for (glatc = 0; glatc <= 90.0; glatc += win->dec_step) {
X glat = glatc + win->dec_strt;
X if (glat < 0.0) glat = 0.0;
X if (glat > 90.0) glat = 90.0;
X olat = glat;
X olon = glonc = 0.0;
X for (glonc = 0.0; glonc <= 360.0; glonc += 10.0) {
X if (clipr_xform(olat, olon, glat, glonc,
X &xloc, &yloc, &xloc2, &yloc2, FALSE,
X &tlat1, &tlon1, &tlat2, &tlon2)) {
X drawcurveline(tlat1, tlon1, tlat2, tlon2,
X xloc, yloc, xloc2, yloc2, DOTTED, FALSE, 0);
X }
X olon = glonc;
X }
X }
X for (glatc = 0; glatc >= -90.0; glatc -= win->dec_step) {
X glat = glatc + win->dec_strt;
X if (glat < -90.0) glat = -90.0;
X if (glat > 0.0) glat = 0.0;
X olat = glat;
X olon = glonc = 0.0;
X for (glonc = 0.0; glonc <= 360.0; glonc += 10.0) {
X if (clipr_xform(olat, olon, glat, glonc,
X &xloc, &yloc, &xloc2, &yloc2, FALSE,
X &tlat1, &tlon1, &tlat2, &tlon2)) {
X drawcurveline(tlat1, tlon1, tlat2, tlon2,
X xloc, yloc, xloc2, yloc2, DOTTED, FALSE, 0);
X }
X olon = glonc;
X }
X }
X}
X
X
X
Xchartecliptic(win)
X mapwindow *win;
X{
X double sineps, coseps;
X int i;
X double lat, lon, olat, olon;
X int xloc, yloc, xloc2, yloc2;
X double tlat1, tlon1, tlat2, tlon2;
X
X cur_function = ECLIPT;
X
X sineps = DSIN(23.439);
X coseps = DCOS(23.439);
X
X olat = 0.0;
X olon = 0.0;
X for (i = 1; i <= 361; i += 10) {
X lat = DASIN(sineps*DSIN(i));
X lon = DATAN2((coseps*DSIN(i)), (DCOS(i)));
X if (lon < 0.0) lon += 360.0; /* Eliminate discontinuity at -180 */
X if (clipr_xform(olat, olon, lat, lon,
X &xloc, &yloc, &xloc2, &yloc2, FALSE,
X &tlat1, &tlon1, &tlat2, &tlon2)) {
X drawcurveline(tlat1, tlon1, tlat2, tlon2,
X xloc, yloc, xloc2, yloc2, DASHED, TRUE, 0);
X
X }
X olat = lat;
X olon = lon;
X }
X}
X
X
Xchartboundaries(win)
X mapwindow *win;
X{
X FILE *sfile;
X if ((sfile = fopen(boundfile, READMODE)) == OPENFAIL) return(0);
X
X cur_function = CONSTBOUND;
X cur_file_name = boundfile;
X
X chartobjects(win, sfile, boundftype, 100.0, 100.0, -100.0,
X /* maglim, lbllim low, gklim high */
X FALSE, 100.0, -100.0, ALLFILES);
X /* don't label with magnitudes */
X fclose(sfile);
X
X cur_file_name = "";
X
X return(1);
X}
X
Xchartpatterns(win)
X mapwindow *win;
X{
X FILE *sfile;
X if ((sfile = fopen(patternfile, READMODE)) == OPENFAIL) return(0);
X
X cur_function = CONSTPATTRN;
X cur_file_name = patternfile;
X
X chartobjects(win, sfile, pattftype, 100.0, 100.0, -100.0,
X /* maglim, lbllim low, gklim high */
X FALSE, 100.0, -100.0, ALLFILES);
X /* don't label with magnitudes */
X fclose(sfile);
X
X cur_file_name = "";
X
X return(1);
X}
X
Xchartconstlnames(win)
X mapwindow *win;
X{
X FILE *sfile;
X if ((sfile = fopen(cnamefile, READMODE)) == OPENFAIL) return(0);
X
X cur_function = CONSTNAME;
X cur_file_name = cnamefile;
X
X chartobjects(win, sfile, cnameftype, 100.0, 100.0, -100.0,
X /* maglim, lbllim low, gklim high */
X FALSE, 100.0, -100.0, ALLFILES);
X /* don't label with magnitudes */
X fclose(sfile);
X
X cur_file_name = "";
X
X return(1);
X}
X
Xchartmain(win, draw_mode)
X mapwindow *win;
X int draw_mode;
X{
X int i;
X char commline[132];
X
X for(i=0;i < win->numfiles; i++) {
X#ifdef INTERACTIVE_CONTROL
X if (user_interact)
X if (D_break()) break;
X#endif
X sprintf(commline, "file %d, type %d, '%s'\n",i,win->file[i].type,
X win->file[i].name);
X D_comment(commline);
X if (!chartfile(win, win->file[i].name, win->file[i].type,
X win->file[i].maglim, win->file[i].lbllim,
X win->file[i].gklim, win->file[i].draw_maglbl,
X win->file[i].maglmin, win->file[i].maglmax, draw_mode))
X fprintf(stderr, "%s: error, open fail on '%s'\n",
X progname, win->file[i].name);
X }
X D_color(" "); /* Reset color */
X}
X
Xchartfile(win, filename, filetype, maglim, lbllim, gklim,
X draw_maglbl, maglmin, maglmax, draw_mode)
X mapwindow *win;
X char *filename;
X int filetype;
X double maglim, lbllim, gklim;
X int draw_maglbl;
X double maglmin, maglmax;
X int draw_mode;
X{
X FILE *file1, *file2;
X double padding;
X double f_east, f_north, f_west, f_south;
X char ibuf[2020], fname[1030], ftypestr[32], commline[1200];
X int n;
X int xloc, yloc, inr1, inr2, inr3, inr4;
X int usethis;
X int ftype;
X
X if ((file1 = fopen(filename, READMODE)) == OPENFAIL) return(FALSE);
X
X cur_function = CHARTFILE;
X cur_file_name = filename;
X
X if (filetype == INDEXTYPE) {
X /* read each line of index file, parse data on the files indexed:
X region included file name
X use an indexed file
X if any corner is in the plot region,
X or if the center of the plot is in the file region */
X /* file region is padded to avoid possible problems with
X corners being out of the plot but some part falling in the area
X which may occur in some clip windows shapes */
X if ((win->proj_mode == STEREOGR) || (win->proj_mode == GNOMONIC)
X || (win->proj_mode == ORTHOGR))
X padding = win->scale;
X else padding = 1.0;
X
X while (!feof(file1)) {
X#ifdef INTERACTIVE_CONTROL
X if (user_interact)
X if (D_break()) break;
X#endif
X fgets(ibuf, 2000, file1);
X n = sscanf(ibuf, "%lf %lf %lf %lf %1000s %30s\n", &f_east, &f_north,
X &f_west, &f_south, fname, ftypestr);
X if ((n != 6) || feof(file1)) continue;
X
X f_east *= 15.0;
X f_west *= 15.0;
X
X f_east += padding;
X f_west -= padding;
X f_north += padding;
X f_south -= padding;
X if (f_east > 360.0) f_east -= 360.0;
X if (f_west < 0.0) f_west += 360.0;
X if (f_north > 90.0) f_north = 90.0;
X if (f_south < -90.0) f_south = -90.0;
X
X xform(f_north, f_east, &xloc, &yloc, &inr1);
X xform(f_south, f_east, &xloc, &yloc, &inr2);
X xform(f_north, f_west, &xloc, &yloc, &inr3);
X xform(f_south, f_west, &xloc, &yloc, &inr4);
X
X usethis = (inr1 || inr2 || inr3 || inr4);
X
X /* If any corner of the file is in the region, use it. (test done above)
X Otherwise if any corner of the region is in the file, use the file.
X Uses xf_north, xf_south, xf_east, xf_west set by initxform()
X Note, east is left when you look at the sky */
X
X if (!usethis) {
X usethis |= ((xf_north >= f_south) && (xf_north <= f_north)
X && (eastof(xf_east,f_west)) && (westof(xf_east,f_east)));
X /* Upper left is in */
X usethis |= ((xf_north >= f_south) && (xf_north <= f_north)
X && (eastof(xf_west,f_west)) && (westof(xf_west,f_east)));
X /* Upper right is in */
X usethis |= ((xf_south >= f_south) && (xf_south <= f_north)
X && (eastof(xf_east,f_west)) && (westof(xf_east,f_east)));
X /* lower left is in */
X usethis |= ((xf_south >= f_south) && (xf_south <= f_north)
X && (eastof(xf_west,f_west)) && (westof(xf_west,f_east)));
X /* lower right is in */
X usethis |= (
X ( ((xf_north >= f_south) && (xf_north <= f_north))
X ||((xf_south >= f_south) && (xf_south <= f_north))
X ||((f_north >= xf_south) && (f_north <= xf_north))
X ||((f_south >= xf_south) && (f_south <= xf_north))
X )
X &&
X ( ((eastof(xf_east,f_west)) && (westof(xf_east,f_east)))
X ||((eastof(xf_west,f_west)) && (westof(xf_west,f_east)))
X ||((eastof(f_east,xf_west)) && (westof(f_east,xf_east)))
X ||((eastof(f_west,xf_west)) && (westof(f_west,xf_east)))
X )
X );
X /* North or south of area is between
X north and south boundaries,
X and east or west of area is between
X east and west boundaries. */
X }
X
X if (usethis) {
X if ((file2 = fopen(fname, READMODE)) == OPENFAIL) {
X fprintf(stderr, "%s: error, couldn't open '%s' for reading.\n",
X progname, fname);
X } else {
X cur_file_name = fname;
X
X ftype = tr_fty(ftypestr);
X sprintf(commline, "'%s', type %d\n",fname, ftype);
X D_comment(commline);
X if (ftype == INDEXTYPE) {
X fprintf(stderr,
X "%s: error, can't use type INDEXTYPE file '%s' from another index file.\n",
X progname, fname);
X } else {
X chartobjects(win, file2, ftype, maglim, lbllim, gklim,
X draw_maglbl, maglmin, maglmax, draw_mode);
X }
X fclose(file2);
X cur_file_name = "";
X }
X }
X }
X } else {
X chartobjects(win, file1, filetype, maglim, lbllim, gklim,
X draw_maglbl, maglmin, maglmax, draw_mode);
X }
X fclose(file1);
X cur_file_name = "";
X return(TRUE);
X}
X
X
Xdouble o_lat, o_lon; /* save areas for track clipping */
Xchar area_stat;
X
Xchartobjects(win, file, ftype, maglim, lbllim, gklim,
X draw_maglbl, maglmin, maglmax, draw_mode)
X mapwindow *win;
X FILE *file;
X int ftype;
X double maglim, lbllim, gklim;
X int draw_mode;
X int draw_maglbl;
X double maglmin, maglmax;
X{
X int xloc, yloc, xloc2, yloc2;
X int inregion;
X double tlat1, tlon1, tlat2, tlon2;
X int glyph_mode, name_mode, magl_mode, vec_mode, area_mode, all_mode;
X int use_label, use_name, use_mag;
X
X /* Modes:
X ALLGLYPHS All symbols
X ALLNAMES All names (and greek)
X ALLMAGLBLS All magnitude labels
X ALLVECTORS All vectors
X ALLAREAS All areas
X ALLFILES All of the above
X */
X
X glyph_mode = ((draw_mode == ALLFILES) || (draw_mode == ALLGLYPHS));
X name_mode = ((draw_mode == ALLFILES) || (draw_mode == ALLNAMES));
X magl_mode = ((draw_mode == ALLFILES) || (draw_mode == ALLMAGLBLS));
X vec_mode = ((draw_mode == ALLFILES) || (draw_mode == ALLVECTORS));
X area_mode = ((draw_mode == ALLFILES) || (draw_mode == ALLAREAS));
X all_mode = (draw_mode == ALLFILES);
X
X for(;;) {
X if ((*readfile)(file, ftype)) break;
X/* if ((obj_mag > maglim) && (obj_type[0] == 'S')) break;*/
X
X if (obj_type[0] == '#') continue;
X
X#ifdef INTERACTIVE_CONTROL
X if (user_interact)
X if (D_break()) break;
X#endif
X
X if ( (obj_mag <= maglim) )
X {
X if (precess) do_precess(&obj_lat, &obj_lon);
X xform(obj_lat, obj_lon, &xloc, &yloc, &inregion);
X if ((!inregion) && (obj_type[0] != 'V')
X && (obj_type[0] != 'A')) continue;
X use_label = (((obj_type[0] == 'S') || (obj_type[0] == 'I')) &&
X (obj_mag <= gklim) &&
X (all_mode || name_mode));
X use_name = ((obj_mag <= lbllim) && name_mode);
X use_mag = (draw_maglbl && (obj_mag <= maglmax) &&
X (obj_mag >= maglmin) && magl_mode);
X
X if (inregion)
X drawobj(xloc, yloc, obj_mag, obj_type, obj_color, obj_label,
X obj_constell, obj_name,
X obj_commnt, fileline,
X glyph_mode,
X name_mode || magl_mode,
X use_label,
X use_name,
X use_mag);
X if (obj_type[0] == 'V') {
X D_color(obj_color);
X if ((obj_type[1] == 'M') || (obj_type[1] == 'm')) { /* move */
X o_lat = obj_lat;
X o_lon = obj_lon;
X } else { /* draw */
X if (vec_mode && clipr_xform(o_lat, o_lon, obj_lat, obj_lon,
X &xloc, &yloc, &xloc2, &yloc2,
X (isupper(obj_type[1])),
X &tlat1, &tlon1, &tlat2, &tlon2)) {
X switch (obj_type[1]) {
X case 'D':
X case 'd':
X drawcurveline(tlat1, tlon1, tlat2, tlon2, xloc, yloc,
X xloc2, yloc2, VECDOT, (obj_type[1] == 'D'), 0);
X break;
X case 'H':
X case 'h':
X drawcurveline(tlat1, tlon1, tlat2, tlon2, xloc, yloc,
X xloc2, yloc2, VECDASH, (obj_type[1] == 'H'), 0);
X break;
X case 'S':
X case 's':
X default:
X drawcurveline(tlat1, tlon1, tlat2, tlon2, xloc, yloc,
X xloc2, yloc2, VECSOLID, isupper(obj_type[1]), 0);
X break;
X
X }
X }
X o_lat = obj_lat;
X o_lon = obj_lon;
X }
X D_color(" ");
X } else if ((obj_type[0] == 'A') && area_mode) {
X D_color(obj_color);
X if ((obj_type[1] == 'M') || (obj_type[1] == 'm')) {
X /* move */
X areastart(obj_lat, obj_lon, (obj_type[1] == 'M'));
X area_stat = 'M';
X } else if ((obj_type[1] == 'A') || (obj_type[1] == 'a')) {
X /* add segment */
X areaadd(obj_lat, obj_lon, (obj_type[1] == 'A'));
X area_stat = obj_type[1];
X } else if ((obj_type[1] == 'F') || (obj_type[1] == 'f')) {
X /* fill */
X if ((area_stat == 'A') || (area_stat == 'a'))
X /* Else, likely an error */
X areaadd(obj_lat, obj_lon, (obj_type[1] == 'F'));
X areafinish();
X area_stat = obj_type[1];
X };
X D_color(" ");
X }
X }
X }
X}
END_OF_FILE
if test 21802 -ne `wc -c <'starchart/starm2.c'`; then
echo shar: \"'starchart/starm2.c'\" unpacked with wrong size!
fi
# end of 'starchart/starm2.c'
fi
if test -f 'starchart/starst.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'starchart/starst.c'\"
else
echo shar: Extracting \"'starchart/starst.c'\" \(21986 characters\)
sed "s/^X//" >'starchart/starst.c' <<'END_OF_FILE'
X/*
X * GDOS Display driver for starchart.c ATARI ST - Version
X */
X
X/*
X * Modified from 2.1 to starchart 3.0. Holger Zessel, Nov 1989
X */
Xstatic char rcsid[]="$Header: starst.c,v 1.1 90/03/08 20:14:37 ccount Exp $";
X
X#include <stdio.h>
X#include <math.h>
X#ifndef SYSV
X#include <strings.h>
X#else
X#include <string.h>
X#endif
X#include <ctype.h> /* isprint(), iscntrl(), etc. */
X#include <osbind.h> /* Operating system bindings */
X#include <vdibind.h> /* The virtual device interface routines */
X#include <stdio.h>
X#include "star3.h" /* Starchart information */
X
X/* Global line A variables used by vdi; MUST be included */
Xint contrl[12], intin[128], ptsin[128], intout[128], ptsout[128];
X/* Array used by vs_clip() */
Xint cliparray[] = { 0, 0, 32767, 32767 };
X
Xint work_in[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
Xint work_out[57];
Xint dummy;
Xint vdihandle; /* Virtual device's handle */
Xint vdihandle_save;
Xint device=1; /* GDOS-Outputdevice */
X
X#define TRUE 1
X#ifdef NULL
X#undef NULL
X#endif
X#define NULL 0
X
X/*
X** Starchart was designed for 1024x768 pixels. These macros scale the
X** image to the 32768*32768 Atari ST GDOS-resolution in normalized mode.
X*/
X#define xadjust(x) ((x) * 32)
X#define yadjust(y) ((y) * 42.667)
X
X
X/* Externs */
Xextern int g_argc;
Xextern char **g_argv;
X
Xextern char *title; /* Title of page */
X
Xextern mapwindow *mapwin[MAXWINDOWS];
Xextern int numwins;
X
Xextern int cur_function;
Xextern int cur_map_type;
Xextern int cur_map_tag;
Xextern char *cur_tag_field;
X
X
X/* Scale multiplier, minimum,
X magnitude change, maximum, for thumbnail,*/
X#define THSMUL 1.2
X#define THSMIN 12.0
X#define THMADJ 2.5
X#define THMMAX 5.0
X
X
X/* Exports */
X
X/* The variables in the first few lines MUST be set by driver */
Xmapwindow fullpage = {
X 880, 700, 20, 65, /* width, height, x and y offsets */
X 5.9, 2.0, 2.05, /* default limiting mags for glyph, name, label */
X
X/* The next several variables SHOULD be set by the driver,
X but are only used by the driver */
X FULLPAGEMAP, /* Type of map: THUMBNAIL may have
X some restrictions */
X 0, /* May be used by driver for whatever */
X "String", /* May be used by driver for whatever */
X
X/* The next several variables may be set by the driver, but the main routines
X may reset them (and the driver routines may then override that) */
X SANSONS, /* Projection mode */
X FALSE, FALSE, /* Draw grids */
X 0.5, 5.0, /* grid step size */
X 0.0, 0.0, /* grid origin */
X
X FALSE, /* Invert (flip north south) */
X};
X
X/* The variables in the first few lines MUST be set by driver */
Xmapwindow mainmap = {
X 880, 500, 20, 265, /* width, height, x and y offsets */
X 5.9, 2.0, 2.05, /* default limiting mags for glyph, name, label */
X
X/* The next several variables SHOULD be set by the driver,
X but are only used by the driver */
X MAINMAP, /* Type of map: THUMBNAIL may have
X some restrictions */
X 0, /* May be used by driver for whatever */
X "String", /* May be used by driver for whatever */
X
X/* The next several variables may be set by the driver, but the main routines
X may reset them (and the driver routines may then override that) */
X SANSONS, /* Projection mode */
X FALSE, FALSE, /* Draw grids */
X 0.5, 5.0, /* grid step size */
X 0.0, 0.0, /* grid origin */
X
X FALSE, /* Invert (flip north south) */
X};
X
X
X/* The variables in the first few lines MUST be set by driver */
Xmapwindow thumbmap = {
X 480, 195, 420, 35, /* width, height, x and y offsets */
X#ifndef ATARI_ST
X 3.0+THMADJ, 1.0+THMADJ, 2.05+THMADJ,
X#else
X 5.5, 3.5, 4.55,
X#endif
X /* default limiting mags for glyph, name, label */
X
X/* The next several variables SHOULD be set by the driver,
X but are only used by the driver */
X THUMBNAIL, /* Type of map: THUMBNAIL may have
X some restrictions */
X 0, /* May be used by driver for whatever */
X "String", /* May be used by driver for whatever */
X
X/* The next several variables may be set by the driver, but the main routines
X may reset them (and the driver routines may then override that) */
X SANSONS, /* Projection mode */
X FALSE, FALSE, /* Draw grids */
X 0.5, 5.0, /* grid step size */
X 0.0, 0.0, /* grid origin */
X
X FALSE, /* Invert (flip north south) */
X};
X
X/* h & v tick text controls */
Xint htick_lim = 2;
Xint htext_lim = 80;
Xint htext_xoff = 2;
Xint htext_yoff = 17;
Xint vtick_lim = 2;
Xint vtext_lim = 20;
Xint vtext_xoff = 24;
Xint vtext_yoff = -4;
X
X/* Scale multiplier, minimum,
X magnitude change, maximum, for thumbnail,*/
Xdouble th_smul=THSMUL;
Xdouble th_smin=THSMIN;
Xdouble th_madj=THMADJ;
Xdouble th_mmax=THMMAX;
X
X#define MAX(a,b) ((a)>(b)?(a):(b))
X#define MIN(a,b) ((a)<(b)?(a):(b))
X
Xint CURRX, CURRY;
X
X
X
X/* Device control argument */
XD_control_arg(s)
Xchar *s;
X{
X int i = 0;
X int c;
X char *p;
X
X switch (*s) {
X case 'd': /* output-device */
X device = atoi(&s[1]); /* device immediately after 'd' */
X break;
X default:
X fprintf(stderr,"Wrong device control string!\n");
X exit(1);
X break;
X }
X}
X
X
X
Xstatic open_virtual_device()
X{
X int i;
X if(appl_init()<0) /* Initialize the application and register it with AES */
X {
X fprintf(stderr,"could not appl_init !!\n");
X exit(1);
X }
X vdihandle = graf_handle(&i, &i, &i, &i); /* Get a VDI handle */
X work_in[0]=(device==31) ? vdihandle:device;
X work_in[10]=(device==31) ? 2:0;
X v_opnvwk(work_in, &vdihandle, work_out); /* Open the virtual workscreen */
X if (vdihandle == 0)
X {
X fprintf(stderr,"could not open virtual workstation!\n");
X appl_exit();
X exit(1);
X }
X work_in[10]=0;
X}
X
X/* Open the device */
XD_open()
X{
X int i;
X
X if (!vqgdos())
X {
X fprintf(stderr,"No gdos loaded !!\n");
X exit(1);
X }
X
X fprintf(stderr,"Device=%d\n",device);
X if ((device >= 1)&&(device <= 4))
X {
X Cursconf(0,0);
X open_virtual_device();
X v_hide_c(vdihandle);
X v_clrwk(vdihandle);
X (void)vst_font(vdihandle,1);
X }
X else
X { int fontindex;
X char fontname[33];
X
X if (device == 31)
X {
X open_virtual_device(); /* seems to be necessary for metafiles*/
X work_in[10]=2;
X vdihandle_save = vdihandle; /* save handle */
X }
X work_in[0]=device;
X v_opnwk(work_in, &vdihandle, work_out); /* Open the virtual workscreen */
X if (vdihandle == 0)
X {
X fprintf(stderr,"could not open physical workstation!\n");
X exit(1);
X }
X (void)vst_load_fonts(vdihandle, 0);
X fontindex = vqt_name(vdihandle,1,fontname);
X vst_font(vdihandle, fontindex);
X }
X
X if (device == 31)
X {
X intin[0]=0;
X intin[1]=2100;
X intin[2]=3050;
X v_write_meta(vdihandle,3,intin,0,ptsin);
X }
X vs_clip(vdihandle, 1, cliparray); /* Set the clipping rectangle */
X vsf_color(vdihandle, 1);
X vsf_interior(vdihandle, 1);
X vsf_perimeter(vdihandle, 0);
X vsf_style(vdihandle,8);
X vswr_mode(vdihandle, 2);
X vst_rotation(vdihandle, 0);
X vst_color(vdihandle,1);
X
X}
X
X#ifdef ATARI_ST
XD_die(a,b)
Xchar *a,*b;
X{
X D_close();
X}
X#endif
X
X/* Close the device */
XD_close()
X{
X char text[80];
X if ((device >=1) && (device <= 4)) /* Screen */
X {
X gets(text);
X v_clsvwk(vdihandle); /* Close the virtual workscreen */
X appl_exit(); /* Remove the application from AES */
X v_show_c(vdihandle,1);
X Cursconf(1,0);
X }
X else
X {
X if (device == 31)
X v_meta_extents(vdihandle,0,0,0x7fff,0x7fff);
X
X v_updwk(vdihandle);
X v_clswk(vdihandle); /* Close the physical workscreen */
X
X if (device == 31)
X {
X vdihandle = vdihandle_save;
X v_clsvwk(vdihandle); /* Close the virtual workscreen */
X appl_exit(); /* Remove the application from AES */
X }
X
X }
X}
X
X
X/* Move to (x, y) */
XD_move(x, y)
X int x, y;
X{
X CURRX = x;
X CURRY = y;
X}
X
X
X/* Draw a line of style line_style from the current point to (x, y) */
X/* Note, this replaces vecdraw vecdrawdot and vecdrawhyph */
XD_draw(x, y, line_style)
X int x, y;
X int line_style; /* SOLID, DOTTED, DASHED, etc. */
X{
X int line[4];
X switch(line_style) {
X case SOLID:
X vsl_type(vdihandle,1);
X break;
X case DOTTED:
X case VECDOT:
X vsl_type(vdihandle,7);
X vsl_udsty(vdihandle, 0xaaaa);
X break;
X case DASHED:
X case VECDASH:
X vsl_type(vdihandle,5);
X break;
X default:
X vsl_type(vdihandle,1);
X break;
X }
X line[0] = xadjust(CURRX);
X line[1] = yadjust(CURRY);
X line[2] = xadjust(CURRX = x);
X line[3] = yadjust(CURRY = y);
X v_pline(vdihandle, 2, line);
X}
X
X/* This routine is encouraged to look at the extern cur_funtion
X and change the line style drawn as desired */
X
X
X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */
XD_movedraw(x1, y1, x2, y2, line_style)
X int x1, y1, x2, y2;
X int line_style; /* SOLID, DOTTED, DASHED, etc. */
X{
X D_move(x1, y1);
X D_draw(x2, y2, line_style);
X}
X
X
X/* Set the color to be used for lines and text */
X/* color_str is a 2 char (+ '\0') string containing
X a specification for a color,
X e.g. "G2" for the color of a star of spectral class G2, or "r7" for
X red, level seven. The interpretation of the color string is left to
X the device driver */
XD_color(color_str)
X char *color_str;
X{
X switch (color_str[0]) {
X case 'O':
X break;
X case 'B':
X break;
X case 'A':
X break;
X case 'F':
X break;
X case 'G':
X break;
X case 'K':
X break;
X case 'M':
X break;
X case 'R':
X case 'N':
X case 'S':
X break;
X case 'r':
X case 'g':
X case 'b':
X case 'y':
X case 'c':
X case 'p':
X case 'o':
X case 'w':
X break;
X case ' ':
X default:
X break;
X }
X}
X
X
X/* Set the font and font size to be used for text. */
X/* Note order of args */
XD_fontsize(fsize, font)
X int fsize; /* Size of font */
X int font; /* e.g. TIMES, HELV, TIMES+ITALIC */
X{
X (void)vst_point(vdihandle,fsize,&dummy,&dummy,&dummy,&dummy);
X/* (void)vst_height(vdihandle,fsize,&dummy,&dummy,&dummy,&dummy);*/
X}
X/* This routine is encouraged to look at the extern cur_funtion
X and change the font used as desired */
X
X
X/* Display text string str at x,y, in current font and font size.
X if star_lbl is TRUE, string is a star label, use
X greek characters (if possible) */
XD_text(x, y, str, star_lbl)
X int x, y;
X char *str;
X int star_lbl;
X{
X int x1,y1;
X
X if (*str == '\0') /* Don't bother if the string is empty */
X return;
X
X if (star_lbl) {
X /* remove leading spaces */
X while (*str == ' ') str++;
X /* can't display greek characters */
X }
X
X x1 = xadjust(x);
X y1 = yadjust(y);
X if (y1 > 32750)
X y1 = 32750; /* Make sure the bottom line shows up */
X
X vswr_mode(vdihandle, 1);
X v_gtext(vdihandle,x1,y1,str);
X vswr_mode(vdihandle, 2);
X
X
X}
X
X
X
X/* Return input coordinate in device coords where there are pointing devices */
XD_inxy(x, y)
X int *x, *y;
X{
X}
X
X
X/* Put non-displayed comment in output. Allowed in postscript, but
X few other drivers will be able to support this. */
XD_comment(str)
X char *str;
X{
X#if 0
X fprintf(stderr, "%s\n", str);
X#endif
X}
X
X
X/**
XHigher level functions
X**/
X
X/* Point sizes for font calls */
X#define TITLESIZE 12
X#define SUBTLSIZE 12
X#ifdef NAMESIZE
X#undef NAMESIZE
X#endif
X#define NAMESIZE 7
X#define LBLSIZE 7
X#define MAGSIZE 7
X
X#ifdef STARIMAGES
Xint namesize = NAMESIZE;
Xint lblsize = LBLSIZE;
Xint magsize = MAGSIZE;
X#endif
X
X/* Fonts for font calls */
X#define NAMEFNT TIMESROMAN
X#define LBLFNT HELV
X#define MAGFNT COURIER
X#define TITLEFNT TIMESBOLD
X#define SUBTLFNT TIMESROMAN
X
X#ifdef STARIMAGES
Xint namefnt = NAMEFNT;
Xint lblfnt = LBLFNT;
Xint magfnt = MAGFNT;
X#endif
X
Xint x_nameoffset = 10, y_nameoffset = 0;
Xint x_lbloffset = 0, y_lbloffset = 10;
Xint x_magoffset = 15, y_magoffset = -15;
X
X
X#ifndef STARIMAGES
X
X/* Interface Function */
X/* Draw object at x, y. properties set by other parameters */
Xdrawobj(x, y, mag, type, color_str, label_field, con_str, obj_name,
X comment_str, file_line,
X draw_glyph, draw_text, use_lbl, use_name, use_mag)
X
X int x, y;
X double mag; /* Magnitude of object */
X char *type; /* 2 chars, object code and subcode */
X char *color_str; /* 2 chars, spectral type for stars,
X color code otherwise */
X char *label_field; /* 2 chars, Bayer or flamsteed for stars,
X size in seconds for nebulae and
X planets */
X char *con_str; /* 3 chars, the constellation the object is in */
X char *obj_name; /* Name of object */
X char *comment_str; /* Comment field */
X char *file_line; /* The full line from the file,
X containing the above if it is in
X standard format */
X int draw_glyph; /* Draw object symbol */
X int draw_text; /* Draw text */
X int use_lbl; /* Label object with the label_field string */
X int use_name; /* Label object with the obj_name string */
X int use_mag; /* Label object with a 2 or 3 character string
X containing the magnitude * 10 without
X decimal point */
X{
X char magstr[10];
X
X/*fprintf(stderr, "%d %d %f <%s> <%s> <%s> <%s> <%s> <%s> <%s>\n", x, y, mag,
X type, color_str, label_field, con_str, obj_name, comment_str,
X file_line);*/
X
X if (draw_glyph)
X switch(type[0]) {
X case 'S': drawStar(x,y,mag,type[1],color_str);
X break;
X case 'P': drawPlan(x,y,mag,type[1],color_str, size_obj(label_field),
X comment_str);
X break;
X case 'N': drawNebu(x,y,mag,type[1],color_str, size_obj(label_field));
X break;
X case 'G': drawGalx(x,y,mag,type[1],color_str, size_obj(label_field));
X break;
X case 'C': drawClus(x,y,mag,type[1],color_str, size_obj(label_field));
X break;
X case 'U':
X drawUnknown(x,y,mag,type[1],color_str, size_obj(label_field));
X break;
X case 'O':
X drawOther(x,y,mag,type[1],color_str, size_obj(label_field));
X break;
X case 'V':
X case 'A':
X case 'I':
X break;
X case '#':
X default:
X break;
X };
X
X
X/*
X * use name or label
X */
X if (draw_text) {
X if (type[0] == 'I')
X D_color(color_str);
X else
X D_color(" ");
X
X if (use_name && obj_name[0]) {
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(x+x_nameoffset, y+y_nameoffset, obj_name, FALSE);
X } else if (use_lbl &&
X ((label_field[0] != ' ') || (label_field[1] != ' '))) {
X D_fontsize(LBLSIZE, LBLFNT);
X D_text(x+x_lbloffset, y+y_lbloffset, label_field, TRUE);
X }
X/* If you want to mag label other objects, change this */
X if (use_mag && (type[0] == 'S')) {
X sprintf(magstr, "%02d", (int)(mag*10.0+0.5));
X D_fontsize(MAGSIZE, MAGFNT);
X D_text(x+x_magoffset, y+y_magoffset, magstr, FALSE);
X }
X }
X}
X
XdrawStar(x, y, mag, type, color)
X int x, y;
X double mag;
X char type, *color;
X{
X double mag2,mag3;
X mag2 = (250 - (mag+1)*30);
X mag2= (mag2<=0)?1:mag2;
X vsf_perimeter(vdihandle, 1);
X v_circle(vdihandle, (int)xadjust(x), (int)yadjust(y), (int)mag2);
X vsf_perimeter(vdihandle, 0);
X
X if ((type == 'V') && (mag<7))
X {
X mag3 = mag2 * 2.0;
X vsf_interior(vdihandle, 0);
X vsf_perimeter(vdihandle, 1);
X v_circle(vdihandle, (int)xadjust(x), (int)yadjust(y), (int)mag3);
X vsf_perimeter(vdihandle, 0);
X vsf_interior(vdihandle, 1);
X }
X else
X if (((type == 'B') || (type == 'D')) && (mag<7))
X {
X int line[4];
X line[1]=line[3]=(int)yadjust(y);
X line[0]= (int)(xadjust(x)-mag2-(mag2/4.0));
X line[2]= (int)(xadjust(x)+mag2+(mag2/4.0));
X v_pline(vdihandle, 2, line);
X }
X}
X
XdrawPlan(x, y, mag, pcode, color, plansize)
X int x,y;
X double mag;
X char pcode, *color;
X long plansize;
X
X{
X vsf_interior(vdihandle, 0);
X drawStar(x, y, mag, 'S', color);
X vsf_interior(vdihandle, 1);
X}
X
XdrawGalx(x, y, mag, type, color, nebsize)
X int x, y;
X double mag;
X char type, *color;
X long nebsize; /* -1 should give default size */
X{
X vsf_interior(vdihandle, 0);
X vsf_perimeter(vdihandle, 1);
X v_ellipse(vdihandle, (int)xadjust(x), (int)yadjust(y),(int)xadjust(12),(int)yadjust(8));
X vsf_perimeter(vdihandle, 0);
X vsf_interior(vdihandle, 1);
X}
X
XdrawClus(x, y, mag, type, color, nebsize)
X int x, y;
X double mag;
X char type, *color;
X long nebsize; /* -1 should give default size */
X{
X switch(type) {
X case 'G': {
X int pxyarray[4];
X int x1=(int)xadjust(x);
X int y1=(int)yadjust(y);
X int dx=(int)xadjust(6);
X int dy=(int)yadjust(6);
X
X vsf_interior(vdihandle, 0);
X vsf_perimeter(vdihandle, 1);
X/* v_circle(vdihandle, x1, y1, 300); */
X v_ellipse(vdihandle, x1, y1, (int)xadjust(10),(int)yadjust(10));
X vsf_perimeter(vdihandle, 0);
X vsf_interior(vdihandle, 1);
X pxyarray[0]=pxyarray[2]=x1;
X pxyarray[1]=y1+dy;
X pxyarray[3]=y1-dy;
X v_pline(vdihandle, 2, pxyarray);
X pxyarray[0]=x1-dx;
X pxyarray[2]=x1+dx;
X pxyarray[1]=pxyarray[3]=y1;
X v_pline(vdihandle, 2, pxyarray);
X break;
X }
X case 'O':
X default:
X vsf_interior(vdihandle, 0);
X vsl_type(vdihandle,3);
X /* vsl_type(vdihandle,7);*/
X /* vsl_udsty(vdihandle, 0xcccc);*/
X vsf_perimeter(vdihandle, 1);
X v_arc(vdihandle, (int)xadjust(x), (int)yadjust(y), 300,0,3600);
X vsf_perimeter(vdihandle, 0);
X vsl_type(vdihandle,1);
X vsf_interior(vdihandle, 1);
X break;
X }
X}
X
XdrawNebu(x, y, mag, type, color, nebsize)
X int x, y;
X double mag;
X char type, *color;
X long nebsize; /* -1 should give default size */
X{
X int pxyarray[4];
X int x1=(int)xadjust(x);
X int y1=(int)yadjust(y);
X int dx=(int)xadjust(5);
X int dy=(int)yadjust(5);
X /* box of 5 edgelength */
X pxyarray[0]= x1 - dx;
X pxyarray[1]= y1 - dy;
X pxyarray[2]= x1 + dx;
X pxyarray[3]= y1 + dy;
X vsf_interior(vdihandle, 0);
X vsl_type(vdihandle,1);
X vsf_perimeter(vdihandle, 1);
X v_bar(vdihandle,pxyarray);
X vsf_perimeter(vdihandle, 0);
X vsl_type(vdihandle,1);
X vsf_interior(vdihandle, 1);
X}
X
XdrawUnknown(x, y, mag, type, color, nebsize)
X int x, y;
X double mag;
X char type, *color;
X long nebsize; /* -1 should give default size */
X{
X}
X
XdrawOther(x, y, mag, type, color, nebsize)
X int x, y;
X double mag;
X char type, *color;
X long nebsize; /* -1 should give default size */
X{
X}
X
X#else STARIMAGES
X
X/*
X** Draw a horizontal line.
X*/
X
Xdrawlen (x, y, dx, dy, len)
Xint x, y, dx, dy, len;
X{
X/* D_movedraw(x+dx, y+dy,
X x+dx+len,
X y+dy, SOLID); another solution ! */
X#undef DRAWTEST
X#ifdef DRAWTEST
X int line[4],i;
X double cx,cy;
X
X cx=xadjust(x);
X cy=yadjust(y)+dy*5;
X
X line[0] = cx + dx*5;
X line[2] = cx + dx*5 + len*10 - 10;
X
X for (i=-5; i<=5 ; i++)
X {
X line[1] = line[3] = cy + i;
X v_pline(vdihandle, 2, line);
X }
X#else
X int line[4];
X
X line[0] = xadjust(x) + dx;
X line[2] = xadjust(x) + dx + len - 1;
X line[1] = line[3] = yadjust(y) + dy;
X v_pline(vdihandle, 2, line);
X#endif
X}
X
X#endif STARIMAGES
X
X/* Functions for areas, drawn as lines for now */
X/* Move to (x, y) to begin an area */
XD_areamove(x, y)
X int x, y;
X{
X D_move(x, y);
X}
X
X/* Add a segment to the area border */
XD_areaadd(x, y)
X int x, y;
X{
X D_draw(x, y, SOLID);
X}
X
X/* Fill the area, after adding the last segment */
XD_areafill(x, y)
X int x, y;
X{
X D_draw(x, y, SOLID);
X}
X
X
X/* Variables of positioning are here */
X#define L_TIL 220
X#define L_STIL 185
X
X#define L_LMAR1 40
X#define L_LMAR2 65
X#define L_LTEXT 95
X#define L_RMAR1 205
X#define L_RMAR2 230
X#define L_RTEXT 260
X
X#define L_LINE1 150
X#define L_LINE2 125
X#define L_LINE3 100
X#define L_LINE4 75
X#define L_LINE5 50
X#define L_LINE6 25
X
X
Xchartlegend(win)
X mapwindow *win;
X{
X char ras[20], dls[20], outstr[40];
X if (!title[0]) title = "LEGEND";
X rastr(ras, win->racen);
X declstr(dls, win->dlcen);
X
X if (win->map_type != FULLPAGEMAP) {
X sprintf(outstr, "(%s,%s lim: %2.1f)", ras, dls, win->maglim);
X D_fontsize(TITLESIZE, TITLEFNT); D_text(L_LMAR1, L_TIL, title, FALSE);
X D_fontsize(SUBTLSIZE, SUBTLFNT); D_text(L_LMAR1, L_STIL, outstr, FALSE);
X
X drawStar(L_LMAR2, L_LINE1, 0.0, 'S', " ");
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_LTEXT, L_LINE1,"<0.5", FALSE);
X if (win->maglim >= 0.5)
X {
X drawStar(L_RMAR2, L_LINE1, 1.0, 'S', " ");
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text( L_RTEXT, L_LINE1,"<1.5", FALSE);
X }
X if (win->maglim >= 1.5)
X {
X drawStar(L_LMAR2, L_LINE2, 2.0, 'S', " ");
X D_fontsize( NAMESIZE, NAMEFNT);
X D_text(L_LTEXT, L_LINE2,"<2.5", FALSE);
X }
X if (win->maglim >= 2.5)
X {
X drawStar(L_RMAR2, L_LINE2, 3.0, 'S', " ");
X D_fontsize( NAMESIZE, NAMEFNT);
X D_text(L_RTEXT, L_LINE2,"<3.5", FALSE);
X }
X if (win->maglim >= 3.5)
X {
X drawStar(L_LMAR2, L_LINE3, 4.0, 'S', " ");
X D_fontsize( NAMESIZE, NAMEFNT);
X D_text(L_LTEXT, L_LINE3,"<4.5", FALSE);
X }
X if (win->maglim > 4.5)
X {
X drawStar(L_RMAR2, L_LINE3, 5.0, 'S', " ");
X D_fontsize( NAMESIZE, NAMEFNT);
X D_text(L_RTEXT, L_LINE3,">4.5", FALSE);
X }
X
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_LTEXT,L_LINE4,"double", FALSE);
X drawStar(L_LMAR2,L_LINE4,2.0, 'D', " ");
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_RTEXT,L_LINE4,"variable",FALSE);
X drawStar(L_RMAR2,L_LINE4,2.0, 'V', " ");
X
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_LTEXT,L_LINE5,"planet", FALSE);
X drawPlan(L_LMAR2,L_LINE5,1.0, ' ', " ", (long) -1);
X
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_RTEXT,L_LINE5,"galaxy", FALSE);
X drawGalx(L_RMAR2,L_LINE5,1.0, 'E', " ", (long) -1);
X drawGalx(L_RMAR1,L_LINE5,1.0, 'S', " ", (long) -1);
X
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_LTEXT,L_LINE6,"nebula", FALSE);
X drawNebu(L_LMAR2,L_LINE6,1.0, 'D', " ", (long) -1);
X drawNebu( L_LMAR1,L_LINE6,1.0, 'P', " ", (long) -1);
X
X D_fontsize(NAMESIZE, NAMEFNT);
X D_text(L_RTEXT,L_LINE6,"cluster", FALSE);
X drawClus(L_RMAR2,L_LINE6,1.0, 'O', " ", (long) -1);
X drawClus(L_RMAR1,L_LINE6,1.0, 'G', " ", (long) -1);
X } else {
X D_fontsize(NAMESIZE, NAMEFNT);
X
X sprintf(outstr, "%s: %s,%s lim: %2.1f", title, ras, dls, win->maglim);
X D_text(15, 15, outstr, FALSE);
X }
X}
END_OF_FILE
if test 21986 -ne `wc -c <'starchart/starst.c'`; then
echo shar: \"'starchart/starst.c'\" unpacked with wrong size!
fi
# end of 'starchart/starst.c'
fi
echo shar: End of archive 12 \(of 32\).
cp /dev/null ark12isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 32 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Comp.sources.misc
mailing list