PLplot
5.10.0
|
00001 //----------------------------------*-C++-*----------------------------------// 00002 // Geoffrey Furnish 00003 // Sep 21 1994 00004 // 00005 // Copyright (C) 2004,2005 Andrew Ross 00006 // Copyright (C) 2004-2014 Alan W. Irwin 00007 // 00008 // This file is part of PLplot. 00009 // 00010 // PLplot is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Library General Public License as published 00012 // by the Free Software Foundation; either version 2 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // PLplot is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Library General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Library General Public License 00021 // along with PLplot; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00023 00024 //-------------------------------------------------------------------------- 00025 // @> Source file plstream. 00026 //-------------------------------------------------------------------------- 00027 00028 #include "plplot.h" 00029 #include "plstream.h" 00030 00031 #include <iostream> 00032 00033 #ifdef PL_USE_NAMESPACE 00034 using namespace std; 00035 #endif 00036 00037 PLFLT Contourable_Data_evaluator( PLINT i, PLINT j, PLPointer p ) 00038 { 00039 const Contourable_Data& d = *(Contourable_Data *) p; 00040 00041 return d( i, j ); 00042 } 00043 00044 void Coord_Xform_evaluator( PLFLT ox, PLFLT oy, 00045 PLFLT *nx, PLFLT *ny, PLPointer p ) 00046 { 00047 const Coord_Xformer& xf = *(Coord_Xformer *) p; 00048 00049 xf.xform( ox, oy, *nx, *ny ); 00050 } 00051 00052 // A specific case for handling transformation defined by 2-d grid vertex 00053 // specification matrices. 00054 00055 cxx_pltr2::cxx_pltr2( Coord_2d& cx, Coord_2d& cy ) 00056 : xg( cx ), yg( cy ) 00057 { 00058 } 00059 00060 // Next routine copied and modified for C++ from PLPLOT 4.99d. 00061 00062 //-------------------------------------------------------------------------- 00063 // pltr2() 00064 // 00065 // Does linear interpolation from doubly dimensioned coord arrays 00066 // (column dominant, as per normal C 2d arrays). 00067 // 00068 // This routine includes lots of checks for out of bounds. This would 00069 // occur occasionally due to some bugs in the contour plotter (now fixed). 00070 // If an out of bounds coordinate is obtained, the boundary value is provided 00071 // along with a warning. These checks should stay since no harm is done if 00072 // if everything works correctly. 00073 //-------------------------------------------------------------------------- 00074 00075 void cxx_pltr2::xform( PLFLT x, PLFLT y, PLFLT& tx, PLFLT& ty ) const 00076 { 00077 int nx, ny; 00078 xg.elements( nx, ny ); 00079 00080 int ul, ur, vl, vr; 00081 PLFLT du, dv; 00082 00083 PLFLT xll, xlr, xrl, xrr; 00084 PLFLT yll, ylr, yrl, yrr; 00085 PLFLT xmin, xmax, ymin, ymax; 00086 00087 ul = (int) x; 00088 ur = ul + 1; 00089 du = x - ul; 00090 00091 vl = (int) y; 00092 vr = vl + 1; 00093 dv = y - vl; 00094 00095 xmin = 0; 00096 xmax = nx - 1; 00097 ymin = 0; 00098 ymax = ny - 1; 00099 00100 if ( x < xmin || x > xmax || y < ymin || y > ymax ) 00101 { 00102 cerr << "cxx_pltr2::xform, Invalid coordinates\n"; 00103 00104 if ( x < xmin ) 00105 { 00106 if ( y < ymin ) 00107 { 00108 tx = xg( 0, 0 ); 00109 ty = yg( 0, 0 ); 00110 } 00111 else if ( y > ymax ) 00112 { 00113 tx = xg( 0, ny - 1 ); 00114 ty = yg( 0, ny - 1 ); 00115 } 00116 else 00117 { 00118 xll = xg( 0, vl ); 00119 yll = yg( 0, vl ); 00120 xlr = xg( 0, vr ); 00121 ylr = yg( 0, vr ); 00122 00123 tx = xll * ( 1 - dv ) + xlr * ( dv ); 00124 ty = yll * ( 1 - dv ) + ylr * ( dv ); 00125 } 00126 } 00127 else if ( x > xmax ) 00128 { 00129 if ( y < ymin ) 00130 { 00131 tx = xg( nx - 1, 0 ); 00132 ty = yg( nx - 1, 0 ); 00133 } 00134 else if ( y > ymax ) 00135 { 00136 tx = xg( nx - 1, ny - 1 ); 00137 ty = yg( nx - 1, ny - 1 ); 00138 } 00139 else 00140 { 00141 xll = xg( nx - 1, vl ); 00142 yll = yg( nx - 1, vl ); 00143 xlr = xg( nx - 1, vr ); 00144 ylr = yg( nx - 1, vr ); 00145 00146 tx = xll * ( 1 - dv ) + xlr * ( dv ); 00147 ty = yll * ( 1 - dv ) + ylr * ( dv ); 00148 } 00149 } 00150 else 00151 { 00152 if ( y < ymin ) 00153 { 00154 xll = xg( ul, 0 ); 00155 xrl = xg( ur, 0 ); 00156 yll = yg( ul, 0 ); 00157 yrl = yg( ur, 0 ); 00158 00159 tx = xll * ( 1 - du ) + xrl * ( du ); 00160 ty = yll * ( 1 - du ) + yrl * ( du ); 00161 } 00162 else if ( y > ymax ) 00163 { 00164 xlr = xg( ul, ny - 1 ); 00165 xrr = xg( ur, ny - 1 ); 00166 ylr = yg( ul, ny - 1 ); 00167 yrr = yg( ur, ny - 1 ); 00168 00169 tx = xlr * ( 1 - du ) + xrr * ( du ); 00170 ty = ylr * ( 1 - du ) + yrr * ( du ); 00171 } 00172 } 00173 } 00174 00175 // Normal case. 00176 // Look up coordinates in row-dominant array. 00177 // Have to handle right boundary specially -- if at the edge, we'd 00178 // better not reference the out of bounds point. 00179 00180 else 00181 { 00182 xll = xg( ul, vl ); 00183 yll = yg( ul, vl ); 00184 00185 // ur is out of bounds 00186 00187 if ( ur == nx && vr < ny ) 00188 { 00189 xlr = xg( ul, vr ); 00190 ylr = yg( ul, vr ); 00191 00192 tx = xll * ( 1 - dv ) + xlr * ( dv ); 00193 ty = yll * ( 1 - dv ) + ylr * ( dv ); 00194 } 00195 00196 // vr is out of bounds 00197 00198 else if ( ur < nx && vr == ny ) 00199 { 00200 xrl = xg( ur, vl ); 00201 yrl = yg( ur, vl ); 00202 00203 tx = xll * ( 1 - du ) + xrl * ( du ); 00204 ty = yll * ( 1 - du ) + yrl * ( du ); 00205 } 00206 00207 // both ur and vr are out of bounds 00208 00209 else if ( ur == nx && vr == ny ) 00210 { 00211 tx = xll; 00212 ty = yll; 00213 } 00214 00215 // everything in bounds 00216 00217 else 00218 { 00219 xrl = xg( ur, vl ); 00220 xlr = xg( ul, vr ); 00221 xrr = xg( ur, vr ); 00222 00223 yrl = yg( ur, vl ); 00224 ylr = yg( ul, vr ); 00225 yrr = yg( ur, vr ); 00226 00227 tx = xll * ( 1 - du ) * ( 1 - dv ) + xlr * ( 1 - du ) * ( dv ) + 00228 xrl * ( du ) * ( 1 - dv ) + xrr * ( du ) * ( dv ); 00229 00230 ty = yll * ( 1 - du ) * ( 1 - dv ) + ylr * ( 1 - du ) * ( dv ) + 00231 yrl * ( du ) * ( 1 - dv ) + yrr * ( du ) * ( dv ); 00232 } 00233 } 00234 } 00235 00236 PLINT plstream::active_streams = 0; 00237 00238 plstream::plstream() 00239 { 00240 ::c_plmkstrm( &stream ); 00241 //::c_plinit(); 00242 active_streams++; 00243 } 00244 00245 plstream::plstream ( PLS::stream_id sid, PLINT strm /*=0*/ ) 00246 { 00247 switch ( sid ) 00248 { 00249 case PLS::Next: 00250 // throw( "plstream ctor option not implemented." ); 00251 break; 00252 00253 case PLS::Current: 00254 ::c_plgstrm( &stream ); 00255 break; 00256 00257 case PLS::Specific: 00258 stream = strm; 00259 break; 00260 00261 default: 00262 // throw( "plstream ctor option not implemented." ); 00263 break; 00264 } 00265 } 00266 00267 plstream::plstream( PLINT nx, PLINT ny, const char *driver, const char *file ) 00268 { 00269 ::c_plmkstrm( &stream ); 00270 00271 if ( driver ) 00272 ::c_plsdev( driver ); 00273 if ( file ) 00274 ::c_plsfnam( file ); 00275 ::c_plssub( nx, ny ); 00276 //::c_plinit(); 00277 00278 active_streams++; 00279 } 00280 00281 plstream::plstream( PLINT nx, PLINT ny, PLINT r, PLINT g, PLINT b, 00282 const char *driver, const char *file ) 00283 { 00284 ::c_plmkstrm( &stream ); 00285 00286 if ( driver ) 00287 ::c_plsdev( driver ); 00288 if ( file ) 00289 ::c_plsfnam( file ); 00290 ::c_plssub( nx, ny ); 00291 ::c_plscolbg( r, g, b ); 00292 //::c_plinit(); 00293 00294 active_streams++; 00295 } 00296 00297 plstream::~plstream() 00298 { 00299 ::c_plsstrm( stream ); 00300 ::c_plend1(); 00301 00302 active_streams--; 00303 if ( !active_streams ) 00304 ::c_plend(); 00305 } 00306 00307 #define BONZAI { throw "plstream method not implemented."; } 00308 00309 // C routines callable from stub routines come first 00310 00311 // Advance to subpage "page", or to the next one if "page" = 0. 00312 00313 void 00314 plstream::adv( PLINT page ) 00315 { 00316 set_stream(); 00317 00318 pladv( page ); 00319 } 00320 00321 void 00322 plstream::arc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, 00323 PLFLT rotate, PLBOOL fill ) 00324 { 00325 set_stream(); 00326 00327 plarc( x, y, a, b, angle1, angle2, rotate, fill ); 00328 } 00329 00330 void 00331 plstream::vect( const PLFLT * const *u, const PLFLT * const *v, PLINT nx, PLINT ny, PLFLT scale, 00332 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 00333 PLPointer pltr_data ) 00334 { 00335 set_stream(); 00336 00337 plvect( u, v, nx, ny, scale, pltr, pltr_data ); 00338 } 00339 00340 void 00341 plstream::svect( const PLFLT *arrow_x, const PLFLT *arrow_y, PLINT npts, bool fill ) 00342 { 00343 set_stream(); 00344 00345 plsvect( arrow_x, arrow_y, npts, (PLBOOL) fill ); 00346 } 00347 00348 // Deprecated version using PLINT instead of bool 00349 void 00350 plstream::svect( const PLFLT *arrow_x, const PLFLT *arrow_y, PLINT npts, PLINT fill ) 00351 { 00352 set_stream(); 00353 00354 plsvect( arrow_x, arrow_y, npts, (PLBOOL) fill ); 00355 } 00356 00357 // This functions similarly to plbox() except that the origin of the axes is 00358 // placed at the user-specified point (x0, y0). 00359 00360 void 00361 plstream::axes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, 00362 const char *yopt, PLFLT ytick, PLINT nysub ) 00363 { 00364 set_stream(); 00365 00366 plaxes( x0, y0, xopt, xtick, nxsub, yopt, ytick, nysub ); 00367 } 00368 00369 // Plot a histogram using x to store data values and y to store frequencies. 00370 00371 void plstream::bin( PLINT nbin, const PLFLT *x, const PLFLT *y, PLINT center ) 00372 { 00373 set_stream(); 00374 00375 plbin( nbin, x, y, center ); 00376 } 00377 00378 // Start new page. Should only be used with pleop(). 00379 00380 void plstream::bop() 00381 { 00382 set_stream(); 00383 00384 plbop(); 00385 } 00386 00387 // This draws a box around the current viewport. 00388 00389 void plstream::box( const char *xopt, PLFLT xtick, PLINT nxsub, 00390 const char *yopt, PLFLT ytick, PLINT nysub ) 00391 { 00392 set_stream(); 00393 00394 plbox( xopt, xtick, nxsub, yopt, ytick, nysub ); 00395 } 00396 00397 00398 // This is the 3-d analogue of plbox(). 00399 00400 void 00401 plstream::box3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, 00402 const char *yopt, const char *ylabel, PLFLT ytick, PLINT nsuby, 00403 const char *zopt, const char *zlabel, PLFLT ztick, PLINT nsubz ) 00404 { 00405 set_stream(); 00406 00407 plbox3( xopt, xlabel, xtick, nsubx, 00408 yopt, ylabel, ytick, nsuby, 00409 zopt, zlabel, ztick, nsubz ); 00410 } 00411 00412 // Calculate broken-down time from continuous time for current stream. 00413 void plstream::btime( PLINT & year, PLINT & month, PLINT & day, PLINT & hour, 00414 PLINT & min, PLFLT & sec, PLFLT ctime ) 00415 { 00416 set_stream(); 00417 00418 plbtime( &year, &month, &day, &hour, &min, &sec, ctime ); 00419 } 00420 00421 // Calculate world coordinates and subpage from relative device coordinates. 00422 00423 void plstream::calc_world( PLFLT rx, PLFLT ry, PLFLT & wx, PLFLT & wy, 00424 PLINT & window ) 00425 { 00426 set_stream(); 00427 00428 plcalc_world( rx, ry, &wx, &wy, &window ); 00429 } 00430 00431 // Clear the current subpage. 00432 00433 void plstream::clear() 00434 { 00435 set_stream(); 00436 00437 plclear(); 00438 } 00439 00440 // Set color, map 0. Argument is integer between 0 and 15. 00441 00442 void plstream::col0( PLINT icol0 ) 00443 { 00444 set_stream(); 00445 00446 plcol0( icol0 ); 00447 } 00448 00449 // Set the color using a descriptive name. Replaces plcol0(). 00450 00451 void plstream::col( PLcolor c ) 00452 { 00453 set_stream(); 00454 00455 plcol0( (int) c ); 00456 } 00457 00458 // Set color, map 1. Argument is a float between 0. and 1. 00459 00460 void plstream::col1( PLFLT c ) 00461 { 00462 set_stream(); 00463 00464 plcol1( c ); 00465 } 00466 00467 // Old (incorrect) version retained only for compatibility 00468 void plstream::col( PLFLT c ) 00469 { 00470 set_stream(); 00471 00472 cerr << 00473 "plstream::col(PLFLT c) : function deprecated. Use plstream::col1(PLFLT c) instead" 00474 << endl; 00475 00476 plcol1( c ); 00477 } 00478 00479 // Configure transformation between continuous and broken-down time (and 00480 // vice versa) for current stream. 00481 void plstream::configtime( PLFLT scale, PLFLT offset1, PLFLT offset2, 00482 PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, 00483 PLINT month, PLINT day, PLINT hour, PLINT min, 00484 PLFLT sec ) 00485 { 00486 set_stream(); 00487 00488 plconfigtime( scale, offset1, offset2, ccontrol, ifbtime_offset, year, 00489 month, day, hour, min, sec ); 00490 } 00491 00492 00493 00494 // Draws a contour plot from data in f(nx,ny). Is just a front-end to 00495 // plfcont, with a particular choice for f2eval and f2eval_data. 00496 00497 void plstream::cont( const PLFLT * const *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, 00498 PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, 00499 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 00500 PLPointer pltr_data ) 00501 { 00502 set_stream(); 00503 00504 plcont( f, nx, ny, kx, lx, ky, ly, clevel, nlevel, 00505 pltr, pltr_data ); 00506 } 00507 00508 // Draws a contour plot using the function evaluator f2eval and data stored 00509 // by way of the f2eval_data pointer. This allows arbitrary organizations 00510 // of 2d array data to be used. 00511 00512 void plstream::fcont( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), 00513 PLPointer f2eval_data, 00514 PLINT nx, PLINT ny, PLINT kx, PLINT lx, 00515 PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, 00516 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 00517 PLPointer pltr_data ) 00518 { 00519 set_stream(); 00520 00521 plfcont( f2eval, f2eval_data, 00522 nx, ny, kx, lx, ky, ly, clevel, nlevel, 00523 pltr, pltr_data ); 00524 } 00525 00526 // Copies state parameters from the reference stream to the current stream. 00527 00528 void plstream::cpstrm( plstream & pls, bool flags ) 00529 { 00530 set_stream(); 00531 00532 plcpstrm( pls.stream, (PLBOOL) flags ); 00533 } 00534 00535 // Deprecated version using PLINT not bool 00536 void plstream::cpstrm( plstream & pls, PLINT flags ) 00537 { 00538 set_stream(); 00539 00540 plcpstrm( pls.stream, (PLBOOL) flags ); 00541 } 00542 00543 // Calculate continuous time from broken-down time for current stream. 00544 void plstream::ctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, 00545 PLFLT sec, PLFLT & ctime ) 00546 { 00547 set_stream(); 00548 00549 plctime( year, month, day, hour, min, sec, &ctime ); 00550 } 00551 00552 // Converts input values from relative device coordinates to relative plot 00553 // coordinates. 00554 00555 void plstream::did2pc( PLFLT & xmin, PLFLT & ymin, PLFLT & xmax, PLFLT & ymax ) 00556 { 00557 set_stream(); 00558 00559 pldid2pc( &xmin, &ymin, &xmax, &ymax ); 00560 } 00561 00562 // Converts input values from relative plot coordinates to relative device 00563 // coordinates. 00564 00565 void plstream::dip2dc( PLFLT & xmin, PLFLT & ymin, PLFLT & xmax, PLFLT & ymax ) 00566 { 00567 set_stream(); 00568 00569 pldip2dc( &xmin, &ymin, &xmax, &ymax ); 00570 } 00571 00572 // These shouldn't be needed, are supposed to be handled by ctor/dtor 00573 // semantics of the plstream object. 00574 00575 // End a plotting session for all open streams. 00576 00577 // void plstream::end() 00578 // { 00579 // set_stream(); 00580 00581 // plend(); 00582 // } 00583 00584 // End a plotting session for the current stream only. 00585 00586 // void plstream::end1() 00587 // { 00588 // set_stream(); 00589 00590 // plend1(); 00591 // } 00592 00593 // Simple interface for defining viewport and window. 00594 00595 void plstream::env( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00596 PLINT just, PLINT axis ) 00597 { 00598 set_stream(); 00599 00600 plenv( xmin, xmax, ymin, ymax, just, axis ); 00601 } 00602 00603 // Similar to env() above, but in multiplot mode does not advance 00604 // the subpage, instead the current subpage is cleared 00605 00606 void plstream::env0( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 00607 PLINT just, PLINT axis ) 00608 { 00609 set_stream(); 00610 00611 plenv0( xmin, xmax, ymin, ymax, just, axis ); 00612 } 00613 00614 // End current page. Should only be used with plbop(). 00615 00616 void plstream::eop() 00617 { 00618 set_stream(); 00619 00620 pleop(); 00621 } 00622 00623 // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)). 00624 00625 void plstream::errx( PLINT n, const PLFLT *xmin, const PLFLT *xmax, const PLFLT *y ) 00626 { 00627 set_stream(); 00628 00629 plerrx( n, xmin, xmax, y ); 00630 } 00631 00632 // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)). 00633 00634 void plstream::erry( PLINT n, const PLFLT *x, const PLFLT *ymin, const PLFLT *ymax ) 00635 { 00636 set_stream(); 00637 00638 plerry( n, x, ymin, ymax ); 00639 } 00640 00641 // Advance to the next family file on the next new page. 00642 00643 void plstream::famadv() 00644 { 00645 set_stream(); 00646 00647 plfamadv(); 00648 } 00649 00650 // Pattern fills the polygon bounded by the input points. 00651 00652 void plstream::fill( PLINT n, const PLFLT *x, const PLFLT *y ) 00653 { 00654 //set_stream(); 00655 00656 plfill( n, x, y ); 00657 } 00658 00659 // Pattern fills the 3d polygon bounded by the input points. 00660 00661 void plstream::fill3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z ) 00662 { 00663 //set_stream(); 00664 00665 plfill3( n, x, y, z ); 00666 } 00667 00668 // Flushes the output stream. Use sparingly, if at all. 00669 00670 void plstream::flush() 00671 { 00672 set_stream(); 00673 00674 ::c_plflush(); 00675 } 00676 00677 // Sets the global font flag to 'ifont'. 00678 00679 void plstream::font( PLINT ifont ) 00680 { 00681 set_stream(); 00682 00683 plfont( ifont ); 00684 } 00685 00686 // Load specified font set. 00687 00688 void plstream::fontld( PLINT fnt ) 00689 { 00690 set_stream(); 00691 00692 plfontld( fnt ); 00693 } 00694 00695 // Get character default height and current (scaled) height. 00696 00697 void plstream::gchr( PLFLT & p_def, PLFLT & p_ht ) 00698 { 00699 set_stream(); 00700 00701 plgchr( &p_def, &p_ht ); 00702 } 00703 00704 // Returns 8 bit RGB values for given color from color map 0. 00705 00706 void plstream::gcol0( PLINT icol0, PLINT & r, PLINT & g, PLINT & b ) 00707 { 00708 set_stream(); 00709 00710 plgcol0( icol0, &r, &g, &b ); 00711 } 00712 00713 // Returns 8 bit RGB values + alpha value for given color from color map 0. 00714 00715 void plstream::gcol0a( PLINT icol0, PLINT & r, PLINT & g, PLINT & b, PLFLT & a ) 00716 { 00717 set_stream(); 00718 00719 plgcol0a( icol0, &r, &g, &b, &a ); 00720 } 00721 00722 // Returns the background color by 8 bit RGB value. 00723 00724 void plstream::gcolbg( PLINT & r, PLINT & g, PLINT & b ) 00725 { 00726 set_stream(); 00727 00728 plgcolbg( &r, &g, &b ); 00729 } 00730 00731 // Returns the background color by 8 bit RGB value + alpha value. 00732 00733 void plstream::gcolbga( PLINT & r, PLINT & g, PLINT & b, PLFLT & a ) 00734 { 00735 set_stream(); 00736 00737 plgcolbga( &r, &g, &b, &a ); 00738 } 00739 00740 // Returns the current compression setting 00741 00742 void plstream::gcompression( PLINT & compression ) 00743 { 00744 set_stream(); 00745 00746 plgcompression( &compression ); 00747 } 00748 00749 // Retrieve current window into device space. 00750 00751 void plstream::gdidev( PLFLT & mar, PLFLT & aspect, PLFLT & jx, PLFLT & jy ) 00752 { 00753 set_stream(); 00754 00755 plgdidev( &mar, &aspect, &jx, &jy ); 00756 } 00757 00758 // Get plot orientation. 00759 00760 void plstream::gdiori( PLFLT & rot ) 00761 { 00762 set_stream(); 00763 00764 plgdiori( &rot ); 00765 } 00766 00767 // Retrieve current window into plot space. 00768 00769 void plstream::gdiplt( PLFLT & xmin, PLFLT & ymin, PLFLT & xmax, PLFLT & ymax ) 00770 { 00771 set_stream(); 00772 00773 plgdiplt( &xmin, &ymin, &xmax, &ymax ); 00774 } 00775 00776 // Get FCI (font characterization integer) 00777 00778 void plstream::gfci( PLUNICODE & pfci ) 00779 { 00780 set_stream(); 00781 00782 plgfci( &pfci ); 00783 } 00784 00785 // Get family file parameters. 00786 00787 void plstream::gfam( PLINT & fam, PLINT & num, PLINT & bmax ) 00788 { 00789 set_stream(); 00790 00791 plgfam( &fam, &num, &bmax ); 00792 } 00793 00794 // Get the (current) output file name. Must be preallocated to >80 bytes. 00795 00796 void plstream::gfnam( char *fnam ) 00797 { 00798 set_stream(); 00799 00800 plgfnam( fnam ); 00801 } 00802 00803 // Get the current font family, style and weight 00804 00805 void plstream::gfont( PLINT & family, PLINT & style, PLINT & weight ) 00806 { 00807 set_stream(); 00808 00809 plgfont( &family, &style, &weight ); 00810 } 00811 00812 // Get current run level. 00813 00814 void plstream::glevel( PLINT & level ) 00815 { 00816 set_stream(); 00817 00818 plglevel( &level ); 00819 } 00820 00821 // Get output device parameters. 00822 00823 void plstream::gpage( PLFLT & xp, PLFLT & yp, PLINT & xleng, PLINT & yleng, 00824 PLINT & xoff, PLINT & yoff ) 00825 { 00826 set_stream(); 00827 00828 plgpage( &xp, &yp, &xleng, &yleng, &xoff, &yoff ); 00829 } 00830 00831 // Switches to graphics screen. 00832 00833 void plstream::gra() 00834 { 00835 set_stream(); 00836 00837 plgra(); 00838 } 00839 00840 00841 // Draw gradient in polygon. 00842 00843 void plstream::gradient( PLINT n, const PLFLT *x, const PLFLT *y, PLFLT angle ) 00844 { 00845 //set_stream(); 00846 00847 plgradient( n, x, y, angle ); 00848 } 00849 00850 // grid irregularly sampled data 00851 void plstream::griddata( const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT npts, 00852 const PLFLT *xg, PLINT nptsx, const PLFLT *yg, PLINT nptsy, 00853 PLFLT **zg, PLINT type, PLFLT data ) 00854 { 00855 set_stream(); 00856 00857 plgriddata( x, y, z, npts, xg, nptsx, yg, nptsy, zg, type, data ); 00858 } 00859 00860 // Get subpage boundaries in absolute coordinates. 00861 00862 void plstream::gspa( PLFLT & xmin, PLFLT & xmax, PLFLT & ymin, PLFLT & ymax ) 00863 { 00864 set_stream(); 00865 00866 plgspa( &xmin, &xmax, &ymin, &ymax ); 00867 } 00868 00869 // This shouldn't be needed in this model. 00870 00871 // Get current stream number. 00872 00873 // void plstream::gstrm( PLINT *p_strm ) 00874 // { 00875 // set_stream(); 00876 00877 // plgstrm(p_strm); 00878 // } 00879 00880 // Get the current library version number. 00881 00882 void plstream::gver( char *p_ver ) 00883 { 00884 set_stream(); 00885 00886 plgver( p_ver ); 00887 } 00888 00889 // Get viewport window in normalized world coordinates 00890 00891 void plstream::gvpd( PLFLT & xmin, PLFLT & xmax, PLFLT & ymin, PLFLT & ymax ) 00892 { 00893 set_stream(); 00894 00895 plgvpd( &xmin, &xmax, &ymin, &ymax ); 00896 } 00897 00898 // Get viewport window in world coordinates 00899 00900 void plstream::gvpw( PLFLT & xmin, PLFLT & xmax, PLFLT & ymin, PLFLT & ymax ) 00901 { 00902 set_stream(); 00903 00904 plgvpw( &xmin, &xmax, &ymin, &ymax ); 00905 } 00906 00907 // Get x axis labeling parameters. 00908 00909 void plstream::gxax( PLINT & digmax, PLINT & digits ) 00910 { 00911 set_stream(); 00912 00913 plgxax( &digmax, &digits ); 00914 } 00915 00916 // Get y axis labeling parameters. 00917 00918 void plstream::gyax( PLINT & digmax, PLINT & digits ) 00919 { 00920 set_stream(); 00921 00922 plgyax( &digmax, &digits ); 00923 } 00924 00925 // Get z axis labeling parameters 00926 00927 void plstream::gzax( PLINT & digmax, PLINT & digits ) 00928 { 00929 set_stream(); 00930 00931 plgzax( &digmax, &digits ); 00932 } 00933 00934 // Draws a histogram of n values of a variable in array data[0..n-1] 00935 00936 void plstream::hist( PLINT n, const PLFLT *data, PLFLT datmin, PLFLT datmax, 00937 PLINT nbin, PLINT oldwin ) 00938 { 00939 set_stream(); 00940 00941 plhist( n, data, datmin, datmax, nbin, oldwin ); 00942 } 00943 00944 // Set current color (map 0) by hue, lightness, and saturation. 00945 00946 #ifdef PL_DEPRECATED 00947 void plstream::hls( PLFLT h, PLFLT l, PLFLT s ) 00948 { 00949 set_stream(); 00950 00951 plhls( h, l, s ); 00952 } 00953 #endif // PL_DEPRECATED 00954 00955 // Initializes PLplot, using preset or default options 00956 00957 void plstream::init() 00958 { 00959 set_stream(); 00960 00961 plinit(); 00962 00963 plgstrm( &stream ); 00964 00965 // This is only set in the constructor. 00966 //active_streams++; 00967 } 00968 00969 // Draws a line segment from (x1, y1) to (x2, y2). 00970 00971 void plstream::join( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ) 00972 { 00973 set_stream(); 00974 00975 pljoin( x1, y1, x2, y2 ); 00976 } 00977 00978 // Simple routine for labelling graphs. 00979 00980 void plstream::lab( const char *xlabel, const char *ylabel, 00981 const char *tlabel ) 00982 { 00983 set_stream(); 00984 00985 pllab( xlabel, ylabel, tlabel ); 00986 } 00987 00988 // Routine for drawing line, symbol, or cmap0 legends 00989 00990 void plstream::legend( PLFLT *p_legend_width, PLFLT *p_legend_height, 00991 PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, 00992 PLINT bg_color, PLINT bb_color, PLINT bb_style, 00993 PLINT nrow, PLINT ncolumn, 00994 PLINT nlegend, const PLINT *opt_array, 00995 PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, 00996 PLFLT text_justification, 00997 const PLINT *text_colors, const char * const *text, 00998 const PLINT *box_colors, const PLINT *box_patterns, 00999 const PLFLT *box_scales, const PLFLT *box_line_widths, 01000 const PLINT *line_colors, const PLINT *line_styles, 01001 const PLFLT *line_widths, 01002 const PLINT *symbol_colors, const PLFLT *symbol_scales, 01003 const PLINT *symbol_numbers, const char * const *symbols ) 01004 { 01005 set_stream(); 01006 01007 pllegend( p_legend_width, p_legend_height, opt, position, x, y, plot_width, 01008 bg_color, bb_color, bb_style, nrow, ncolumn, nlegend, opt_array, 01009 text_offset, text_scale, text_spacing, text_justification, 01010 text_colors, text, box_colors, box_patterns, box_scales, 01011 box_line_widths, line_colors, line_styles, line_widths, 01012 symbol_colors, symbol_scales, symbol_numbers, symbols ); 01013 } 01014 01015 void plstream::colorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, 01016 PLINT opt, PLINT position, PLFLT x, PLFLT y, 01017 PLFLT x_length, PLFLT y_length, 01018 PLINT bg_color, PLINT bb_color, PLINT bb_style, 01019 PLFLT low_cap_color, PLFLT high_cap_color, 01020 PLINT cont_color, PLFLT cont_width, 01021 PLINT n_labels, PLINT *label_opts, const char * const *label, 01022 PLINT n_axes, const char * const *axis_opts, 01023 PLFLT *ticks, PLINT *sub_ticks, 01024 PLINT *n_values, const PLFLT * const *values ) 01025 { 01026 set_stream(); 01027 01028 plcolorbar( p_colorbar_width, p_colorbar_height, opt, position, x, y, 01029 x_length, y_length, bg_color, bb_color, bb_style, 01030 low_cap_color, high_cap_color, cont_color, cont_width, 01031 n_labels, label_opts, label, n_axes, axis_opts, 01032 ticks, sub_ticks, n_values, values ); 01033 } 01034 01035 01036 // Sets position of the light source 01037 01038 void plstream::lightsource( PLFLT x, PLFLT y, PLFLT z ) 01039 { 01040 set_stream(); 01041 01042 pllightsource( x, y, z ); 01043 } 01044 01045 // Draws line segments connecting a series of points. 01046 01047 void plstream::line( PLINT n, const PLFLT *x, const PLFLT *y ) 01048 { 01049 set_stream(); 01050 01051 plline( n, x, y ); 01052 } 01053 01054 // Draws a line in 3 space. 01055 01056 void plstream::line3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z ) 01057 { 01058 set_stream(); 01059 01060 plline3( n, x, y, z ); 01061 } 01062 01063 // Set line style. 01064 01065 void plstream::lsty( PLINT lin ) 01066 { 01067 set_stream(); 01068 01069 pllsty( lin ); 01070 } 01071 01072 // Plot continental outline in world coordinates 01073 01074 void plstream::map( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), 01075 const char *type, PLFLT minlong, PLFLT maxlong, 01076 PLFLT minlat, PLFLT maxlat ) 01077 { 01078 set_stream(); 01079 01080 plmap( mapform, type, minlong, maxlong, minlat, maxlat ); 01081 } 01082 01083 // Plot map lines 01084 01085 void plstream::mapline( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), const char *type, 01086 PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat, 01087 int* plotentries, int nplotentries) 01088 { 01089 set_stream(); 01090 01091 plmapline( mapform, type, minlong, maxlong, minlat, maxlat, plotentries, nplotentries ); 01092 } 01093 01094 // Plot map points 01095 01096 void plstream::mapstring( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), 01097 const char *type, const char *string, 01098 PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat, 01099 int* plotentries, int nplotentries) 01100 { 01101 set_stream(); 01102 01103 plmapstring( mapform, type, string, minlong, maxlong, minlat, maxlat, plotentries, nplotentries ); 01104 } 01105 01106 // Plot map text 01107 01108 void plstream::maptex( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), 01109 const char *type, PLFLT dx, PLFLT dy, PLFLT just, const char *text, 01110 PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat, 01111 int plotentry) 01112 { 01113 set_stream(); 01114 01115 plmaptex( mapform, type, dx, dy, just, text, minlong, maxlong, minlat, maxlat, plotentry ); 01116 } 01117 01118 // Plot map fills 01119 01120 void plstream::mapfill( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), 01121 const char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, 01122 PLFLT maxlat, int* plotentries, int nplotentries) 01123 { 01124 set_stream(); 01125 01126 plmapfill( mapform, type, minlong, maxlong, minlat, maxlat, plotentries, nplotentries ); 01127 } 01128 01129 // Plot the latitudes and longitudes on the background. 01130 01131 void plstream::meridians( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), 01132 PLFLT dlong, PLFLT dlat, 01133 PLFLT minlong, PLFLT maxlong, 01134 PLFLT minlat, PLFLT maxlat ) 01135 { 01136 set_stream(); 01137 01138 plmeridians( mapform, dlong, dlat, minlong, maxlong, minlat, 01139 maxlat ); 01140 } 01141 01142 // Plots a mesh representation of the function z[x][y]. 01143 01144 void plstream::mesh( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, 01145 PLINT opt ) 01146 { 01147 set_stream(); 01148 01149 plmesh( x, y, z, nx, ny, opt ); 01150 } 01151 01152 // Plots a mesh representation of the function z[x][y] with contour. 01153 01154 void plstream::meshc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, 01155 PLINT opt, const PLFLT *clevel, PLINT nlevel ) 01156 { 01157 set_stream(); 01158 01159 plmeshc( x, y, z, nx, ny, opt, clevel, nlevel ); 01160 } 01161 01162 // Creates a new stream and makes it the default. 01163 01164 // void plstream::mkstrm( PLINT *p_strm ) 01165 // { 01166 // set_stream(); 01167 01168 // plmkstrm(p_strm); 01169 // } 01170 01171 // Prints out "text" at specified position relative to viewport 01172 01173 void plstream::mtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just, 01174 const char *text ) 01175 { 01176 set_stream(); 01177 01178 plmtex( side, disp, pos, just, text ); 01179 } 01180 01181 // Prints out "text" at specified position relative to viewport (3D) 01182 01183 void plstream::mtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just, 01184 const char *text ) 01185 { 01186 set_stream(); 01187 01188 plmtex3( side, disp, pos, just, text ); 01189 } 01190 01191 // Plots a 3-d shaded representation of the function z[x][y]. 01192 01193 void plstream::surf3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01194 PLINT nx, PLINT ny, PLINT opt, 01195 const PLFLT *clevel, PLINT nlevel ) 01196 { 01197 set_stream(); 01198 01199 plsurf3d( x, y, z, nx, ny, opt, clevel, nlevel ); 01200 } 01201 01202 // Plots a 3-d shaded representation of the function z[x][y] with 01203 // y index limits 01204 01205 void plstream::surf3dl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01206 PLINT nx, PLINT ny, PLINT opt, 01207 const PLFLT *clevel, PLINT nlevel, 01208 PLINT ixstart, PLINT ixn, 01209 const PLINT *indexymin, const PLINT *indexymax ) 01210 { 01211 set_stream(); 01212 01213 plsurf3dl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn, 01214 indexymin, indexymax ); 01215 } 01216 01217 // Plots a 3-d representation of the function z[x][y]. 01218 01219 void plstream::plot3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01220 PLINT nx, PLINT ny, PLINT opt, bool side ) 01221 { 01222 set_stream(); 01223 01224 ::plot3d( x, y, z, nx, ny, opt, (PLBOOL) side ); 01225 } 01226 01227 // Deprecated version using PLINT not bool 01228 void plstream::plot3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01229 PLINT nx, PLINT ny, PLINT opt, PLINT side ) 01230 { 01231 set_stream(); 01232 01233 ::plot3d( x, y, z, nx, ny, opt, (PLBOOL) side ); 01234 } 01235 01236 // Plots a 3-d representation of the function z[x][y] with contour. 01237 01238 void plstream::plot3dc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01239 PLINT nx, PLINT ny, PLINT opt, 01240 const PLFLT *clevel, PLINT nlevel ) 01241 { 01242 set_stream(); 01243 01244 ::plot3dc( x, y, z, nx, ny, opt, clevel, nlevel ); 01245 } 01246 01247 // Plots a 3-d representation of the function z[x][y] with contour 01248 // and y index limits 01249 01250 void plstream::plot3dcl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, 01251 PLINT nx, PLINT ny, PLINT opt, 01252 const PLFLT *clevel, PLINT nlevel, 01253 PLINT ixstart, PLINT ixn, 01254 const PLINT *indexymin, const PLINT *indexymax ) 01255 { 01256 set_stream(); 01257 01258 ::plot3dcl( x, y, z, nx, ny, opt, clevel, nlevel, ixstart, ixn, 01259 indexymin, indexymax ); 01260 } 01261 01262 // Process options list using current options info. 01263 01264 int plstream::parseopts( int *p_argc, const char **argv, PLINT mode ) 01265 { 01266 set_stream(); 01267 01268 return ::plparseopts( p_argc, argv, mode ); 01269 } 01270 01271 // Set fill pattern directly. 01272 01273 void plstream::pat( PLINT nlin, const PLINT *inc, const PLINT *del ) 01274 { 01275 set_stream(); 01276 01277 plpat( nlin, inc, del ); 01278 } 01279 01280 // Draw a line connecting two points, accounting for coordinate transforms 01281 01282 void plstream::path( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ) 01283 { 01284 set_stream(); 01285 01286 plpath( n, x1, y1, x2, y2 ); 01287 } 01288 01289 // Plots array y against x for n points using ASCII code "code". 01290 01291 void plstream::poin( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code ) 01292 { 01293 set_stream(); 01294 01295 plpoin( n, x, y, code ); 01296 } 01297 01298 // Draws a series of points in 3 space. 01299 01300 void plstream::poin3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT code ) 01301 { 01302 set_stream(); 01303 01304 plpoin3( n, x, y, z, code ); 01305 } 01306 01307 // Draws a polygon in 3 space. 01308 01309 void plstream::poly3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, 01310 const bool *draw, bool ifcc ) 01311 { 01312 PLBOOL *loc_draw = new PLBOOL[n - 1]; 01313 for ( int i = 0; i < n - 1; i++ ) 01314 { 01315 loc_draw[i] = (PLBOOL) draw[i]; 01316 } 01317 01318 set_stream(); 01319 01320 plpoly3( n, x, y, z, loc_draw, (PLBOOL) ifcc ); 01321 01322 delete [] loc_draw; 01323 } 01324 01325 // Deprecated version using PLINT not bool 01326 void plstream::poly3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, 01327 const PLINT *draw, PLINT ifcc ) 01328 { 01329 PLBOOL *loc_draw = new PLBOOL[n - 1]; 01330 for ( int i = 0; i < n - 1; i++ ) 01331 { 01332 loc_draw[i] = (PLBOOL) draw[i]; 01333 } 01334 01335 set_stream(); 01336 01337 plpoly3( n, x, y, z, loc_draw, (PLBOOL) ifcc ); 01338 01339 delete [] loc_draw; 01340 } 01341 01342 // Set the floating point precision (in number of places) in numeric labels. 01343 01344 void plstream::prec( PLINT setp, PLINT prec ) 01345 { 01346 set_stream(); 01347 01348 plprec( setp, prec ); 01349 } 01350 01351 // Set fill pattern, using one of the predefined patterns. 01352 01353 void plstream::psty( PLINT patt ) 01354 { 01355 set_stream(); 01356 01357 plpsty( patt ); 01358 } 01359 01360 // Prints out "text" at world cooordinate (x,y). 01361 01362 void plstream::ptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, 01363 const char *text ) 01364 { 01365 set_stream(); 01366 01367 plptex( x, y, dx, dy, just, text ); 01368 } 01369 01370 // Prints out "text" at world cooordinate (x,y). 01371 01372 void plstream::ptex3( PLFLT wx, PLFLT wy, PLFLT wz, 01373 PLFLT dx, PLFLT dy, PLFLT dz, 01374 PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, 01375 const char *text ) 01376 { 01377 set_stream(); 01378 01379 plptex3( wx, wy, wz, dx, dy, dz, sx, sy, sz, just, text ); 01380 } 01381 01382 // Replays contents of plot buffer to current device/file. 01383 01384 void plstream::replot() 01385 { 01386 set_stream(); 01387 01388 plreplot(); 01389 } 01390 01391 // Set line color by red, green, blue from 0. to 1. 01392 01393 #ifdef PL_DEPRECATED 01394 void plstream::rgb( PLFLT r, PLFLT g, PLFLT b ) 01395 { 01396 set_stream(); 01397 01398 plrgb( r, g, b ); 01399 } 01400 #endif // PL_DEPRECATED 01401 01402 // Set line color by 8 bit RGB values. 01403 01404 #ifdef PL_DEPRECATED 01405 void plstream::rgb( PLINT r, PLINT g, PLINT b ) 01406 { 01407 set_stream(); 01408 01409 plrgb1( r, g, b ); 01410 } 01411 #endif // PL_DEPRECATED 01412 01413 // Set character height. 01414 01415 void plstream::schr( PLFLT def, PLFLT scale ) 01416 { 01417 set_stream(); 01418 01419 plschr( def, scale ); 01420 } 01421 01422 // Set number of colors in cmap 0 01423 01424 void plstream::scmap0n( PLINT ncol0 ) 01425 { 01426 set_stream(); 01427 01428 plscmap0n( ncol0 ); 01429 } 01430 01431 // Set number of colors in cmap 1 01432 01433 void plstream::scmap1n( PLINT ncol1 ) 01434 { 01435 set_stream(); 01436 01437 plscmap1n( ncol1 ); 01438 } 01439 01440 // Set number of colors in cmap 1 01441 01442 void plstream::scmap1_range( PLFLT min_color, PLFLT max_color ) 01443 { 01444 set_stream(); 01445 01446 plscmap1_range( min_color, max_color ); 01447 } 01448 01449 // Set number of colors in cmap 1 01450 01451 void plstream::gcmap1_range( PLFLT & min_color, PLFLT & max_color ) 01452 { 01453 set_stream(); 01454 01455 plgcmap1_range( &min_color, &max_color ); 01456 } 01457 01458 // Set color map 0 colors by 8 bit RGB values 01459 01460 void plstream::scmap0( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol0 ) 01461 { 01462 set_stream(); 01463 01464 plscmap0( r, g, b, ncol0 ); 01465 } 01466 01467 // Set color map 0 colors by 8 bit RGB values + alpha value 01468 01469 void plstream::scmap0a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *a, PLINT ncol0 ) 01470 { 01471 set_stream(); 01472 01473 plscmap0a( r, g, b, a, ncol0 ); 01474 } 01475 01476 // Set color map 1 colors by 8 bit RGB values 01477 01478 void plstream::scmap1( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol1 ) 01479 { 01480 set_stream(); 01481 01482 plscmap1( r, g, b, ncol1 ); 01483 } 01484 01485 // Set color map 1 colors by 8 bit RGB values + alpha value 01486 01487 void plstream::scmap1a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *a, PLINT ncol1 ) 01488 { 01489 set_stream(); 01490 01491 plscmap1a( r, g, b, a, ncol1 ); 01492 } 01493 01494 // Set color map 1 colors using a piece-wise linear relationship between 01495 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. 01496 01497 void plstream::scmap1l( bool itype, PLINT npts, const PLFLT *intensity, 01498 const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3, 01499 const bool *alt_hue_path ) 01500 { 01501 PLBOOL *loc_alt_hue_path = NULL; 01502 if ( alt_hue_path != NULL ) 01503 { 01504 loc_alt_hue_path = new PLBOOL[npts - 1]; 01505 for ( int i = 0; i < npts - 1; i++ ) 01506 { 01507 loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i]; 01508 } 01509 } 01510 01511 set_stream(); 01512 01513 plscmap1l( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3, loc_alt_hue_path ); 01514 01515 if ( loc_alt_hue_path != NULL ) 01516 delete [] loc_alt_hue_path; 01517 } 01518 01519 // Set color map 1 colors using a piece-wise linear relationship between 01520 // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space 01521 // and alpha value. 01522 01523 void plstream::scmap1la( bool itype, PLINT npts, const PLFLT *intensity, 01524 const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3, 01525 const PLFLT *a, const bool *alt_hue_path ) 01526 { 01527 PLBOOL *loc_alt_hue_path = NULL; 01528 if ( alt_hue_path != NULL ) 01529 { 01530 loc_alt_hue_path = new PLBOOL[npts - 1]; 01531 for ( int i = 0; i < npts - 1; i++ ) 01532 { 01533 loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i]; 01534 } 01535 } 01536 01537 set_stream(); 01538 01539 plscmap1la( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3, 01540 a, loc_alt_hue_path ); 01541 01542 if ( loc_alt_hue_path != NULL ) 01543 delete [] loc_alt_hue_path; 01544 } 01545 01546 // 01547 // void plstream::scmap1l( bool itype, PLINT npts, PLFLT *intensity, 01548 // PLFLT *coord1, PLFLT *coord2, PLFLT *coord3) 01549 // { 01550 // set_stream(); 01551 // 01552 // plscmap1l((PLBOOL) itype,npts,intensity,coord1,coord2,coord3,NULL); 01553 // 01554 // } 01555 01556 // Deprecated version using PLINT instead of bool 01557 void plstream::scmap1l( PLINT itype, PLINT npts, const PLFLT *intensity, 01558 const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3, 01559 const PLINT *alt_hue_path ) 01560 { 01561 PLBOOL *loc_alt_hue_path = NULL; 01562 if ( alt_hue_path != NULL ) 01563 { 01564 loc_alt_hue_path = new PLBOOL[npts - 1]; 01565 for ( int i = 0; i < npts - 1; i++ ) 01566 { 01567 loc_alt_hue_path[i] = (PLBOOL) alt_hue_path[i]; 01568 } 01569 } 01570 01571 set_stream(); 01572 01573 plscmap1l( (PLBOOL) itype, npts, intensity, coord1, coord2, coord3, loc_alt_hue_path ); 01574 01575 if ( loc_alt_hue_path != NULL ) 01576 delete [] loc_alt_hue_path; 01577 } 01578 01579 // Set a given color from color map 0 by 8 bit RGB value 01580 01581 void plstream::scol0( PLINT icol0, PLINT r, PLINT g, PLINT b ) 01582 { 01583 set_stream(); 01584 01585 plscol0( icol0, r, g, b ); 01586 } 01587 01588 // Set a given color from color map 0 by 8 bit RGB value + alpha value 01589 01590 void plstream::scol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT a ) 01591 { 01592 set_stream(); 01593 01594 plscol0a( icol0, r, g, b, a ); 01595 } 01596 01597 // Set the background color by 8 bit RGB value 01598 01599 void plstream::scolbg( PLINT r, PLINT g, PLINT b ) 01600 { 01601 set_stream(); 01602 01603 plscolbg( r, g, b ); 01604 } 01605 01606 // Set the background color by 8 bit RGB + alpha value 01607 01608 void plstream::scolbga( PLINT r, PLINT g, PLINT b, PLFLT a ) 01609 { 01610 set_stream(); 01611 01612 plscolbga( r, g, b, a ); 01613 } 01614 01615 // Used to globally turn color output on/off 01616 01617 void plstream::scolor( PLINT color ) 01618 { 01619 set_stream(); 01620 01621 plscolor( color ); 01622 } 01623 01624 // Sets the compression level 01625 01626 void plstream::scompression( PLINT compression ) 01627 { 01628 set_stream(); 01629 01630 plscompression( compression ); 01631 } 01632 01633 // Set the device (keyword) name 01634 01635 void plstream::sdev( const char *devname ) 01636 { 01637 set_stream(); 01638 01639 plsdev( devname ); 01640 } 01641 01642 // Get the device (keyword) name 01643 01644 void plstream::gdev( char *devname ) 01645 { 01646 set_stream(); 01647 01648 plgdev( devname ); 01649 } 01650 01651 // Set window into device space using margin, aspect ratio, and 01652 // justification 01653 01654 void plstream::sdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy ) 01655 { 01656 set_stream(); 01657 01658 plsdidev( mar, aspect, jx, jy ); 01659 } 01660 01661 // Set up transformation from metafile coordinates. 01662 01663 void plstream::sdimap( PLINT dimxmin, PLINT dimxmax, 01664 PLINT dimymin, PLINT dimymax, 01665 PLFLT dimxpmm, PLFLT dimypmm ) 01666 { 01667 set_stream(); 01668 01669 plsdimap( dimxmin, dimxmax, dimymin, dimymax, dimxpmm, dimypmm ); 01670 } 01671 01672 // Set plot orientation, specifying rotation in units of pi/2. 01673 01674 void plstream::sdiori( PLFLT rot ) 01675 { 01676 set_stream(); 01677 01678 plsdiori( rot ); 01679 } 01680 01681 // Set window into plot space 01682 01683 void plstream::sdiplt( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ) 01684 { 01685 set_stream(); 01686 01687 plsdiplt( xmin, ymin, xmax, ymax ); 01688 } 01689 01690 // Set window into plot space incrementally (zoom) 01691 01692 void plstream::sdiplz( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ) 01693 { 01694 set_stream(); 01695 01696 plsdiplz( xmin, ymin, xmax, ymax ); 01697 } 01698 01699 // Set the escape character for text strings. 01700 01701 void plstream::sesc( char esc ) 01702 { 01703 set_stream(); 01704 01705 plsesc( esc ); 01706 } 01707 01708 // Set the offset and spacing of contour labels 01709 01710 void plstream::setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing, 01711 PLINT active ) 01712 { 01713 set_stream(); 01714 01715 pl_setcontlabelparam( offset, size, spacing, active ); 01716 } 01717 01718 // Set the format of the contour labels 01719 01720 void plstream::setcontlabelformat( PLINT lexp, PLINT sigdig ) 01721 { 01722 set_stream(); 01723 01724 pl_setcontlabelformat( lexp, sigdig ); 01725 } 01726 01727 // Set family file parameters 01728 01729 void plstream::sfam( PLINT fam, PLINT num, PLINT bmax ) 01730 { 01731 set_stream(); 01732 01733 plsfam( fam, num, bmax ); 01734 } 01735 01736 // Set FCI (font characterization integer) 01737 01738 void plstream::sfci( PLUNICODE fci ) 01739 { 01740 set_stream(); 01741 01742 plsfci( fci ); 01743 } 01744 01745 // Set the output file name. 01746 01747 void plstream::sfnam( const char *fnam ) 01748 { 01749 set_stream(); 01750 01751 plsfnam( fnam ); 01752 } 01753 01754 // Set the current font family, style and weight 01755 01756 void plstream::sfont( PLINT family, PLINT style, PLINT weight ) 01757 { 01758 set_stream(); 01759 01760 plsfont( family, style, weight ); 01761 } 01762 01763 // Shade region. 01764 01765 void 01766 plstream::shade( const PLFLT * const *a, PLINT nx, PLINT ny, 01767 PLINT ( *defined )( PLFLT, PLFLT ), 01768 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01769 PLFLT shade_min, PLFLT shade_max, 01770 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01771 PLINT min_color, PLFLT min_width, 01772 PLINT max_color, PLFLT max_width, 01773 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, 01774 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01775 PLPointer pltr_data ) 01776 { 01777 set_stream(); 01778 01779 plshade( a, nx, ny, defined, left, right, bottom, top, 01780 shade_min, shade_max, 01781 sh_cmap, sh_color, sh_width, 01782 min_color, min_width, max_color, max_width, 01783 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01784 } 01785 01786 // Deprecated version using PLINT instead of bool 01787 void 01788 plstream::shade( const PLFLT * const *a, PLINT nx, PLINT ny, 01789 PLINT ( *defined )( PLFLT, PLFLT ), 01790 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01791 PLFLT shade_min, PLFLT shade_max, 01792 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01793 PLINT min_color, PLFLT min_width, 01794 PLINT max_color, PLFLT max_width, 01795 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, 01796 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01797 PLPointer pltr_data ) 01798 { 01799 set_stream(); 01800 01801 plshade( a, nx, ny, defined, left, right, bottom, top, 01802 shade_min, shade_max, 01803 sh_cmap, sh_color, sh_width, 01804 min_color, min_width, max_color, max_width, 01805 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01806 } 01807 01808 void 01809 plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny, 01810 PLINT ( *defined )( PLFLT, PLFLT ), 01811 PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 01812 const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, 01813 PLINT cont_color, PLFLT cont_width, 01814 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, 01815 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01816 PLPointer pltr_data ) 01817 { 01818 set_stream(); 01819 01820 plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax, 01821 clevel, nlevel, fill_width, cont_color, cont_width, 01822 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01823 } 01824 01825 // Deprecated version using PLINT instead of bool 01826 void 01827 plstream::shades( const PLFLT * const *a, PLINT nx, PLINT ny, 01828 PLINT ( *defined )( PLFLT, PLFLT ), 01829 PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 01830 const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, 01831 PLINT cont_color, PLFLT cont_width, 01832 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, 01833 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01834 PLPointer pltr_data ) 01835 { 01836 set_stream(); 01837 01838 plshades( a, nx, ny, defined, xmin, xmax, ymin, ymax, 01839 clevel, nlevel, fill_width, cont_color, cont_width, 01840 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01841 } 01842 01843 void 01844 plstream::shade( Contourable_Data & d, PLFLT xmin, PLFLT xmax, 01845 PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, 01846 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01847 PLINT min_color, PLFLT min_width, 01848 PLINT max_color, PLFLT max_width, 01849 bool rectangular, 01850 Coord_Xformer *pcxf ) 01851 { 01852 set_stream(); 01853 01854 int nx, ny; 01855 d.elements( nx, ny ); 01856 01857 if ( pcxf != NULL ) 01858 ::plfshade( Contourable_Data_evaluator, &d, 01859 NULL, NULL, 01860 nx, ny, 01861 xmin, xmax, ymin, ymax, shade_min, shade_max, 01862 sh_cmap, sh_color, sh_width, 01863 min_color, min_width, max_color, max_width, 01864 ::plfill, rectangular, 01865 Coord_Xform_evaluator, pcxf ); 01866 else 01867 ::plfshade( Contourable_Data_evaluator, &d, 01868 NULL, NULL, 01869 nx, ny, 01870 xmin, xmax, ymin, ymax, shade_min, shade_max, 01871 sh_cmap, sh_color, sh_width, 01872 min_color, min_width, max_color, max_width, 01873 ::plfill, rectangular, 01874 NULL, NULL ); 01875 } 01876 01877 // Deprecated version using PLINT not bool 01878 void 01879 plstream::shade( Contourable_Data & d, PLFLT xmin, PLFLT xmax, 01880 PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, 01881 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01882 PLINT min_color, PLFLT min_width, 01883 PLINT max_color, PLFLT max_width, 01884 PLINT rectangular, 01885 Coord_Xformer *pcxf ) 01886 { 01887 set_stream(); 01888 01889 int nx, ny; 01890 d.elements( nx, ny ); 01891 01892 ::plfshade( Contourable_Data_evaluator, &d, 01893 NULL, NULL, 01894 nx, ny, 01895 xmin, xmax, ymin, ymax, shade_min, shade_max, 01896 sh_cmap, sh_color, sh_width, 01897 min_color, min_width, max_color, max_width, 01898 ::plfill, rectangular != 0, 01899 Coord_Xform_evaluator, pcxf ); 01900 } 01901 01902 void 01903 plstream::shade1( const PLFLT *a, PLINT nx, PLINT ny, 01904 PLINT ( *defined )( PLFLT, PLFLT ), 01905 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01906 PLFLT shade_min, PLFLT shade_max, 01907 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01908 PLINT min_color, PLFLT min_width, 01909 PLINT max_color, PLFLT max_width, 01910 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, 01911 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01912 PLPointer pltr_data ) 01913 { 01914 set_stream(); 01915 01916 plshade1( a, nx, ny, defined, 01917 left, right, bottom, top, 01918 shade_min, shade_max, 01919 sh_cmap, sh_color, sh_width, 01920 min_color, min_width, max_color, max_width, 01921 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01922 } 01923 01924 // Deprecated version using PLINT not bool 01925 void 01926 plstream::shade1( const PLFLT *a, PLINT nx, PLINT ny, 01927 PLINT ( *defined )( PLFLT, PLFLT ), 01928 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01929 PLFLT shade_min, PLFLT shade_max, 01930 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01931 PLINT min_color, PLFLT min_width, 01932 PLINT max_color, PLFLT max_width, 01933 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, 01934 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01935 PLPointer pltr_data ) 01936 { 01937 set_stream(); 01938 01939 plshade1( a, nx, ny, defined, 01940 left, right, bottom, top, 01941 shade_min, shade_max, 01942 sh_cmap, sh_color, sh_width, 01943 min_color, min_width, max_color, max_width, 01944 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01945 } 01946 01947 void 01948 plstream::fshade( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), 01949 PLPointer f2eval_data, 01950 PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), 01951 PLPointer c2eval_data, 01952 PLINT nx, PLINT ny, 01953 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01954 PLFLT shade_min, PLFLT shade_max, 01955 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01956 PLINT min_color, PLFLT min_width, 01957 PLINT max_color, PLFLT max_width, 01958 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), bool rectangular, 01959 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01960 PLPointer pltr_data ) 01961 { 01962 set_stream(); 01963 01964 plfshade( f2eval, f2eval_data, 01965 c2eval, c2eval_data, 01966 nx, ny, left, right, bottom, top, 01967 shade_min, shade_max, 01968 sh_cmap, sh_color, sh_width, 01969 min_color, min_width, max_color, max_width, 01970 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01971 } 01972 01973 // Deprecated version using PLINT not bool 01974 void 01975 plstream::fshade( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), 01976 PLPointer f2eval_data, 01977 PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), 01978 PLPointer c2eval_data, 01979 PLINT nx, PLINT ny, 01980 PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, 01981 PLFLT shade_min, PLFLT shade_max, 01982 PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, 01983 PLINT min_color, PLFLT min_width, 01984 PLINT max_color, PLFLT max_width, 01985 void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, 01986 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 01987 PLPointer pltr_data ) 01988 { 01989 set_stream(); 01990 01991 plfshade( f2eval, f2eval_data, 01992 c2eval, c2eval_data, 01993 nx, ny, left, right, bottom, top, 01994 shade_min, shade_max, 01995 sh_cmap, sh_color, sh_width, 01996 min_color, min_width, max_color, max_width, 01997 fill, (PLBOOL) rectangular, pltr, pltr_data ); 01998 } 01999 02000 // Setup a user-provided custom labeling function 02001 02002 void plstream::slabelfunc( void ( *label_func )( PLINT, PLFLT, char *, PLINT, PLPointer ), 02003 PLPointer label_data ) 02004 { 02005 set_stream(); 02006 02007 plslabelfunc( label_func, label_data ); 02008 } 02009 02010 // Set up lengths of major tick marks. 02011 02012 void plstream::smaj( PLFLT def, PLFLT scale ) 02013 { 02014 set_stream(); 02015 02016 plsmaj( def, scale ); 02017 } 02018 02019 // Set the RGB memory area to be plotted (with the 'mem' or 'memcairo' drivers) 02020 02021 void plstream::smem( PLINT maxx, PLINT maxy, void *plotmem ) 02022 { 02023 set_stream(); 02024 02025 plsmem( maxx, maxy, plotmem ); 02026 } 02027 02028 // Set the RGBA memory area to be plotted (with the 'memcairo' drivers) 02029 02030 void plstream::smema( PLINT maxx, PLINT maxy, void *plotmem ) 02031 { 02032 set_stream(); 02033 02034 plsmema( maxx, maxy, plotmem ); 02035 } 02036 02037 // Set up lengths of minor tick marks. 02038 02039 void plstream::smin( PLFLT def, PLFLT scale ) 02040 { 02041 set_stream(); 02042 02043 plsmin( def, scale ); 02044 } 02045 02046 // Set orientation. Must be done before calling plinit. 02047 02048 void plstream::sori( PLINT ori ) 02049 { 02050 set_stream(); 02051 02052 plsori( ori ); 02053 } 02054 02055 // Set output device parameters. Usually ignored by the driver. 02056 02057 void plstream::spage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, 02058 PLINT xoff, PLINT yoff ) 02059 { 02060 set_stream(); 02061 02062 plspage( xp, yp, xleng, yleng, xoff, yoff ); 02063 } 02064 02065 // Set the colors for color table 0 from a cmap0 file 02066 02067 void plstream::spal0( const char *filename ) 02068 { 02069 set_stream(); 02070 02071 plspal0( filename ); 02072 } 02073 02074 // Set the colors for color table 1 from a cmap1 file 02075 02076 void plstream::spal1( const char *filename, bool interpolate ) 02077 { 02078 set_stream(); 02079 02080 plspal1( filename, (PLBOOL) interpolate ); 02081 } 02082 02083 // Set the pause (on end-of-page) status 02084 02085 void plstream::spause( bool pause ) 02086 { 02087 set_stream(); 02088 02089 plspause( (PLBOOL) pause ); 02090 } 02091 02092 // Deprecated version using PLINT not bool 02093 void plstream::spause( PLINT pause ) 02094 { 02095 set_stream(); 02096 02097 plspause( (PLBOOL) pause ); 02098 } 02099 02100 // Set stream number. 02101 02102 void plstream::sstrm( PLINT strm ) 02103 { 02104 set_stream(); 02105 02106 plsstrm( strm ); 02107 } 02108 02109 // Set the number of subwindows in x and y 02110 02111 void plstream::ssub( PLINT nx, PLINT ny ) 02112 { 02113 set_stream(); 02114 02115 plssub( nx, ny ); 02116 } 02117 02118 // Set symbol height. 02119 02120 void plstream::ssym( PLFLT def, PLFLT scale ) 02121 { 02122 set_stream(); 02123 02124 plssym( def, scale ); 02125 } 02126 02127 // Initialize PLplot, passing in the windows/page settings. 02128 02129 void plstream::star( PLINT nx, PLINT ny ) 02130 { 02131 set_stream(); 02132 02133 plstar( nx, ny ); 02134 } 02135 02136 // Initialize PLplot, passing the device name and windows/page settings. 02137 02138 void plstream::start( const char *devname, PLINT nx, PLINT ny ) 02139 { 02140 set_stream(); 02141 02142 plstart( devname, nx, ny ); 02143 } 02144 02145 // Set the coordinate transform 02146 02147 void plstream::stransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), 02148 PLPointer coordinate_transform_data ) 02149 { 02150 set_stream(); 02151 02152 plstransform( coordinate_transform, coordinate_transform_data ); 02153 } 02154 02155 // Prints out the same string repeatedly at the n points in world 02156 // coordinates given by the x and y arrays. Supersedes plpoin and 02157 // plsymbol for the case where text refers to a unicode glyph either 02158 // directly as UTF-8 or indirectly via the standard text escape 02159 // sequences allowed for PLplot input strings. 02160 02161 void plstream::string( PLINT n, const PLFLT *x, const PLFLT *y, const char *string ) 02162 { 02163 set_stream(); 02164 plstring( n, x, y, string ); 02165 } 02166 02167 // Prints out the same string repeatedly at the n points in world 02168 // coordinates given by the x, y, and z arrays. Supersedes plpoin3 02169 // for the case where text refers to a unicode glyph either directly 02170 // as UTF-8 or indirectly via the standard text escape sequences 02171 // allowed for PLplot input strings. 02172 02173 void plstream::string3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, const char *string ) 02174 { 02175 set_stream(); 02176 plstring3( n, x, y, z, string ); 02177 } 02178 02179 // Create 1d stripchart 02180 02181 void plstream::stripc( PLINT *id, const char *xspec, const char *yspec, 02182 PLFLT xmin, PLFLT xmax, PLFLT xjump, 02183 PLFLT ymin, PLFLT ymax, 02184 PLFLT xlpos, PLFLT ylpos, bool y_ascl, 02185 bool acc, PLINT colbox, PLINT collab, 02186 const PLINT colline[], const PLINT styline[], 02187 const char *legline[], const char *labx, 02188 const char *laby, const char *labtop ) 02189 { 02190 set_stream(); 02191 02192 plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, 02193 (PLBOOL) y_ascl, (PLBOOL) acc, colbox, collab, colline, styline, 02194 legline, labx, laby, labtop ); 02195 } 02196 02197 02198 // Deprecated version using PLINT not bool 02199 void plstream::stripc( PLINT *id, const char *xspec, const char *yspec, 02200 PLFLT xmin, PLFLT xmax, PLFLT xjump, 02201 PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, 02202 PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab, 02203 const PLINT colline[], const PLINT styline[], 02204 const char *legline[], const char *labx, 02205 const char *laby, const char *labtop ) 02206 { 02207 set_stream(); 02208 02209 plstripc( id, xspec, yspec, xmin, xmax, xjump, ymin, ymax, xlpos, ylpos, 02210 (PLBOOL) y_ascl, (PLBOOL) acc, colbox, collab, colline, styline, 02211 legline, labx, laby, labtop ); 02212 } 02213 02214 // Add a point to a stripchart. 02215 02216 void plstream::stripa( PLINT id, PLINT pen, PLFLT x, PLFLT y ) 02217 { 02218 set_stream(); 02219 02220 plstripa( id, pen, x, y ); 02221 } 02222 02223 // Deletes and releases memory used by a stripchart. 02224 02225 void plstream::stripd( PLINT id ) 02226 { 02227 set_stream(); 02228 02229 plstripd( id ); 02230 } 02231 02232 // plots a 2d image (or a matrix too large for plshade() ) - colors 02233 // automatically scaled 02234 02235 void plstream::image( const PLFLT * const *data, PLINT nx, PLINT ny, 02236 PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 02237 PLFLT zmin, PLFLT zmax, 02238 PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ) 02239 { 02240 set_stream(); 02241 02242 plimage( data, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, 02243 Dxmin, Dxmax, Dymin, Dymax ); 02244 } 02245 02246 // plots a 2d image (or a matrix too large for plshade() ) 02247 02248 void plstream::imagefr( const PLFLT * const *data, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, 02249 PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, 02250 PLFLT valuemin, PLFLT valuemax, 02251 void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), 02252 PLPointer pltr_data ) 02253 { 02254 set_stream(); 02255 02256 plimagefr( data, nx, ny, xmin, xmax, ymin, ymax, zmin, zmax, 02257 valuemin, valuemax, pltr, pltr_data ); 02258 } 02259 02260 // Set up a new line style 02261 02262 void plstream::styl( PLINT nms, const PLINT *mark, const PLINT *space ) 02263 { 02264 set_stream(); 02265 02266 plstyl( nms, mark, space ); 02267 } 02268 02269 // Sets the edges of the viewport to the specified absolute coordinates 02270 02271 void plstream::svpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ) 02272 { 02273 set_stream(); 02274 02275 plsvpa( xmin, xmax, ymin, ymax ); 02276 } 02277 02278 // Set x axis labeling parameters 02279 02280 void plstream::sxax( PLINT digmax, PLINT digits ) 02281 { 02282 set_stream(); 02283 02284 plsxax( digmax, digits ); 02285 } 02286 02287 // Set inferior X window 02288 02289 void plstream::sxwin( PLINT window_id ) 02290 { 02291 set_stream(); 02292 02293 plsxwin( window_id ); 02294 } 02295 02296 // Set y axis labeling parameters 02297 02298 void plstream::syax( PLINT digmax, PLINT digits ) 02299 { 02300 set_stream(); 02301 02302 plsyax( digmax, digits ); 02303 } 02304 02305 // Plots array y against x for n points using Hershey symbol "code" 02306 02307 void plstream::sym( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code ) 02308 { 02309 set_stream(); 02310 02311 plsym( n, x, y, code ); 02312 } 02313 02314 // Set z axis labeling parameters 02315 02316 void plstream::szax( PLINT digmax, PLINT digits ) 02317 { 02318 set_stream(); 02319 02320 plszax( digmax, digits ); 02321 } 02322 02323 // Switches to text screen. 02324 02325 void plstream::text() 02326 { 02327 set_stream(); 02328 02329 pltext(); 02330 } 02331 02332 // Set the format for date / time labels 02333 02334 void plstream::timefmt( const char *fmt ) 02335 { 02336 set_stream(); 02337 02338 pltimefmt( fmt ); 02339 } 02340 02341 // Sets the edges of the viewport with the given aspect ratio, leaving 02342 // room for labels. 02343 02344 void plstream::vasp( PLFLT aspect ) 02345 { 02346 set_stream(); 02347 02348 plvasp( aspect ); 02349 } 02350 02351 // Creates the largest viewport of the specified aspect ratio that fits 02352 // within the specified normalized subpage coordinates. 02353 02354 void plstream::vpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, 02355 PLFLT aspect ) 02356 { 02357 set_stream(); 02358 02359 plvpas( xmin, xmax, ymin, ymax, aspect ); 02360 } 02361 02362 // Creates a viewport with the specified normalized subpage coordinates. 02363 02364 void plstream::vpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ) 02365 { 02366 set_stream(); 02367 02368 plvpor( xmin, xmax, ymin, ymax ); 02369 } 02370 02371 // Defines a "standard" viewport with seven character heights for 02372 // the left margin and four character heights everywhere else. 02373 02374 void plstream::vsta() 02375 { 02376 set_stream(); 02377 02378 plvsta(); 02379 } 02380 02381 // Set up a window for three-dimensional plotting. 02382 02383 void plstream::w3d( PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0, 02384 PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, 02385 PLFLT zmax0, PLFLT alt, PLFLT az ) 02386 { 02387 set_stream(); 02388 02389 plw3d( basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, 02390 alt, az ); 02391 } 02392 02393 // Set pen width. 02394 02395 void plstream::width( PLFLT width ) 02396 { 02397 set_stream(); 02398 02399 plwidth( width ); 02400 } 02401 02402 // Set up world coordinates of the viewport boundaries (2d plots). 02403 02404 void plstream::wind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ) 02405 { 02406 set_stream(); 02407 02408 plwind( xmin, xmax, ymin, ymax ); 02409 } 02410 02411 // Set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device 02412 02413 void plstream::xormod( bool mode, bool *status ) 02414 { 02415 PLBOOL loc_status; 02416 02417 set_stream(); 02418 02419 plxormod( (PLBOOL) mode, &loc_status ); 02420 02421 *status = ( loc_status != 0 ); 02422 } 02423 02424 // Deprecated version using PLINT not bool 02425 void plstream::xormod( PLINT mode, PLINT *status ) 02426 { 02427 PLBOOL loc_status; 02428 02429 set_stream(); 02430 02431 plxormod( (PLBOOL) mode, &loc_status ); 02432 02433 *status = (PLINT) loc_status; 02434 } 02435 02436 // Set the seed for the random number generator included. 02437 02438 void plstream::seed( unsigned int s ) 02439 { 02440 set_stream(); 02441 02442 plseed( s ); 02443 } 02444 02445 // Returns a random number on [0,1]-interval. 02446 02447 PLFLT plstream::randd( void ) 02448 { 02449 set_stream(); 02450 02451 return plrandd(); 02452 } 02453 02454 // The rest for use from C / C++ only 02455 02456 // Returns a list of file-oriented device names and their menu strings 02457 02458 void plstream::gFileDevs( const char ***p_menustr, const char ***p_devname, 02459 int *p_ndev ) 02460 { 02461 set_stream(); 02462 02463 plgFileDevs( p_menustr, p_devname, p_ndev ); 02464 } 02465 02466 // Set the function pointer for the keyboard event handler 02467 02468 void plstream::sKeyEH( void ( *KeyEH )( PLGraphicsIn *, void *, int * ), 02469 void *KeyEH_data ) 02470 { 02471 set_stream(); 02472 02473 plsKeyEH( KeyEH, KeyEH_data ); 02474 } 02475 02476 // Set the variables to be used for storing error info 02477 02478 void plstream::sError( PLINT *errcode, char *errmsg ) 02479 { 02480 set_stream(); 02481 02482 plsError( errcode, errmsg ); 02483 } 02484 02485 // Sets an optional user exit handler. 02486 02487 void plstream::sexit( int ( *handler )( const char * ) ) 02488 { 02489 set_stream(); 02490 02491 plsexit( handler ); 02492 } 02493 02494 // Transformation routines 02495 02496 // Identity transformation. 02497 02498 void plstream::tr0( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, 02499 PLPointer pltr_data ) 02500 { 02501 pltr0( x, y, tx, ty, pltr_data ); 02502 } 02503 02504 // Does linear interpolation from singly dimensioned coord arrays. 02505 02506 void plstream::tr1( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, 02507 PLPointer pltr_data ) 02508 { 02509 pltr1( x, y, tx, ty, pltr_data ); 02510 } 02511 02512 // Does linear interpolation from doubly dimensioned coord arrays 02513 // (column dominant, as per normal C 2d arrays). 02514 02515 void plstream::tr2( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, 02516 PLPointer pltr_data ) 02517 { 02518 pltr2( x, y, tx, ty, pltr_data ); 02519 } 02520 02521 // Just like pltr2() but uses pointer arithmetic to get coordinates from 02522 // 2d grid tables. 02523 02524 void plstream::tr2p( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, 02525 PLPointer pltr_data ) 02526 { 02527 pltr2p( x, y, tx, ty, pltr_data ); 02528 } 02529 02530 // We obviously won't be using this object from Fortran... 02531 // // Identity transformation for plots from Fortran. 02532 02533 // void plstream::tr0f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) 02534 // { 02535 // set_stream(); 02536 02537 // pltr0f(x,y,tx,ty,pltr_data); 02538 // } 02539 02540 // // Does linear interpolation from doubly dimensioned coord arrays 02541 // // (row dominant, i.e. Fortran ordering). 02542 02543 // void plstream::tr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ) 02544 // { 02545 // set_stream(); 02546 02547 // pltr2f(x,y,tx,ty,pltr_data); 02548 // } 02549 02550 // Example linear transformation function for contour plotter. 02551 // This is not actually a part of the core library any more 02552 // 02553 // void plstream::xform( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty ) 02554 // { 02555 // set_stream(); 02556 // 02557 // xform(x,y,tx,ty); 02558 // } 02559 02560 // Function evaluators 02561 02562 // Does a lookup from a 2d function array. Array is of type (PLFLT **), 02563 // and is column dominant (normal C ordering). 02564 02565 PLFLT plstream::f2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data ) 02566 { 02567 set_stream(); 02568 02569 return ::plf2eval2( ix, iy, plf2eval_data ); 02570 } 02571 02572 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 02573 // and is column dominant (normal C ordering). 02574 02575 PLFLT plstream::f2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data ) 02576 { 02577 set_stream(); 02578 02579 return ::plf2eval( ix, iy, plf2eval_data ); 02580 } 02581 02582 // Does a lookup from a 2d function array. Array is of type (PLFLT *), 02583 // and is row dominant (Fortran ordering). 02584 02585 PLFLT plstream::f2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data ) 02586 { 02587 set_stream(); 02588 02589 return ::plf2evalr( ix, iy, plf2eval_data ); 02590 } 02591 02592 // Command line parsing utilities 02593 02594 // Clear internal option table info structure. 02595 02596 void plstream::ClearOpts() 02597 { 02598 set_stream(); 02599 02600 ::plClearOpts(); 02601 } 02602 02603 // Reset internal option table info structure. 02604 02605 void plstream::ResetOpts() 02606 { 02607 set_stream(); 02608 02609 ::plResetOpts(); 02610 } 02611 02612 // Merge user option table into internal info structure. 02613 02614 int plstream::MergeOpts( PLOptionTable *options, const char *name, 02615 const char **notes ) 02616 { 02617 set_stream(); 02618 02619 return ::plMergeOpts( options, name, notes ); 02620 } 02621 02622 // Set the strings used in usage and syntax messages. 02623 02624 void plstream::SetUsage( char *program_string, char *usage_string ) 02625 { 02626 set_stream(); 02627 02628 ::plSetUsage( program_string, usage_string ); 02629 } 02630 02631 // Process input strings, treating them as an option and argument pair. 02632 02633 int plstream::setopt( const char *opt, const char *optarg ) 02634 { 02635 set_stream(); 02636 02637 return ::plsetopt( opt, optarg ); 02638 } 02639 02640 // Depreciated version - use setopt instead. 02641 #ifdef PL_DEPRECATED 02642 int plstream::SetOpt( const char *opt, const char *optarg ) 02643 { 02644 set_stream(); 02645 02646 return ::plsetopt( opt, optarg ); 02647 } 02648 #endif // PL_DEPRECATED 02649 02650 // Print usage & syntax message. 02651 02652 void plstream::OptUsage() 02653 { 02654 set_stream(); 02655 02656 ::plOptUsage(); 02657 } 02658 02659 // Miscellaneous 02660 02661 // Set the output file pointer 02662 02663 void plstream::gfile( FILE **p_file ) 02664 { 02665 set_stream(); 02666 02667 ::plgfile( p_file ); 02668 } 02669 02670 // Get the output file pointer 02671 02672 void plstream::sfile( FILE *file ) 02673 { 02674 set_stream(); 02675 02676 ::plsfile( file ); 02677 } 02678 02679 02680 // Get the escape character for text strings. 02681 02682 void plstream::gesc( char *p_esc ) 02683 { 02684 set_stream(); 02685 02686 ::plgesc( p_esc ); 02687 } 02688 02689 // Front-end to driver escape function. 02690 02691 void plstream::cmd( PLINT op, void *ptr ) 02692 { 02693 set_stream(); 02694 02695 ::pl_cmd( op, ptr ); 02696 } 02697 02698 // Return full pathname for given file if executable 02699 02700 int plstream::FindName( char *p ) 02701 { 02702 set_stream(); 02703 02704 return plFindName( p ); 02705 } 02706 02707 // Looks for the specified executable file according to usual search path. 02708 02709 char *plstream::FindCommand( char *fn ) 02710 { 02711 set_stream(); 02712 02713 return plFindCommand( fn ); 02714 } 02715 02716 // Gets search name for file by concatenating the dir, subdir, and file 02717 // name, allocating memory as needed. 02718 02719 void plstream::GetName( char *dir, char *subdir, char *filename, 02720 char **filespec ) 02721 { 02722 set_stream(); 02723 02724 plGetName( dir, subdir, filename, filespec ); 02725 } 02726 02727 // Prompts human to input an integer in response to given message. 02728 02729 PLINT plstream::GetInt( char *s ) 02730 { 02731 set_stream(); 02732 02733 return plGetInt( s ); 02734 } 02735 02736 // Prompts human to input a float in response to given message. 02737 02738 PLFLT plstream::GetFlt( char *s ) 02739 { 02740 set_stream(); 02741 02742 return plGetFlt( s ); 02743 } 02744 02745 // Nice way to allocate space for a vectored 2d grid 02746 02747 // Allocates a block of memory for use as a 2-d grid of PLFLT's. 02748 02749 void plstream::Alloc2dGrid( PLFLT ***f, PLINT nx, PLINT ny ) 02750 { 02751 set_stream(); 02752 02753 ::plAlloc2dGrid( f, nx, ny ); 02754 } 02755 02756 // Frees a block of memory allocated with plAlloc2dGrid(). 02757 02758 void plstream::Free2dGrid( PLFLT **f, PLINT nx, PLINT ny ) 02759 { 02760 set_stream(); 02761 02762 ::plFree2dGrid( f, nx, ny ); 02763 } 02764 02765 // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid(). 02766 void plstream::MinMax2dGrid( const PLFLT * const *f, PLINT nx, PLINT ny, 02767 PLFLT *fmax, PLFLT *fmin ) 02768 { 02769 set_stream(); 02770 02771 ::plMinMax2dGrid( f, nx, ny, fmax, fmin ); 02772 } 02773 02774 // Functions for converting between HLS and RGB color space 02775 02776 void plstream::hlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, 02777 PLFLT *p_b ) 02778 { 02779 set_stream(); 02780 02781 ::c_plhlsrgb( h, l, s, p_r, p_g, p_b ); 02782 } 02783 02784 void plstream::rgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, 02785 PLFLT *p_s ) 02786 { 02787 set_stream(); 02788 02789 ::c_plrgbhls( r, g, b, p_h, p_l, p_s ); 02790 } 02791 02792 // Wait for right button mouse event and translate to world coordinates 02793 02794 int plstream::GetCursor( PLGraphicsIn *gin ) 02795 { 02796 set_stream(); 02797 02798 return plGetCursor( gin ); 02799 } 02800 02801 //-------------------------------------------------------------------------- 02802 // end of plstream.cc 02803 //--------------------------------------------------------------------------