Changeset 3269 in Sophya for trunk/SophyaPI


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

Location:
trunk/SophyaPI/PIext
Files:
5 edited

Legend:

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

    r2781 r3269  
    285285  string ph = "";
    286286  mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
    287                      tokens[5], tokens[6], tokens[7], false);
     287                     tokens[5], tokens[6], ph, false, tokens[7], false);
     288  }
     289else if (kw == "nt2dcn") {
     290  if (tokens.size() < 4) {
     291    cout << "Usage: nt2dcn nameobj color varx vary [errx erry wt label opt]" << endl;
     292    return(0);
     293  }
     294  while (tokens.size() < 9) tokens.push_back("");
     295  string ph = "";
     296  mObjMgr->DisplayNT(tokens[1], tokens[2], tokens[3], ph, tokens[4], tokens[5], ph,
     297                     tokens[6], tokens[7], tokens[0], false, tokens[8], false);
     298  }
     299else if (kw == "nt2dci") {
     300  if (tokens.size() < 4) {
     301    cout << "Usage: nt2dci nameobj color varx vary [errx erry wt label opt]" << endl;
     302    return(0);
     303  }
     304  while (tokens.size() < 9) tokens.push_back("");
     305  string ph = "";
     306  mObjMgr->DisplayNT(tokens[1], tokens[2], tokens[3], ph, tokens[4], tokens[5], ph,
     307                     tokens[6], tokens[7], tokens[0], true, tokens[8], false);
    288308  }
    289309else if (kw == "nt3d") {
     
    685705usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
    686706usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
    687 usage += "\n  Related commands: disp  surf  nt3d  gfd2d vecplot"; 
     707usage += "\n  Related commands: disp surf nt2dcn nt2dci nt3d  gfd2d vecplot"; 
     708mpiac->RegisterCommand(kw, usage, this, grp);
     709kw = "nt2dcn";
     710usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
     711usage = "   with colors specified by a column content (as color names) ";
     712usage += "\n Usage : nt2dcn nameobj color varx vary [errx erry wt label graphic_attributes]";
     713usage += "\n  Related commands: disp  surf  nt2d nt2dci nt3d  gfd2d vecplot"; 
     714mpiac->RegisterCommand(kw, usage, this, grp);
     715kw = "nt2dci";
     716usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
     717usage = "   with colors specified by a column content (as color index) ";
     718usage += "\n Usage : nt2dci nameobj color varx vary [errx erry wt label graphic_attributes]";
     719usage += "\n  Related commands: disp  surf  nt2d nt2dci nt3d  gfd2d vecplot"; 
    688720mpiac->RegisterCommand(kw, usage, this, grp);
    689721kw = "nt3d";
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r2999 r3269  
    14071407void NamedObjMgr::DisplayNT(string& nom, string& nmx, string& nmy, string& nmz,
    14081408                            string& erx, string& ery, string& erz, string& wt,
    1409                             string& label, string dopt, bool fg3d)
     1409                            string& label, string& colornm, bool coloridx, string dopt, bool fg3d)
    14101410{
    14111411// Pas de display si option dopt = nodisp
     
    14531453  pin->SelectLabel(label.c_str());
    14541454  pin->SelectErrBar(erx.c_str(), ery.c_str());
     1455  if (colornm.length() > 0) {   // Juin 2007 : gestion de nom de colonne pour la couleur
     1456    if (coloridx) pin->SelectColorByIndex(colornm.c_str());
     1457    else pin->SelectColorByName(colornm.c_str());
     1458  }
    14551459  string titre = nmy + "%" + nmx;
    14561460  wrsid = myImgApp->DispScDrawer( (PIDrawer*)pin, n1, dopt, titre, 0, fglock);
  • trunk/SophyaPI/PIext/nobjmgr.h

    r2999 r3269  
    8686  virtual void          DisplayNT(string & nom, string& nmx, string& nmy, string& nmz, 
    8787                                  string& erx, string& ery, string& erz, string& wt,
    88                                   string& label, string dopt="", bool fg3d=false);
     88                                  string& label, string& colornm, bool coloridx=false,
     89                                  string dopt="", bool fg3d=false);
    8990  virtual void          DisplayGFD(string & nom, string& numvarx, string& numvary,
    9091                                   string& err, string dopt="");
  • 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
  • trunk/SophyaPI/PIext/pintuple.h

    r3149 r3269  
    2222  virtual void       SelectErrBar(const char* erbx=NULL, const char* erby=NULL);
    2323  virtual void       SelectLabel(const char* plabel=NULL);
     24  virtual void       SelectColorByName(const char* pcolnm=NULL);
     25  virtual void       SelectColorByIndex(const char* pcolidx=NULL);
    2426
    2527  inline  void       ConnectPoints(bool fg=false) { connectPts = fg; }
     
    5658  int wK;              // Index du nom de variable poids
    5759  int lK;              // Index du nom de variable label (affiche en texte)
     60  int cnK;             // Index du nom de variable couleur (par nom de couleur)
     61  int ciK;             // Index du nom de variable couleur (par index de couleur)
    5862  double wMin, wMax;   // Valeurs de poids min/max
    5963  bool mrkSzScale;     // true -> Taille de markers variable suivant poids
Note: See TracChangeset for help on using the changeset viewer.