libpgplotxx.a (C++ interface to PGPLOT)

◆ advance()

void pgplot::Ttext::advance ( const float *  xbox,
const float *  ybox,
const bool &  nl,
const float &  sep 
)
private

advance to new reference position

Definition at line 466 of file xpgplotxx.cc.

References Minline, Mjust, Mxnl, Mxref, Mynl, and Myref.

Referenced by print(), and space().

470  {
471  // infer new refernce position from bounding box
472  float dxh=xbox[3]-xbox[0];
473  float dyh=ybox[3]-ybox[0];
474  float ddh=sqrt(dxh*dxh+dyh*dyh);
475  float dxv=xbox[1]-xbox[0];
476  float dyv=ybox[1]-ybox[0];
477  float ddv=sqrt(dxv*dxv+dyv*dyv);
478  dxv+=sep*dxv/ddv;
479  dyv+=sep*dyv/ddv;
480  dxh+=sep*dxh/ddh;
481  dyh+=sep*dyh/ddh;
482  if (nl)
483  {
484  // start at new line position
485  if (Minline)
486  {
487  // we were already within the line -> take prepare reference
488  Mxref=Mxnl;
489  Myref=Mynl;
490  }
491  else
492  {
493  // we did start from the reference position -> shift both
494  Mxref=Mxref-dxv;
495  Myref=Myref-dyv;
496  }
497  Mxnl=Mxref-dxv;
498  Mynl=Myref-dyv;
499  Minline=false;
500  }
501  else
502  {
503  // stay in line
504  if (!Minline)
505  {
506  // we did start from newline position -> remember new newline
507  Mxnl=Mxref-dxv;
508  Mynl=Myref-dyv;
509  }
510  // find new reference position
511  // this will only work with Mjust=0. and Mjust=1.
512  Mxref=Mxref+(1.-2.*Mjust)*dxh;
513  Myref=Myref+(1.-2.*Mjust)*dyh;
514  Minline=true;
515  }
516  } // Ttext::advance
bool Minline
true if text was written previously with no nl
Definition: xpgplotxx.h:604
float Mynl
text reference position for carriage return
Definition: xpgplotxx.h:603
float Mjust
parameters to pgptxt
Definition: xpgplotxx.h:602
float Myref
text reference position
Definition: xpgplotxx.h:601
Here is the caller graph for this function: