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