Changeset 1971 in Sophya for trunk/SophyaPI/PIext/basexecut.cc


Ignore:
Timestamp:
Apr 30, 2002, 2:34:41 PM (23 years ago)
Author:
ansari
Message:

1/ Basculement de decodage des options de display aux methodes
PIDrawer/PIWdg::DecodeOptionString()
2/ Possibilite de Show/Hide de la partie Zoom/ColorMap/Stat du MainWindow

Reza 30/4/2002

File:
1 edited

Legend:

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

    r1938 r1971  
    6161  nx = ny = 1;
    6262  nx = atoi(tokens[0].c_str());    ny = atoi(tokens[1].c_str());
    63   mObjMgr->SetGraphicWinZone(nx, ny, false);
     63  if (mImgApp) mImgApp->SetZone(nx, ny);
    6464  } 
    6565else if (kw == "newwin") {
     
    6868  if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
    6969  if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
    70   mObjMgr->SetGraphicWinZone(nx, ny, true);
     70  if (mImgApp) mImgApp->CreateGraphWin(nx, ny);
    7171  } 
    7272else if (kw == "stacknext") mImgApp->StackWinNext();
    7373else if (kw == "graphicatt") {
    7474  if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl;  return(0); }
    75   mObjMgr->SetGraphicAttributes(tokens[0]);
    76   }
    77 else if (kw == "setxylimits") {
    78   if (tokens.size() < 4) { cout << "Usage: setxylimits xmin xmax ymin ymax" << endl;  return(0); }
    79   double xmin = atof(tokens[0].c_str());
    80   double xmax = atof(tokens[1].c_str());
    81   double ymin = atof(tokens[2].c_str());
    82   double ymax = atof(tokens[3].c_str());
    83   mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
     75  string opts = tokens[0];
     76  if (tokens.size() > 1)
     77    for(int kt=1; kt<tokens.size(); kt++)  { opts += ' '; opts += tokens[kt]; }
     78  if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts);
     79  }
     80else if (kw == "setaxesatt") {
     81  if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl;  return(0); }
     82  string opts = tokens[0];
     83  if (tokens.size() > 1)
     84    for(int kt=1; kt<tokens.size(); kt++)  { opts += ' '; opts += tokens[kt]; }
     85  if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts);
    8486  }
    8587else if (kw == "setinsetlimits") {
     
    9193  mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
    9294  }
    93 else if (kw == "setimgcenter") {
    94   if (tokens.size() < 2) { cout << "Usage: setimgcenter xc yc" << endl;  return(0); }
    95   int xc = atoi(tokens[0].c_str());
    96   int yc = atoi(tokens[1].c_str());
    97   mImgApp->SetImageCenterPosition(xc, yc);
    98   }
    9995else if (kw == "addtext") {
    10096  if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl;  return(0); }
     
    10298  double yp = atof(tokens[1].c_str());
    10399  string txt = tokens[2];
    104   bool fgsr = false;
    105   if (tokens.size() > 3)
    106     mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr);
    107   mImgApp->AddText(txt, xp, yp);
    108   if (fgsr) mImgApp->RestoreGraphicAtt();
     100  string sop;
     101  if (tokens.size() > 3) sop = tokens[3];
     102  mImgApp->AddText(txt, xp, yp, sop);
    109103  }
    110104else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) {
     
    114108  double xp2 = atof(tokens[2].c_str());
    115109  double yp2 = atof(tokens[3].c_str());
    116   bool fgsr = false;
    117   if (tokens.size() > 4)
    118    mObjMgr->GetServiceObj()->DecodeDispOption(tokens[4], fgsr);
    119   if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2);
     110  string sop;
     111  if (tokens.size() > 4) sop = tokens[4];
     112  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop);
    120113  else {
    121114    bool fgfill = (kw == "addrect") ? false : true;
    122     mImgApp->AddRectangle(xp1, yp1, xp2, yp2, fgfill);
    123   }
    124   if (fgsr) mImgApp->RestoreGraphicAtt();
     115    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill);
     116  }
    125117  }
    126118else if ((kw == "addcirc") || (kw == "addfcirc")) {
     
    130122  double rad = atof(tokens[2].c_str());
    131123  bool fgsr = false;
    132   if (tokens.size() > 3)
    133     mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr);
     124  string sop;
     125  if (tokens.size() > 3) sop = tokens[3];
    134126  bool fgfill = (kw == "addcirc") ? false : true;
    135   mImgApp->AddCircle(xc, yc, rad, fgfill);
    136   if (fgsr) mImgApp->RestoreGraphicAtt();
     127  mImgApp->AddCircle(xc, yc, rad, sop, fgfill);
    137128  }
    138129
     
    141132  if (tokens.size() < 1) { cout << "Usage: settitle TopTitle [BotTitle] [fontatt]" << endl;  return(0); }
    142133  bool fgsr = true;
    143   if (tokens.size() > 2)
    144     mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
    145   if (tokens.size() < 2)
    146     tokens.push_back("");
    147134  mImgApp->SetTitle(tokens[0], tokens[1]);
    148   if (fgsr) mImgApp->RestoreGraphicAtt();
    149135  }
    150136 
     
    397383    }
    398384  else {
    399     if (tokens.size() < 5)  tokens.push_back("n");
     385    if (tokens.size() < 5)  tokens.push_back("next");
    400386    mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
    401387                                         nx, ny, tokens[4]);
     
    415401else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
    416402  if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
    417   string opt = "n";
     403  string opt = "next";
    418404  if (tokens.size() > 1)  opt = tokens[1];
    419405  if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
     
    457443  string numvary = "";
    458444  string err = "";
    459   string opt = "n";
     445  string opt = "next";
    460446  if(tokens.size()>2) err = tokens[2];
    461447  if(tokens.size()>3) opt = tokens[3];
     
    468454     return(0);}
    469455  string err = "";
    470   string opt = "n";
     456  string opt = "next";
    471457  if(tokens.size()>3) err = tokens[3];
    472458  if(tokens.size()>4) opt = tokens[4];
     
    767753kw = "graphicatt";
    768754usage = "To change default graphic options \n  Usage: graphicatt att_list \n";
    769 usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
     755usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
    770756usage += "\n ------------------ Graphic attribute list ------------------ \n";
    771757usage += ">> Colors: defcol black white grey red blue green yellow \n";
     
    791777usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
    792778usage += "                               zoom/2 zoom/3 zoom/4 zoom/5 \n";
    793 usage += ">> Image centering: centerimg -> Position the image in widget \n";
     779usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
    794780usage += ">> Axes:  stdaxes=defaxes=boxaxes  simpleaxes boxaxesgrid \n";
    795 usage += "          fineaxes  grid=fineaxesgrid \n";
     781usage += "          fineaxes  fineaxesgrid \n";
    796782usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
    797783usage += ">> XYLimits : xylimits  -> Forces X-Y limits in 2-D plots \n";
     
    799785usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
    800786usage += ">> DisplayWindow: next same win stack inset \n";
    801 usage += "   Related commands: setxylimits setinsetlimits setimgcenter"; 
     787usage += "   Related commands: setaxesatt setinsetlimits "; 
    802788mpiac->RegisterCommand(kw, usage, this, "Graphics");
    803789
    804 kw = "setxylimits";
    805 usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
    806 usage += "\n  Related commands: graphicatt /xylimits"; 
     790kw = "setaxesatt";
     791usage = "To set default axes attributes \n  Usage: setaxesatt att_list \n";
     792usage += ">> Axes:  stdaxes=defaxes=boxaxes  simpleaxes boxaxesgrid \n";
     793usage += "          fineaxes  fineaxesgrid \n";
     794usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
     795usage += ">> xylimits=xmin,xmax,ymin,ymax  -> Forces X-Y limits in 2-D plots \n";
    807796mpiac->RegisterCommand(kw, usage, this, "Graphics");
     797
    808798
    809799kw = "setinsetlimits";
Note: See TracChangeset for help on using the changeset viewer.