Changeset 1525 in Sophya


Ignore:
Timestamp:
Jun 13, 2001, 5:05:38 PM (24 years ago)
Author:
ansari
Message:

Ajout methode NamedObjMgr::DisplayVector() et commande vecplot , Reza 13/6/2001

Location:
trunk/SophyaPI/PIext
Files:
3 edited

Legend:

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

    r1504 r1525  
    410410                     tokens[6], tokens[7], tokens[8], tokens[9], true);
    411411  }
     412else if (kw == "vecplot") {
     413  if (tokens.size() < 2) {
     414    cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
     415  }
     416  while (tokens.size() < 3) tokens.push_back("");
     417  mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
     418}
    412419
    413420// Obsolete : ne pas virer SVP, cmv 26/7/99
     
    915922kw = "disp";
    916923usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
    917 usage += "\n  Related commands: surf nt2d nt3d "; 
     924usage += "\n  Related commands: surf nt2d nt3d vecplot"; 
    918925mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    919926kw = "imag";
    920927usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
    921 usage += "\n  Related commands: disp surf nt2d nt3d "; 
     928usage += "\n  Related commands: disp surf nt2d nt3d vecplot"; 
    922929mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    923930kw = "surf";
    924931usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
    925 usage += "\n  Related commands: disp nt2d nt3d "; 
     932usage += "\n  Related commands: disp nt2d nt3d vecplot"; 
    926933mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    927934kw = "nt2d";
    928935usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
    929936usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
    930 usage += "\n  Related commands: disp  surf  nt3d  gfd2d "; 
     937usage += "\n  Related commands: disp  surf  nt3d  gfd2d vecplot"; 
    931938mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    932939kw = "nt3d";
     
    934941usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
    935942usage += "\n  Related commands: disp  surf  nt2d gfd3d "; 
     943mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
     944kw = "vecplot";
     945usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
     946usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
     947usage += "\n  Related commands: disp nt2d "; 
    936948mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    937949
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r1513 r1525  
    2424#else
    2525#include "fitsautoreader.h"
     26#include "tvector.h"
     27#include "pitvmaad.h"
     28#include "piscdrawwdg.h"
    2629#endif
    2730
     
    13611364}
    13621365
     1366/* --Methode-- */
     1367void NamedObjMgr::DisplayVector(string & nomvx, string& nomvy, string dopt)
     1368//      Pour l'affichage 2-D de points avec coordonnees definies par deux vecteurs
     1369//   nomvx et nomvy
     1370{
     1371#ifdef SANS_EVOLPLANCK
     1372  cerr << " NamedObjMgr::DisplayVector() Error: Not implemented with PEIDA " << endl;
     1373#else
     1374
     1375if(!myImgApp) return;
     1376
     1377AnyDataObj* obj;
     1378obj = GetObj(nomvx);
     1379if(obj == NULL) {
     1380  cout << "NamedObjMgr::DisplayVector() Error , No such object " << nomvx << endl;
     1381  return;
     1382}
     1383Vector * vx = dynamic_cast<Vector *>(obj);
     1384if (vx == NULL) {
     1385  cout << "NamedObjMgr::DisplayVector() Error " << nomvx << " not a Vector ! " << endl;
     1386  return; 
     1387}
     1388
     1389obj = GetObj(nomvy);
     1390if(obj == NULL) {
     1391  cout << "NamedObjMgr::DisplayVector() Error , No such object " << nomvy << endl;
     1392  return;
     1393}
     1394Vector * vy = dynamic_cast<Vector *>(obj);
     1395if (vy == NULL) {
     1396  cout << "NamedObjMgr::DisplayVector() Error " << nomvy << " not a Vector ! " << endl;
     1397  return; 
     1398}
     1399
     1400
     1401Vector * cvx, * cvy;
     1402
     1403if (vx->Size() != vy->Size()) {
     1404  cout << "NamedObjMgr::DisplayVector() Warning / Vx.Size() != Vy.Size() " << endl;
     1405  if (vx->Size() < vy->Size()) {
     1406    cvx = new Vector(*vx);
     1407    cvy = new Vector(vy->SubVector(Range(0, 0, vx->Size()-1)));
     1408  }
     1409  else {
     1410    cvx = new Vector(vx->SubVector(Range(0, 0, vy->Size()-1)));
     1411    cvy = new Vector(*vy);
     1412  }
     1413}
     1414else {
     1415  cvx = new Vector(*vx);
     1416  cvy = new Vector(*vy);
     1417}
     1418
     1419POVectorAdapter * avx = new POVectorAdapter(cvx, true);
     1420POVectorAdapter * avy = new POVectorAdapter(cvy, true);
     1421PIYfXDrawer * vxydrw = new PIYfXDrawer(avx, avy, true);
     1422
     1423// Decodage des options classiques
     1424bool fgsr = true;
     1425int opt = servnobjm->DecodeDispOption(dopt, fgsr);
     1426string nx,rx;
     1427ParseObjectName(nomvx, rx, nx);
     1428string ny,ry;
     1429ParseObjectName(nomvy, ry, ny);
     1430
     1431string title = ny + " (Y) vs. " + nx + " (X)";
     1432// display 2D
     1433int wrsid = myImgApp->DispScDrawer(vxydrw, title, opt);
     1434
     1435if (fgsr) myImgApp->RestoreGraphicAtt();
     1436return;
     1437
     1438#endif
     1439}
     1440
    13631441/* --Methode--
    13641442void NamedObjMgr::DisplayImage(string& nom, string dopt)
  • trunk/SophyaPI/PIext/nobjmgr.h

    r1265 r1525  
    9090                                   string& err, string dopt="");
    9191
     92  virtual void          DisplayVector(string & nomvx, string& nomvy, string dopt="");
     93
    9294  virtual void          SetGraphicAttributes(string gratt="");
    9395  virtual void          SetGraphicWinZone(int nzx, int nzy, bool fcr=false);
Note: See TracChangeset for help on using the changeset viewer.