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


Ignore:
Timestamp:
Aug 16, 2001, 2:19:01 PM (24 years ago)
Author:
ansari
Message:

1/ Definition d'attributs graphiques texte pour les nouvelles couleurs violettes
2/ Ajout commandes addline addrect addfrect addfcircle ....

Reza 16/8/2001

File:
1 edited

Legend:

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

    r1569 r1642  
    9898  }
    9999else if (kw == "addtext") {
    100   if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl;  return(0); }
     100  if (tokens.size() < 3) { cout << "Usage: addtext x y txt [colfontatt]" << endl;  return(0); }
    101101  double xp = atof(tokens[0].c_str());
    102102  double yp = atof(tokens[1].c_str());
    103   bool fgsr = true;
    104   string txt = tokens[3];
    105   for(int k=4; k<(int)tokens.size(); k++) txt += (' ' + tokens[k]);
    106   //int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
     103  string txt = tokens[2];
     104  bool fgsr = false;
     105  if (tokens.size() > 3)
     106    mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr);
    107107  mImgApp->AddText(txt, xp, yp);
    108108  if (fgsr) mImgApp->RestoreGraphicAtt();
    109109  }
     110else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect")) {
     111  if (tokens.size() < 4) { cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt]" << endl;  return(0); }
     112  double xp1 = atof(tokens[0].c_str());
     113  double yp1 = atof(tokens[1].c_str());
     114  double xp2 = atof(tokens[2].c_str());
     115  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);
     120  else {
     121    bool fgfill = (kw == "addrect") ? false : true;
     122    mImgApp->AddRectangle(xp1, yp1, xp2, yp2, fgfill);
     123  }
     124  if (fgsr) mImgApp->RestoreGraphicAtt();
     125  }
     126else if ((kw == "addcirc") || (kw == "addfcirc")) {
     127  if (tokens.size() < 3) { cout << "Usage: addcirc/addfcirc xc yc r [colatt]" << endl;  return(0); }
     128  double xc = atof(tokens[0].c_str());
     129  double yc = atof(tokens[1].c_str());
     130  double rad = atof(tokens[2].c_str());
     131  bool fgsr = false;
     132  if (tokens.size() > 3)
     133    mObjMgr->GetServiceObj()->DecodeDispOption(tokens[3], fgsr);
     134  bool fgfill = (kw == "addcirc") ? false : true;
     135  mImgApp->AddCircle(xc, yc, rad, fgfill);
     136  if (fgsr) mImgApp->RestoreGraphicAtt();
     137  }
     138
     139
    110140else if (kw == "settitle") {
    111   if (tokens.size() < 2) { cout << "Usage: addtitle fontatt titleup " << endl;  return(0); }
     141  if (tokens.size() < 1) { cout << "Usage: settitle TopTitle [BotTitle] [fontatt]" << endl;  return(0); }
    112142  bool fgsr = true;
    113   //int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[0], fgsr);
    114   string txt = tokens[1];
    115   for(int k=2; k<(int)tokens.size(); k++) txt += (' ' + tokens[k]);
    116   string td = "";
    117   mImgApp->SetTitle(txt, td);
     143  if (tokens.size() > 2)
     144    mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
     145  if (tokens.size() < 2)
     146    tokens.push_back("");
     147  mImgApp->SetTitle(tokens[0], tokens[1]);
    118148  if (fgsr) mImgApp->RestoreGraphicAtt();
    119149  }
     
    744774usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
    745775usage += "\n ------------------ Graphic attribute list ------------------ \n";
    746 usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
    747 usage += "           turquoise navyblue orange siennared purple limegreen gold \n";
     776usage += ">> Colors: defcol black white grey red blue green yellow \n";
     777usage += "           magenta cyan turquoise navyblue orange siennared purple \n";
     778usage += "           limegreen gold violet violetred blueviolet darkviolet \n";
    748779usage += ">> Lines:  defline normalline thinline thickline dashedline thindashedline \n";
    749780usage += "           thickdashedline dottedline thindottedline thickdottedline \n";
     
    796827kw = "addtext";
    797828usage = "Adds a text string to the current graphic object";
    798 usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
    799 usage += "\n  Usage: addtext x y ColFontAtt TextString";
    800 usage += "\n  Related commands: settitle graphicatt"; 
     829usage += "\n at the specified position (+ color and font attributes) ";
     830usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
     831usage += "\n Alt<Z> to remove added elements";
     832usage += "\n Font attribute is common with axes";
     833usage += "\n  Usage: addtext x y TextString [ColFontAtt]";
     834usage += "\n  (use quotes '' for multi word text strings) ";
     835usage += "\n  Related commands: addline addrect addfrect addcirc addfcirc settitle graphicatt"; 
    801836mpiac->RegisterCommand(kw, usage, this, "Graphics");
    802837
     838kw = "addline";
     839usage = "Adds a line to the current graphic object";
     840usage += "\n at the specified position (+ color attribute)";
     841usage += "\n The Base/AxesDrawer is used to handle added lines";
     842usage += "\n Alt<Z> to remove added elements";
     843usage += "\n  Usage: addline x1 y1 x2 y2 [ColAtt]";
     844usage += "\n  Related commands: addtext addrect addfrect addcirc addfcirc graphicatt"; 
     845mpiac->RegisterCommand(kw, usage, this, "Graphics");
     846
     847kw = "addrect";
     848usage = "Adds a rectangle to the current graphic object";
     849usage += "\n between the specified positions (+ color attribute)";
     850usage += "\n The Base/AxesDrawer is used to handle added rectangle";
     851usage += "\n Alt<Z> to remove added elements";
     852usage += "\n  Usage: addrect x1 y1 x2 y2 [ColAtt]";
     853usage += "\n  Related commands: addtext addline addfrect addcirc addfcirc graphicatt"; 
     854mpiac->RegisterCommand(kw, usage, this, "Graphics");
     855
     856kw = "addfrect";
     857usage = "Adds a filled rectangle to the current graphic object";
     858usage += "\n between the specified positions (+ color attribute)";
     859usage += "\n The Base/AxesDrawer is used to handle added rectangle";
     860usage += "\n Alt<Z> to remove added elements";
     861usage += "\n  Usage: addfrect x1 y1 x2 y2 [ColAtt]";
     862usage += "\n  Related commands: addtext addline addrect addcirc addfcirc graphicatt"; 
     863mpiac->RegisterCommand(kw, usage, this, "Graphics");
     864
     865kw = "addcirc";
     866usage = "Adds a circle to the current graphic object";
     867usage += "\n with the specified center and radius (+ color attribute)";
     868usage += "\n The Base/AxesDrawer is used to handle added circles";
     869usage += "\n Alt<Z> to remove added elements";
     870usage += "\n  Usage: addcirc xcenter ycenter radius [ColAtt]";
     871usage += "\n  Related commands: addtext addline addfrect addfrect addfcirc graphicatt"; 
     872mpiac->RegisterCommand(kw, usage, this, "Graphics");
     873
     874kw = "addfcirc";
     875usage = "Adds a filled circle to the current graphic object";
     876usage += "\n with the specified center and radius (+ color attribute)";
     877usage += "\n The Base/AxesDrawer is used to handle added circles";
     878usage += "\n Alt<Z> to remove added elements";
     879usage += "\n  Usage: addcirc xcenter ycenter radius [ColAtt]";
     880usage += "\n  Related commands: addtext addline addfrect addfrect addcirc graphicatt"; 
     881mpiac->RegisterCommand(kw, usage, this, "Graphics");
     882
    803883kw = "settitle";
    804 usage = "Set the title string (top title) for the current graphic object";
    805 usage += "\n  Usage: settitle FontAtt TopTitle";
     884usage = "Set the title string (top title / bottom title) for the current graphic object";
     885usage += "\n  Usage: settitle TopTitle [BottomTitle] [fontAtt]";
    806886usage += "\n  Related commands: addtext graphicatt"; 
    807887mpiac->RegisterCommand(kw, usage, this, "Graphics");
Note: See TracChangeset for help on using the changeset viewer.