Changeset 2651 in Sophya


Ignore:
Timestamp:
Feb 18, 2005, 3:09:47 PM (21 years ago)
Author:
ansari
Message:

Modifications pour l'utilisation viewer PIImageNavigator (ajout commande imagnav) - Reza 18 Fev 2005

Location:
trunk/SophyaPI/PIext
Files:
6 edited

Legend:

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

    r2645 r2651  
    714714
    715715// >>>>>>>>>>>  Affichage des objets
    716 else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
    717   if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
     716else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") || (kw == "imagnav") ) {
     717  if (tokens.size() < 1) { cout << "Usage: disp/surf/imag/imagnav nameobj [opt]" << endl; return(0); }
    718718  string opt = "next";
    719719  if (tokens.size() > 1)  opt = tokens[1];
    720720  if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
    721721  else if (kw == "surf")  mObjMgr->DisplaySurf3D(tokens[0], opt);
    722   else if (kw == "imag")  mObjMgr->DisplayImage(tokens[0], opt);
     722  else if (kw == "imag")  mObjMgr->DisplayImage(tokens[0], opt, false);
     723  else if (kw == "imagnav")  mObjMgr->DisplayImage(tokens[0], opt, true);
    723724  }
    724725
     
    16381639kw = "imag";
    16391640usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
    1640 usage += "\n  Related commands: disp surf nt2d nt3d vecplot"; 
     1641usage += "\n  Related commands: disp imagnav surf nt2d nt3d vecplot"; 
     1642mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
     1643kw = "imagnav";
     1644usage = "Displays an object as an image with the ImageNavigator viewer \n";
     1645usage += "Usage: imagnav nameobj [graphic_attributes]";
     1646usage += "\n  Related commands: disp imag surf nt2d nt3d vecplot"; 
    16411647mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
    16421648kw = "surf";
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r2645 r2651  
    13111311  else wrsid = myImgApp->DispScDrawer( dr, n1, dopt, "", 0, fglock);
    13121312  }
    1313 else if (arr) wrsid = myImgApp->DispImage(arr, n1, dopt, 0, fglock);
     1313else if (arr) wrsid = myImgApp->DispImage(arr, n1, dopt, false, 0, fglock);
    13141314
    13151315AddWRsId(nom, wrsid);
     
    13181318
    13191319/* --Methode-- */
    1320 void NamedObjMgr::DisplayImage(string& nom, string dopt)
     1320void NamedObjMgr::DisplayImage(string& nom, string dopt, bool fgimagnav)
    13211321{
    13221322ZSync(*myMutex);
     
    13491349
    13501350int wrsid = 0;
    1351 wrsid = myImgApp->DispImage(arr, n1, dopt, 0, fglock);
     1351wrsid = myImgApp->DispImage(arr, n1, dopt, fgimagnav, 0, fglock);
    13521352
    13531353AddWRsId(nom, wrsid);
  • trunk/SophyaPI/PIext/nobjmgr.h

    r2645 r2651  
    8383//  Affichage des objets
    8484  virtual void          DisplayObj(string & nom, string dopt="");
    85   virtual void          DisplayImage(string & nom, string dopt="");
     85  virtual void          DisplayImage(string & nom, string dopt="", bool fgimagnav=false);
    8686  virtual void          DisplaySurf3D(string & nom, string dopt="");
    8787  virtual void          DisplayNT(string & nom, string& nmx, string& nmy, string& nmz, 
  • trunk/SophyaPI/PIext/piaversion.h

    r2613 r2651  
    22#define PIAPPVERSION_H_SEEN
    33
    4 #define PIAPP_VERSIONNUMBER  3.97
     4#define PIAPP_VERSIONNUMBER  3.972
    55
    66#endif
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2638 r2651  
    661661PIApplication::SetBusy();
    662662// Attention : Appel XSync specifique X11 -  en attendant multi-thread
    663 XSync(PIXDisplay(), False); 
     663// XSync(PIXDisplay(), False);  RZDEL
    664664}
    665665
     
    671671PIApplication::SetBlocked();
    672672// Attention : Appel XSync specifique X11 -  en attendant multi-thread
    673 XSync(PIXDisplay(), False); 
     673// XSync(PIXDisplay(), False);  RZDEL
    674674}
    675675
     
    701701/* --Methode-- */
    702702int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop,
    703                            int oid, bool fglock)
    704 {
    705 PIImage* pii;
     703                           bool fgimagnav, int oid, bool fglock)
     704{
     705PIImage* pii=NULL;
     706PIImageNavigator* piin=NULL;
    706707PIWindow* win;
    707708int sx, sy, px, py, flag;
     
    738739px = py = 0;
    739740win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
    740 pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
    741 pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
    742 pii->SetZoomWin(zoom, false);
    743 pii->SetGloVWin(gimv, false);
    744 pii->SetCMapWin(cmapv, false);
    745 pii->ShowCursor(true);
    746 pii->SetUserData(NULL, oid);
    747 
     741if (fgimagnav) {  // Creation de naviguateur d'image
     742  piin = new PIImageNavigator(win, (char *)name.c_str(), sx, sy, px,py);
     743  piin->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     744  piin->ImageWdg()->ShowCursor(true);
     745  pii = piin->ImageWdg();
     746  pii->SetUserData(NULL, oid);
     747  //  XSync(PIXDisplay(), False); 
     748  // cout << " DBG-ImagNav-BBB-BBB Apres XSync() " << endl; 
     749 
     750}
     751else { // Creation de widget PIImage normal
     752  pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
     753  pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     754  pii->SetZoomWin(zoom, false);
     755  pii->SetGloVWin(gimv, false);
     756  pii->SetCMapWin(cmapv, false);
     757  pii->ShowCursor(true);
     758  pii->SetUserData(NULL, oid);
     759}
    748760
    749761// On recalcule la taille de la fenetre si Disp_Win
     
    776788mBWList[mBWId] = pii;
    777789// pii->Refresh();
    778 pii->Apply();
    779 cmapv->Refresh();
     790  pii->Apply(true);
     791  //  cmapv->Refresh();  Pas besoin ? , Reza Fev 2005
    780792return(mBWId);
    781793}
     
    13801392    PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
    13811393//    cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
    1382     if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
     1394    if (nw) DeleteWidget(nw, false, false);
    13831395    flag = mGrIdx;
    13841396    mGrIdx = (mGrIdx+1)%(nx*ny);
     
    14301442  for(k=0; k<mGrW->NbChilds(); k++) {
    14311443    if ((cwd = mGrW->GetChild(k)) == NULL)  continue;
    1432     DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
     1444    DeleteWidget(cwd, false, false);
    14331445    }
    14341446  mGrW->SetZone(nzx, nzy);
     
    14611473for(k=0; k<w->NbChilds(); k++) {
    14621474  if ((cwd = w->GetChild(k)) == NULL)  continue;
    1463   DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
     1475  DeleteWidget(cwd,false,false);
    14641476  }
    14651477delete w;
     
    14681480
    14691481/* --Methode-- */
    1470 void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
     1482void PIStdImgApp::DeleteWidget(PIWdg* w, bool dw, bool dwin)
    14711483{
    14721484if (w == NULL)  return;
     
    14741486for(it = mBWList.begin(); it != mBWList.end(); it++)
    14751487  if ((*it).second == w)  { mBWList.erase(it);  break; }
    1476 int k;
    1477 PIDrawer* drw;
    1478 for(k=0; k<w->NbDrawers(); k++) {
    1479   if ((drw = w->GetDrawer(k)) == NULL)  continue;
    1480   DrwMList::iterator itt;
    1481   for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
    1482     if ((*itt).second == drw)  { mDrwList.erase(itt);  break; }
    1483   }
    1484 
    1485 if (w == mCurWdg) { 
     1488PIBaseWdg* bw = dynamic_cast<PIBaseWdg *>(w);
     1489if (bw != NULL) {
     1490  PIDrawer* drw;
     1491  int k;
     1492  for(k=0; k<bw->NbDrawers(); k++) {
     1493    if ((drw = bw->GetDrawer(k)) == NULL)  continue;
     1494    DrwMList::iterator itt;
     1495    for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
     1496      if ((*itt).second == drw)  { mDrwList.erase(itt);  break; }
     1497  }
     1498}
     1499
     1500// Reza Fev 2005 - On met systematiquement mCurWdg et mLastWdg a NULL
     1501// Il peuvent en effet etre un des fils du widget qui est supprime
     1502// if (w == mCurWdg) { 
     1503if (true) {    // Reza Fev 2005 - mCurWdg = NULL systematique
    14861504  mCurWdg = NULL;
    14871505  if (mFgCWImg) {
     
    14921510  }
    14931511
    1494 if (w == mLastWdg)  mLastWdg = NULL;
     1512// if (w == mLastWdg)  mLastWdg = NULL;
     1513mLastWdg = NULL; // Reza Fev 2005 - mLastWdg = NULL systematique
    14951514
    14961515PIWdg* pw=NULL;
    1497 if (dwin)  pw = (PIWdg*)(w->Parent());
    1498 //DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
    1499 if (dw) delete w;
    1500 if (pw && (pw->kind() == PIWindow::ClassId )) {
    1501  PIWindow* pww = (PIWindow*) pw;
    1502  if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
     1516pw = (PIWdg*)(w->Parent());
     1517//DBG printf("DeleteWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
     1518if (dw) {
     1519  if (pw && (pw->kind() == PIImageNavigator::ClassId) )  {
     1520    delete pw;
     1521    pw = NULL;
     1522  }
     1523  else delete w;
     1524}
     1525if (dwin && pw && (pw->kind() == PIWindow::ClassId )) {
     1526 PIWindow* pww = dynamic_cast<PIWindow *>(pw);
     1527 if (pww && (pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
    15031528    DeleteWindow((PIWindow*)pw);
    15041529 }
     
    15161541  it  = mBWList.find(k);
    15171542  if (it == mBWList.end())  return;
    1518   PIBaseWdg* wd = (*it).second;
     1543  PIWdg* wd = (*it).second;
    15191544//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
    1520   DeleteBaseWidget(wd, true, true);
     1545  DeleteWidget(wd, true, true);
    15211546  }
    15221547else {  // C'est un drawer
     
    18671892    if (mCurWdg) {
    18681893      int oid = mCurWdg->UserFlag();
    1869       DeleteBaseWidget(mCurWdg);
     1894      DeleteWidget(mCurWdg);
    18701895      mObjMgr->DelObj_Id(oid);
    18711896      }
     
    19641989    if (mStW) {
    19651990      PIWdg* cw =  mStW->CurrentWdg();
    1966       if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
     1991      if (cw) DeleteWidget(cw);
    19671992      }
    19681993    break;
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2638 r2651  
    4141
    4242typedef map<long, PIWindow*, less<long> > WindMList;
    43 typedef map<long, PIBaseWdg*, less<long> > BWMList;
     43typedef map<long, PIWdg*, less<long> > BWMList;
    4444typedef map<long, PIDrawer*, less<long> > DrwMList;
    4545
     
    6666  // Methodes d'Affichage generique
    6767     int  DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt,
    68                     int oid=0, bool fglock=true);
     68                    bool fgimagnav=false, int oid=0, bool fglock=true);
    6969     int  DispScDrawer(PIDrawer* scd, string const & name, string const & opt,
    7070                       string title="", int oid=0, bool fglock=true);
     
    114114
    115115     void DeleteWindow(PIWindow* w);
    116      void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
     116     void DeleteWidget(PIWdg* w, bool dw=true, bool dwin=true);
    117117     void DelWRsId(int k);
    118118     bool CheckWRsId(int k);
Note: See TracChangeset for help on using the changeset viewer.