Changeset 2263 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc


Ignore:
Timestamp:
Nov 14, 2002, 8:12:02 PM (23 years ago)
Author:
ansari
Message:
  • Ajout commande de trace d'elements graphiques (addpoly addctext ...)
  • Ajout de commandes de lecture ascii matrices/vecteurs
  • Trace de vecteur vx vs vy pour tout type de vecteurs

Reza 14/11/2002

File:
1 edited

Legend:

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

    r2259 r2263  
    1919
    2020#include "pistdimgapp.h"
     21#include "servnobjm.h"
    2122// #include "pihisto2d.h"
    2223#include "psfile.h"
     
    9596m[0]->AppendItem("Open-Fits", 10120);
    9697m[0]->AppendItem("Open-PPF", 10130);
     98#ifndef SANS_EVOLPLANCK
     99m[0]->AppendItem("Open-ASCII", 10140);
     100#endif
    97101// m[0]->AppendItem("Options", 10101);
    98102m[0]->AppendItem("Help", 10100);
     
    251255pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
    252256pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
     257pfc_ascii = new PIFileChooser(this,"ASCII-FileChooser", 10145);
    253258pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
    254259
     
    345350delete pfc_fits;
    346351delete pfc_ppf;
     352delete pfc_ascii;
    347353delete pfc_ps;
    348354
     
    796802
    797803/* --Methode-- */
    798 void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
     804void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop, bool fgcn)
    799805{
    800806PIDrawer *eld=CurrentElDrawer();
     
    813819unsigned long tpd = 0;
    814820gratt.DecodeTextPosDirAtt(opts, tpd, false);
    815 elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd);
     821elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd, fgcn);
    816822eld->Refresh();
    817823}
    818824
    819825/* --Methode-- */
     826void PIStdImgApp::AddCompText(string const & txt, string const & txtup, string const & txtdn,
     827                              double xp, double yp, string const& sop,
     828                              string const& optss, bool fgcn)
     829{
     830PIDrawer *eld=CurrentElDrawer();
     831if (eld == NULL) return;
     832PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     833PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     834if ((eld2 == NULL) && (eld3 == NULL)) return;
     835PIElDrwMgr* elmgr;
     836if (eld2) elmgr = &(eld2->ElDrwMgr());
     837else if (eld3) elmgr = &(eld3->ElDrwMgr());
     838if (elmgr == NULL) return;
     839
     840vector<string> opts;
     841ParseDisplayOption(sop, opts);
     842PIGraphicAtt gratt(opts);
     843unsigned long tpd = 0;
     844gratt.DecodeTextPosDirAtt(opts, tpd, false);
     845ParseDisplayOption(optss, opts);
     846PIGraphicAtt grattss(opts);
     847elmgr->ElAddCompText(xp,yp,txt.c_str(), gratt, txtup, txtdn, grattss, tpd, fgcn);
     848eld->Refresh();
     849}
     850
     851/* --Methode-- */
    820852void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2,
    821                           string const& sop, bool fgarrow)
     853                          string const& sop, bool fgarrow, bool fgcn)
    822854{
    823855PIDrawer *eld=CurrentElDrawer();
     
    835867PIGraphicAtt gratt(opts);
    836868if (fgarrow)
    837   elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt);
    838 else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
     869  elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt, fgcn);
     870else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt, fgcn);
    839871eld->Refresh();
    840872}
     
    842874/* --Methode-- */
    843875void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
    844                                string const& sop, bool fgfill)
     876                               string const& sop, bool fgfill, bool fgcn)
    845877{
    846878PIDrawer *eld=CurrentElDrawer();
     
    872904PIGraphicAtt gratt(opts);
    873905
    874 if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt);
    875 else elmgr->ElAddRect(xp, yp, dx, dy, gratt);
     906if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt, fgcn);
     907else elmgr->ElAddRect(xp, yp, dx, dy, gratt, fgcn);
    876908eld->Refresh();
    877909}
    878910
    879911/* --Methode-- */
    880 void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
     912void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop,
     913                            bool fgfill, bool fgcn)
    881914{
    882915PIDrawer *eld=CurrentElDrawer();
     
    895928  elmgr->ElAddMarker(xc, yc, gratt);
    896929else {
    897   if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
    898   else elmgr->ElAddCirc(xc, yc, r, gratt);
     930  if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt, fgcn);
     931  else elmgr->ElAddCirc(xc, yc, r, gratt, fgcn);
    899932}
    900933eld->Refresh();
     
    903936/* --Methode-- */
    904937void PIStdImgApp::AddArc(double x1, double y1, double x2, double y2,
    905                          double x3, double y3, string const& sop, bool fgfill)
     938                         double x3, double y3, string const& sop, bool fgfill, bool fgcn)
    906939{
    907940PIDrawer *eld=CurrentElDrawer();
     
    919952PIGraphicAtt gratt(opts);
    920953if (fgfill)
    921   elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt);
    922 else  elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt);
     954  elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
     955else  elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
    923956eld->Refresh();
    924957}
     958
     959/* --Methode-- */
     960void PIStdImgApp::AddPoly(vector<double>& xpol, vector<double>& ypol,
     961                          string const& sop, bool fgfill, bool fgcn)
     962{
     963PIDrawer *eld=CurrentElDrawer();
     964if (eld == NULL) return;
     965PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
     966PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
     967if ((eld2 == NULL) && (eld3 == NULL)) return;
     968PIElDrwMgr* elmgr = NULL;
     969if (eld2) elmgr = &(eld2->ElDrwMgr());
     970else if (eld3) elmgr = &(eld3->ElDrwMgr());
     971if (elmgr == NULL) return;
     972
     973vector<string> opts;
     974ParseDisplayOption(sop, opts);
     975PIGraphicAtt gratt(opts);
     976if (fgfill)
     977  elmgr->ElAddFPoly(xpol, ypol, gratt, fgcn);
     978else  elmgr->ElAddPoly(xpol, ypol, gratt, fgcn);
     979eld->Refresh();
     980
     981}
     982
    925983
    926984/* --Methode-- */
     
    14261484      break;
    14271485       
     1486#ifndef SANS_EVOLPLANCK
     1487    case 10140 :
     1488      pfc_ascii->AcceptNewFile(false);
     1489      mFCMsg = 10145;
     1490      pfc_ascii->SetMsg(mFCMsg);
     1491      SetBlocked();
     1492      pfc_ascii->Show();
     1493      break;
     1494
     1495    case 10145 :
     1496      SetBusy();
     1497      if (data)  {
     1498        string afname = pfc_ascii->GetFileName();
     1499        string nomobj = ObjMgr()->GetServiceObj()->FileName2Name(afname);
     1500        string cmd = "mtxfrascii ";
     1501        cmd += nomobj;  cmd += " ";  cmd += afname;
     1502        try {
     1503          mCmd->Interpret(cmd);
     1504        } 
     1505        catch ( PThrowable & exc ) {
     1506          cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
     1507               << (string)typeid(exc).name() << " Msg= "
     1508               << exc.Msg() << endl;
     1509          cout << endl;
     1510        }
     1511        catch ( ... ) {
     1512          cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ... " << endl;
     1513          cout << endl;
     1514        }
     1515       
     1516      }
     1517      mFCMsg = 0;
     1518      SetReady();
     1519      break;
     1520#endif
     1521
    14281522    case 10105:
    14291523      Stop();
Note: See TracChangeset for help on using the changeset viewer.