1 /* *************************************************************************
2                           gdlgstream.hpp  -  graphic stream
3                              -------------------
4     begin                : July 22 2002
5     copyright            : (C) 2002 by Marc Schellens
6     email                : m_schellens@users.sf.net
7  ***************************************************************************/
8 
9 /* *************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef GDLGSTREAM_HPP_
19 #define GDLGSTREAM_HPP_
20 
21 //debug aid. Put to 1 to debug
22 #ifdef GDL_DEBUG
23 #define GDL_DEBUG_PLSTREAM 1
24 #else
25 #define GDL_DEBUG_PLSTREAM 0
26 #endif
27 
28 #ifdef HAVE_CONFIG_H
29 // we should not add all the plplot's internal defines (which are
30 // added if HAVE_CONFIG_H is defined) to ours. Makes problem with distros.
31 #undef HAVE_CONFIG_H
32 #include <plplot/plstream.h>
33 #include <plplot/plstrm.h>
34 #include <plplot/plplot.h>
35 #define HAVE_CONFIG_H 1
36 #endif
37 //this include should be removed as soon as plplot has a public method to give the size of a string in mm when plotted.
38 #if PLPLOT_PRIVATE_NOT_HIDDEN
39 #include <plplot/plplotP.h>
40 #endif
41 #include <string>
42 #include <iostream>
43 #include "typedefs.hpp"
44 #include "gdlexception.hpp"
45 
46 #include "initsysvar.hpp"
47 
48 #ifdef _MSC_VER
49 #include <algorithm>
50 #endif
51 
52 const double MMToINCH = 0.039370078 ; // 1./2.54;
53 const double CM_IN_MM = 10.00000000 ;
54 
55 using namespace std;
56 static std::string internalFontCodes[] = {
57     "#fn",      // !0  : unused
58     "#fn",      // !1  : unused
59     "#fn",      // !2  : unused
60     "#fn",      // !3  : simplex Roman (default)
61     "#fn",      // !4  : simplex Greek
62     "#fn",      // !5  : duplex Roman
63     "#fr",      // !6  : complex Roman
64     "#fr",      // !7  : complex Greek
65     "#fi",      // !8  : complex italic
66     "#fn",      // !9  : math/special characters
67     "#fn",      // !10 : special characters
68     "#fn",      // !11 : Gothic English
69     "#fs",      // !12 : simplex script
70     "#fs",      // !13 : complex script
71     "#fn",      // !14 : Gothic Italian
72     "#fn",      // !15 : Gothic German
73     "#fn",      // !16 : Cyrillic
74     "#fr",      // !17 : triplex Roman
75     "#fi",      // !18 : triplex Italic
76     "#fn",      // !19 :
77     "#fn",      // !20 : miscellaneous
78     "#fn",      // !21 :
79     "#fn",      // !22 :
80     "#fn",      // !23 :
81     "#fn",      // !24 :
82     "#fn",      // !25 :
83     "#fn",      // !26 :
84     "#fn",      // !27 :
85     "#fn",      // !28 :
86     "#fn",      // !29 :
87   };
88 
89 // Graphic Structures:
90 //  typedef struct _P_GRAPHICS {
91 //    DLong background;
92 //    DFloat charSize;
93 //    DFloat charThick;
94 //    DLong clip[6];
95 //    DLong color;
96 //    DLong font;
97 //    DLong lineStyle;
98 //    DLong multi[5];
99 //    DLong noClip;
100 //    DLong noErase;
101 //    DLong nsum;
102 //    DFloat position[4];
103 //    DLong psym;
104 //    DFloat region[4];
105 //    DString subTitle;
106 //    DFloat symSize;
107 //    DDouble t[4][4];
108 //    DLong t3d;
109 //    DFloat thick;
110 //    DString title;
111 //    DFloat ticklen;
112 //    DLong channel;
113 //  } pstruct ;
114 
115   typedef struct GDL_BOX {
116     bool initialized;
117     PLFLT wx1; //world coord of x min
118     PLFLT wx2;
119     PLFLT wy1;
120     PLFLT wy2;
121     PLFLT nx1; //normalized position in subpage
122     PLFLT nx2;
123     PLFLT ny1;
124     PLFLT ny2;
125     PLFLT ndx1; //normalized device position
126     PLFLT ndx2;
127     PLFLT ndy1;
128     PLFLT ndy2;
129     PLFLT ondx; //offset x of box in device coords
130     PLFLT ondy; // in y
131     PLFLT sndx; //size of box, x , device
132     PLFLT sndy;
133     PLFLT dx1; //position in device coords (e.g. pixels)
134     PLFLT dx2;
135     PLFLT dy1;
136     PLFLT dy2;
137     PLFLT pageWorldCoordinates[4];
138     PLFLT subPageWorldCoordinates[4];
139   } gdlbox ;
140 
141   typedef struct GDL_SUBPAGE {
142     PLFLT dxsize; //subpage x size device units
143     PLFLT dysize; //subpage y size device units
144     PLFLT dxoff; // subpage x offset
145     PLFLT dyoff; // subpage y offset
146   } gdlsubpage ;
147 
148   typedef struct GDL_PAGE {
149     PLFLT xdpmm; // x resolution Dots per mm
150     PLFLT ydpmm; // y resolution Dots per mm
151     PLFLT length; //x length (device coordinates)
152     PLFLT height; //y lenght
153     PLFLT plxoff; // x offset
154     PLFLT plyoff; // y iffset
155     PLFLT xsizemm; // size in mm, x
156     PLFLT ysizemm;
157     PLINT curPage; //current Page
158     PLINT nbPages; //nx*ny
159     PLINT nx;
160     PLINT ny;
161     gdlsubpage subpage;
162   } gdlpage ;
163 
164   typedef struct GDL_CHARINFO {
165     PLFLT scale;
166     PLFLT ndsx; // size of char in normalized device units, x direction
167     PLFLT ndsy; // idem y
168     PLFLT dsx; // size of char in device units, x direction
169     PLFLT dsy; // idem y
170     PLFLT fudge; //a correction factor to reported sizes, useful with wxWidgets plplot driver (?) for which it is 1.8 . go figure.
171     DDouble mmsx; //in mm
172     DDouble mmsy; //
173     PLFLT wsx;  //in current world coordinates
174     PLFLT wsy;
175     PLFLT convx; //symbol size conversion factor, (for PSYMs, not characters: PSYMs are handled by GDL, CHARS by plplot)
176     PLFLT convy; //set only while in 2D mode, used in 2D or 3D mode.
177     PLFLT dspacing; // spacing of line, device units, 2nd element of device,set_character_size
178     PLFLT nspacing; // in normalized units
179     PLFLT mmspacing; // in mm
180     PLFLT wspacing; // in world
181   } gdlCharInfo;
182 
183 class GDLGStream: public plstream
184 {
185 // protected:
186 //   void init(); // prevent plstream::init from being called directly
187 private:
188     gdlpage pageLayout;
189     gdlbox boxLayout;
190 
191 protected:
192   bool valid;
193   gdlCharInfo theCurrentChar;
194   gdlCharInfo theDefaultChar;
195   int gdlDefaultCharInitialized;
196   gdlbox theBox;
197   gdlpage thePage;
198   PLStream* pls;
199   DFloat thickFactor;
200   PLFLT theCurrentSymSize;
201   PLFLT theLineSpacing_in_mm;
202   bool usedAsPixmap; //for WINDOW,/PIXMAP retains the fact that this is a pixmap (invisible) window.
203   int activeFontCodeNum; //simplex Roman by default.
204 public:
205 
GDLGStream(int nx,int ny,const char * driver,const char * file=NULL)206    GDLGStream( int nx, int ny, const char *driver, const char *file=NULL)
207     : plstream( nx, ny, driver, file), valid( true), thickFactor(1.0), usedAsPixmap(false), activeFontCodeNum(3)
208   {
209     if (!checkPlplotDriver(driver))
210       ThrowGDLException(std::string("PLplot installation lacks the requested driver: ") + driver);
211     gdlDefaultCharInitialized=0;
212     thePage.nbPages=0;
213     thePage.length=0;
214     thePage.height=0;
215     thePage.plxoff=0;
216     thePage.plyoff=0;
217     theBox.initialized=false;
218     plgpls( &pls);
219     //you can debug plplot things with
220     //    pls->verbose=1;
221 
222 	if (GDL_DEBUG_PLSTREAM) printf(" new GDLGstream( %d , %d , %s ):pls=%p \n", nx, ny, driver, (void *)pls);
223 
224   }
225 
~GDLGStream()226   virtual ~GDLGStream()
227   {
228 	  if (GDL_DEBUG_PLSTREAM) printf(" retire GDLGstream:pls=0x%p \n", (void *)pls);
229   }
230 
checkPlplotDriver(const char * driver)231   static bool checkPlplotDriver(const char *driver) {
232   int numdevs = 128;
233   const char **devlongnames = (const char**) malloc(numdevs * sizeof (char*));
234   const char **devnames = (const char**) malloc(numdevs * sizeof (char*));
235   plgDevs(&devlongnames, &devnames, &numdevs);
236   bool found = false;
237   for (int i = 0; i < numdevs; ++i) {
238    if (strcmp(driver, devnames[i])==0){
239      found = true;
240      break;
241     }
242   }
243     free(devlongnames);
244     free(devnames);
245     return found;
246  }
getActiveFontCode()247    std::string getActiveFontCode(){
248    return internalFontCodes[activeFontCodeNum];
249   }
250 
251   static void SetErrorHandlers();
252 
253   virtual void Init()=0;
254 
255   // called after draw operation
256   //virtual void Update() {}
Update()257   virtual void Update(){plstream::cmd(PLESC_EXPOSE, NULL);}
258 
EventHandler()259   virtual void EventHandler() {}
260 
261   virtual void GetGeometry( long& xSize, long& ySize);
GetWindowDepth()262   virtual unsigned long GetWindowDepth () {return 0;}
GetVisualDepth()263   virtual DLong GetVisualDepth() {return -1;}
GetVisualName()264   virtual DString GetVisualName() {return "";}
GetFontnames(DString pattern)265   virtual BaseGDL* GetFontnames(DString pattern) {return NULL;}
GetFontnum(DString pattern)266   virtual DLong GetFontnum(DString pattern) {return 0;}
UnsetFocus()267   virtual bool UnsetFocus(){return false;}
SetBackingStore(int value)268   virtual bool SetBackingStore(int value){return false;}
SetGraphicsFunction(long value)269   virtual bool SetGraphicsFunction(long value ){return false;}
GetWindowPosition(long & xpos,long & ypos)270   virtual bool GetWindowPosition(long& xpos, long& ypos ){return false;}
GetScreenResolution(double & resx,double & resy)271   virtual bool GetScreenResolution(double& resx, double& resy){return false;}
CursorStandard(int cursorNumber)272   virtual bool CursorStandard(int cursorNumber){return false;}
CursorImage(char * v,int x,int y,char * m)273   virtual bool CursorImage(char* v, int x, int y, char* m) {return false;}
eop()274   virtual void eop()          { plstream::eop();}
SetDoubleBuffering()275   virtual void SetDoubleBuffering() {}
UnSetDoubleBuffering()276   virtual void UnSetDoubleBuffering() {}
HasDoubleBuffering()277   virtual bool HasDoubleBuffering() {return pls->db;}
HasSafeDoubleBuffering()278   virtual bool HasSafeDoubleBuffering() {return false;}
Raise()279   virtual void Raise()         {}
Lower()280   virtual void Lower()        {}
Iconic()281   virtual void Iconic()        {}
DeIconic()282   virtual void DeIconic()        {}
GetGin(PLGraphicsIn * gin,int mode)283   virtual bool GetGin(PLGraphicsIn *gin, int mode) {return 0;}
WarpPointer(DLong x,DLong y)284   virtual void WarpPointer(DLong x, DLong y){}
Flush()285   virtual void Flush() {}
Clear()286   virtual void Clear()         {}
Clear(DLong chan)287   virtual void Clear( DLong chan)          {}
PaintImage(unsigned char * idata,PLINT nx,PLINT ny,DLong * pos,DLong tru,DLong chan)288   virtual bool PaintImage(unsigned char *idata, PLINT nx, PLINT ny, DLong *pos, DLong tru, DLong chan){return false;}
HasCrossHair()289   virtual bool HasCrossHair() {return false;}
UnMapWindowAndSetPixmapProperty()290   virtual void UnMapWindowAndSetPixmapProperty() {usedAsPixmap=true;}
IsPixmapWindow()291   bool IsPixmapWindow() {return usedAsPixmap;}
IsPlot()292   virtual bool IsPlot() {return true;} //except some wxWidgets
GetBitmapData()293   virtual BaseGDL* GetBitmapData(){return NULL;}
SetCurrentFont(std::string fontname)294   virtual void SetCurrentFont(std::string fontname){}//do nothing
295   bool GetRegion(DLong& xs, DLong& ys, DLong& nx, DLong& ny);//{return false;}
296   bool SetRegion(DLong& xd, DLong& yd, DLong& nx, DLong& ny);//{return false;}
297 
CheckValid()298   virtual void CheckValid() {}
SetValid(bool v)299   void SetValid( bool v) { valid = v;}
GetValid()300   bool GetValid() { return valid;}
validWorldBox()301   bool validWorldBox()
302   {
303     if (((theBox.wx1==0) && (theBox.wx2==0))
304 	|| ((theBox.wy1==0) && (theBox.wy2==0))) return false; else return true;
305   }
getCurrentWorldBox(PLFLT & xmin,PLFLT & xmax,PLFLT & ymin,PLFLT & ymax)306   void getCurrentWorldBox(PLFLT &xmin, PLFLT &xmax, PLFLT &ymin, PLFLT &ymax) {
307    xmin=theBox.wx1;
308    ymin=theBox.wy1;
309    xmax=theBox.wx2;
310    ymax=theBox.wy2;
311   }
validNormdBox()312   bool validNormdBox()
313   {
314     if (((theBox.nx1==0) && (theBox.nx2==0))
315 	|| ((theBox.ny1==0) && (theBox.ny2==0))) return false; else return true;
316   }
getCurrentNormBox(PLFLT & xmin,PLFLT & xmax,PLFLT & ymin,PLFLT & ymax)317   void getCurrentNormBox(PLFLT &xmin, PLFLT &xmax, PLFLT &ymin, PLFLT &ymax) {
318    xmin=theBox.nx1;
319    ymin=theBox.ny1;
320    xmax=theBox.nx2;
321    ymax=theBox.ny2;
322   }
getPsymConvX()323   inline PLFLT getPsymConvX(){return theCurrentChar.convx;}
getPsymConvY()324   inline PLFLT getPsymConvY(){return theCurrentChar.convy;}
setSymbolSizeConversionFactors()325   inline void setSymbolSizeConversionFactors(){
326     PLFLT symsize=this->getSymbolSize();
327     theCurrentChar.convx=(0.5*symsize*(this->wCharLength()/this->charScale())); //be dependent only on symsize!
328     theCurrentChar.convy=(0.5*symsize*(this->wCharHeight()/this->charScale()));
329     PLFLT wun, wdeux, wtrois, wquatre; //take care of axes world orientation!
330     this->pageWorldCoordinates(wun, wdeux, wtrois, wquatre);
331     if ((wdeux-wun)<0) theCurrentChar.convx*=-1.0;
332     if ((wquatre-wtrois)<0) theCurrentChar.convy*=-1.0;}
charScale()333   inline PLFLT charScale(){return theCurrentChar.scale;}
nCharLength()334   inline PLFLT nCharLength(){return theCurrentChar.ndsx;}
nCharHeight()335   inline PLFLT nCharHeight(){return theCurrentChar.ndsy;}
nLineSpacing()336   inline PLFLT nLineSpacing(){return theCurrentChar.nspacing;}
dCharLength()337   inline PLFLT dCharLength(){return theCurrentChar.dsx;}
dCharHeight()338   inline PLFLT dCharHeight(){return theCurrentChar.dsy;}
dLineSpacing()339   inline PLFLT dLineSpacing(){return theCurrentChar.dspacing;}
wCharLength()340   inline PLFLT wCharLength(){return theCurrentChar.wsx;}
wCharHeight()341   inline PLFLT wCharHeight(){return theCurrentChar.wsy;}
wLineSpacing()342   inline PLFLT wLineSpacing(){return theCurrentChar.wspacing;}
mmCharLength()343   inline DDouble mmCharLength(){return theCurrentChar.mmsx;}
mmCharHeight()344   inline DDouble mmCharHeight(){return theCurrentChar.mmsy;}
mmLineSpacing()345   inline DDouble mmLineSpacing(){return theCurrentChar.mmspacing;}
xResolution()346   inline PLFLT xResolution(){return thePage.xdpmm;}
yResolution()347   inline PLFLT yResolution(){return thePage.ydpmm;}
mmxPageSize()348   inline PLFLT mmxPageSize(){return thePage.xsizemm;} //size in mm
mmyPageSize()349   inline PLFLT mmyPageSize(){return thePage.ysizemm;}
boxnXSize()350   inline PLFLT boxnXSize(){return theBox.sndx;}
boxnYSize()351   inline PLFLT boxnYSize(){return theBox.sndy;}
xPageSize()352   inline PLFLT xPageSize(){return thePage.length;} //size in units (alternate:{return pls->xlength;})
yPageSize()353   inline PLFLT yPageSize(){return thePage.height;} //alternate: {return pls->ylength;}
xSubPageSize()354   inline PLFLT xSubPageSize(){return thePage.subpage.dxsize;} //size in units
ySubPageSize()355   inline PLFLT ySubPageSize(){return thePage.subpage.dysize;}
356 
357 //  // bunch of conversion functions that should be used in the future now that pls is here!
358 //  // (normed) device coords to physical coords (x,y) 0..1 -> 0->32768
359 //  inline PLFLT nd2px(PLFLT x){ return ( pls->phyxmi + pls->phyxlen * x  );}
360 //  inline PLFLT nd2py(PLFLT y){ return ( pls->phyymi + pls->phyylen * y  );}
361 //  inline void norm2physical(PLFLT devx, PLFLT devy, PLFLT &physx, PLFLT &physy)
362 //  { physx=nd2px(devx); physy=nd2py(devy);}
363 //  // (normed) device to mm
364 //  inline PLFLT nd2mx(PLFLT x){ return (PLFLT) ( x * abs( pls->phyxma - pls->phyxmi ) / pls->xpmm ) ;}
365 //  inline PLFLT nd2my(PLFLT y){ return (PLFLT) ( y * abs( pls->phyyma - pls->phyymi ) / pls->ypmm ) ;}
366 //  inline void norm2mm(PLFLT devx, PLFLT devy, PLFLT &mmx, PLFLT &mmy)
367 //  { mmx=nd2mx(devx); mmy=nd2my(devy);}
368 //  //(normed) device to world
nd2wx(PLFLT x)369   inline PLFLT nd2wx(PLFLT x){return (PLFLT) ( (x- pls->wdxoff) / pls->wdxscl );}
nd2wy(PLFLT y)370   inline PLFLT nd2wy(PLFLT y){return (PLFLT) ( (y- pls->wdyoff) / pls->wdyscl );}
371 //  inline void norm2world(PLFLT devx, PLFLT devy, PLFLT &wx, PLFLT &wy)
372 //  { wx=nd2wx(devx); wy=nd2wy(devy);}
373 //  // (normed) device coords to subpage coords
374 //  inline PLFLT nd2spx(PLFLT x){ return (PLFLT) ( ( x - pls->spdxmi ) / ( pls->spdxma - pls->spdxmi ) ) ;}
375 //  inline PLFLT nd2spy(PLFLT y){ return (PLFLT) ( ( y - pls->spdymi ) / ( pls->spdyma - pls->spdymi ) ) ;}
376 //  inline void norm2subpage(PLFLT devx, PLFLT devy, PLFLT &spx, PLFLT &spy)
377 //  { spx=nd2spx(devx); spy=nd2spy(devy);}
378 //
379 //  // millimeters to physical coords (x,y)
380 //  inline PLFLT mm2px(PLFLT x){ return ( pls->phyxmi + pls->xpmm * x  );}
381 //  inline PLFLT mm2py(PLFLT y){ return ( pls->phyymi + pls->ypmm * y  );}
382 //  inline void mm2physical(PLFLT mmx, PLFLT mmy, PLFLT &physx, PLFLT &physy)
383 //  { physx=mm2px(mmx); physy=mm2py(mmy);}
384 //  // mm to (absolute) device
mm2adx(PLFLT x)385   inline PLFLT mm2adx(PLFLT x){ return (PLFLT) ( ( x * pls->xpmm ) / abs( pls->phyxma - pls->phyxmi )*thePage.length);}
mm2ady(PLFLT y)386   inline PLFLT mm2ady(PLFLT y){ return (PLFLT) ( ( y * pls->ypmm ) / abs( pls->phyyma - pls->phyymi )*thePage.height);}
mm2device(PLFLT mmx,PLFLT mmy,PLFLT & devx,PLFLT & devy)387   inline void mm2device(PLFLT mmx, PLFLT mmy, PLFLT &devx, PLFLT &devy)
388   { devx=mm2adx(mmx); devy=mm2ady(mmy);}
389 //  // mm to (normed) device
mm2ndx(PLFLT x)390   inline PLFLT mm2ndx(PLFLT x){ return (PLFLT) ( ( x * pls->xpmm ) / abs( pls->phyxma - pls->phyxmi ));}
mm2ndy(PLFLT y)391   inline PLFLT mm2ndy(PLFLT y){ return (PLFLT) ( ( y * pls->ypmm ) / abs( pls->phyyma - pls->phyymi ));}
392 //  inline void mm2norm(PLFLT mmx, PLFLT mmy, PLFLT &devx, PLFLT &devy)
393 //  { devx=mm2ndx(mmx); devy=mm2ndy(mmy);}
394 //  // mm to world
mm2wx(PLFLT x)395   inline PLFLT mm2wx(PLFLT x){ x=mm2ndx(x); return nd2wx(x);}
mm2wy(PLFLT y)396   inline PLFLT mm2wy(PLFLT y){ y=mm2ndy(y); return nd2wy(y);}
397 //  inline void mm2world(PLFLT mmx, PLFLT mmy, PLFLT &wx, PLFLT &wy)
398 //  { wx=mm2wx(mmx); wy=mm2wy(mmy);}
399 //  // mm to subpage coord
400 //  inline PLFLT mm2spx(PLFLT x){ x=mm2ndx(x); return nd2spx(x);}
401 //  inline PLFLT mm2spy(PLFLT y){ y=mm2ndy(y); return nd2spy(y);}
402 //  inline void mm2subpage(PLFLT mmx, PLFLT mmy, PLFLT &spx, PLFLT &spy)
403 //  { spx=mm2spx(mmx); spy=mm2spy(mmy);}
404 //
405 //  // world to physical coords
406 //  inline PLFLT w2px(PLFLT x){ return ( pls->wpxoff + pls->wpxscl * x  );}
407 //  inline PLFLT w2py(PLFLT y){ return ( pls->wpyoff + pls->wpyscl * y  );}
408 //  inline void world2physical(PLFLT wx, PLFLT wy, PLFLT &physx, PLFLT &physy)
409 //  { physx=w2px(wx); physy=w2py(wy);}
410 //  // world to (normed) device
411 //  inline PLFLT w2ndx(PLFLT x){ return (PLFLT) ( pls->wdxoff + pls->wdxscl * x );}
412 //  inline PLFLT w2ndy(PLFLT y){ return (PLFLT) ( pls->wdyoff + pls->wdyscl * y );}
413 //  inline void world2norm(PLFLT wx, PLFLT wy, PLFLT &devx, PLFLT &devy)
414 //  { devx=w2ndx(wx); devy=w2ndy(wy);}
415 //   // world to (absolute) device
w2adx(PLFLT x)416   inline PLFLT w2adx(PLFLT x){ return (PLFLT) ( pls->wdxoff + pls->wdxscl * x )*thePage.length;}
w2ady(PLFLT y)417   inline PLFLT w2ady(PLFLT y){ return (PLFLT) ( pls->wdyoff + pls->wdyscl * y )*thePage.height;}
world2device(PLFLT wx,PLFLT wy,PLFLT & devx,PLFLT & devy)418   inline void world2device(PLFLT wx, PLFLT wy, PLFLT &devx, PLFLT &devy)
419   { devx=w2adx(wx); devy=w2ady(wy);}
420 //  //world to mm
421 //  inline PLFLT w2mmx(PLFLT x){ return (PLFLT) ( pls->wmxoff + pls->wmxscl * x );}
422 //  inline PLFLT w2mmy(PLFLT y){ return (PLFLT) ( pls->wmyoff + pls->wmyscl * y );}
423 //  inline void world2mm(PLFLT wx, PLFLT wy, PLFLT &mmx, PLFLT &mmy)
424 //  { mmx=w2mmx(wx); mmy=w2mmy(wy);}
425 //  //world to subpage coord
426 //  inline PLFLT w2spx(PLFLT x){ x=w2ndx(x) ; return nd2spx(x);}
427 //  inline PLFLT w2spy(PLFLT y){ y=w2ndy(y) ; return nd2spy(y);}
428 //  inline void world2subpage(PLFLT wx, PLFLT wy, PLFLT &spx, PLFLT &spy)
429 //  { spx=w2spx(wx); spy=w2spy(spy);}
430 //
431 //  // physical to (normed) device
432 //  inline PLFLT p2ndx(PLFLT x){ return (PLFLT) ( ( x - pls->phyxmi ) / (double) pls->phyxlen );}
433 //  inline PLFLT p2ndy(PLFLT y){ return (PLFLT) ( ( y - pls->phyymi ) / (double) pls->phyylen );}
434 //  inline void physical2device(PLFLT physx, PLFLT physy, PLFLT &devx, PLFLT &devy)
435 //  { devx=p2ndx(physx); devy=p2ndy(physy);}
436 //  //physical to world
437 //  //physical to mm
438 //  //physical to subpage coord
439 //
440 //  // subpage coords to (normed) device coords
441 //  inline PLFLT sp2ndx(PLFLT x){ return (PLFLT) ( pls->spdxmi + ( pls->spdxma - pls->spdxmi ) * x ) ;}
442 //  inline PLFLT sp2ndy(PLFLT y){ return (PLFLT) ( pls->spdymi + ( pls->spdyma - pls->spdymi ) * y ) ;}
443 //  inline void subpage2norm(PLFLT spx, PLFLT spy, PLFLT &devx, PLFLT &devy)
444 //  { devx=sp2ndx(spx); devy=sp2ndy(spy);}
445 //  //subpage to world
446 //  //subpage to mm
447 //  //subpage to physical
448 
449 #if PLPLOT_PRIVATE_NOT_HIDDEN
450   //use simple internal function
gdlGetStringLength(const std::string & s)451   PLFLT gdlGetStringLength(const std::string &s)
452   {
453     return plstrl(s.c_str());
454   }
455 #endif
456 
457 //  void  currentPhysicalPos(PLFLT &x, PLFLT &y)
458 //  {
459 //    x=pls->currx; //Physical x-coordinate of current point
460 //    y=pls->curry;
461 //  }
462 //  void  currentWorldPos(PLFLT &x, PLFLT &y)
463 //  {
464 //    x=pls->currx; //Physical x-coordinate of current point
465 //    y=pls->curry;
466 //    x=(x-pls->wpxoff)/pls->wpxscl;
467 //    y=(y-pls->wpyoff)/pls->wpyscl;
468 //  }
469 //  void  currentNormedDevicePos(PLFLT &x, PLFLT &y)
470 //  {
471 //    x=pls->currx; //Physical x-coordinate of current point
472 //    y=pls->curry;
473 //    x=p2ndx(x);
474 //    y=p2ndy(y);
475 //  }
476 
477 //  void  currentMmPos(PLFLT &x, PLFLT &y)
478 //  {
479 //    x=pls->currx; //Physical x-coordinate of current point
480 //    y=pls->curry;
481 //    x=p2ndx(x);x=nd2mx(x);
482 //    y=p2ndy(y);y=nd2my(y);
483 //  }
484 
pageWorldCoordinates(PLFLT & wxmin,PLFLT & wxmax,PLFLT & wymin,PLFLT & wymax)485   void  pageWorldCoordinates(PLFLT &wxmin, PLFLT &wxmax, PLFLT &wymin, PLFLT &wymax)
486   {
487       wxmin=theBox.pageWorldCoordinates[0];
488       wxmax=theBox.pageWorldCoordinates[1];
489       wymin=theBox.pageWorldCoordinates[2];
490       wymax=theBox.pageWorldCoordinates[3];
491   }
492 //  void  subPageWorldCoordinates(PLFLT &wxmin, PLFLT &wxmax, PLFLT &wymin, PLFLT &wymax)
493 //  {
494 //      wxmin=theBox.subPageWorldCoordinates[0];
495 //      wxmax=theBox.subPageWorldCoordinates[1];
496 //      wymin=theBox.subPageWorldCoordinates[2];
497 //      wymax=theBox.subPageWorldCoordinates[3];
498 //  }
499 //  void  boxDeviceCoordinates(PLFLT &wxmin, PLFLT &wxmax, PLFLT &wymin, PLFLT &wymax)
500 //  {
501 //      wxmin=theBox.dx1;
502 //      wxmax=theBox.dx2;
503 //      wymin=theBox.dy1;
504 //      wymax=theBox.dy2;
505 //  }
boxAspectDevice()506   PLFLT  boxAspectDevice(){return (theBox.dy2-theBox.dy1)/(theBox.dx2-theBox.dx1);}
boxAspectWorld()507   PLFLT  boxAspectWorld(){return fabs(theBox.wy2-theBox.wy1)/fabs(theBox.wx2-theBox.wx1);}
508 
SaveLayout()509   void SaveLayout()
510   {
511     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"SaveLayout():\n");
512     pageLayout.nbPages=thePage.nbPages;
513     pageLayout.nx=thePage.nx;
514     pageLayout.ny=thePage.ny;
515     pageLayout.curPage=thePage.curPage;
516     pageLayout.length=thePage.length;
517     pageLayout.height=thePage.height;
518     pageLayout.xsizemm=thePage.xsizemm;
519     pageLayout.ysizemm=thePage.ysizemm;
520     pageLayout.plxoff=thePage.plxoff;
521     pageLayout.plyoff=thePage.plyoff;
522 
523     boxLayout.nx1=theBox.nx1;
524     boxLayout.nx2=theBox.nx2;
525     boxLayout.ny1=theBox.ny1;
526     boxLayout.ny2=theBox.ny2;
527     boxLayout.ndx1=theBox.ndx1;
528     boxLayout.ndx2=theBox.ndx2;
529     boxLayout.ndy1=theBox.ndy1;
530     boxLayout.ndy2=theBox.ndy2;
531     boxLayout.ondx=theBox.ondx;
532     boxLayout.ondy=theBox.ondy;
533     boxLayout.sndx=theBox.sndx;
534     boxLayout.sndy=theBox.sndy;
535     boxLayout.dx1=theBox.dx1;
536     boxLayout.dx2=theBox.dx2;
537     boxLayout.dy1=theBox.dy1;
538     boxLayout.dy2=theBox.dy2;
539     boxLayout.wx1=theBox.wx1;
540     boxLayout.wx2=theBox.wx2;
541     boxLayout.wy1=theBox.wy1;
542     boxLayout.wy2=theBox.wy2;
543     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"saving box [%f,%f,%f,%f] at [%f,%f,%f,%f] in subpage %d of %dx%d (device coords [%f,%f,%f,%f]\n",boxLayout.wx1,boxLayout.wy1,boxLayout.wx2,boxLayout.wy2,boxLayout.nx1,boxLayout.ny1,boxLayout.nx2,boxLayout.ny2,pageLayout.curPage,pageLayout.nx,pageLayout.ny,boxLayout.dx1,boxLayout.dy1,boxLayout.dx2,boxLayout.dy2);
544   }
545 
RestoreLayout()546   void RestoreLayout()
547   {
548       ssub(pageLayout.nx,pageLayout.ny);
549       adv(pageLayout.curPage);
550       vpor(boxLayout.nx1,boxLayout.nx2,boxLayout.ny1,boxLayout.ny2);
551       wind(boxLayout.wx1,boxLayout.wx2,boxLayout.wy1,boxLayout.wy2);
552   }
553 
OnePageSaveLayout()554   void OnePageSaveLayout()
555   {
556       SaveLayout();
557       NoSub();
558   }
559 
updatePageInfo()560   bool updatePageInfo()
561   {
562     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"updatePageInfo():\n");
563     if (thePage.nbPages==0) {if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"            FAILED\n");return false;}
564     long xsize,ysize;
565     GetGeometry(xsize,ysize);
566     if (thePage.length==xsize && thePage.height==ysize ) return true;
567     thePage.length=xsize;
568     thePage.height=ysize;
569     (*static_cast<DLongGDL*>(SysVar::D()->GetTag(SysVar::D()->Desc()->TagIndex("X_SIZE"), 0)))[0] = xsize;
570     (*static_cast<DLongGDL*>(SysVar::D()->GetTag(SysVar::D()->Desc()->TagIndex("Y_SIZE"), 0)))[0] = ysize;
571     (*static_cast<DLongGDL*>(SysVar::D()->GetTag(SysVar::D()->Desc()->TagIndex("X_VSIZE"), 0)))[0] = xsize;
572     (*static_cast<DLongGDL*>(SysVar::D()->GetTag(SysVar::D()->Desc()->TagIndex("Y_VSIZE"), 0)))[0] = ysize;
573     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"             %fx%f device units.\n",thePage.length, thePage.height);
574     return true;
575   }
576 
NormToDevice(PLFLT normx,PLFLT normy,PLFLT & devx,PLFLT & devy)577   inline void NormToDevice(PLFLT normx, PLFLT normy, PLFLT &devx, PLFLT &devy)
578   {
579     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"NormToDevice()\n");
580     devx=normx*thePage.subpage.dxsize+thePage.subpage.dxoff;
581     devy=normy*thePage.subpage.dysize+thePage.subpage.dyoff;
582     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"        input [%f,%f] output [%f,%f]\n", normx, normy, devx, devy);
583   }
584 
NormedDeviceToDevice(PLFLT normx,PLFLT normy,PLFLT & devx,PLFLT & devy)585   inline void NormedDeviceToDevice(PLFLT normx, PLFLT normy, PLFLT &devx, PLFLT &devy)
586   {
587     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"NormedDeviceToDevice()\n");
588     devx=normx*thePage.length;
589     devy=normy*thePage.height;
590     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"         input [%f,%f] output [%f,%f]\n", normx, normy, devx, devy);
591   }
592 
DeviceToNorm(PLFLT devx,PLFLT devy,PLFLT & normx,PLFLT & normy)593   inline void DeviceToNorm(PLFLT devx, PLFLT devy, PLFLT &normx, PLFLT &normy)
594   {
595     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"DeviceToNorm()\n");
596     normx=(devx-thePage.subpage.dxoff)/thePage.subpage.dxsize;
597     normy=(devy-thePage.subpage.dyoff)/thePage.subpage.dysize;
598     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"          input [%f,%f] output [%f,%f]\n", devx, devy, normx, normy);
599   }
DeviceToNormedDevice(PLFLT devx,PLFLT devy,PLFLT & normx,PLFLT & normy)600   inline void DeviceToNormedDevice(PLFLT devx, PLFLT devy, PLFLT &normx, PLFLT &normy)
601   {
602     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"DeviceToNormedDevice()\n");
603     normx=devx/thePage.length;
604     normy=devy/thePage.height;
605     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"          input [%f,%f] output [%f,%f]\n", devx, devy, normx, normy);
606   }
NormToWorld(PLFLT normx,PLFLT normy,PLFLT & worldx,PLFLT & worldy)607   inline void NormToWorld(PLFLT normx, PLFLT normy, PLFLT &worldx, PLFLT &worldy)
608   {
609     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"NormToWorld()\n");
610     DDouble s1,s2;
611     s1=(theBox.wx2-theBox.wx1)/(theBox.nx2-theBox.nx1);
612     s2=theBox.wx1;
613     worldx=s1*(normx-theBox.nx1)+s2;
614     s1=(theBox.wy2-theBox.wy1)/(theBox.ny2-theBox.ny1);
615     s2=theBox.wy1;
616     worldy=s1*(normy-theBox.ny1)+s2;
617     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"         input [%f,%f] output [%f,%f]\n", normx, normy, worldx, worldy);
618   }
619 
NormedDeviceToWorld(PLFLT normx,PLFLT normy,PLFLT & worldx,PLFLT & worldy)620   inline void NormedDeviceToWorld(PLFLT normx, PLFLT normy, PLFLT &worldx, PLFLT &worldy)
621   {
622     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"NormedDeviceToWorld()\n");
623     DDouble s1,s2;
624     s1=(theBox.wx2-theBox.wx1)/(theBox.ndx2-theBox.ndx1);
625     s2=theBox.wx1;
626     worldx=s1*(normx-theBox.ndx1)+s2;
627     s1=(theBox.wy2-theBox.wy1)/(theBox.ndy2-theBox.ndy1);
628     s2=theBox.wy1;
629     worldy=s1*(normy-theBox.ndy1)+s2;
630     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"          input [%f,%f] (nd) output [%f,%f] (w)\n", normx, normy, worldx, worldy);
631   }
632 
WorldToNorm(PLFLT worldx,PLFLT worldy,PLFLT & normx,PLFLT & normy)633   inline void WorldToNorm(PLFLT worldx, PLFLT worldy, PLFLT &normx, PLFLT &normy)
634   {
635     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"WorldToNormedDevice()\n");
636     DDouble s1,s2;
637     s1=(theBox.nx2-theBox.nx1)/(theBox.wx2-theBox.wx1);
638     s2=theBox.nx1;
639     normx=s1*(worldx-theBox.wx1)+s2;
640     s1=(theBox.ny2-theBox.ny1)/(theBox.wy2-theBox.wy1);
641     s2=theBox.ny1;
642     normy=s1*(worldy-theBox.wy1)+s2;
643     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"     input [%f,%f] output [%f,%f]\n", worldx, worldy, normx, normy);
644   }
645 
WorldToNormedDevice(PLFLT worldx,PLFLT worldy,PLFLT & normx,PLFLT & normy)646   inline void WorldToNormedDevice(PLFLT worldx, PLFLT worldy, PLFLT &normx, PLFLT &normy)
647   {
648     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"WorldToNormedDevice()\n");
649     DDouble s1,s2;
650     s1=(theBox.ndx2-theBox.ndx1)/(theBox.wx2-theBox.wx1);
651     s2=theBox.ndx1;
652     normx=s1*(worldx-theBox.wx1)+s2;
653     s1=(theBox.ndy2-theBox.ndy1)/(theBox.wy2-theBox.wy1);
654     s2=theBox.ndy1;
655     normy=s1*(worldy-theBox.wy1)+s2;
656     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"    input [%f,%f](w) output [%f,%f](nd)\n", worldx, worldy, normx, normy);
657   }
658 
659 
DeviceToWorld(PLFLT devx,PLFLT devy,PLFLT & worldx,PLFLT & worldy)660   inline void DeviceToWorld(PLFLT devx, PLFLT devy, PLFLT &worldx, PLFLT &worldy)
661   {
662     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"DeviceToWorld()\n");
663     PLFLT normx, normy;
664     DeviceToNormedDevice(devx, devy, normx, normy);
665     NormedDeviceToWorld(normx, normy, worldx, worldy);
666   }
667 
WorldToDevice(PLFLT worldx,PLFLT worldy,PLFLT & devx,PLFLT & devy)668   inline void WorldToDevice(PLFLT worldx, PLFLT worldy, PLFLT &devx, PLFLT &devy)
669   {
670     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"WorldToDevice()\n");
671     PLFLT normx, normy;
672     WorldToNormedDevice(worldx, worldy, normx, normy);
673     NormedDeviceToDevice(normx, normy,  devx, devy);
674   }
675 
676   void Thick( DFloat thick);
677   virtual void Color( ULong c, DLong decomposed=0);
678   void Background( ULong c, DLong decomposed=0);
679   void DefaultBackground();
680   void SetColorMap1SingleColor( ULong color);
681   //if decomposed, create a red ramp. If not, copy the colormap0 in colormap1
682   void SetColorMap1DefaultColors(PLINT ncolors, DLong decomposed=0);
683   //if create a colormap1 color with passed colors, palette will be tableSize and colors assigned like in contour.
684   void SetColorMap1Table(PLINT tableSize, BaseGDL *passed_colors, DLong decomposed=0);
685   //if create a colormap1 with a black to white ramp.
686   void SetColorMap1Ramp(DLong decomposed=0, PLFLT minlight=0.0);
687   virtual void DefaultCharSize();
GetPlplotFudge()688   virtual float GetPlplotFudge(){return 1;}; //correction factor
689   void NextPlot( bool erase=true); // handles multi plots
690 
691   void NoSub(); // no subwindows (/NORM, /DEVICE)
692 
CurrentCharSize(PLFLT scale)693   void CurrentCharSize(PLFLT scale)
694   {
695     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"CurrentCharsize()\n");
696     if (gdlDefaultCharInitialized==0)
697     {
698         if (updatePageInfo()==true)
699         {
700         GetPlplotDefaultCharSize();
701         }
702     }
703     theCurrentChar.scale=scale;
704     theCurrentChar.ndsx=scale*theDefaultChar.ndsx;
705     theCurrentChar.ndsy=scale*theDefaultChar.ndsy;
706     theCurrentChar.dsx=scale*theDefaultChar.dsx;
707     theCurrentChar.dsy=scale*theDefaultChar.dsy;
708     theCurrentChar.mmsx=scale*theDefaultChar.mmsx;
709     theCurrentChar.mmsy=scale*theDefaultChar.mmsy;
710     theCurrentChar.wsx=scale*theDefaultChar.wsx;
711     theCurrentChar.wsy=scale*theDefaultChar.wsy;
712     theCurrentChar.mmspacing=scale*theDefaultChar.mmspacing;
713     theCurrentChar.nspacing=scale*theDefaultChar.nspacing;
714     theCurrentChar.dspacing=scale*theDefaultChar.dspacing;
715     theCurrentChar.wspacing=scale*theDefaultChar.wspacing;
716     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"            sized by %f is %fx%f mm or %fx%f device or %fx%f world\n",scale,theCurrentChar.mmsx,theCurrentChar.mmsy,theCurrentChar.dsx,theCurrentChar.dsy,theCurrentChar.wsx, theCurrentChar.wsy);
717   }
718 
UpdateCurrentCharWorldSize()719   void UpdateCurrentCharWorldSize()
720   {
721     PLFLT x,y,dx,dy;
722     DeviceToWorld(0,0,x,y);
723     DeviceToWorld(theDefaultChar.dsx,theDefaultChar.dsy, dx, dy);
724     theDefaultChar.wsx=abs(dx-x);
725     theDefaultChar.wsy=abs(dy-y);
726     theCurrentChar.wsx=theCurrentChar.scale*theDefaultChar.wsx;
727     theCurrentChar.wsy=theCurrentChar.scale*theDefaultChar.wsy;
728 
729     DeviceToWorld(0,theDefaultChar.dspacing, dx, dy);
730     theDefaultChar.wspacing=abs(dy-y);
731 
732     if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"UpdateCurrentCharWorldSize(%f,%f)\n",
733                                     theCurrentChar.wsx,theCurrentChar.wsy);
734   }
735 
736   void RenewPlplotDefaultCharsize(PLFLT newMmSize);
737 
738   void GetPlplotDefaultCharSize();
739 
740   // SA: overloading plplot methods in order to handle IDL-plplot extended
741   // text formating syntax conversion
742   std::string TranslateFormatCodes(const char *text, double *stringLength);
743   void setSymbolSize( PLFLT scale );
744   void setLineSpacing( PLFLT spacing );
745   PLFLT getSymbolSize();
746   void mtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just,
747                          const char *text);
748   void mtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just,
749                          const char *text);
750   void ptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just,
751                          const char *text, double *stringCharLength=NULL );
752   void schr( PLFLT charwidthmm, PLFLT scale, PLFLT lineSpacingmm);
753   void sizeChar(PLFLT scale);
754   void vpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
755 //  void gvpd( PLFLT& xmin, PLFLT& xmax, PLFLT& ymin, PLFLT& ymax );
756   void wind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax );
757   void ssub( PLINT nx, PLINT ny);
758   void adv(PLINT page);
759 
syncPageInfo()760   inline void syncPageInfo()
761   {
762       if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"SyncPageInfo()\n");
763       PLINT level;
764       plstream::glevel(level);
765       if (level>1 && thePage.nbPages!=0) //we need to have a vpor defined, and a page!
766       {
767         PLFLT bxsize_mm, bysize_mm, offx_mm, offy_mm;
768         PLFLT xmin,ymin,xmax,ymax;
769         plstream::gspa(xmin,xmax,ymin,ymax); //subpage in mm
770         bxsize_mm=xmax-xmin;
771         bysize_mm=ymax-ymin;
772         offx_mm=xmin;
773         offy_mm=ymin;
774         if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"         gspa returned size[%f,%f] at offset [%f,%f] (mm) for subpage %d of %dx%d subpages\n",bxsize_mm,bysize_mm,offx_mm,offy_mm,thePage.curPage,thePage.nx,thePage.ny);
775         //we can derive the dpm in x and y which converts mm to device coords:
776         thePage.xdpmm=abs(thePage.length/(thePage.nx*bxsize_mm));
777         thePage.ydpmm=abs(thePage.height/(thePage.ny*bysize_mm));
778         //and the page width and height in mm:
779         thePage.xsizemm=thePage.length/thePage.xdpmm;
780         thePage.ysizemm=thePage.height/thePage.ydpmm;
781         if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"         device resolution [%f,%f]mm^-1, device size [%f,%f], [%f,%f] mm\n",
782          thePage.xdpmm,thePage.ydpmm,thePage.length,thePage.height,thePage.xsizemm,thePage.ysizemm);
783         thePage.subpage.dxoff=offx_mm*thePage.xdpmm;
784         thePage.subpage.dyoff=offy_mm*thePage.ydpmm;
785         thePage.subpage.dxsize=bxsize_mm*thePage.xdpmm;
786         thePage.subpage.dysize=bysize_mm*thePage.ydpmm;
787         if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"         subpage is %fx%f at [%f,%f] device units\n",
788                 thePage.subpage.dxsize,thePage.subpage.dysize,thePage.subpage.dxoff,thePage.subpage.dyoff);
789 
790       } else         if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"       WARNING: not initalized\n");
791   }
792 
updateBoxDeviceCoords()793   inline void updateBoxDeviceCoords()
794   {
795       if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"updateBoxDeviceCoords()\n");
796     // world coordinates of current subpage boundaries and page boundaries
797     NormedDeviceToWorld(0.0, 0.0,theBox.pageWorldCoordinates[0],theBox.pageWorldCoordinates[2]);
798     NormedDeviceToWorld(1.0, 1.0,theBox.pageWorldCoordinates[1],theBox.pageWorldCoordinates[3]);
799     NormToWorld(0.0, 0.0,theBox.subPageWorldCoordinates[0],theBox.subPageWorldCoordinates[2]);
800     NormToWorld(1.0, 1.0,theBox.subPageWorldCoordinates[1],theBox.subPageWorldCoordinates[3]);
801     NormToDevice(theBox.nx1,theBox.ny1,theBox.dx1,theBox.dy1);
802     NormToDevice(theBox.nx2,theBox.ny2,theBox.dx2,theBox.dy2);
803   }
804 
setThickFactor(DFloat tf)805   inline void setThickFactor(DFloat tf)
806   {
807       thickFactor=tf;
808   }
809 
810   //GD: enables overloading scmap0,1... to accelerate plots for X11 and possibly others
811   // Set color map 0 colors by 8 bit RGB values
SetColorMap0(PLINT * r,PLINT * g,PLINT * b,PLINT ncol0)812   virtual void SetColorMap0( PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 ) {
813    plstream::scmap0( r, g, b, ncol0);
814   }
815   // Set color map 1 colors by 8 bit RGB values
SetColorMap1(PLINT * r,PLINT * g,PLINT * b,PLINT ncol1)816   virtual void SetColorMap1( PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 ) {
817    plstream::scmap1( r, g, b, ncol1);
818   }
819   // Set color map 1 colors using a piece-wise linear relationship between
820   // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space.
SetColorMap1l(bool itype,PLINT npts,PLFLT * intensity,PLFLT * coord1,PLFLT * coord2,PLFLT * coord3,const bool * rev=NULL)821   virtual void SetColorMap1l( bool itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, const bool *rev = NULL ) {
822    plstream::scmap1l(itype,npts,intensity,coord1,coord2,coord3,rev);
823   }
824   // Set number of colors in cmap 1
SetColorMap1n(PLINT ncol1)825   virtual void SetColorMap1n( PLINT ncol1 ){
826    plstream::scmap1n(ncol1);
827   }
828 
829 
830 };
831 
832 #endif
833