- Timestamp:
- Dec 24, 2008, 12:18:58 AM (17 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/piaxes.cc
r3498 r3558 53 53 //++ 54 54 // void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, \ 55 // unsigned int flags =kAxesDflt, bool afsz=true)55 // unsigned int flags, bool afsz, double fszf) 56 56 // Trace les axes en utilisant les limites de l'objet PIGraphicUC. 57 57 // "flags" spécifie les attributs d'axes. Constantes prédéfinies: … … 64 64 //| kBoxAxes | kTicks | | kIntTicks | kLabels 65 65 //| kGridOn, kAxesNone 66 // Si "afsz == true", la taille de fonte est choisie automatiquement. 66 // Si "afsz == true", la taille de fonte est choisie automatiquement avec "fszf" 67 // representant la taille de fonte en fraction de (ymax-ymin) 68 // 69 // void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, unsigned int flags=kAxesDflt) 70 // Appel de DrawXYAxes avec les parametres "axesAFSz. fontSz" de l'objet. 67 71 // 68 72 // void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, \ 69 73 // double xmin, double xmax, double ymin, double ymax, \ 70 // unsigned int flags =kAxesDflt, bool afsz=true)74 // unsigned int flags, bool afsz, double ) 71 75 // Tracé d'axes avec spécification des limites d'axes. 76 // 77 // void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, \ 78 // double xmin, double xmax, double ymin, double ymax, unsigned int flags=kAxesDflt) 79 // Appel de DrawXYAxes avec les parametres "axesAFSz. fontSz" de l'objet. 72 80 // 73 81 // void DrawXCaption(PIGraphicUC* g, string const& xLabel, PIGraphicAtt const& att) … … 79 87 /* --Methode-- */ 80 88 void PIAxes::DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 81 unsigned int flags, bool afsz )89 unsigned int flags, bool afsz, double fszf) 82 90 { 83 91 PIGrCoord xmin, xmax, ymin, ymax; 84 92 g->GetGrSpace(xmin, xmax, ymin, ymax); 85 93 DrawXYAxes(g, gratt, (double)xmin, (double)xmax, 86 (double)ymin, (double)ymax, flags, afsz );94 (double)ymin, (double)ymax, flags, afsz, fszf); 87 95 } 88 96 … … 90 98 void PIAxes::DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 91 99 double xmin, double xmax, double ymin, double ymax, 92 unsigned int flags, bool afsz )100 unsigned int flags, bool afsz, double fszf) 93 101 94 102 { … … 107 115 108 116 if(afsz) { 109 double fsz = (yMax-yMin)*f ontSz;117 double fsz = (yMax-yMin)*fszf; 110 118 g->SelFontSz(fsz); 111 119 } … … 332 340 333 341 /* --Methode-- */ 334 void PIAxes::ConfigureAutoFontSize(double fszf) 335 { 342 void PIAxes::ConfigureAutoFontSize(bool afsz, double fszf) 343 { 344 axesAFSz = afsz; 336 345 if (fszf > 1.e-19) fontSz = fszf; 337 346 } -
trunk/SophyaPI/PI/piaxes.h
r3144 r3558 40 40 41 41 virtual void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 42 unsigned int flags=kAxesDflt, bool afsz=true); 42 unsigned int flags, bool afsz, double fszf); 43 inline void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, unsigned int flags=kAxesDflt) 44 { DrawXYAxes(g, gratt, flags, axesAFSz, fontSz); } 43 45 44 46 virtual void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 45 47 double xmin, double xmax, 46 48 double ymin, double ymax, 47 unsigned int flags=kAxesDflt, bool afsz=true); 48 49 unsigned int flags, bool afsz, double fszf); 50 inline void DrawXYAxes(PIGraphicUC* g, PIGraphicAtt& gratt, 51 double xmin, double xmax, double ymin, double ymax, unsigned int flags=kAxesDflt) 52 { DrawXYAxes(g, gratt, xmin, xmax, ymin, ymax, flags, axesAFSz, fontSz); } 49 53 50 54 virtual void DrawXCaption(PIGraphicUC* g, PIGraphicAtt& att, unsigned int flags, … … 56 60 void ConfigureTicks(int ntickx=10, int nticky=12, 57 61 double majtl=0.016, double mintl=0.01); 58 void ConfigureAutoFontSize( double fszf=0.04);62 void ConfigureAutoFontSize(bool afsz=true, double fszf=0.06); 59 63 void ConfigureAxesCenter(bool fset=false,double x0=0.,double y0=0.); 60 64 … … 91 95 bool aXdir, aYdir; // Sens des axes horiz, vertical 92 96 bool aXlog, aYlog; // Echelle log pour les axes horiz, vertical 93 bool axesAFSz; 97 bool axesAFSz; // true -> AutoFontSize 94 98 95 99 int xNTicks, yNTicks; // Nb de ticks en X, Y -
trunk/SophyaPI/PI/piaxestools.cc
r2615 r3558 237 237 mCkb[3]->SetState(scd->isLogScaleX()); 238 238 mCkb[4]->SetState(scd->isLogScaleY()); 239 mCkb[7]->SetState(scd->BaseDrawer()-> isAxesAutoFontSize());239 mCkb[7]->SetState(scd->BaseDrawer()->GetAutoFontSizeState()); 240 240 } 241 241 else { … … 312 312 313 313 scd->SetLogScale(mCkb[3]->GetState(), mCkb[4]->GetState() ); 314 scd->BaseDrawer()-> SetAxesAutoFontSize(mCkb[7]->GetState());314 scd->BaseDrawer()->ConfigureAutoFontSize(mCkb[7]->GetState(), -1); 315 315 if (refr) scd->Refresh(); 316 316 return; -
trunk/SophyaPI/PI/pidrawer.cc
r2780 r3558 65 65 limitsFixed = false; 66 66 SetAxesFlags(kAxesNone); // Pas de trace d'axes par defaut 67 SetAxesAutoFontSize();67 ConfigureAutoFontSize(); 68 68 69 69 mDndfg = false; // Pour controle de l'appel de Detach() si delete … … 395 395 PIDrawer::DecodeOptionString(vector<string> & opt, bool rmdecop) 396 396 { 397 if (opt.size() < 1) return(0); 397 int nopt0 = opt.size(); 398 if (nopt0 < 1) return(0); 398 399 PIGraphicAtt gratt; 399 int ndec = gratt.DecodeAttStrings(opt, rmdecop);400 int ndec1 = gratt.DecodeAttStrings(opt, rmdecop); 400 401 UpdateGraphicAtt(gratt); 401 return(ndec); 402 if ((nopt0 - ndec1) < 1) return(ndec1); // si tout a ete decode 403 vector<string> udopt; 404 unsigned int k = 0; 405 int ndec = opt.size(); 406 string opts; 407 for( k=0; k<opt.size(); k++ ) { 408 opts = opt[k]; 409 if (opts.substr(0,13) == "autofontsize=") { 410 double fszf = atof(opts.substr(13).c_str()); 411 ConfigureAutoFontSize(true, fszf); 412 } 413 else if (opts == "fixedfontsize") 414 ConfigureAutoFontSize(false, -1.); 415 else { 416 ndec--; 417 if (rmdecop) udopt.push_back(opts); 418 } 419 } 420 421 if (rmdecop) opt = udopt; 422 return(ndec+ndec1); 402 423 } 403 424 … … 424 445 info += " FontAtt: roman, bold, italic, bolditalic \n"; 425 446 info += " FontSize: 6,8,10,12... (pts) - integer \n"; 447 info += ">>> Automatic font size selection : \n"; 448 info += " autofontsize=FontSizeFrac fixedfontsize \n"; 449 info += ">>> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n"; 426 450 info += ">>> marker=MarkerType,MarkerSize (MarkerSize: integer 3,5,7... \n"; 427 451 info += " MarkerType: dot, plus, cross, circle, fcircle, box, fbox \n"; … … 505 529 PIAxes axes; 506 530 axes.DrawXYAxes(g, mGrAtt, XMin(), XMax(), YMin(), YMax(), 507 axesFlags, axesAFSz);531 axesFlags, mAFSz, mFontSzF); 508 532 g->Clip(); 509 533 } -
trunk/SophyaPI/PI/pidrawer.h
r2780 r3558 30 30 31 31 virtual void SetAxesFlags(unsigned int flags=kAxesNone); 32 inline void SetAxesAutoFontSize(bool fg=true) { axesAFSz = fg; } 32 33 // Choix automatique ou pas de taille de fonte 34 inline void ConfigureAutoFontSize(bool afsz=true, double fszf=0.06) 35 { mAFSz = afsz; if (fszf>1e-5) mFontSzF = fszf; } 33 36 34 37 virtual void DrawAxes(PIGraphicUC* g); … … 63 66 64 67 inline unsigned int GetAxesFlags() { return(axesFlags); } 65 inline bool isAxesAutoFontSize() { return axesAFSz; } 68 69 inline bool GetAutoFontSizeState() { return mAFSz; } 70 inline double GetAutoFontSizeFraction() { return mFontSzF; } 66 71 67 72 inline PIGraphicUC* GetGraphicUC() { return(mGrUC); } … … 127 132 bool limitsFixed; 128 133 unsigned int axesFlags; 129 bool axesAFSz; 134 135 bool mAFSz; // true -> Choix automatique de taille de font en fraction (ymax-ymin) 136 double mFontSzF; // TailleFonteAuto = mFontSzF*(ymax-ymin) 137 130 138 PIBaseWdgGen* mBWdg; 131 139 PIGraphicUC* mGrUC; -
trunk/SophyaPI/PI/pieldrw.cc
r2797 r3558 593 593 } 594 594 } 595 596 else if (opts.substr(0,13) == "autofontsize=") { 597 double fszf = atof(opts.substr(13).c_str()); 598 ConfigureAxeAutoFontSize(fszf); 599 SetAxesAutoFontSize(true); 600 } 601 else if (opts == "fixedfontsize") 602 SetAxesAutoFontSize(false); 603 595 604 596 else if (opts == "title" || opts == "tit") ShowTitles(true); 605 597 else if (opts == "notitle" || opts == "notit") ShowTitles(false); … … 639 631 info += " ticks/noticks minorticks/nominorticks \n"; 640 632 info += " extticks/intticks/extintticks nbticks=X_NbTicks,Y_NbTicks \n"; 641 info += " tickslen=MajorTickLenFrac,MinorTickLenFraC \n"; 642 info += " >> Axe label font size: \n";633 info += " tickslen=MajorTickLenFrac,MinorTickLenFraC \n"; 634 info += " >> Axe labels font size: \n"; 643 635 info += " autofontsize=FontSizeFrac fixedfontsize \n"; 644 636 info += " >> Up/Down title: title tit notitle notit \n"; … … 655 647 // g->NoClip(); 656 648 axeDr.DrawXYAxes(g, mGrAtt, XMin(), XMax(), YMin(), YMax(), 657 axesFlags, axesAFSz);649 axesFlags, mAFSz, mFontSzF); 658 650 if (showAxesLabels) { 659 651 axeDr.DrawXCaption(g, labelAtt, axesFlags, xLabel); -
trunk/SophyaPI/PI/pieldrw.h
r2637 r3558 246 246 double majtl=0., double mintl=0.) 247 247 { axeDr.ConfigureTicks(ntickx, nticky, majtl, mintl); } 248 inline void ConfigureAxeAutoFontSize(double fszf=0.)249 { axeDr.ConfigureAutoFontSize(fszf); }250 248 251 249 inline PIElDrwMgr& ElDrwMgr() { return eltsMgr; }
Note:
See TracChangeset
for help on using the changeset viewer.