Changeset 3355 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Oct 23, 2007, 12:02:12 AM (18 years ago)
Author:
ansari
Message:

ajout decodage attributs graphiques samew=WdgName wname=Nom inset=fx1,fx2,fy1,fy2 - Reza 22/10/2007

Location:
trunk/SophyaPI/PIext
Files:
5 edited

Legend:

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

    r3296 r3355  
    463463usage = "Define the display rectangle for drawers added as insets \n";
    464464usage += " over existing graphic objects - limits expressed as fraction \n"; 
    465 usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
     465usage += " graphic object size (0. .. 1.) Xmax at right, YMax top \n ";
    466466usage += " Usage: setinsetlimits xmin xmax ymin ymax";
    467467usage += "\n  Related commands: graphicatt /inset"; 
     
    859859usage += "o Most objects can be also be displayed overlayed \n";
    860860usage += "  on the last displayed widget (gr_att= same) \n";
    861 usage += "o The overlay can be on a selected rectangle of the \n"; 
    862 usage += "  last displayed widget (gr_att= inset) - See setinsetlimits\n";
     861usage += "  or by specifying a widget name samew=Widgetname \n";
     862usage += "o The widget/window name can be specified (gr_att wname=Name) \n";
     863usage += "o The overlay can be on a selected rectangle of the last \n"; 
     864usage += "  displayed widget (gr_att: inset  or inset=fxmin,fxmax,fymin,fymax) \n";
    863865usage += "\n  Related commands: newwin zone stacknext graphicatt setinsetlimits"; 
    864866piac->RegisterHelp(kw, usage, grp);
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r3269 r3355  
    16381638
    16391639/* --Methode-- */
     1640int NamedObjMgr::NameToOId(string & nom)
     1641{
     1642ZSync zs(*myMutex); zs.NOp();
     1643return NameToOId_P(nom);
     1644}
     1645
     1646/* --Methode-- */
     1647int NamedObjMgr::NameToOId_P(string & nom)
     1648{
     1649string n1,r1;
     1650ParseObjectName(nom, r1, n1);
     1651nom = '/' + r1 + '/' + n1;
     1652NObjList::iterator it = myObjs->find(nom);
     1653if (it == myObjs->end()) return(-1);
     1654else return((*it).second.oid);
     1655}
     1656
     1657
     1658/* --Methode-- */
    16401659void NamedObjMgr::AddWRsId(string & nom, int wrsid)
    16411660{
  • trunk/SophyaPI/PIext/nobjmgr.h

    r3269 r3355  
    100100  virtual void                  SetTmpDir(string const& tmpdir);
    101101
     102// Pour convertir un nom d'objet en identificateur d'objet (OId)
     103  virtual int           NameToOId(string & nom);
     104
    102105// Ajoute un identificateur d'objet widget/drawer/fenetre pour l'objet nom
    103106// Ces identificateurs servent lors de la destruction de l'objet nom
     
    125128  virtual void          SaveObj_P(string & nom, POutPersist& s, bool keeppath=false);
    126129
     130  virtual int           NameToOId_P(string & nom);
    127131  virtual void          AddWRsId_P(string & nom, int wrsid);
    128132  virtual void          UpdateObjMgrWindow_P(int did);
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r3024 r3355  
    761761  }
    762762
     763// <ZThread> global PIApplication event loop synchronisation
     764SyncPIS zs(getMutex(), fglock, 2);
     765
    763766// On decode les options graphiques
    764767vector<string> opts;
    765 DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     768string wname = name;
     769DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname);
    766770
    767771// Pas de same ou inset pour DispImage
    768772if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next;
    769 
    770 // <ZThread> global PIApplication event loop synchronisation
    771 SyncPIS zs(getMutex(), fglock, 2);
    772773
    773774// Choix de la taille de fenetre
     
    778779if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
    779780px = py = 0;
    780 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
     781win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str());
    781782if (fgimagnav) {  // Creation de naviguateur d'image
    782   piin = new PIImageNavigator(win, (char *)name.c_str(), sx, sy, px,py);
     783  piin = new PIImageNavigator(win, (char *)wname.c_str(), sx, sy, px,py);
    783784  piin->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    784785  piin->Show();
     
    789790}
    790791else { // Creation de widget PIImage normal
    791   pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
     792  pii = new PIImage(win, (char *)wname.c_str(), sx, sy, px,py);
    792793  pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    793794  pii->SetZoomWin(zoom, false);
     
    845846  }
    846847
     848// <ZThread> global PIApplication event loop synchronisation
     849SyncPIS zs(getMutex(), fglock, 2);
     850
    847851// On decode les options graphiques
    848852vector<string> opts;
    849 DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     853string wname = name;
     854DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname);
    850855if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) )  dwopt = Disp_Next;
    851 
    852 // <ZThread> global PIApplication event loop synchronisation
    853 SyncPIS zs(getMutex(), fglock, 2);
    854856
    855857// Trace en superpoistion
     
    898900sx = 200+mFgScSz*100;
    899901sy = 200+mFgScSz*100;
    900 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    901 
    902 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
     902win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str());
     903
     904scw = new PIScDrawWdg(win, (char *)wname.c_str(), sx, sy, px, py);
    903905scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    904906scw->SetUserData(NULL, oid);
     
    923925//   Titre du plot
    924926if (mAddTitle) {
    925   if (title.length() <= 0)  title = name;  string t2="";   
     927  if (title.length() <= 0)  title = wname;  string t2="";   
    926928  scw->SetTitles(title, t2);   
    927929}
     
    948950  }
    949951
     952// <ZThread> global PIApplication event loop synchronisation
     953SyncPIS zs(getMutex(), fglock, 2);
     954
    950955// On decode les options graphiques
    951956vector<string> opts;
    952 DispWinEnum dwopt = ParseDisplayOption(sop, opts);
     957string wname = name;
     958DispWinEnum dwopt = ParseDisplayOption(sop, opts, wname);
    953959
    954960if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) )  dwopt = Disp_Next;
    955 
    956 // <ZThread> global PIApplication event loop synchronisation
    957 SyncPIS zs(getMutex(), fglock, 2);
    958961
    959962// Trace en superpoistion
     
    10021005sx = 200+mFgScSz*100;
    10031006sy = 200+mFgScSz*100;
    1004 win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    1005 PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
     1007win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)wname.c_str());
     1008PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)wname.c_str(), sx, sy, px, py);
    10061009wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    10071010wd3->SetUserData(NULL, oid);
     
    10261029//   Titre du plot
    10271030if (mAddTitle) {
    1028   if (title.length() <= 0)  title = name;  string t2="";   
     1031  if (title.length() <= 0)  title = wname;  string t2="";   
    10291032  wd3->SetTitles(title, t2);   
    10301033}
     
    14931496{
    14941497if (mStW)  mStW->DispNext();
     1498}
     1499
     1500/* --Methode-- */
     1501void PIStdImgApp::SelectLastWidget(string & nom)
     1502{
     1503
     1504  if ( (mLastWdg != NULL) && (mLastWdg->Nom() == nom) ) return;
     1505  if ( (mCurWdg != NULL) && (mCurWdg->Nom() == nom) ) {
     1506    mLastWdg = mCurWdg;
     1507    return;
     1508  }
     1509
     1510  PIWdg* bw = NULL;
     1511  long wsid = -1;
     1512  BWMList::iterator it;
     1513  for(it = mBWList.begin(); it != mBWList.end(); it++) {
     1514    if ( ((*it).second->Nom() == nom) && ((*it).first > wsid)) {
     1515      bw = (*it).second; wsid = (*it).first;
     1516    }
     1517  }
     1518  if (bw != NULL) {
     1519    if (bw->kind() == PIImageNavigator::ClassId)
     1520      mLastWdg = dynamic_cast<PIImageNavigator *>(bw)->ImageWdg();
     1521    else mLastWdg = dynamic_cast<PIBaseWdg *>(bw);
     1522  }
     1523  return;
     1524}
     1525
     1526/* --Methode-- */
     1527void PIStdImgApp::SelectLastWidgetByObjName(string & nom)
     1528{
     1529  int oid = ObjMgr()->NameToOId(nom);
     1530  if (oid < 0) return;
     1531
     1532  if ( (mLastWdg != NULL) && (mLastWdg->UserFlag() == oid) ) return;
     1533  if ( (mCurWdg != NULL) && (mCurWdg->UserFlag() == oid) ) {
     1534    mLastWdg = mCurWdg;
     1535    return;
     1536  }
     1537
     1538  PIWdg* bw = NULL;
     1539  long wsid = -1;
     1540  BWMList::iterator it;
     1541  for(it = mBWList.begin(); it != mBWList.end(); it++) {
     1542    if ( ((*it).second->UserFlag() == oid) && ((*it).first > wsid)) {
     1543      bw = (*it).second; wsid = (*it).first;
     1544    }
     1545  }
     1546  if (bw != NULL) {
     1547    if (bw->kind() == PIImageNavigator::ClassId)
     1548      mLastWdg = dynamic_cast<PIImageNavigator *>(bw)->ImageWdg();
     1549    else mLastWdg = dynamic_cast<PIBaseWdg *>(bw);
     1550  }
     1551  return;
    14951552}
    14961553
     
    17491806
    17501807/* --Methode-- */
    1751 DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts)
     1808DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts, string& wname)
    17521809{
    17531810  DispWinEnum rc = Disp_Next;
     
    17741831    else if (token == "same")  rc = Disp_Same;
    17751832    else if (token == "inset")   rc = Disp_Inset;
    1776     else  if (token == "stack")   rc = Disp_Stack;
    1777     else  if (token == "next")   rc = Disp_Next;
     1833    else if (token == "stack")   rc = Disp_Stack;
     1834    else if (token == "next")   rc = Disp_Next;
     1835    else if (token.substr(0,6)=="samew=") {
     1836      string snom=token.substr(6);
     1837      SelectLastWidget(snom);
     1838      rc = Disp_Same;
     1839    }
     1840    else if (token.substr(0,6)=="inset=") {
     1841      double fx1,fx2,fy1,fy2;
     1842      fx1=fy1=0.4; fx2=fy2=0.6;
     1843      sscanf(token.substr(6).c_str(),"%lg,%lg,%lg,%lg",&fx1,&fx2,&fy1,&fy2);
     1844      SetInsetLimits(fx1, fx2, fy1, fy2);
     1845      rc = Disp_Inset;
     1846    }
     1847    else if (token.substr(0,6)=="wname=") {   // specification de nom de widget
     1848      wname=token.substr(6);
     1849    }
    17781850    // Option a etre decode par les drawers, etc ...
    17791851    else  opts.push_back(token);
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2944 r3355  
    114114     void StackWinNext();
    115115
     116  // Pour specifier le widget pour le trace en superpose, en specifiant un nom de widget
     117     void SelectLastWidget(string & nom);
     118  // Pour specifier le widget pour le trace en superpose, en specifiant un nom d'objet
     119     void SelectLastWidgetByObjName(string & nom);
     120     
    116121     void DeleteWindow(PIWindow* w);
    117122     void DeleteWidget(PIWdg* w, bool dw=true, bool dwin=true);
     
    156161     void  SetDefaultGraphicAttributes(string const & opt);
    157162     void  SetDefaultAxesAttributes(string const & opt);
    158      DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
     163     DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts, string& wname);
     164     inline DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts)
     165       {
     166         string wname;
     167         return ParseDisplayOption(opt, opts, wname);
     168       }
    159169
    160170// Gestion fichiers PS
Note: See TracChangeset for help on using the changeset viewer.