Changeset 3269 in Sophya for trunk/SophyaPI/PIext/pintuple.cc


Ignore:
Timestamp:
Jun 19, 2007, 4:14:55 PM (18 years ago)
Author:
ansari
Message:

Ajout des commandes nt2dcn et nt2dci , modifs PINtuple pour permettre l'utilisation d'une colonne pour specifier la couleur de trace de chaque marker - Reza 19/06/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pintuple.cc

    r3149 r3269  
    5858  SelectErrBar();
    5959  SelectLabel(NULL);
     60  SelectColorByName(NULL);
     61  SelectColorByIndex(NULL);
    6062  SetName("NTupleDrw");
    6163  NptDraw = 0;
     
    114116
    115117/* --Methode-- */
     118void  PINTuple::SelectColorByName(const char* pcolnm=NULL)
     119{
     120if (pcolnm == NULL) cnK = -1;
     121else {  string name = pcolnm;  cnK = mNT->ColumnIndex(name);  }
     122if (cnK >= 0)  ciK = -1;
     123}
     124
     125/* --Methode-- */
     126void  PINTuple::SelectColorByIndex(const char* pcolidx=NULL)
     127{
     128if (pcolidx == NULL) ciK = -1;
     129else {  string name = pcolidx;  ciK = mNT->ColumnIndex(name);  }
     130if (ciK >= 0)  cnK = -1;
     131}
     132
     133
     134/* --Methode-- */
    116135void  PINTuple::SelectErrBar(const char* erbx, const char* erby)
    117136{
     
    162181double dw = (wMax-wMin)/nWbins;
    163182if (dw < 1.e-19) dw = 1.e-19;
     183
     184// La couleur par defaut (pour le trace avec couleur specifie par nom de colonne (06/2007)
     185PIColors defcol = GetGraphicAtt().GetColor();
     186if (defcol == PI_NotDefColor) defcol = PI_Black;
    164187
    165188//  Pour tracer des markers avec couleur en fonction de Wt (poids)
     
    234257  }
    235258
     259// Si on a specifie un nom de colonne pour la couleur (06/2007)
     260  if ( (cnK >= 0) || (ciK >= 0) ) {
     261    PIColors scol = defcol;
     262    if (cnK > 0)
     263      scol = PIGraphicAtt::ColNameToColor(mNT->GetCelltoString(i, cnK));
     264    else
     265      scol = PIGraphicAtt::ColIndexToColor(mNT->GetCell(i, ciK));
     266    if (scol == PI_NotDefColor) scol = defcol;
     267    g->SelForeground(scol);
     268  }
     269
    236270  // Trace d'une ligne reliant les points
    237271  if( connectPts ) {
     
    273307
    274308if (stats) { // Trace de stats
     309  g->SelForeground(defcol);
    275310  g->SelFontSz((YMax() - YMin())/30); 
    276311  // La hauteur de la cellule
Note: See TracChangeset for help on using the changeset viewer.