Changeset 2638 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Nov 19, 2004, 6:41:07 PM (21 years ago)
Author:
ansari
Message:

Ajout commandes addoval addfoval pour trace d'ellipse - Reza 19/11/2004

Location:
trunk/SophyaPI/PIext
Files:
3 edited

Legend:

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

    r2615 r2638  
    164164  }
    165165else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
     166         (kw == "addoval") || (kw == "addfoval") ||
    166167         (kw == "addarrow") ) {
    167168  if (tokens.size() < 4) {
    168     cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt] [fgnc]" << endl; 
     169    if ( (kw == "addoval") || (kw == "addfoval") )
     170      cout << "Usage  addoval/addfoval/addarrow xc yc dx dy [colatt] [fgnc]" << endl; 
     171    else
     172      cout << "Usage: addline/addrect/addfrect/addarrow x1 y1 x2 y2 [colatt] [fgnc]" << endl; 
    169173    return(0);
    170174  }
     
    178182  if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
    179183  else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
    180   else {
    181     bool fgfill = (kw == "addrect") ? false : true;
    182     mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
     184  else {
     185    bool fgfill = ((kw == "addrect") || (kw == "addoval")) ? false : true;
     186    if ( (kw == "addrect") || (kw == "addfrect") )
     187      mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
     188    else  mImgApp->AddOval(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
    183189  }
    184190}
     
    13391345usage += "\n  Related commands: addtext addline addarrow addfrect addfrect";
    13401346usage += "\n       addcirc addarc addfarc addpoly addfpoly graphicatt"; 
     1347mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
     1348
     1349kw = "addoval";
     1350usage = "Adds an oval (ellipse) to the current graphic object";
     1351usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
     1352usage += "\n The Base/AxesDrawer is used to handle added rectangle";
     1353usage += "\n Alt<E> to remove added element";
     1354usage += "\n  Usage: addoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
     1355usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
     1356usage += "\n  Related commands: addfoval addline addarrow addfrect addcirc addfcirc";
     1357usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
     1358mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
     1359
     1360kw = "addfoval";
     1361usage = "Adds a filled oval (ellipse) to the current graphic object";
     1362usage += "\n centered on xc,yc - semi-axis ds,dy (+ graphic attribute)";
     1363usage += "\n The Base/AxesDrawer is used to handle added rectangle";
     1364usage += "\n Alt<E> to remove added element";
     1365usage += "\n  Usage: addfoval xc yc dx dy [GraphicAtt] [fgnc=false/true]";
     1366usage += "\n  if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
     1367usage += "\n  Related commands: addoval addline addarrow addfrect addcirc addfcirc";
     1368usage += "\n       addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt"; 
    13411369mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
    13421370
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2615 r2638  
    11481148}
    11491149/* --Methode-- */
     1150void PIStdImgApp::AddOval(double xp, double yp, double dx, double dy,
     1151                          string const& sop, bool fgfill, bool fgcn)
     1152{
     1153// <ZThread> global PIApplication event loop synchronisation
     1154ZSync zs(thr_glsyn, 2); 
     1155
     1156PIDrawer *eld=CurrentElDrawer();
     1157if (eld == NULL) return;
     1158PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     1159PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     1160if ((eld2 == NULL) && (eld3 == NULL)) return;
     1161PIElDrwMgr* elmgr = NULL;
     1162if (eld2) elmgr = &(eld2->ElDrwMgr());
     1163else if (eld3) elmgr = &(eld3->ElDrwMgr());
     1164
     1165
     1166vector<string> opts;
     1167ParseDisplayOption(sop, opts);
     1168PIGraphicAtt gratt(opts);
     1169
     1170if (fgfill) elmgr->ElAddFOval(xp, yp, dx, dy, gratt, fgcn);
     1171else elmgr->ElAddOval(xp, yp, dx, dy, gratt, fgcn);
     1172eld->Refresh();
     1173}
     1174
     1175/* --Methode-- */
    11501176void PIStdImgApp::AddArc(double xc, double yc, double r, double a, double da,
    11511177                         string const& sop, bool fgfill, bool fgcn)
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2494 r2638  
    9090     void AddCircle(double xc, double yc, double r, string const& opt,
    9191                    bool fgfill=false, bool fgcn=false);
     92     void AddOval(double xp, double yp, double dx, double dy, string const& opt,
     93                  bool fgfill=false, bool fgcn=false);
    9294     void AddArc(double xc, double yc, double r, double a, double da,
    9395                 string const& opt, bool fgfill=false, bool fgcn=false);
Note: See TracChangeset for help on using the changeset viewer.