IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 27, 2006, 9:10:53 AM (20 years ago)
Author:
eugene
Message:

support for multipage plots; additional PS info now sent after PSIT command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa/graph/PSObjects.c

    r10802 r10834  
    55void ClipLinePS (double, double, double, double, double, double, double, double, FILE *);
    66
    7 int PSit (int mode) {
    8 
    9   int i;
     7static char *name = "$Name: not supported by cvs2svn $";
     8
     9int PSit () {
     10
     11  int i, pageMode, scaleMode;
    1012  double scale;
    1113  FILE *f;
    12   char filename[1024];
     14  char filename[1024], pagename[1024], *version;
    1315  int Nbytes, status;
    1416
    1517  /* expect a line telling the number of bytes and a filename */
    16   status = read (sock, filename, 16);
    17   filename[16] = 0;
    18   sscanf (filename, "%*s %d", &Nbytes);
    19   status = read (sock, filename, Nbytes);
    20   filename[status] = 0; /* make the string easy to parse */
    21 
    22   if (mode == NEWPAGE) {
    23     f = fopen (filename, "a");
     18  KiiScanMessage (sock, "%s %s %d %d", filename, pagename, &scaleMode, &pageMode);
     19
     20  if (pageMode == KAPA_PS_NEWPAGE) {
     21    f = fopen (filename, "a+");
    2422  } else {
    2523    f = fopen (filename, "w");
    2624  }
    27 
    28   if (f == (FILE *) NULL) {
     25  if (f == NULL) {
    2926    fprintf (stderr, "can't open output file %s\n", filename);
    3027    return (TRUE);  /* true because otherwise it quits kapa! */
     
    3229
    3330  /* two scaling options: expand to fit page / keep absolute size */
    34   scale = 1;
    35   if (mode == SCALE) {
     31  if (scaleMode) {
    3632    scale = MIN (fabs(500.0 / graphic.dx), fabs (700.0 / graphic.dy));
    3733  } else {
     
    3935  }
    4036
    41   switch (mode) {
    42     case NEWPAGE:
    43       fprintf (f, "%%%%Page: foobar\n\n");
    44       break;
    45 
    46     case SCALE:
    47     case NOSCALE:
     37  switch (pageMode) {
     38    case KAPA_PS_NEWPLOT:
    4839      fprintf (f, "%%!PS-Adobe-2.0 EPSF-2.0\n");
    49       fprintf (f, "%%%%Title: Kapa Plot\n");
    50       fprintf (f, "%%%%Creator: Kapa (0.95)\n");
     40      fprintf (f, "%%%%Title: %s\n", filename);
     41      version = strip_version (name);
     42      fprintf (f, "%%%%Creator: Kapa (%s)\n", version);
     43      free (version);
    5144      fprintf (f, "%%%%BoundingBox: %d %d %.0f %.0f\n",
    5245               XOFFSET, YOFFSET, XOFFSET + scale*graphic.dx, YOFFSET + scale*graphic.dy);
     
    5548      fprintf (f, "%%%%EndComments\n");
    5649      fprintf (f, "%%%%EndProlog\n");
    57       fprintf (f, "%%%%Page: foobar\n\n");
    58       break;
    59 
    60     case RAW:
     50      fprintf (f, "%%%%Page: %s\n\n", pagename);
     51      break;
     52
     53    case KAPA_PS_NEWPAGE:
     54      fprintf (f, "%%%%Page: %s\n\n", pagename);
     55      break;
     56
     57    case KAPA_PS_RAWPAGE:
    6158      break;
    6259  }
     
    7370  fprintf (f, "/TF {newpath moveto lineto lineto fill stroke} def\n\n");
    7471
    75   if (mode != RAW) {
     72  if (pageMode != KAPA_PS_RAWPAGE) {
    7673    fprintf (f, " %d %d translate\n", XOFFSET, YOFFSET);
    7774    fprintf (f, "  %f  %f scale\n", scale, scale);
     
    8784  fprintf (f, "grestore %% end of picture\n");
    8885
    89   if (mode != RAW) fprintf (f, "showpage\n");
     86  if (pageMode != KAPA_PS_RAWPAGE) fprintf (f, "showpage\n");
    9087
    9188  fclose (f);
Note: See TracChangeset for help on using the changeset viewer.