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