PLplot  5.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plstream.cc
Go to the documentation of this file.
1 //----------------------------------*-C++-*----------------------------------//
2 // Geoffrey Furnish
3 // Sep 21 1994
4 //
5 // Copyright (C) 2004,2005 Andrew Ross
6 // Copyright (C) 2004-2014 Alan W. Irwin
7 //
8 // This file is part of PLplot.
9 //
10 // PLplot is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Library General Public License as published
12 // by the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // PLplot is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Library General Public License for more details.
19 //
20 // You should have received a copy of the GNU Library General Public License
21 // along with PLplot; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 
24 //--------------------------------------------------------------------------
25 // @> Source file plstream.
26 //--------------------------------------------------------------------------
27 
28 #include "plplot.h"
29 #include "plstream.h"
30 
31 #include <iostream>
32 
33 #ifdef PL_USE_NAMESPACE
34 using namespace std;
35 #endif
36 
38 {
39  const Contourable_Data& d = *(Contourable_Data *) p;
40 
41  return d( i, j );
42 }
43 
45  PLFLT *nx, PLFLT *ny, PLPointer p )
46 {
47  const Coord_Xformer& xf = *(Coord_Xformer *) p;
48 
49  xf.xform( ox, oy, *nx, *ny );
50 }
51 
52 // A specific case for handling transformation defined by 2-d grid vertex
53 // specification matrices.
54 
56  : xg( cx ), yg( cy )
57 {
58 }
59 
60 // Next routine copied and modified for C++ from PLPLOT 4.99d.
61 
62 //--------------------------------------------------------------------------
63 // pltr2()
64 //
65 // Does linear interpolation from doubly dimensioned coord arrays
66 // (column dominant, as per normal C 2d arrays).
67 //
68 // This routine includes lots of checks for out of bounds. This would
69 // occur occasionally due to some bugs in the contour plotter (now fixed).
70 // If an out of bounds coordinate is obtained, the boundary value is provided
71 // along with a warning. These checks should stay since no harm is done if
72 // if everything works correctly.
73 //--------------------------------------------------------------------------
74 
75 void cxx_pltr2::xform( PLFLT x, PLFLT y, PLFLT& tx, PLFLT& ty ) const
76 {
77  int nx, ny;
78  xg.elements( nx, ny );
79 
80  int ul, ur, vl, vr;
81  PLFLT du, dv;
82 
83  PLFLT xll, xlr, xrl, xrr;
84  PLFLT yll, ylr, yrl, yrr;
85  PLFLT xmin, xmax, ymin, ymax;
86 
87  ul = (int) x;
88  ur = ul + 1;
89  du = x - ul;
90 
91  vl = (int) y;
92  vr = vl + 1;
93  dv = y - vl;
94 
95  xmin = 0;
96  xmax = nx - 1;
97  ymin = 0;
98  ymax = ny - 1;
99 
100  if ( x < xmin || x > xmax || y < ymin || y > ymax )
101  {
102  cerr << "cxx_pltr2::xform, Invalid coordinates\n";
103 
104  if ( x < xmin )
105  {
106  if ( y < ymin )
107  {
108  tx = xg( 0, 0 );
109  ty = yg( 0, 0 );
110  }
111  else if ( y > ymax )
112  {
113  tx = xg( 0, ny - 1 );
114  ty = yg( 0, ny - 1 );
115  }
116  else
117  {
118  xll = xg( 0, vl );
119  yll = yg( 0, vl );
120  xlr = xg( 0, vr );
121  ylr = yg( 0, vr );
122 
123  tx = xll * ( 1 - dv ) + xlr * ( dv );
124  ty = yll * ( 1 - dv ) + ylr * ( dv );
125  }
126  }
127  else if ( x > xmax )
128  {
129  if ( y < ymin )
130  {
131  tx = xg( nx - 1, 0 );
132  ty = yg( nx - 1, 0 );
133  }
134  else if ( y > ymax )
135  {
136  tx = xg( nx - 1, ny - 1 );
137  ty = yg( nx - 1, ny - 1 );
138  }
139  else
140  {
141  xll = xg( nx - 1, vl );
142  yll = yg( nx - 1, vl );
143  xlr = xg( nx - 1, vr );
144  ylr = yg( nx - 1, vr );
145 
146  tx = xll * ( 1 - dv ) + xlr * ( dv );
147  ty = yll * ( 1 - dv ) + ylr * ( dv );
148  }
149  }
150  else
151  {
152  if ( y < ymin )
153  {
154  xll = xg( ul, 0 );
155  xrl = xg( ur, 0 );
156  yll = yg( ul, 0 );
157  yrl = yg( ur, 0 );
158 
159  tx = xll * ( 1 - du ) + xrl * ( du );
160  ty = yll * ( 1 - du ) + yrl * ( du );
161  }
162  else if ( y > ymax )
163  {
164  xlr = xg( ul, ny - 1 );
165  xrr = xg( ur, ny - 1 );
166  ylr = yg( ul, ny - 1 );
167  yrr = yg( ur, ny - 1 );
168 
169  tx = xlr * ( 1 - du ) + xrr * ( du );
170  ty = ylr * ( 1 - du ) + yrr * ( du );
171  }
172  }
173  }
174 
175 // Normal case.
176 // Look up coordinates in row-dominant array.
177 // Have to handle right boundary specially -- if at the edge, we'd
178 // better not reference the out of bounds point.
179 
180  else
181  {
182  xll = xg( ul, vl );
183  yll = yg( ul, vl );
184 
185 // ur is out of bounds
186 
187  if ( ur == nx && vr < ny )
188  {
189  xlr = xg( ul, vr );
190  ylr = yg( ul, vr );
191 
192  tx = xll * ( 1 - dv ) + xlr * ( dv );
193  ty = yll * ( 1 - dv ) + ylr * ( dv );
194  }
195 
196 // vr is out of bounds
197 
198  else if ( ur < nx && vr == ny )
199  {
200  xrl = xg( ur, vl );
201  yrl = yg( ur, vl );
202 
203  tx = xll * ( 1 - du ) + xrl * ( du );
204  ty = yll * ( 1 - du ) + yrl * ( du );
205  }
206 
207 // both ur and vr are out of bounds
208 
209  else if ( ur == nx && vr == ny )
210  {
211  tx = xll;
212  ty = yll;
213  }
214 
215 // everything in bounds
216 
217  else
218  {
219  xrl = xg( ur, vl );
220  xlr = xg( ul, vr );
221  xrr = xg( ur, vr );
222 
223  yrl = yg( ur, vl );
224  ylr = yg( ul, vr );
225  yrr = yg( ur, vr );
226 
227  tx = xll * ( 1 - du ) * ( 1 - dv ) + xlr * ( 1 - du ) * ( dv ) +
228  xrl * ( du ) * ( 1 - dv ) + xrr * ( du ) * ( dv );
229 
230  ty = yll * ( 1 - du ) * ( 1 - dv ) + ylr * ( 1 - du ) * ( dv ) +
231  yrl * ( du ) * ( 1 - dv ) + yrr * ( du ) * ( dv );
232  }
233  }
234 }
235 
237 
239 {
240  ::c_plmkstrm( &stream );
241  //::c_plinit();
242  active_streams++;
243 }
244 
246 {
247  switch ( sid )
248  {
249  case PLS::Next:
250 // throw( "plstream ctor option not implemented." );
251  break;
252 
253  case PLS::Current:
254  ::c_plgstrm( &stream );
255  break;
256 
257  case PLS::Specific:
258  stream = strm;
259  break;
260 
261  default:
262 // throw( "plstream ctor option not implemented." );
263  break;
264  }
265 }
266 
267 plstream::plstream( PLINT nx, PLINT ny, const char *driver, const char *file )
268 {
269  ::c_plmkstrm( &stream );
270 
271  if ( driver )
272  ::c_plsdev( driver );
273  if ( file )
274  ::c_plsfnam( file );
275  ::c_plssub( nx, ny );
276  //::c_plinit();
277 
278  active_streams++;
279 }
280 
282  const char *driver, const char *file )
283 {
284  ::c_plmkstrm( &stream );
285 
286  if ( driver )
287  ::c_plsdev( driver );
288  if ( file )
289  ::c_plsfnam( file );
290  ::c_plssub( nx, ny );
291  ::c_plscolbg( r, g, b );
292  //::c_plinit();
293 
294  active_streams++;
295 }
296 
298 {
299  ::c_plsstrm( stream );
300  ::c_plend1();
301 
302  active_streams--;
303  if ( !active_streams )
304  ::c_plend();
305 }
306 
307 #define BONZAI { throw "plstream method not implemented."; }
308 
309 // C routines callable from stub routines come first
310 
311 // Advance to subpage "page", or to the next one if "page" = 0.
312 
313 void
315 {
316  set_stream();
317 
318  pladv( page );
319 }
320 
321 void
322 plstream::arc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2,
323  PLFLT rotate, PLBOOL fill )
324 {
325  set_stream();
326 
327  plarc( x, y, a, b, angle1, angle2, rotate, fill );
328 }
329 
330 void
331 plstream::vect( const PLFLT * const *u, const PLFLT * const *v, PLINT nx, PLINT ny, PLFLT scale,
332  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
333  PLPointer pltr_data )
334 {
335  set_stream();
336 
337  plvect( u, v, nx, ny, scale, pltr, pltr_data );
338 }
339 
340 void
341 plstream::svect( const PLFLT *arrow_x, const PLFLT *arrow_y, PLINT npts, bool fill )
342 {
343  set_stream();
344 
345  plsvect( arrow_x, arrow_y, npts, (PLBOOL) fill );
346 }
347 
348 // Deprecated version using PLINT instead of bool
349 void
350 plstream::svect( const PLFLT *arrow_x, const PLFLT *arrow_y, PLINT npts, PLINT fill )
351 {
352  set_stream();
353 
354  plsvect( arrow_x, arrow_y, npts, (PLBOOL) fill );
355 }
356 
357 // This functions similarly to plbox() except that the origin of the axes is
358 // placed at the user-specified point (x0, y0).
359 
360 void
361 plstream::axes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub,
362  const char *yopt, PLFLT ytick, PLINT nysub )
363 {
364  set_stream();
365 
366  plaxes( x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub );
367 }
368 
369 // Plot a histogram using x to store data values and y to store frequencies.
370 
371 void plstream::bin( PLINT nbin, const PLFLT *x, const PLFLT *y, PLINT center )
372 {
373  set_stream();
374 
375  plbin( nbin, x, y, center );
376 }
377 
378 // Start new page. Should only be used with pleop().
379 
381 {
382  set_stream();
383 
384  plbop();
385 }
386 
387 // This draws a box around the current viewport.
388 
389 void plstream::box( const char *xopt, PLFLT xtick, PLINT nxsub,
390  const char *yopt, PLFLT ytick, PLINT nysub )
391 {
392  set_stream();
393 
394  plbox( xopt, xtick, nxsub, yopt, ytick, nysub );
395 }
396 
397 
398 // This is the 3-d analogue of plbox().
399 
400 void
401 plstream::box3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx,
402  const char *yopt, const char *ylabel, PLFLT ytick, PLINT nsuby,
403  const char *zopt, const char *zlabel, PLFLT ztick, PLINT nsubz )
404 {
405  set_stream();
406 
407  plbox3( xopt, xlabel, xtick, nsubx,
408  yopt, ylabel, ytick, nsuby,
409  zopt, zlabel, ztick, nsubz );
410 }
411 
412 // Calculate broken-down time from continuous time for current stream.
413 void plstream::btime( PLINT & year, PLINT & month, PLINT & day, PLINT & hour,
414  PLINT & min, PLFLT & sec, PLFLT ctime )
415 {
416  set_stream();
417 
418  plbtime( &year, &month, &day, &hour, &min, &sec, ctime );
419 }
420 
421 // Calculate world coordinates and subpage from relative device coordinates.
422 
424  PLINT & window )
425 {
426  set_stream();
427 
428  plcalc_world( rx, ry, &wx, &wy, &window );
429 }
430 
431 // Clear the current subpage.
432 
434 {
435  set_stream();
436 
437  plclear();
438 }
439 
440 // Set color, map 0. Argument is integer between 0 and 15.
441 
442 void plstream::col0( PLINT icol0 )
443 {
444  set_stream();
445 
446  plcol0( icol0 );
447 }
448 
449 // Set the color using a descriptive name. Replaces plcol0().
450 
452 {
453  set_stream();
454 
455  plcol0( (int) c );
456 }
457 
458 // Set color, map 1. Argument is a float between 0. and 1.
459 
461 {
462  set_stream();
463 
464  plcol1( c );
465 }
466 
467 // Old (incorrect) version retained only for compatibility
469 {
470  set_stream();
471 
472  cerr <<
473  "plstream::col(PLFLT c) : function deprecated. Use plstream::col1(PLFLT c) instead"
474  << endl;
475 
476  plcol1( c );
477 }
478 
479 // Configure transformation between continuous and broken-down time (and
480 // vice versa) for current stream.
481 void plstream::configtime( PLFLT scale, PLFLT offset1, PLFLT offset2,
482  PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year,
483  PLINT month, PLINT day, PLINT hour, PLINT min,
484  PLFLT sec )
485 {
486  set_stream();
487 
488  plconfigtime( scale, offset1, offset2, ccontrol, ifbtime_offset, year,
489  month, day, hour, min, sec );
490 }
491 
492 
493 
494 // Draws a contour plot from data in f(nx,ny). Is just a front-end to
495 // plfcont, with a particular choice for f2eval and f2eval_data.
496 
497 void plstream::cont( const PLFLT * const *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx,
498  PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel,
499  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
500  PLPointer pltr_data )
501 {
502  set_stream();
503 
504  plcont( f, nx, ny, kx, lx, ky, ly, clevel, nlevel,
505  pltr, pltr_data );
506 }
507 
508 // Draws a contour plot using the function evaluator f2eval and data stored
509 // by way of the f2eval_data pointer. This allows arbitrary organizations
510 // of 2d array data to be used.
511 
512 void plstream::fcont( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ),
513  PLPointer f2eval_data,
514  PLINT nx, PLINT ny, PLINT kx, PLINT lx,
515  PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel,
516  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
517  PLPointer pltr_data )
518 {
519  set_stream();
520 
521  plfcont( f2eval, f2eval_data,
522  nx, ny, kx, lx, ky, ly, clevel, nlevel,
523  pltr, pltr_data );
524 }
525 
526 // Copies state parameters from the reference stream to the current stream.
527 
528 void plstream::cpstrm( plstream & pls, bool flags )
529 {
530  set_stream();
531 
532  plcpstrm( pls.stream, (PLBOOL) flags );
533 }
534 
535 // Deprecated version using PLINT not bool
536 void plstream::cpstrm( plstream & pls, PLINT flags )
537 {
538  set_stream();
539 
540  plcpstrm( pls.stream, (PLBOOL) flags );
541 }
542 
543 // Calculate continuous time from broken-down time for current stream.
544 void plstream::ctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min,
545  PLFLT sec, PLFLT & ctime )
546 {
547  set_stream();
548 
549  plctime( year, month, day, hour, min, sec, &ctime );
550 }
551 
552 // Converts input values from relative device coordinates to relative plot
553 // coordinates.
554 
556 {
557  set_stream();
558 
559  pldid2pc( &xmin, &ymin, &xmax, &ymax );
560 }
561 
562 // Converts input values from relative plot coordinates to relative device
563 // coordinates.
564 
566 {
567  set_stream();
568 
569  pldip2dc( &xmin, &ymin, &xmax, &ymax );
570 }
571 
572 // These shouldn't be needed, are supposed to be handled by ctor/dtor
573 // semantics of the plstream object.
574 
575 // End a plotting session for all open streams.
576 
577 // void plstream::end()
578 // {
579 // set_stream();
580 
581 // plend();
582 // }
583 
584 // End a plotting session for the current stream only.
585 
586 // void plstream::end1()
587 // {
588 // set_stream();
589 
590 // plend1();
591 // }
592 
593 // Simple interface for defining viewport and window.
594 
596  PLINT just, PLINT axis )
597 {
598  set_stream();
599 
600  plenv( xmin, xmax, ymin, ymax, just, axis );
601 }
602 
603 // Similar to env() above, but in multiplot mode does not advance
604 // the subpage, instead the current subpage is cleared
605 
607  PLINT just, PLINT axis )
608 {
609  set_stream();
610 
611  plenv0( xmin, xmax, ymin, ymax, just, axis );
612 }
613 
614 // End current page. Should only be used with plbop().
615 
617 {
618  set_stream();
619 
620  pleop();
621 }
622 
623 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)).
624 
625 void plstream::errx( PLINT n, const PLFLT *xmin, const PLFLT *xmax, const PLFLT *y )
626 {
627  set_stream();
628 
629  plerrx( n, xmin, xmax, y );
630 }
631 
632 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)).
633 
634 void plstream::erry( PLINT n, const PLFLT *x, const PLFLT *ymin, const PLFLT *ymax )
635 {
636  set_stream();
637 
638  plerry( n, x, ymin, ymax );
639 }
640 
641 // Advance to the next family file on the next new page.
642 
644 {
645  set_stream();
646 
647  plfamadv();
648 }
649 
650 // Pattern fills the polygon bounded by the input points.
651 
652 void plstream::fill( PLINT n, const PLFLT *x, const PLFLT *y )
653 {
654  //set_stream();
655 
656  plfill( n, x, y );
657 }
658 
659 // Pattern fills the 3d polygon bounded by the input points.
660 
661 void plstream::fill3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z )
662 {
663  //set_stream();
664 
665  plfill3( n, x, y, z );
666 }
667 
668 // Flushes the output stream. Use sparingly, if at all.
669 
671 {
672  set_stream();
673 
674  ::c_plflush();
675 }
676 
677 // Sets the global font flag to 'ifont'.
678 
679 void plstream::font( PLINT ifont )
680 {
681  set_stream();
682 
683  plfont( ifont );
684 }
685 
686 // Load specified font set.
687 
689 {
690  set_stream();
691 
692  plfontld( fnt );
693 }
694 
695 // Get character default height and current (scaled) height.
696 
697 void plstream::gchr( PLFLT & p_def, PLFLT & p_ht )
698 {
699  set_stream();
700 
701  plgchr( &p_def, &p_ht );
702 }
703 
704 // Returns 8 bit RGB values for given color from color map 0.
705 
706 void plstream::gcol0( PLINT icol0, PLINT & r, PLINT & g, PLINT & b )
707 {
708  set_stream();
709 
710  plgcol0( icol0, &r, &g, &b );
711 }
712 
713 // Returns 8 bit RGB values + alpha value for given color from color map 0.
714 
715 void plstream::gcol0a( PLINT icol0, PLINT & r, PLINT & g, PLINT & b, PLFLT & a )
716 {
717  set_stream();
718 
719  plgcol0a( icol0, &r, &g, &b, &a );
720 }
721 
722 // Returns the background color by 8 bit RGB value.
723 
724 void plstream::gcolbg( PLINT & r, PLINT & g, PLINT & b )
725 {
726  set_stream();
727 
728  plgcolbg( &r, &g, &b );
729 }
730 
731 // Returns the background color by 8 bit RGB value + alpha value.
732 
733 void plstream::gcolbga( PLINT & r, PLINT & g, PLINT & b, PLFLT & a )
734 {
735  set_stream();
736 
737  plgcolbga( &r, &g, &b, &a );
738 }
739 
740 // Returns the current compression setting
741 
742 void plstream::gcompression( PLINT & compression )
743 {
744  set_stream();
745 
746  plgcompression( &compression );
747 }
748 
749 // Retrieve current window into device space.
750 
751 void plstream::gdidev( PLFLT & mar, PLFLT & aspect, PLFLT & jx, PLFLT & jy )
752 {
753  set_stream();
754 
755  plgdidev( &mar, &aspect, &jx, &jy );
756 }
757 
758 // Get plot orientation.
759 
760 void plstream::gdiori( PLFLT & rot )
761 {
762  set_stream();
763 
764  plgdiori( &rot );
765 }
766 
767 // Retrieve current window into plot space.
768 
770 {
771  set_stream();
772 
773  plgdiplt( &xmin, &ymin, &xmax, &ymax );
774 }
775 
776 // Get FCI (font characterization integer)
777 
778 void plstream::gfci( PLUNICODE & pfci )
779 {
780  set_stream();
781 
782  plgfci( &pfci );
783 }
784 
785 // Get family file parameters.
786 
787 void plstream::gfam( PLINT & fam, PLINT & num, PLINT & bmax )
788 {
789  set_stream();
790 
791  plgfam( &fam, &num, &bmax );
792 }
793 
794 // Get the (current) output file name. Must be preallocated to >80 bytes.
795 
796 void plstream::gfnam( char *fnam )
797 {
798  set_stream();
799 
800  plgfnam( fnam );
801 }
802 
803 // Get the current font family, style and weight
804 
805 void plstream::gfont( PLINT & family, PLINT & style, PLINT & weight )
806 {
807  set_stream();
808 
809  plgfont( &family, &style, &weight );
810 }
811 
812 // Get current run level.
813 
814 void plstream::glevel( PLINT & level )
815 {
816  set_stream();
817 
818  plglevel( &level );
819 }
820 
821 // Get output device parameters.
822 
823 void plstream::gpage( PLFLT & xp, PLFLT & yp, PLINT & xleng, PLINT & yleng,
824  PLINT & xoff, PLINT & yoff )
825 {
826  set_stream();
827 
828  plgpage( &xp, &yp, &xleng, &yleng, &xoff, &yoff );
829 }
830 
831 // Switches to graphics screen.
832 
834 {
835  set_stream();
836 
837  plgra();
838 }
839 
840 
841 // Draw gradient in polygon.
842 
843 void plstream::gradient( PLINT n, const PLFLT *x, const PLFLT *y, PLFLT angle )
844 {
845  //set_stream();
846 
847  plgradient( n, x, y, angle );
848 }
849 
850 // grid irregularly sampled data
851 void plstream::griddata( const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT npts,
852  const PLFLT *xg, PLINT nptsx, const PLFLT *yg, PLINT nptsy,
853  PLFLT **zg, PLINT type, PLFLT data )
854 {
855  set_stream();
856 
857  plgriddata( x, y, z, npts, xg, nptsx, yg, nptsy, zg, type, data );
858 }
859 
860 // Get subpage boundaries in absolute coordinates.
861 
863 {
864  set_stream();
865 
866  plgspa( &xmin, &xmax, &ymin, &ymax );
867 }
868 
869 // This shouldn't be needed in this model.
870 
871 // Get current stream number.
872 
873 // void plstream::gstrm( PLINT *p_strm )
874 // {
875 // set_stream();
876 
877 // plgstrm(p_strm);
878 // }
879 
880 // Get the current library version number.
881 
882 void plstream::gver( char *p_ver )
883 {
884  set_stream();
885 
886  plgver( p_ver );
887 }
888 
889 // Get viewport window in normalized world coordinates
890 
892 {
893  set_stream();
894 
895  plgvpd( &xmin, &xmax, &ymin, &ymax );
896 }
897 
898 // Get viewport window in world coordinates
899 
901 {
902  set_stream();
903 
904  plgvpw( &xmin, &xmax, &ymin, &ymax );
905 }
906 
907 // Get x axis labeling parameters.
908 
909 void plstream::gxax( PLINT & digmax, PLINT & digits )
910 {
911  set_stream();
912 
913  plgxax( &digmax, &digits );
914 }
915 
916 // Get y axis labeling parameters.
917 
918 void plstream::gyax( PLINT & digmax, PLINT & digits )
919 {
920  set_stream();
921 
922  plgyax( &digmax, &digits );
923 }
924 
925 // Get z axis labeling parameters
926 
927 void plstream::gzax( PLINT & digmax, PLINT & digits )
928 {
929  set_stream();
930 
931  plgzax( &digmax, &digits );
932 }
933 
934 // Draws a histogram of n values of a variable in array data[0..n-1]
935 
936 void plstream::hist( PLINT n, const PLFLT *data, PLFLT datmin, PLFLT datmax,
937  PLINT nbin, PLINT oldwin )
938 {
939  set_stream();
940 
941  plhist( n, data, datmin, datmax, nbin, oldwin );
942 }
943 
944 // Set current color (map 0) by hue, lightness, and saturation.
945 
946 #ifdef PL_DEPRECATED
947 void plstream::hls( PLFLT h, PLFLT l, PLFLT s )
948 {
949  set_stream();
950 
951  plhls( h, l, s );
952 }
953 #endif // PL_DEPRECATED
954 
955 // Initializes PLplot, using preset or default options
956 
958 {
959  set_stream();
960 
961  plinit();
962 
963  plgstrm( &stream );
964 
965  // This is only set in the constructor.
966  //active_streams++;
967 }
968 
969 // Draws a line segment from (x1, y1) to (x2, y2).
970 
971 void plstream::join( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 )
972 {
973  set_stream();
974 
975  pljoin( x1, y1, x2, y2 );
976 }
977 
978 // Simple routine for labelling graphs.
979 
980 void plstream::lab( const char *xlabel, const char *ylabel,
981  const char *tlabel )
982 {
983  set_stream();
984 
985  pllab( xlabel, ylabel, tlabel );
986 }
987 
988 // Routine for drawing line, symbol, or cmap0 legends
989 
990 void plstream::legend( PLFLT *p_legend_width, PLFLT *p_legend_height,
991  PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width,
992  PLINT bg_color, PLINT bb_color, PLINT bb_style,
993  PLINT nrow, PLINT ncolumn,
994  PLINT nlegend, const PLINT *opt_array,
995  PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing,
996  PLFLT text_justification,
997  const PLINT *text_colors, const char * const *text,
998  const PLINT *box_colors, const PLINT *box_patterns,
999  const PLFLT *box_scales, const PLFLT *box_line_widths,
1000  const PLINT *line_colors, const PLINT *line_styles,
1001  const PLFLT *line_widths,
1002  const PLINT *symbol_colors, const PLFLT *symbol_scales,
1003  const PLINT *symbol_numbers, const char * const *symbols )
1004 {
1005  set_stream();
1006 
1007  pllegend( p_legend_width, p_legend_height, opt, position, x, y, plot_width,
1008  bg_color, bb_color, bb_style, nrow, ncolumn, nlegend, opt_array,
1009  text_offset, text_scale, text_spacing, text_justification,
1010  text_colors, text, box_colors, box_patterns, box_scales,
1011  box_line_widths, line_colors, line_styles, line_widths,
1012  symbol_colors, symbol_scales, symbol_numbers, symbols );
1013 }
1014 
1015 void plstream::colorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height,
1016  PLINT opt, PLINT position, PLFLT x, PLFLT y,
1017  PLFLT x_length, PLFLT y_length,
1018  PLINT bg_color, PLINT bb_color, PLINT bb_style,
1019  PLFLT low_cap_color, PLFLT high_cap_color,
1020  PLINT cont_color, PLFLT cont_width,
1021  PLINT n_labels, PLINT *label_opts, const char * const *label,
1022  PLINT n_axes, const char * const *axis_opts,
1023  PLFLT *ticks, PLINT *sub_ticks,
1024  PLINT *n_values, const PLFLT * const *values )
1025 {
1026  set_stream();
1027 
1028  plcolorbar( p_colorbar_width, p_colorbar_height, opt, position, x, y,
1029  x_length, y_length, bg_color, bb_color, bb_style,
1030  low_cap_color, high_cap_color, cont_color, cont_width,
1031  n_labels, label_opts, label, n_axes, axis_opts,
1032  ticks, sub_ticks, n_values, values );
1033 }
1034 
1035 
1036 // Sets position of the light source
1037 
1039 {
1040  set_stream();
1041 
1042  pllightsource( x, y, z );
1043 }
1044 
1045 // Draws line segments connecting a series of points.
1046 
1047 void plstream::line( PLINT n, const PLFLT *x, const PLFLT *y )
1048 {
1049  set_stream();
1050 
1051  plline( n, x, y );
1052 }
1053 
1054 // Draws a line in 3 space.
1055 
1056 void plstream::line3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z )
1057 {
1058  set_stream();
1059 
1060  plline3( n, x, y, z );
1061 }
1062 
1063 // Set line style.
1064 
1066 {
1067  set_stream();
1068 
1069  pllsty( lin );
1070 }
1071 
1072 // Plot continental outline in world coordinates
1073 
1074 void plstream::map( void ( *mapform )( PLINT, PLFLT *, PLFLT * ),
1075  const char *type, PLFLT minlong, PLFLT maxlong,
1076  PLFLT minlat, PLFLT maxlat )
1077 {
1078  set_stream();
1079 
1080  plmap( mapform, type, minlong, maxlong, minlat, maxlat );
1081 }
1082 
1083 // Plot map lines
1084 
1085 void plstream::mapline( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), const char *type,
1086  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat,
1087  int* plotentries, int nplotentries )
1088 {
1089  set_stream();
1090 
1091  plmapline( mapform, type, minlong, maxlong, minlat, maxlat, plotentries, nplotentries );
1092 }
1093 
1094 // Plot map points
1095 
1096 void plstream::mapstring( void ( *mapform )( PLINT, PLFLT *, PLFLT * ),
1097  const char *type, const char *string,
1098  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat,
1099  int* plotentries, int nplotentries )
1100 {
1101  set_stream();
1102 
1103  plmapstring( mapform, type, string, minlong, maxlong, minlat, maxlat, plotentries, nplotentries );
1104 }
1105 
1106 // Plot map text
1107 
1108 void plstream::maptex( void ( *mapform )( PLINT, PLFLT *, PLFLT * ),
1109  const char *type, PLFLT dx, PLFLT dy, PLFLT just, const char *text,
1110  PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat,
1111  int plotentry )
1112 {
1113  set_stream();
1114 
1115  plmaptex( mapform, type, dx, dy, just, text, minlong, maxlong, minlat, maxlat, plotentry );
1116 }
1117 
1118 // Plot map fills
1119 
1120 void plstream::mapfill( void ( *mapform )( PLINT, PLFLT *, PLFLT * ),
1121  const char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat,
1122  PLFLT maxlat, int* plotentries, int nplotentries )
1123 {
1124  set_stream();
1125 
1126  plmapfill( mapform, type, minlong, maxlong, minlat, maxlat, plotentries, nplotentries );
1127 }
1128 
1129 // Plot the latitudes and longitudes on the background.
1130 
1131 void plstream::meridians( void ( *mapform )( PLINT, PLFLT *, PLFLT * ),
1132  PLFLT dlong, PLFLT dlat,
1133  PLFLT minlong, PLFLT maxlong,
1134  PLFLT minlat, PLFLT maxlat )
1135 {
1136  set_stream();
1137 
1138  plmeridians( mapform, dlong, dlat, minlong, maxlong, minlat,
1139  maxlat );
1140 }
1141 
1142 // Plots a mesh representation of the function z[x][y].
1143 
1144 void plstream::mesh( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny,
1145  PLINT opt )
1146 {
1147  set_stream();
1148 
1149  plmesh( x, y, z, nx, ny, opt );
1150 }
1151 
1152 // Plots a mesh representation of the function z[x][y] with contour.
1153 
1154 void plstream::meshc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny,
1155  PLINT opt, const PLFLT *clevel, PLINT nlevel )
1156 {
1157  set_stream();
1158 
1159  plmeshc( x, y, z, nx, ny, opt, clevel, nlevel );
1160 }
1161 
1162 // Creates a new stream and makes it the default.
1163 
1164 // void plstream::mkstrm( PLINT *p_strm )
1165 // {
1166 // set_stream();
1167 
1168 // plmkstrm(p_strm);
1169 // }
1170 
1171 // Prints out "text" at specified position relative to viewport
1172 
1173 void plstream::mtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just,
1174  const char *text )
1175 {
1176  set_stream();
1177 
1178  plmtex( side, disp, pos, just, text );
1179 }
1180 
1181 // Prints out "text" at specified position relative to viewport (3D)
1182 
1183 void plstream::mtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just,
1184  const char *text )
1185 {
1186  set_stream();
1187 
1188  plmtex3( side, disp, pos, just, text );
1189 }
1190 
1191 // Plots a 3-d shaded representation of the function z[x][y].
1192 
1193 void plstream::surf3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1194  PLINT nx, PLINT ny, PLINT opt,
1195  const PLFLT *clevel, PLINT nlevel )
1196 {
1197  set_stream();
1198 
1199  plsurf3d( x, y, z, nx, ny, opt, clevel, nlevel );
1200 }
1201 
1202 // Plots a 3-d shaded representation of the function z[x][y] with
1203 // y index limits
1204 
1205 void plstream::surf3dl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1206  PLINT nx, PLINT ny, PLINT opt,
1207  const PLFLT *clevel, PLINT nlevel,
1208  PLINT ixstart, PLINT ixn,
1209  const PLINT *indexymin, const PLINT *indexymax )
1210 {
1211  set_stream();
1212 
1213  plsurf3dl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn,
1214  indexymin, indexymax );
1215 }
1216 
1217 // Plots a 3-d representation of the function z[x][y].
1218 
1219 void plstream::plot3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1220  PLINT nx, PLINT ny, PLINT opt, bool side )
1221 {
1222  set_stream();
1223 
1224  ::plot3d( x, y, z, nx, ny, opt, (PLBOOL) side );
1225 }
1226 
1227 // Deprecated version using PLINT not bool
1228 void plstream::plot3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1229  PLINT nx, PLINT ny, PLINT opt, PLINT side )
1230 {
1231  set_stream();
1232 
1233  ::plot3d( x, y, z, nx, ny, opt, (PLBOOL) side );
1234 }
1235 
1236 // Plots a 3-d representation of the function z[x][y] with contour.
1237 
1238 void plstream::plot3dc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1239  PLINT nx, PLINT ny, PLINT opt,
1240  const PLFLT *clevel, PLINT nlevel )
1241 {
1242  set_stream();
1243 
1244  ::plot3dc( x, y, z, nx, ny, opt, clevel, nlevel );
1245 }
1246 
1247 // Plots a 3-d representation of the function z[x][y] with contour
1248 // and y index limits
1249 
1250 void plstream::plot3dcl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z,
1251  PLINT nx, PLINT ny, PLINT opt,
1252  const PLFLT *clevel, PLINT nlevel,
1253  PLINT ixstart, PLINT ixn,
1254  const PLINT *indexymin, const PLINT *indexymax )
1255 {
1256  set_stream();
1257 
1258  ::plot3dcl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn,
1259  indexymin, indexymax );
1260 }
1261 
1262 // Process options list using current options info.
1263 
1264 int plstream::parseopts( int *p_argc, const char **argv, PLINT mode )
1265 {
1266  set_stream();
1267 
1268  return ::plparseopts( p_argc, argv, mode );
1269 }
1270 
1271 // Set fill pattern directly.
1272 
1273 void plstream::pat( PLINT nlin, const PLINT *inc, const PLINT *del )
1274 {
1275  set_stream();
1276 
1277  plpat( nlin, inc, del );
1278 }
1279 
1280 // Draw a line connecting two points, accounting for coordinate transforms
1281 
1282 void plstream::path( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 )
1283 {
1284  set_stream();
1285 
1286  plpath( n, x1, y1, x2, y2 );
1287 }
1288 
1289 // Plots array y against x for n points using ASCII code "code".
1290 
1291 void plstream::poin( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code )
1292 {
1293  set_stream();
1294 
1295  plpoin( n, x, y, code );
1296 }
1297 
1298 // Draws a series of points in 3 space.
1299 
1300 void plstream::poin3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT code )
1301 {
1302  set_stream();
1303 
1304  plpoin3( n, x, y, z, code );
1305 }
1306 
1307 // Draws a polygon in 3 space.
1308 
1309 void plstream::poly3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z,
1310  const bool *draw, bool ifcc )
1311 {
1312  PLBOOL *loc_draw = new PLBOOL[n - 1];
1313  for ( int i = 0; i < n - 1; i++ )
1314  {
1315  loc_draw[i] = (PLBOOL) draw[i];
1316  }
1317 
1318  set_stream();
1319 
1320  plpoly3( n, x, y, z, loc_draw, (PLBOOL) ifcc );
1321 
1322  delete [] loc_draw;
1323 }
1324 
1325 // Deprecated version using PLINT not bool
1326 void plstream::poly3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z,
1327  const PLINT *draw, PLINT ifcc )
1328 {
1329  PLBOOL *loc_draw = new PLBOOL[n - 1];
1330  for ( int i = 0; i < n - 1; i++ )
1331  {
1332  loc_draw[i] = (PLBOOL) draw[i];
1333  }
1334 
1335  set_stream();
1336 
1337  plpoly3( n, x, y, z, loc_draw, (PLBOOL) ifcc );
1338 
1339  delete [] loc_draw;
1340 }
1341 
1342 // Set the floating point precision (in number of places) in numeric labels.
1343 
1344 void plstream::prec( PLINT setp, PLINT prec )
1345 {
1346  set_stream();
1347 
1348  plprec( setp, prec );
1349 }
1350 
1351 // Set fill pattern, using one of the predefined patterns.
1352 
1353 void plstream::psty( PLINT patt )
1354 {
1355  set_stream();
1356 
1357  plpsty( patt );
1358 }
1359 
1360 // Prints out "text" at world cooordinate (x,y).
1361 
1363  const char *text )
1364 {
1365  set_stream();
1366 
1367  plptex( x, y, dx, dy, just, text );
1368 }
1369 
1370 // Prints out "text" at world cooordinate (x,y).
1371 
1373  PLFLT dx, PLFLT dy, PLFLT dz,
1374  PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just,
1375  const char *text )
1376 {
1377  set_stream();
1378 
1379  plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text );
1380 }
1381 
1382 // Replays contents of plot buffer to current device/file.
1383 
1385 {
1386  set_stream();
1387 
1388  plreplot();
1389 }
1390 
1391 // Set line color by red, green, blue from 0. to 1.
1392 
1393 #ifdef PL_DEPRECATED
1394 void plstream::rgb( PLFLT r, PLFLT g, PLFLT b )
1395 {
1396  set_stream();
1397 
1398  plrgb( r, g, b );
1399 }
1400 #endif // PL_DEPRECATED
1401 
1402 // Set line color by 8 bit RGB values.
1403 
1404 #ifdef PL_DEPRECATED
1405 void plstream::rgb( PLINT r, PLINT g, PLINT b )
1406 {
1407  set_stream();
1408 
1409  plrgb1( r, g, b );
1410 }
1411 #endif // PL_DEPRECATED
1412 
1413 // Set character height.
1414 
1415 void plstream::schr( PLFLT def, PLFLT scale )
1416 {
1417  set_stream();
1418 
1419  plschr( def, scale );
1420 }
1421 
1422 // Set number of colors in cmap 0
1423 
1425 {
1426  set_stream();
1427 
1428  plscmap0n( ncol0 );
1429 }
1430 
1431 // Set number of colors in cmap 1
1432 
1434 {
1435  set_stream();
1436 
1437  plscmap1n( ncol1 );
1438 }
1439 
1440 // Set number of colors in cmap 1
1441 
1442 void plstream::scmap1_range( PLFLT min_color, PLFLT max_color )
1443 {
1444  set_stream();
1445 
1446  plscmap1_range( min_color, max_color );
1447 }
1448 
1449 // Set number of colors in cmap 1
1450 
1451 void plstream::gcmap1_range( PLFLT & min_color, PLFLT & max_color )
1452 {
1453  set_stream();
1454 
1455  plgcmap1_range( &min_color, &max_color );
1456 }
1457 
1458 // Set color map 0 colors by 8 bit RGB values
1459 
1460 void plstream::scmap0( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol0 )
1461 {
1462  set_stream();
1463 
1464  plscmap0( r, g, b, ncol0 );
1465 }
1466 
1467 // Set color map 0 colors by 8 bit RGB values + alpha value
1468 
1469 void plstream::scmap0a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *a, PLINT ncol0 )
1470 {
1471  set_stream();
1472 
1473  plscmap0a( r, g, b, a, ncol0 );
1474 }
1475 
1476 // Set color map 1 colors by 8 bit RGB values
1477 
1478 void plstream::scmap1( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol1 )
1479 {
1480  set_stream();
1481 
1482  plscmap1( r, g, b, ncol1 );
1483 }
1484 
1485 // Set color map 1 colors by 8 bit RGB values + alpha value
1486 
1487 void plstream::scmap1a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *a, PLINT ncol1 )
1488 {
1489  set_stream();
1490 
1491  plscmap1a( r, g, b, a, ncol1 );
1492 }
1493 
1494 // Set color map 1 colors using a piece-wise linear relationship between
1495 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
1496 
1497 void plstream::scmap1l( bool itype, PLINT npts, const PLFLT *intensity,
1498  const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3,
1499  const bool *alt_hue_path )
1500 {
1501  PLBOOL *loc_alt_hue_path = NULL;
1502  if ( alt_hue_path != NULL )
1503  {
1504  loc_alt_hue_path = new PLBOOL[npts - 1];
1505  for ( int i = 0; i < npts - 1; i++ )
1506  {
1507  loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i];
1508  }
1509  }
1510 
1511  set_stream();
1512 
1513  plscmap1l( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3, loc_alt_hue_path );
1514 
1515  if ( loc_alt_hue_path != NULL )
1516  delete [] loc_alt_hue_path;
1517 }
1518 
1519 // Set color map 1 colors using a piece-wise linear relationship between
1520 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space
1521 // and alpha value.
1522 
1523 void plstream::scmap1la( bool itype, PLINT npts, const PLFLT *intensity,
1524  const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3,
1525  const PLFLT *a, const bool *alt_hue_path )
1526 {
1527  PLBOOL *loc_alt_hue_path = NULL;
1528  if ( alt_hue_path != NULL )
1529  {
1530  loc_alt_hue_path = new PLBOOL[npts - 1];
1531  for ( int i = 0; i < npts - 1; i++ )
1532  {
1533  loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i];
1534  }
1535  }
1536 
1537  set_stream();
1538 
1539  plscmap1la( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3,
1540  a, loc_alt_hue_path );
1541 
1542  if ( loc_alt_hue_path != NULL )
1543  delete [] loc_alt_hue_path;
1544 }
1545 
1546 //
1547 // void plstream::scmap1l( bool itype, PLINT npts, PLFLT *intensity,
1548 // PLFLT *coord1, PLFLT *coord2, PLFLT *coord3)
1549 // {
1550 // set_stream();
1551 //
1552 // plscmap1l((PLBOOL) itype,npts,intensity,coord1,coord2,coord3,NULL);
1553 //
1554 // }
1555 
1556 // Deprecated version using PLINT instead of bool
1557 void plstream::scmap1l( PLINT itype, PLINT npts, const PLFLT *intensity,
1558  const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3,
1559  const PLINT *alt_hue_path )
1560 {
1561  PLBOOL *loc_alt_hue_path = NULL;
1562  if ( alt_hue_path != NULL )
1563  {
1564  loc_alt_hue_path = new PLBOOL[npts - 1];
1565  for ( int i = 0; i < npts - 1; i++ )
1566  {
1567  loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i];
1568  }
1569  }
1570 
1571  set_stream();
1572 
1573  plscmap1l( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3, loc_alt_hue_path );
1574 
1575  if ( loc_alt_hue_path != NULL )
1576  delete [] loc_alt_hue_path;
1577 }
1578 
1579 // Set a given color from color map 0 by 8 bit RGB value
1580 
1581 void plstream::scol0( PLINT icol0, PLINT r, PLINT g, PLINT b )
1582 {
1583  set_stream();
1584 
1585  plscol0( icol0, r, g, b );
1586 }
1587 
1588 // Set a given color from color map 0 by 8 bit RGB value + alpha value
1589 
1590 void plstream::scol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a )
1591 {
1592  set_stream();
1593 
1594  plscol0a( icol0, r, g, b, a );
1595 }
1596 
1597 // Set the background color by 8 bit RGB value
1598 
1600 {
1601  set_stream();
1602 
1603  plscolbg( r, g, b );
1604 }
1605 
1606 // Set the background color by 8 bit RGB + alpha value
1607 
1609 {
1610  set_stream();
1611 
1612  plscolbga( r, g, b, a );
1613 }
1614 
1615 // Used to globally turn color output on/off
1616 
1618 {
1619  set_stream();
1620 
1621  plscolor( color );
1622 }
1623 
1624 // Sets the compression level
1625 
1626 void plstream::scompression( PLINT compression )
1627 {
1628  set_stream();
1629 
1630  plscompression( compression );
1631 }
1632 
1633 // Set the device (keyword) name
1634 
1635 void plstream::sdev( const char *devname )
1636 {
1637  set_stream();
1638 
1639  plsdev( devname );
1640 }
1641 
1642 // Get the device (keyword) name
1643 
1644 void plstream::gdev( char *devname )
1645 {
1646  set_stream();
1647 
1648  plgdev( devname );
1649 }
1650 
1651 // Set window into device space using margin, aspect ratio, and
1652 // justification
1653 
1654 void plstream::sdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy )
1655 {
1656  set_stream();
1657 
1658  plsdidev( mar, aspect, jx, jy );
1659 }
1660 
1661 // Set up transformation from metafile coordinates.
1662 
1663 void plstream::sdimap( PLINT dimxmin, PLINT dimxmax,
1664  PLINT dimymin, PLINT dimymax,
1665  PLFLT dimxpmm, PLFLT dimypmm )
1666 {
1667  set_stream();
1668 
1669  plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm );
1670 }
1671 
1672 // Set plot orientation, specifying rotation in units of pi/2.
1673 
1675 {
1676  set_stream();
1677 
1678  plsdiori( rot );
1679 }
1680 
1681 // Set window into plot space
1682 
1684 {
1685  set_stream();
1686 
1687  plsdiplt( xmin, ymin, xmax, ymax );
1688 }
1689 
1690 // Set window into plot space incrementally (zoom)
1691 
1693 {
1694  set_stream();
1695 
1696  plsdiplz( xmin, ymin, xmax, ymax );
1697 }
1698 
1699 // Set the escape character for text strings.
1700 
1701 void plstream::sesc( char esc )
1702 {
1703  set_stream();
1704 
1705  plsesc( esc );
1706 }
1707 
1708 // Set the offset and spacing of contour labels
1709 
1710 void plstream::setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing,
1711  PLINT active )
1712 {
1713  set_stream();
1714 
1715  pl_setcontlabelparam( offset, size, spacing, active );
1716 }
1717 
1718 // Set the format of the contour labels
1719 
1721 {
1722  set_stream();
1723 
1724  pl_setcontlabelformat( lexp, sigdig );
1725 }
1726 
1727 // Set family file parameters
1728 
1729 void plstream::sfam( PLINT fam, PLINT num, PLINT bmax )
1730 {
1731  set_stream();
1732 
1733  plsfam( fam, num, bmax );
1734 }
1735 
1736 // Set FCI (font characterization integer)
1737 
1739 {
1740  set_stream();
1741 
1742  plsfci( fci );
1743 }
1744 
1745 // Set the output file name.
1746 
1747 void plstream::sfnam( const char *fnam )
1748 {
1749  set_stream();
1750 
1751  plsfnam( fnam );
1752 }
1753 
1754 // Set the current font family, style and weight
1755 
1756 void plstream::sfont( PLINT family, PLINT style, PLINT weight )
1757 {
1758  set_stream();
1759 
1760  plsfont( family, style, weight );
1761 }
1762 
1763 // Shade region.
1764 
1765 void
1766 plstream::shade( const PLFLT * const *a, PLINT nx, PLINT ny,
1767  PLINT ( *defined )( PLFLT, PLFLT ),
1768  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1769  PLFLT shade_min, PLFLT shade_max,
1770  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1771  PLINT min_color, PLFLT min_width,
1772  PLINT max_color, PLFLT max_width,
1773  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular,
1774  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1775  PLPointer pltr_data )
1776 {
1777  set_stream();
1778 
1779  plshade( a, nx, ny, defined, left, right, bottom, top,
1780  shade_min, shade_max,
1781  sh_cmap, sh_color, sh_width,
1782  min_color, min_width, max_color, max_width,
1783  fill, (PLBOOL) rectangular, pltr, pltr_data );
1784 }
1785 
1786 // Deprecated version using PLINT instead of bool
1787 void
1788 plstream::shade( const PLFLT * const *a, PLINT nx, PLINT ny,
1789  PLINT ( *defined )( PLFLT, PLFLT ),
1790  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1791  PLFLT shade_min, PLFLT shade_max,
1792  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1793  PLINT min_color, PLFLT min_width,
1794  PLINT max_color, PLFLT max_width,
1795  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular,
1796  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1797  PLPointer pltr_data )
1798 {
1799  set_stream();
1800 
1801  plshade( a, nx, ny, defined, left, right, bottom, top,
1802  shade_min, shade_max,
1803  sh_cmap, sh_color, sh_width,
1804  min_color, min_width, max_color, max_width,
1805  fill, (PLBOOL) rectangular, pltr, pltr_data );
1806 }
1807 
1808 void
1809 plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny,
1810  PLINT ( *defined )( PLFLT, PLFLT ),
1812  const PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
1813  PLINT cont_color, PLFLT cont_width,
1814  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular,
1815  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1816  PLPointer pltr_data )
1817 {
1818  set_stream();
1819 
1820  plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax,
1821  clevel, nlevel, fill_width, cont_color, cont_width,
1822  fill, (PLBOOL) rectangular, pltr, pltr_data );
1823 }
1824 
1825 // Deprecated version using PLINT instead of bool
1826 void
1827 plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny,
1828  PLINT ( *defined )( PLFLT, PLFLT ),
1829  PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
1830  const PLFLT *clevel, PLINT nlevel, PLFLT fill_width,
1831  PLINT cont_color, PLFLT cont_width,
1832  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular,
1833  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1834  PLPointer pltr_data )
1835 {
1836  set_stream();
1837 
1838  plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax,
1839  clevel, nlevel, fill_width, cont_color, cont_width,
1840  fill, (PLBOOL) rectangular, pltr, pltr_data );
1841 }
1842 
1843 void
1845  PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max,
1846  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1847  PLINT min_color, PLFLT min_width,
1848  PLINT max_color, PLFLT max_width,
1849  bool rectangular,
1850  Coord_Xformer *pcxf )
1851 {
1852  set_stream();
1853 
1854  int nx, ny;
1855  d.elements( nx, ny );
1856 
1857  if ( pcxf != NULL )
1859  NULL, NULL,
1860  nx, ny,
1861  xmin, xmax, ymin, ymax, shade_min, shade_max,
1862  sh_cmap, sh_color, sh_width,
1863  min_color, min_width, max_color, max_width,
1864  ::plfill, rectangular,
1865  Coord_Xform_evaluator, pcxf );
1866  else
1868  NULL, NULL,
1869  nx, ny,
1870  xmin, xmax, ymin, ymax, shade_min, shade_max,
1871  sh_cmap, sh_color, sh_width,
1872  min_color, min_width, max_color, max_width,
1873  ::plfill, rectangular,
1874  NULL, NULL );
1875 }
1876 
1877 // Deprecated version using PLINT not bool
1878 void
1880  PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max,
1881  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1882  PLINT min_color, PLFLT min_width,
1883  PLINT max_color, PLFLT max_width,
1884  PLINT rectangular,
1885  Coord_Xformer *pcxf )
1886 {
1887  set_stream();
1888 
1889  int nx, ny;
1890  d.elements( nx, ny );
1891 
1893  NULL, NULL,
1894  nx, ny,
1895  xmin, xmax, ymin, ymax, shade_min, shade_max,
1896  sh_cmap, sh_color, sh_width,
1897  min_color, min_width, max_color, max_width,
1898  ::plfill, rectangular != 0,
1899  Coord_Xform_evaluator, pcxf );
1900 }
1901 
1902 void
1903 plstream::shade1( const PLFLT *a, PLINT nx, PLINT ny,
1904  PLINT ( *defined )( PLFLT, PLFLT ),
1905  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1906  PLFLT shade_min, PLFLT shade_max,
1907  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1908  PLINT min_color, PLFLT min_width,
1909  PLINT max_color, PLFLT max_width,
1910  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular,
1911  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1912  PLPointer pltr_data )
1913 {
1914  set_stream();
1915 
1916  plshade1( a, nx, ny, defined,
1917  left, right, bottom, top,
1918  shade_min, shade_max,
1919  sh_cmap, sh_color, sh_width,
1920  min_color, min_width, max_color, max_width,
1921  fill, (PLBOOL) rectangular, pltr, pltr_data );
1922 }
1923 
1924 // Deprecated version using PLINT not bool
1925 void
1926 plstream::shade1( const PLFLT *a, PLINT nx, PLINT ny,
1927  PLINT ( *defined )( PLFLT, PLFLT ),
1928  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1929  PLFLT shade_min, PLFLT shade_max,
1930  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1931  PLINT min_color, PLFLT min_width,
1932  PLINT max_color, PLFLT max_width,
1933  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular,
1934  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1935  PLPointer pltr_data )
1936 {
1937  set_stream();
1938 
1939  plshade1( a, nx, ny, defined,
1940  left, right, bottom, top,
1941  shade_min, shade_max,
1942  sh_cmap, sh_color, sh_width,
1943  min_color, min_width, max_color, max_width,
1944  fill, (PLBOOL) rectangular, pltr, pltr_data );
1945 }
1946 
1947 void
1949  PLPointer f2eval_data,
1950  PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ),
1951  PLPointer c2eval_data,
1952  PLINT nx, PLINT ny,
1953  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1954  PLFLT shade_min, PLFLT shade_max,
1955  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1956  PLINT min_color, PLFLT min_width,
1957  PLINT max_color, PLFLT max_width,
1958  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular,
1959  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1960  PLPointer pltr_data )
1961 {
1962  set_stream();
1963 
1964  plfshade( f2eval, f2eval_data,
1965  c2eval, c2eval_data,
1966  nx, ny, left, right, bottom, top,
1967  shade_min, shade_max,
1968  sh_cmap, sh_color, sh_width,
1969  min_color, min_width, max_color, max_width,
1970  fill, (PLBOOL) rectangular, pltr, pltr_data );
1971 }
1972 
1973 // Deprecated version using PLINT not bool
1974 void
1976  PLPointer f2eval_data,
1977  PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ),
1978  PLPointer c2eval_data,
1979  PLINT nx, PLINT ny,
1980  PLFLT left, PLFLT right, PLFLT bottom, PLFLT top,
1981  PLFLT shade_min, PLFLT shade_max,
1982  PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width,
1983  PLINT min_color, PLFLT min_width,
1984  PLINT max_color, PLFLT max_width,
1985  void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular,
1986  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
1987  PLPointer pltr_data )
1988 {
1989  set_stream();
1990 
1991  plfshade( f2eval, f2eval_data,
1992  c2eval, c2eval_data,
1993  nx, ny, left, right, bottom, top,
1994  shade_min, shade_max,
1995  sh_cmap, sh_color, sh_width,
1996  min_color, min_width, max_color, max_width,
1997  fill, (PLBOOL) rectangular, pltr, pltr_data );
1998 }
1999 
2000 // Setup a user-provided custom labeling function
2001 
2002 void plstream::slabelfunc( void ( *label_func )( PLINT, PLFLT, char *, PLINT, PLPointer ),
2003  PLPointer label_data )
2004 {
2005  set_stream();
2006 
2007  plslabelfunc( label_func, label_data );
2008 }
2009 
2010 // Set up lengths of major tick marks.
2011 
2012 void plstream::smaj( PLFLT def, PLFLT scale )
2013 {
2014  set_stream();
2015 
2016  plsmaj( def, scale );
2017 }
2018 
2019 // Set the RGB memory area to be plotted (with the 'mem' or 'memcairo' drivers)
2020 
2021 void plstream::smem( PLINT maxx, PLINT maxy, void *plotmem )
2022 {
2023  set_stream();
2024 
2025  plsmem( maxx, maxy, plotmem );
2026 }
2027 
2028 // Set the RGBA memory area to be plotted (with the 'memcairo' drivers)
2029 
2030 void plstream::smema( PLINT maxx, PLINT maxy, void *plotmem )
2031 {
2032  set_stream();
2033 
2034  plsmema( maxx, maxy, plotmem );
2035 }
2036 
2037 // Set up lengths of minor tick marks.
2038 
2039 void plstream::smin( PLFLT def, PLFLT scale )
2040 {
2041  set_stream();
2042 
2043  plsmin( def, scale );
2044 }
2045 
2046 // Set orientation. Must be done before calling plinit.
2047 
2049 {
2050  set_stream();
2051 
2052  plsori( ori );
2053 }
2054 
2055 // Set output device parameters. Usually ignored by the driver.
2056 
2057 void plstream::spage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng,
2058  PLINT xoff, PLINT yoff )
2059 {
2060  set_stream();
2061 
2062  plspage( xp, yp, xleng, yleng, xoff, yoff );
2063 }
2064 
2065 // Set the colors for color table 0 from a cmap0 file
2066 
2067 void plstream::spal0( const char *filename )
2068 {
2069  set_stream();
2070 
2071  plspal0( filename );
2072 }
2073 
2074 // Set the colors for color table 1 from a cmap1 file
2075 
2076 void plstream::spal1( const char *filename, bool interpolate )
2077 {
2078  set_stream();
2079 
2080  plspal1( filename, (PLBOOL) interpolate );
2081 }
2082 
2083 // Set the pause (on end-of-page) status
2084 
2085 void plstream::spause( bool pause )
2086 {
2087  set_stream();
2088 
2089  plspause( (PLBOOL) pause );
2090 }
2091 
2092 // Deprecated version using PLINT not bool
2094 {
2095  set_stream();
2096 
2097  plspause( (PLBOOL) pause );
2098 }
2099 
2100 // Set stream number.
2101 
2103 {
2104  set_stream();
2105 
2106  plsstrm( strm );
2107 }
2108 
2109 // Set the number of subwindows in x and y
2110 
2112 {
2113  set_stream();
2114 
2115  plssub( nx, ny );
2116 }
2117 
2118 // Set symbol height.
2119 
2120 void plstream::ssym( PLFLT def, PLFLT scale )
2121 {
2122  set_stream();
2123 
2124  plssym( def, scale );
2125 }
2126 
2127 // Initialize PLplot, passing in the windows/page settings.
2128 
2130 {
2131  set_stream();
2132 
2133  plstar( nx, ny );
2134 }
2135 
2136 // Initialize PLplot, passing the device name and windows/page settings.
2137 
2138 void plstream::start( const char *devname, PLINT nx, PLINT ny )
2139 {
2140  set_stream();
2141 
2142  plstart( devname, nx, ny );
2143 }
2144 
2145 // Set the coordinate transform
2146 
2147 void plstream::stransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ),
2148  PLPointer coordinate_transform_data )
2149 {
2150  set_stream();
2151 
2152  plstransform( coordinate_transform, coordinate_transform_data );
2153 }
2154 
2155 // Prints out the same string repeatedly at the n points in world
2156 // coordinates given by the x and y arrays. Supersedes plpoin and
2157 // plsymbol for the case where text refers to a unicode glyph either
2158 // directly as UTF-8 or indirectly via the standard text escape
2159 // sequences allowed for PLplot input strings.
2160 
2161 void plstream::string( PLINT n, const PLFLT *x, const PLFLT *y, const char *string )
2162 {
2163  set_stream();
2164  plstring( n, x, y, string );
2165 }
2166 
2167 // Prints out the same string repeatedly at the n points in world
2168 // coordinates given by the x, y, and z arrays. Supersedes plpoin3
2169 // for the case where text refers to a unicode glyph either directly
2170 // as UTF-8 or indirectly via the standard text escape sequences
2171 // allowed for PLplot input strings.
2172 
2173 void plstream::string3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, const char *string )
2174 {
2175  set_stream();
2176  plstring3( n, x, y, z, string );
2177 }
2178 
2179 // Create 1d stripchart
2180 
2181 void plstream::stripc( PLINT *id, const char *xspec, const char *yspec,
2182  PLFLT xmin, PLFLT xmax, PLFLT xjump,
2183  PLFLT ymin, PLFLT ymax,
2184  PLFLT xlpos, PLFLT ylpos, bool y_ascl,
2185  bool acc, PLINT colbox, PLINT collab,
2186  const PLINT colline[], const PLINT styline[],
2187  const char *legline[], const char *labx,
2188  const char *laby, const char *labtop )
2189 {
2190  set_stream();
2191 
2192  plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos,
2193  (PLBOOL) y_ascl, (PLBOOL) acc, colbox, collab, colline, styline,
2194  legline, labx, laby, labtop );
2195 }
2196 
2197 
2198 // Deprecated version using PLINT not bool
2199 void plstream::stripc( PLINT *id, const char *xspec, const char *yspec,
2200  PLFLT xmin, PLFLT xmax, PLFLT xjump,
2201  PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos,
2202  PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab,
2203  const PLINT colline[], const PLINT styline[],
2204  const char *legline[], const char *labx,
2205  const char *laby, const char *labtop )
2206 {
2207  set_stream();
2208 
2209  plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos,
2210  (PLBOOL) y_ascl, (PLBOOL) acc, colbox, collab, colline, styline,
2211  legline, labx, laby, labtop );
2212 }
2213 
2214 // Add a point to a stripchart.
2215 
2216 void plstream::stripa( PLINT id, PLINT pen, PLFLT x, PLFLT y )
2217 {
2218  set_stream();
2219 
2220  plstripa( id, pen, x, y );
2221 }
2222 
2223 // Deletes and releases memory used by a stripchart.
2224 
2226 {
2227  set_stream();
2228 
2229  plstripd( id );
2230 }
2231 
2232 // plots a 2d image (or a matrix too large for plshade() ) - colors
2233 // automatically scaled
2234 
2235 void plstream::image( const PLFLT * const *data, PLINT nx, PLINT ny,
2236  PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2237  PLFLT zmin, PLFLT zmax,
2238  PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax )
2239 {
2240  set_stream();
2241 
2242  plimage( data, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
2243  Dxmin, Dxmax, Dymin, Dymax );
2244 }
2245 
2246 // plots a 2d image (or a matrix too large for plshade() )
2247 
2248 void plstream::imagefr( const PLFLT * const *data, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax,
2249  PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax,
2250  PLFLT valuemin, PLFLT valuemax,
2251  void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
2252  PLPointer pltr_data )
2253 {
2254  set_stream();
2255 
2256  plimagefr( data, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax,
2257  valuemin, valuemax, pltr, pltr_data );
2258 }
2259 
2260 // Set up a new line style
2261 
2262 void plstream::styl( PLINT nms, const PLINT *mark, const PLINT *space )
2263 {
2264  set_stream();
2265 
2266  plstyl( nms, mark, space );
2267 }
2268 
2269 // Sets the edges of the viewport to the specified absolute coordinates
2270 
2271 void plstream::svpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
2272 {
2273  set_stream();
2274 
2275  plsvpa( xmin, xmax, ymin, ymax );
2276 }
2277 
2278 // Set x axis labeling parameters
2279 
2280 void plstream::sxax( PLINT digmax, PLINT digits )
2281 {
2282  set_stream();
2283 
2284  plsxax( digmax, digits );
2285 }
2286 
2287 // Set inferior X window
2288 
2289 void plstream::sxwin( PLINT window_id )
2290 {
2291  set_stream();
2292 
2293  plsxwin( window_id );
2294 }
2295 
2296 // Set y axis labeling parameters
2297 
2298 void plstream::syax( PLINT digmax, PLINT digits )
2299 {
2300  set_stream();
2301 
2302  plsyax( digmax, digits );
2303 }
2304 
2305 // Plots array y against x for n points using Hershey symbol "code"
2306 
2307 void plstream::sym( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code )
2308 {
2309  set_stream();
2310 
2311  plsym( n, x, y, code );
2312 }
2313 
2314 // Set z axis labeling parameters
2315 
2316 void plstream::szax( PLINT digmax, PLINT digits )
2317 {
2318  set_stream();
2319 
2320  plszax( digmax, digits );
2321 }
2322 
2323 // Switches to text screen.
2324 
2326 {
2327  set_stream();
2328 
2329  pltext();
2330 }
2331 
2332 // Set the format for date / time labels
2333 
2334 void plstream::timefmt( const char *fmt )
2335 {
2336  set_stream();
2337 
2338  pltimefmt( fmt );
2339 }
2340 
2341 // Sets the edges of the viewport with the given aspect ratio, leaving
2342 // room for labels.
2343 
2344 void plstream::vasp( PLFLT aspect )
2345 {
2346  set_stream();
2347 
2348  plvasp( aspect );
2349 }
2350 
2351 // Creates the largest viewport of the specified aspect ratio that fits
2352 // within the specified normalized subpage coordinates.
2353 
2354 void plstream::vpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
2355  PLFLT aspect )
2356 {
2357  set_stream();
2358 
2359  plvpas( xmin, xmax, ymin, ymax, aspect );
2360 }
2361 
2362 // Creates a viewport with the specified normalized subpage coordinates.
2363 
2364 void plstream::vpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
2365 {
2366  set_stream();
2367 
2368  plvpor( xmin, xmax, ymin, ymax );
2369 }
2370 
2371 // Defines a "standard" viewport with seven character heights for
2372 // the left margin and four character heights everywhere else.
2373 
2375 {
2376  set_stream();
2377 
2378  plvsta();
2379 }
2380 
2381 // Set up a window for three-dimensional plotting.
2382 
2383 void plstream::w3d( PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0,
2384  PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0,
2385  PLFLT zmax0, PLFLT alt, PLFLT az )
2386 {
2387  set_stream();
2388 
2389  plw3d( basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0,
2390  alt, az );
2391 }
2392 
2393 // Set pen width.
2394 
2395 void plstream::width( PLFLT width )
2396 {
2397  set_stream();
2398 
2399  plwidth( width );
2400 }
2401 
2402 // Set up world coordinates of the viewport boundaries (2d plots).
2403 
2404 void plstream::wind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax )
2405 {
2406  set_stream();
2407 
2408  plwind( xmin, xmax, ymin, ymax );
2409 }
2410 
2411 // Set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device
2412 
2413 void plstream::xormod( bool mode, bool *status )
2414 {
2415  PLBOOL loc_status;
2416 
2417  set_stream();
2418 
2419  plxormod( (PLBOOL) mode, &loc_status );
2420 
2421  *status = ( loc_status != 0 );
2422 }
2423 
2424 // Deprecated version using PLINT not bool
2425 void plstream::xormod( PLINT mode, PLINT *status )
2426 {
2427  PLBOOL loc_status;
2428 
2429  set_stream();
2430 
2431  plxormod( (PLBOOL) mode, &loc_status );
2432 
2433  *status = (PLINT) loc_status;
2434 }
2435 
2436 // Set the seed for the random number generator included.
2437 
2438 void plstream::seed( unsigned int s )
2439 {
2440  set_stream();
2441 
2442  plseed( s );
2443 }
2444 
2445 // Returns a random number on [0,1]-interval.
2446 
2448 {
2449  set_stream();
2450 
2451  return plrandd();
2452 }
2453 
2454 // The rest for use from C / C++ only
2455 
2456 // Returns a list of file-oriented device names and their menu strings
2457 
2458 void plstream::gFileDevs( const char ***p_menustr, const char ***p_devname,
2459  int *p_ndev )
2460 {
2461  set_stream();
2462 
2463  plgFileDevs( p_menustr, p_devname, p_ndev );
2464 }
2465 
2466 // Set the function pointer for the keyboard event handler
2467 
2468 void plstream::sKeyEH( void ( *KeyEH )( PLGraphicsIn *, void *, int * ),
2469  void *KeyEH_data )
2470 {
2471  set_stream();
2472 
2473  plsKeyEH( KeyEH, KeyEH_data );
2474 }
2475 
2476 // Set the variables to be used for storing error info
2477 
2478 void plstream::sError( PLINT *errcode, char *errmsg )
2479 {
2480  set_stream();
2481 
2482  plsError( errcode, errmsg );
2483 }
2484 
2485 // Sets an optional user exit handler.
2486 
2487 void plstream::sexit( int ( *handler )( const char * ) )
2488 {
2489  set_stream();
2490 
2491  plsexit( handler );
2492 }
2493 
2494 // Transformation routines
2495 
2496 // Identity transformation.
2497 
2498 void plstream::tr0( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty,
2499  PLPointer pltr_data )
2500 {
2501  pltr0( x, y, tx, ty, pltr_data );
2502 }
2503 
2504 // Does linear interpolation from singly dimensioned coord arrays.
2505 
2506 void plstream::tr1( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty,
2507  PLPointer pltr_data )
2508 {
2509  pltr1( x, y, tx, ty, pltr_data );
2510 }
2511 
2512 // Does linear interpolation from doubly dimensioned coord arrays
2513 // (column dominant, as per normal C 2d arrays).
2514 
2515 void plstream::tr2( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty,
2516  PLPointer pltr_data )
2517 {
2518  pltr2( x, y, tx, ty, pltr_data );
2519 }
2520 
2521 // Just like pltr2() but uses pointer arithmetic to get coordinates from
2522 // 2d grid tables.
2523 
2524 void plstream::tr2p( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty,
2525  PLPointer pltr_data )
2526 {
2527  pltr2p( x, y, tx, ty, pltr_data );
2528 }
2529 
2530 // We obviously won't be using this object from Fortran...
2531 // // Identity transformation for plots from Fortran.
2532 
2533 // void plstream::tr0f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data )
2534 // {
2535 // set_stream();
2536 
2537 // pltr0f(x,y,tx,ty,pltr_data);
2538 // }
2539 
2540 // // Does linear interpolation from doubly dimensioned coord arrays
2541 // // (row dominant, i.e. Fortran ordering).
2542 
2543 // void plstream::tr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data )
2544 // {
2545 // set_stream();
2546 
2547 // pltr2f(x,y,tx,ty,pltr_data);
2548 // }
2549 
2550 // Example linear transformation function for contour plotter.
2551 // This is not actually a part of the core library any more
2552 //
2553 // void plstream::xform( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty )
2554 // {
2555 // set_stream();
2556 //
2557 // xform(x,y,tx,ty);
2558 // }
2559 
2560 // Function evaluators
2561 
2562 // Does a lookup from a 2d function array. Array is of type (PLFLT **),
2563 // and is column dominant (normal C ordering).
2564 
2565 PLFLT plstream::f2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data )
2566 {
2567  set_stream();
2568 
2569  return ::plf2eval2( ix, iy, plf2eval_data );
2570 }
2571 
2572 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2573 // and is column dominant (normal C ordering).
2574 
2575 PLFLT plstream::f2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data )
2576 {
2577  set_stream();
2578 
2579  return ::plf2eval( ix, iy, plf2eval_data );
2580 }
2581 
2582 // Does a lookup from a 2d function array. Array is of type (PLFLT *),
2583 // and is row dominant (Fortran ordering).
2584 
2585 PLFLT plstream::f2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data )
2586 {
2587  set_stream();
2588 
2589  return ::plf2evalr( ix, iy, plf2eval_data );
2590 }
2591 
2592 // Command line parsing utilities
2593 
2594 // Clear internal option table info structure.
2595 
2597 {
2598  set_stream();
2599 
2600  ::plClearOpts();
2601 }
2602 
2603 // Reset internal option table info structure.
2604 
2606 {
2607  set_stream();
2608 
2609  ::plResetOpts();
2610 }
2611 
2612 // Merge user option table into internal info structure.
2613 
2615  const char **notes )
2616 {
2617  set_stream();
2618 
2619  return ::plMergeOpts( options, name, notes );
2620 }
2621 
2622 // Set the strings used in usage and syntax messages.
2623 
2624 void plstream::SetUsage( char *program_string, char *usage_string )
2625 {
2626  set_stream();
2627 
2628  ::plSetUsage( program_string, usage_string );
2629 }
2630 
2631 // Process input strings, treating them as an option and argument pair.
2632 
2633 int plstream::setopt( const char *opt, const char *optarg )
2634 {
2635  set_stream();
2636 
2637  return ::plsetopt( opt, optarg );
2638 }
2639 
2640 // Depreciated version - use setopt instead.
2641 #ifdef PL_DEPRECATED
2642 int plstream::SetOpt( const char *opt, const char *optarg )
2643 {
2644  set_stream();
2645 
2646  return ::plsetopt( opt, optarg );
2647 }
2648 #endif // PL_DEPRECATED
2649 
2650 // Print usage & syntax message.
2651 
2653 {
2654  set_stream();
2655 
2656  ::plOptUsage();
2657 }
2658 
2659 // Miscellaneous
2660 
2661 // Set the output file pointer
2662 
2663 void plstream::gfile( FILE **p_file )
2664 {
2665  set_stream();
2666 
2667  ::plgfile( p_file );
2668 }
2669 
2670 // Get the output file pointer
2671 
2672 void plstream::sfile( FILE *file )
2673 {
2674  set_stream();
2675 
2676  ::plsfile( file );
2677 }
2678 
2679 
2680 // Get the escape character for text strings.
2681 
2682 void plstream::gesc( char *p_esc )
2683 {
2684  set_stream();
2685 
2686  ::plgesc( p_esc );
2687 }
2688 
2689 // Front-end to driver escape function.
2690 
2691 void plstream::cmd( PLINT op, void *ptr )
2692 {
2693  set_stream();
2694 
2695  ::pl_cmd( op, ptr );
2696 }
2697 
2698 // Return full pathname for given file if executable
2699 
2700 int plstream::FindName( char *p )
2701 {
2702  set_stream();
2703 
2704  return plFindName( p );
2705 }
2706 
2707 // Looks for the specified executable file according to usual search path.
2708 
2709 char *plstream::FindCommand( char *fn )
2710 {
2711  set_stream();
2712 
2713  return plFindCommand( fn );
2714 }
2715 
2716 // Gets search name for file by concatenating the dir, subdir, and file
2717 // name, allocating memory as needed.
2718 
2719 void plstream::GetName( char *dir, char *subdir, char *filename,
2720  char **filespec )
2721 {
2722  set_stream();
2723 
2724  plGetName( dir, subdir, filename, filespec );
2725 }
2726 
2727 // Prompts human to input an integer in response to given message.
2728 
2730 {
2731  set_stream();
2732 
2733  return plGetInt( s );
2734 }
2735 
2736 // Prompts human to input a float in response to given message.
2737 
2739 {
2740  set_stream();
2741 
2742  return plGetFlt( s );
2743 }
2744 
2745 // Nice way to allocate space for a vectored 2d grid
2746 
2747 // Allocates a block of memory for use as a 2-d grid of PLFLT's.
2748 
2750 {
2751  set_stream();
2752 
2753  ::plAlloc2dGrid( f, nx, ny );
2754 }
2755 
2756 // Frees a block of memory allocated with plAlloc2dGrid().
2757 
2759 {
2760  set_stream();
2761 
2762  ::plFree2dGrid( f, nx, ny );
2763 }
2764 
2765 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid().
2766 void plstream::MinMax2dGrid( const PLFLT * const *f, PLINT nx, PLINT ny,
2767  PLFLT *fmax, PLFLT *fmin )
2768 {
2769  set_stream();
2770 
2771  ::plMinMax2dGrid( f, nx, ny, fmax, fmin );
2772 }
2773 
2774 // Functions for converting between HLS and RGB color space
2775 
2776 void plstream::hlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g,
2777  PLFLT *p_b )
2778 {
2779  set_stream();
2780 
2781  ::c_plhlsrgb( h, l, s, p_r, p_g, p_b );
2782 }
2783 
2784 void plstream::rgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l,
2785  PLFLT *p_s )
2786 {
2787  set_stream();
2788 
2789  ::c_plrgbhls( r, g, b, p_h, p_l, p_s );
2790 }
2791 
2792 // Wait for right button mouse event and translate to world coordinates
2793 
2795 {
2796  set_stream();
2797 
2798  return plGetCursor( gin );
2799 }
2800 
2801 //--------------------------------------------------------------------------
2802 // end of plstream.cc
2803 //--------------------------------------------------------------------------