Changeset 2088 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Jul 11, 2002, 11:29:39 PM (23 years ago)
Author:
cmv
Message:

PIAxes: nouvelle gestion axes, add simpleaxesgrid finesimpleaxesgrid finesimpleaxes cmv 11/7/2002

Location:
trunk/SophyaPI/PI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/piaxes.cc

    r2085 r2088  
    55
    66#include "machdefs.h"
    7 #include "piaxes.h"
    87#include <stdio.h>
    98#include <math.h>
     9#include "piaxes.h"
    1010
    1111inline void dble_SWAP(double a, double b) {double tmp=a; a=b; b=tmp;}
     
    6363 
    6464    if (flags & kMajTicks) {
    65         DrawHTicks(g, (yMin+yMax)/2., xMajTickLen, xMajTickLen, xFirstMajTick, xMajTickStep);
    66         DrawVTicks(g, (xMin+xMax)/2., yMajTickLen, yMajTickLen, yFirstMajTick, yMajTickStep);
     65        DrawHTicks(g, (yMin+yMax)/2., xMajTickLen, xMajTickLen, xMajTicks);
     66        DrawVTicks(g, (xMin+xMax)/2., yMajTickLen, yMajTickLen, yMajTicks);
    6767    }
    6868   
     
    7070 
    7171    if (flags & kMinTicks) {
    72         DrawHTicks(g, (yMin+yMax)/2., xMinTickLen, xMinTickLen, xFirstMinTick, xMinTickStep);
    73         DrawVTicks(g, (xMin+xMax)/2., yMinTickLen, yMinTickLen, yFirstMinTick, yMinTickStep);
     72        DrawHTicks(g, (yMin+yMax)/2., xMinTickLen, xMinTickLen, xMinTicks);
     73        DrawVTicks(g, (xMin+xMax)/2., yMinTickLen, yMinTickLen, yMinTicks);
    7474    }
    7575   
     
    7878    if (flags & kLabels) {
    7979      if (!aYdir)
    80         DrawHLabels(g, (yMin+yMax)/2.-xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
     80        DrawHLabels(g, (yMin+yMax)/2.-xMajTickLen*2, xMajTicks, PI_VerticalTop);
    8181      else
    82         DrawHLabels(g, (yMin+yMax)/2.+xMajTickLen*2, xFirstMajTick, xMajTickStep,PI_VerticalTop);
     82        DrawHLabels(g, (yMin+yMax)/2.+xMajTickLen*2, xMajTicks, PI_VerticalTop);
    8383      if (!aXdir)
    84         DrawVLabels(g, (xMin+xMax)/2.-yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
     84        DrawVLabels(g, (xMin+xMax)/2.-yMajTickLen*2, yMajTicks, PI_HorizontalRight);
    8585      else
    86         DrawVLabels(g, (xMin+xMax)/2.+yMajTickLen*2, yFirstMajTick, yMajTickStep,PI_HorizontalRight);
     86        DrawVLabels(g, (xMin+xMax)/2.+yMajTickLen*2, yMajTicks, PI_HorizontalRight);
    8787    }
    8888   
     
    116116 
    117117    if (flags & kMajTicks) {
    118         DrawHTicks(g, yMin, intXMajTickLen, extXMajTickLen, xFirstMajTick, xMajTickStep);
    119         DrawHTicks(g, yMax, extXMajTickLen, intXMajTickLen, xFirstMajTick, xMajTickStep);
    120         DrawVTicks(g, xMin, extYMajTickLen, intYMajTickLen, yFirstMajTick, yMajTickStep);
    121         DrawVTicks(g, xMax, intYMajTickLen, extYMajTickLen, yFirstMajTick, yMajTickStep);
     118        DrawHTicks(g, yMin, intXMajTickLen, extXMajTickLen, xMajTicks);
     119        DrawHTicks(g, yMax, extXMajTickLen, intXMajTickLen, xMajTicks);
     120        DrawVTicks(g, xMin, extYMajTickLen, intYMajTickLen, yMajTicks);
     121        DrawVTicks(g, xMax, intYMajTickLen, extYMajTickLen, yMajTicks);
    122122    }
    123123   
     
    125125 
    126126    if (flags & kMinTicks) {
    127         DrawHTicks(g, yMin, intXMinTickLen, extXMinTickLen, xFirstMinTick, xMinTickStep);
    128         DrawHTicks(g, yMax, extXMinTickLen, intXMinTickLen, xFirstMinTick, xMinTickStep);
    129         DrawVTicks(g, xMin, extYMinTickLen, intYMinTickLen, yFirstMinTick, yMinTickStep);
    130         DrawVTicks(g, xMax, intYMinTickLen, extYMinTickLen, yFirstMinTick, yMinTickStep);
     127        DrawHTicks(g, yMin, intXMinTickLen, extXMinTickLen, xMinTicks);
     128        DrawHTicks(g, yMax, extXMinTickLen, intXMinTickLen, xMinTicks);
     129        DrawVTicks(g, xMin, extYMinTickLen, intYMinTickLen, yMinTicks);
     130        DrawVTicks(g, xMax, intYMinTickLen, extYMinTickLen, yMinTicks);
    131131    }
    132132
     
    136136    if (flags & kLabels) {
    137137      if (!aYdir) {
    138         DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
    139         //DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
     138        DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xMajTicks, PI_VerticalTop);
    140139      }
    141140      else {
    142         //DrawHLabels(g, g->DeltaUCY(yMin, -xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalBottom);
    143         DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xFirstMajTick, xMajTickStep,PI_VerticalTop);
     141        DrawHLabels(g, g->DeltaUCY(yMax,  xMajTickLen*2), xMajTicks, PI_VerticalTop);
    144142      }
    145143      if (!aXdir) {
    146         DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
    147         //DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
     144        DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yMajTicks, PI_HorizontalRight);
    148145      }
    149146      else {
    150         //DrawVLabels(g, g->DeltaUCX(xMin, -yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalLeft);
    151         DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yFirstMajTick, yMajTickStep,PI_HorizontalRight);
     147        DrawVLabels(g, g->DeltaUCX(xMax,  yMajTickLen*2), yMajTicks, PI_HorizontalRight);
    152148      }
    153149    }
     
    171167
    172168  int ntick_x = (aXlog) ? 6 : 10;
    173   BestTicks(xMin,xMax,ntick_x,xMajTickStep,xFirstMajTick);
    174   xMinTickStep = xMajTickStep/5;
    175   xFirstMinTick = floor(xMin / xMinTickStep) * xMinTickStep;
    176   if(xFirstMinTick < xMin) xFirstMinTick += xMinTickStep;
     169  BestTicks(xMin,xMax,ntick_x,xMajTicks,xMinTicks);
    177170
    178171  int ntick_y = (aYlog) ? 6 : 12;
    179   BestTicks(yMin,yMax,ntick_y,yMajTickStep,yFirstMajTick);
    180   yMinTickStep = yMajTickStep/5;
    181   yFirstMinTick = floor(yMin / yMinTickStep) * yMinTickStep;
    182   if(yFirstMinTick < yMin) yFirstMinTick += yMinTickStep;
     172  BestTicks(yMin,yMax,ntick_y,yMajTicks,yMinTicks);
    183173
    184174  yMajTickLen = (xMax-xMin)/100;
     
    191181/* --Methode-- */
    192182void PIAxes::DrawHTicks(PIGraphicUC* g, double y, double tickUp,
    193                         double tickDown, double xBeg, double xStep)
    194 {
    195   for (double x=xBeg; x<=xMax+xStep/10.; x += xStep)
    196     g->DrawLine(x, g->DeltaUCY(y, -tickDown), x, g->DeltaUCY(y, tickUp));
     183                        double tickDown, vector<double>& xticks)
     184{
     185  if(xticks.size()<=0) return;
     186  for(unsigned int i=0;i<xticks.size();i++) {
     187    if(xticks[i]>xMax) break;
     188    g->DrawLine(xticks[i],g->DeltaUCY(y,-tickDown),xticks[i],g->DeltaUCY(y,tickUp));
     189  }
    197190}
    198191
    199192/* --Methode-- */
    200193void PIAxes::DrawVTicks(PIGraphicUC* g, double x, double tickLeft,
    201                         double tickRight, double yBeg, double yStep)
    202 {
    203   for (double y=yBeg; y<=yMax; y += yStep)
    204     g->DrawLine(g->DeltaUCX(x, -tickLeft), y, g->DeltaUCX(x,tickRight), y);
    205 }
    206 
    207 /* --Methode-- */
    208 void PIAxes::DrawHLabels(PIGraphicUC* g, double y, double xBeg,
    209                          double xStep, unsigned long just)
    210 {
    211 
     194                        double tickRight, vector<double>& yticks)
     195{
     196  if(yticks.size()<=0) return;
     197  for(unsigned int i=0;i<yticks.size();i++) {
     198    if(yticks[i]>yMax) break;
     199    g->DrawLine(g->DeltaUCX(x,-tickLeft),yticks[i],g->DeltaUCX(x,tickRight),yticks[i]);
     200  }
     201}
     202
     203/* --Methode-- */
     204void PIAxes::DrawHLabels(PIGraphicUC* g, double y, vector<double>& xticks, unsigned long just)
     205{
     206
     207  if(xticks.size()<=1) return;
    212208  // Choix du bon format pour les labels des axes;
    213209  char label[64]; string format; double fac=1.; bool p10=false;
    214   int npuiss = BonFormatAxes(xBeg,xMax,xStep,format,2,1);
     210  double xstep=xticks[1]-xticks[0];
     211  int npuiss = BonFormatAxes(xticks[0],xMax,xstep,format,2,1);
    215212  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
    216   else BonFormatAxes(xBeg,xMax,xStep,format,0,1);
     213  else BonFormatAxes(xticks[0],xMax,xstep,format,0,1);
    217214
    218215  double xOffset = 0;
    219   double xlastlabelfin = xBeg - 2.*(xMax-xBeg);
    220   for(double x=xBeg; x<=xMax+xStep/10.; x+=xStep) {
     216  double xlastlabelfin = xticks[0] - 2.*(xMax-xticks[0]);
     217  for(unsigned int i=0;i<xticks.size();i++) {
     218    if(xticks[i]>xMax) break;
    221219    //Attention erreur d'arrondi x->0 (on code 5.1698e-26 au lieu de 0)
    222     double xx = (fabs(x/xStep)<1.e-5) ? 0.: x;
     220    double xx = (fabs(xticks[i]/xstep)<1.e-5) ? 0.: xticks[i];
    223221    sprintf(label,format.c_str(),xx/fac);
    224     for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
     222    Arrange_Label(label);
    225223    double largeur = g->CalcStringWidth(label);
    226224    if(aXdir) xOffset = largeur/2; else xOffset=-largeur/2;
    227     if(x+xOffset > xlastlabelfin) {
    228       g->DrawString(x,y,label,PI_HorizontalCenter|just);
    229       xlastlabelfin = x + xOffset + 1.1*largeur;
     225    if(xticks[i]+xOffset > xlastlabelfin) {
     226      g->DrawString(xticks[i],y,label,PI_HorizontalCenter|just);
     227      xlastlabelfin = xticks[i] + xOffset + 1.1*largeur;
    230228    }
    231229  }
     
    244242
    245243/* --Methode-- */
    246 void PIAxes::DrawVLabels(PIGraphicUC* g, double x, double yBeg,
    247                          double yStep, unsigned long just)
    248 {
    249 
     244void PIAxes::DrawVLabels(PIGraphicUC* g, double x, vector<double>& yticks, unsigned long just)
     245{
     246
     247  if(yticks.size()<=1) return;
    250248  // Choix du bon format pour les labels des axes;
    251249  char label[64]; string format; double fac=1.; bool p10=false;
    252   int npuiss = BonFormatAxes(yBeg,yMax,yStep,format,2,1);
     250  double ystep=yticks[1]-yticks[0];
     251  int npuiss = BonFormatAxes(yticks[0],yMax,ystep,format,2,1);
    253252  if(npuiss<-2 || npuiss>3) {p10 = true; fac=pow(10.,(double)npuiss);}
    254   else BonFormatAxes(yBeg,yMax,yStep,format,0,1);
    255 
    256   for(double y=yBeg; y<=yMax; y += yStep) {
    257     double yy = (fabs(y/yStep)<1.e-5) ? 0.: y;
     253  else BonFormatAxes(yticks[0],yMax,ystep,format,0,1);
     254
     255  for(unsigned int i=0;i<yticks.size();i++) {
     256    if(yticks[i]>yMax) break;
     257    double yy = (fabs(yticks[i]/ystep)<1.e-5) ? 0.: yticks[i];
    258258    sprintf(label,format.c_str(),yy/fac);
    259     for(int kk=0;kk<64;kk++) if(label[kk]==' ') {label[kk]='\0'; break;}
    260     g->DrawString(x,y,label,PI_VerticalCenter|just);
     259    Arrange_Label(label);
     260    g->DrawString(x,yticks[i],label,PI_VerticalCenter|just);
    261261  }
    262262
     
    276276{
    277277  PILineAtt savlineatt = g->GetLineAtt();
    278 //  g->SelLine(PI_ThinDashedLine);
    279278  g->SelLine(PI_ThinDottedLine);
    280279
    281   for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep)
    282     g->DrawLine(x, yMin, x, yMax);
    283 
    284   for (double y=yFirstMajTick; y<=yMax; y += yMajTickStep)
    285     g->DrawLine(xMin, y, xMax, y);
     280  if(xMajTicks.size()>0)
     281    for(unsigned int i=0;i<xMajTicks.size();i++) {
     282      if(xMajTicks[i]>xMax) break;
     283      g->DrawLine(xMajTicks[i], yMin, xMajTicks[i], yMax);
     284    }
     285
     286  if(yMajTicks.size()>0)
     287    for(unsigned int i=0;i<yMajTicks.size();i++) {
     288      if(yMajTicks[i]>yMax) break;
     289      g->DrawLine(xMin, yMajTicks[i], xMax, yMajTicks[i]);
     290    }
    286291
    287292  g->SelLine(savlineatt);
     
    292297/* --Methode-Static-- */
    293298void PIAxes::BestTicks(double xmin,double xmax,int nticks
    294                         ,double& steptick,double& xfirsttick)
     299                      ,vector<double>& majticks,vector<double>& minticks)
    295300// *** Calcul de l'intervalle entre les ticks et de la valeur du premier tick
    296301{
    297 double d=xmax-xmin; if(d<1.e-100) d=1.e-100; //if (d<1.e-39) d=1.e-39;
    298 double ld  = log10(d);
    299 double fld = floor( ((ld<0.)? -ld: ld) );
    300 double del,del0;
    301 if(ld>=0.) {fld-=1.; del0=del=pow(10.,fld);}
    302   else     {fld+=2.; del0=del=pow(10.,-fld);}
    303 // *** Intervalle entre les ticks
    304 // xmin  xmax    d       ld       fld -->fld  del0
    305 // 1     1500    1499    3.17     3      2    10^2
    306 // 1     9500    9499    3.98     3      2    10^2
    307 // 1     1.005   0.005   -2.3     2      4    10^-4
    308 // 1     1.995   0.995   -0.0022  0      2    10^-2
    309 // - Et recherche de la valeur del={del0,2*del0,...,20*del0}
    310 // telle que "nticks*del" soit le plus petit nombre ">=d"
    311 // Par exemple, si nticks=10:
    312 // 1-/ pour le 2sd cas ou d=9499 et del0=100 :
    313 // del        =    100    200    500    1000    2000
    314 // nticks*del =   1000   2000   5000   10000   20000
    315 // d/del      =   94.9   47.4   18.9 | 9.499   4.749  ==> majt = 1000
    316 // 2-/ pour le 3ieme cas ou d=5e-3 et del0=1e-4 :
    317 // del        =  1e-4   2e-4   5e-4  1e-3   2e-3
    318 // nticks*del =  1e-3   2e-3   5e-3  1e-2   2e-2
    319 // d/del      =  50     25   | 10    5      2.5       ==> majt = 5e-4
    320 int k=0;
    321 double fac[4] = {2.,5.,10.,20.};
    322 while(d/del>(double)nticks && k<4 ) {del=fac[k]*del0; k++;}
    323 steptick=del;
    324 //***  Valeur du premier tick
    325 xfirsttick = floor(xmin/steptick); if(xmin<0.) xfirsttick+=1.;
    326 xfirsttick *= steptick;
    327 if(xfirsttick<xmin) xfirsttick += steptick;
     302 double d=xmax-xmin; if(d<1.e-100) d=1.e-100; //if (d<1.e-39) d=1.e-39;
     303 double ld  = log10(d);
     304 double fld = floor( ((ld<0.)? -ld: ld) );
     305 double del,del0;
     306 majticks.resize(0); minticks.resize(0);
     307 if(ld>=0.) {fld-=1.; del0=del=pow(10.,fld);}
     308   else     {fld+=2.; del0=del=pow(10.,-fld);}
     309 // *** Intervalle entre les ticks
     310 // xmin  xmax    d       ld       fld -->fld  del0
     311 // 1     1500    1499    3.17     3      2    10^2
     312 // 1     9500    9499    3.98     3      2    10^2
     313 // 1     1.005   0.005   -2.3     2      4    10^-4
     314 // 1     1.995   0.995   -0.0022  0      2    10^-2
     315 // - Et recherche de la valeur del={del0,2*del0,...,20*del0}
     316 // telle que "nticks*del" soit le plus petit nombre ">=d"
     317 // Par exemple, si nticks=10:
     318 // 1-/ pour le 2sd cas ou d=9499 et del0=100 :
     319 // del        =    100    200    500    1000    2000
     320 // nticks*del =   1000   2000   5000   10000   20000
     321 // d/del      =   94.9   47.4   18.9 | 9.499   4.749  ==> majt = 1000
     322 // 2-/ pour le 3ieme cas ou d=5e-3 et del0=1e-4 :
     323 // del        =  1e-4   2e-4   5e-4  1e-3   2e-3
     324 // nticks*del =  1e-3   2e-3   5e-3  1e-2   2e-2
     325 // d/del      =  50     25   | 10    5      2.5       ==> majt = 5e-4
     326 int k=0;
     327 double fac[4] = {2.,5.,10.,20.};
     328 while(d/del>(double)nticks && k<4 ) {del=fac[k]*del0; k++;}
     329 double steptick=del;
     330 //***  Valeur du premier tick
     331 double xfirsttick = floor(xmin/steptick); if(xmin<0.) xfirsttick+=1.;
     332 xfirsttick *= steptick;
     333 if(xfirsttick<xmin) xfirsttick += steptick;
     334 majticks.push_back(xfirsttick);
     335 while(xfirsttick<=xmax)
     336   {xfirsttick+= steptick; majticks.push_back(xfirsttick);}
     337 //***  Gestion des ticks mineurs
     338 double steptickmin = steptick/5.;
     339 double xfirsttickmin = floor(xmin/steptickmin) * steptickmin;
     340 if(xfirsttickmin<xmin) xfirsttickmin += steptickmin;
     341 minticks.push_back(xfirsttickmin);
     342 while(xfirsttickmin<=xmax)
     343   {xfirsttickmin+= steptickmin; minticks.push_back(xfirsttickmin);}
    328344}
    329345
     
    424440}
    425441
     442void PIAxes::Arrange_Label(char *label)
     443// Enleve les blancs et les zeros inutiles a la fin d'un label
     444{
     445 size_t lenl=strlen(label);
     446 if(lenl==0) return;
     447
     448 // --- On enleve les blancs et plus au debut du label
     449 if(label[0]==' ' || label[0]=='+') {
     450   char *str=new char[lenl+2];
     451   strcpy(str,label);
     452   unsigned i=0;
     453   for(i=0;i<lenl;i++) if(str[i]!=' ' && str[i]!='+') break;
     454   strcpy(label,&str[i]);
     455   delete [] str;
     456   lenl=strlen(label);
     457   if(lenl==0) return;
     458 }
     459
     460 // --- On enleve les blancs a la fin du label
     461 if(label[lenl-1]==' ') {
     462   for(unsigned int i=lenl-1;i>=0;i--) {
     463     if(label[i]!=' ') break;
     464     label[i]='\0';
     465   }
     466   lenl=strlen(label);
     467 }
     468
     469 // --- On enleve les e... E... non-significatifs
     470 // ex: a.be-zzz  a.be+zzz  a.bezzz avec zzz=0,00,000,...
     471 // Attention on n'enleve pas si: a.be+10
     472 // Attention on ne fait rien si: e+10
     473 char* e=index(label,'e');
     474 if(e==NULL) e=index(label,'E');
     475 if(e) {
     476   for(unsigned int i=lenl-1;i>=0;i--) {
     477     if(isdigit(label[i]) && label[i]!='0') break;
     478     if(label[i]=='e' || label[i]=='E')
     479       {label[i]='\0'; lenl=strlen(label); break;}
     480   }
     481 }
     482
     483 // --- On enleve les zeros non-significatifs a la fin du label
     484 // On enleve des zeros ou le point si: ab. ab.czzz avec zzz=0,00,000,...
     485 // Attention on n'enleve pas de zeros si: abzzz
     486 // Attention a ne pas enlever des zeros si on a ab.ccce+a0
     487 // Attention on traite 0eaaa -> 0
     488 if(index(label,'.')==NULL) return;  // Recherche d'un point
     489 string stre;
     490 if(e) {if(e==label) return; stre=e; *e='\0'; lenl=strlen(label);}
     491 for(unsigned int i=lenl-1;i>=0;i--) {
     492   if(label[i]=='0') label[i]='\0';
     493   else if(label[i]=='.') {
     494     if(i>0) label[i]='\0';
     495     else {
     496       // Attention: ".e+10" -> "1e+10" MAIS "." -> "0"
     497       if(e) strcpy(label,"1"); else strcpy(label,"0");
     498     }
     499     break;
     500   }
     501   else break;  // Ni un point ni un zero
     502 }
     503 if(e) {
     504   if(strlen(label)==1) if(label[0]=='0') return;
     505   strcat(label,stre.c_str());
     506 }
     507
     508}
  • trunk/SophyaPI/PI/piaxes.h

    r2080 r2088  
    99#include "pigraphuc.h"
    1010#include "pigratt.h"
     11#include <vector>
    1112
    1213enum {
     
    4142  //  virtual void      DrawHorizontalAxe(double xmin, double xmax, double y,
    4243
    43 //  --- Methodes static ----
    44 //  Calcul des Distances optimales des subdivisions
     44//  Calcul des Distances optimales des subdivisions (STATIC)
    4545  static void BestTicks(double xmin,double xmax,int nticks
    46                        ,double& steptick,double& xfirsttick);
    47 //  Calcul du format optimal pour les axes
     46                        ,vector<double>& majticks,vector<double>& minticks);
     47
     48//  Calcul du format optimal pour les axes (STATIC)
    4849  static int BonFormatAxes(double xmin,double xmax,double xstep
    49                           ,string& format,int typf=0,int add_digit=0);
     50                           ,string& format,int typf=0,int add_digit=0);
     51
     52//  Mise en forme optimale du format (STATIC)
     53  static void Arrange_Label(char *label);
     54
    5055protected:
    5156  void Setup(PIGraphicUC* g, double xmin, double xmax,
    5257             double ymin, double ymax);
    5358
    54   void DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep);
    55   void DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep);
    56   void DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, unsigned long just=0);
    57   void DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, unsigned long just=0);
     59  void DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, vector<double>& xticks);
     60  void DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, vector<double>& yticks);
     61  void DrawHLabels(PIGraphicUC* g, double y, vector<double>& xticks, unsigned long just=0);
     62  void DrawVLabels(PIGraphicUC* g, double x, vector<double>& yticks, unsigned long just=0);
    5863  void DrawGrid(PIGraphicUC* g);
    5964
     
    6368  bool   axesAFSz;
    6469 
    65   double xFirstMajTick, xFirstMinTick;
    66   double yFirstMajTick, yFirstMinTick;
    67   double xMajTickStep, xMinTickStep;
    68   double yMajTickStep, yMinTickStep;
     70  vector<double> xMajTicks;
     71  vector<double> xMinTicks;
     72  vector<double> yMajTicks;
     73  vector<double> yMinTicks;
    6974  double xMajTickLen,  xMinTickLen;
    7075  double yMajTickLen,  yMinTickLen;
    71 
    7276};
    7377
  • trunk/SophyaPI/PI/pieldrw.cc

    r1970 r2088  
    8585  for( k=0; k<opt.size(); k++ ) {
    8686    string opts = opt[k];
    87     if ( (opts == "stdaxes") || (opts == "defaxes") || (opts == "boxaxes") ) 
     87    if ( (opts == "stdaxes") || (opts == "defaxes") || (opts == "boxaxes") )
    8888      SetAxesFlags(kBoxAxes | kExtTicks | kLabels);
    89     else if (opts == "simpleaxes") 
     89    else if (opts == "simpleaxes")
    9090      SetAxesFlags(kAxesDflt);
    91     else if (opts == "boxaxesgrid")
     91    else if (opts == "finesimpleaxes")
     92      SetAxesFlags(kAxesDflt | kMinTicks);
     93    else if (opts == "boxaxesgrid")
    9294      SetAxesFlags(kBoxAxes | kExtTicks | kLabels | kGridOn);
    9395    else if (opts == "fineaxes")
    9496      SetAxesFlags(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks);
    95     else if ((opts == "grid") || (opts == "fineaxesgrid")) 
     97    else if ((opts == "grid") || (opts == "fineaxesgrid"))
    9698      SetAxesFlags(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks | kGridOn);
    97     else if (opts == "autofontsize")
     99    else if (opts == "simpleaxesgrid")
     100      SetAxesFlags(kAxesDflt | kGridOn);
     101    else if (opts == "finesimpleaxesgrid")
     102      SetAxesFlags(kAxesDflt | kMinTicks | kGridOn);
     103    else if (opts == "autofontsize")
    98104      SetAxesAutoFontSize(true);
    99     else if (opts == "fixedfontsize") 
     105    else if (opts == "fixedfontsize")
    100106      SetAxesAutoFontSize(false);
    101107    else if (opts == "title") ShowTitles(true);
Note: See TracChangeset for help on using the changeset viewer.