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


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.