Changeset 118 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Jul 8, 1998, 7:47:58 PM (27 years ago)
Author:
ansari
Message:

PIImgTools complete Reza 8/7/98

Location:
trunk/SophyaPI/PI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/pibwdggen.cc

    r113 r118  
    5757puts("Debug_PIBaseWdgGen::Draw() Efface la fenetre par defaut ! ");
    5858#endif
    59 EraseWindow(0, 0, XSize(), YSize());
     59if (g->kind() != PI_PSFileGraphics) EraseWindow(0, 0, XSize(), YSize());
    6060if (fgdrawloop == 0)
    6161  { fgdrawloop=2;  Draw(g, 0, 0, XSize(), YSize()); }
  • trunk/SophyaPI/PI/piimage.h

    r113 r118  
    6262  inline int XSzPave() { return(xszpav); }
    6363  inline int YSzPave() { return(yszpav); }
     64
     65  inline PIElDrawer* MyElDrawer() { return (mdrw); }
    6466
    6567  void Apply(bool mw=true);
  • trunk/SophyaPI/PI/piimgtools.cc

    r117 r118  
    3333
    3434int wszx = 8*spx+3*bsx+2*bsy;
    35 int wszy = 10*spy+9*bsy;
     35int wszy = 9*spy+9*bsy;
    3636SetSize(wszx, wszy);
    3737
     
    8484cpy += 2*spy+bsy;
    8585cpx = bsx/2;
    86 mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.5, bsy, cpx, cpy);
     86mBut[0] = new PIButton(this, "Apply", 2500, bsx*1.75, bsy, cpx, cpy);
    8787cpx += bsx*2;
    88 mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.5, bsy, cpx, cpy);
     88mBut[1] = new PIButton(this, "Dismiss", 2600,  bsx*1.75, bsy, cpx, cpy);
    8989mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    9090mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    9191
    92 int offy = cpy+bsy+spy*3;
    93 printf("-DBG- PIImgLutWind()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
    94 
    95 cpx = 6*spx+2.75*bsx;
     92int offy = cpy+bsy+spy*2;
     93// printf("-DBG- PIImgLutWind()  SzX,Y= %d %d , ButPos= %d %d (off=%d)\n", wszx, wszy, cpx, cpy, offy);
     94
     95cpx = 4*spx+2.75*bsx;
    9696cpy = 2*spy;
    9797mSc[0] = new PIScale(this, "sc-offset-lut", 2700, false, bsy*0.75, 4.5*bsy, cpx, cpy);
     
    106106
    107107//  Option-Menu  Couleur/Zoom
    108 cpx = 3*spx;
     108cpx = bsx/2;
    109109cpy = offy;
    110 mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", 1.5*bsx, bsy, cpx, cpy);
     110mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy);
    111111mOptzc[0]->AppendItem("Grey32", 201);
    112112mOptzc[0]->AppendItem("GreyInv32", 202);
     
    122122mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    123123
    124 cpx += 1.5*bsx+3*spx;
    125 mOptzc[1] = new PIOptMenu(this, "imglut-opt-4", 1.5*bsx, bsy, cpx, cpy);
     124cpx += bsx*2;
     125mOptzc[1] = new PIOptMenu(this, "imglut-opt-4", bsx*1.75, bsy, cpx, cpy);
    126126mOptzc[1]->AppendItem("Agr. x10", 110);
    127127mOptzc[1]->AppendItem("Agr. x 8", 108);
     
    142142mOptzc[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    143143
    144 cpx = 2*spx;
    145 cpy += bsy+spy;
    146 mButsz[0] = new PIButton(this, "1x1", 3201,  bsx/2, bsy, cpx, cpy);
     144int pbsx = bsy;
     145int pbsy = bsy;
     146int pspx = spy/2;
     147int pspy = spy;
     148
     149cpx = 2*pspx;
     150cpy += pbsy+2*spy;
     151mButsz[0] = new PIButton(this, "1x1", 3201,  pbsx, pbsy, cpx, cpy);
    147152mButsz[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    148 cpx += bsx/2+spx;
    149 mButsz[1] = new PIButton(this, "1x2", 3202,  bsx/2, bsy, cpx, cpy);
     153cpx += pbsx+pspx;
     154mButsz[1] = new PIButton(this, "1x2", 3202,  pbsx, pbsy, cpx, cpy);
    150155mButsz[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    151 cpx += bsx/2+spx;
    152 mButsz[2] = new PIButton(this, "1x4", 3204,  bsx/2, bsy, cpx, cpy);
     156cpx += pbsx+pspx;
     157mButsz[2] = new PIButton(this, "1x4", 3204,  pbsx, pbsy, cpx, cpy);
    153158mButsz[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    154 cpx += bsx/2+spx;
    155 mButsz[3] = new PIButton(this, "1/2", 3198,  bsx/2, bsy, cpx, cpy);
     159cpx += pbsx+pspx;
     160mButsz[3] = new PIButton(this, "1/2", 3198,  pbsx, pbsy, cpx, cpy);
    156161mButsz[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    157 cpx += bsx/2+spx;
    158 mButsz[4] = new PIButton(this, "1/4", 3196,  bsx/2, bsy, cpx, cpy);
     162cpx += pbsx+pspx;
     163mButsz[4] = new PIButton(this, "1/4", 3196,  pbsx, pbsy, cpx, cpy);
    159164mButsz[4]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    160165
    161 cpx = 2*spx;
    162 cpy += bsy+spy;
    163 mButcax[0] = new PIButton(this, "- X", 5201,  bsx/2, bsy, cpx, cpy);
     166cpx += pbsx+10*pspx;
     167mButoa[0] = new PIButton(this, "+Info", 5311,  1.5*pbsx, pbsy, cpx, cpy);
     168mButoa[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     169cpx += 1.5*pbsx+pspx;
     170mButoa[1] = new PIButton(this, "-Info", 5312,  1.5*pbsx, pbsy, cpx, cpy);
     171mButoa[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     172
     173
     174cpx = 2*pspx;
     175cpy += pbsy+pspy;
     176mButcax[0] = new PIButton(this, "-X", 5201,  pbsx, pbsy, cpx, cpy);
    164177mButcax[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    165 cpx += bsx/2+spx;
    166 mButcax[1] = new PIButton(this, "- Y", 5202,  bsx/2, bsy, cpx, cpy);
     178cpx += pbsx+pspx;
     179mButcax[1] = new PIButton(this, "-Y", 5202,  pbsx, pbsy, cpx, cpy);
    167180mButcax[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    168 cpx += bsx/2+spx;
    169 mButcax[2] = new PIButton(this, "X<>Y", 5203,  bsx/2, bsy, cpx, cpy);
     181cpx += pbsx+pspx;
     182mButcax[2] = new PIButton(this, "X-Y", 5203, pbsx, pbsy, cpx, cpy);
    170183mButcax[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     184
     185cpx += 1.5*pbsx+pspx+10*pspx;
     186mButoa[2] = new PIButton(this, "-All", 5300,  1.5*pbsx, pbsy, cpx, cpy);
     187mButoa[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     188cpx += 1.5*pbsx+pspx;
     189mButoa[3] = new PIButton(this, "+Curs", 5321,  1.5*pbsx, pbsy, cpx, cpy);
     190mButoa[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     191cpx += 1.5*pbsx+pspx;
     192mButoa[4] = new PIButton(this, "+Axe", 5331,  1.5*pbsx, pbsy, cpx, cpy);
     193mButoa[4]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    171194
    172195curlutw = this;
     
    190213for(int i=0; i<5; i++)  delete mButsz[i];
    191214for(int i=0; i<3; i++)  delete mButcax[i];
     215for(int i=0; i<5; i++)  delete mButoa[i];
    192216
    193217}
     
    201225mpii = PIImage::CurrentPIImage();
    202226if (mpii == NULL)  return;
    203 sprintf(buff,"%g", (mpii->Lut())->Min());
     227min_lut = mpii->Lut()->Min();
     228max_lut = mpii->Lut()->Max();
     229sprintf(buff,"%g", min_lut);
    204230mText[0]->SetText(buff);
    205 sprintf(buff,"%g", (mpii->Lut())->Max());
     231sprintf(buff,"%g", max_lut);
    206232mText[1]->SetText(buff);
    207233if ( (mpii->Lut())->Type() == kLutType_Lin )
     
    212238mSc[0]->SetValue(0);
    213239mSc[1]->SetValue(0);
     240mOptzc[0]->SetValue(203);
     241mOptzc[1]->SetValue(101);
    214242return;
    215243}
     
    238266    max = atof(mText[1]->GetText().c_str());
    239267    if (msg == 2700) {
    240       del = max-min;
    241       min += (float)mSc[0]->GetValue()/100*del;
    242       max += (float)mSc[0]->GetValue()/100*del;
     268      del = max_lut-min_lut;
     269      min = min_lut+(float)mSc[0]->GetValue()/100*del;
     270      max = max_lut+(float)mSc[0]->GetValue()/100*del;
    243271    }
    244272    if (msg == 2800) {
    245       del = max-min;
    246       min -= (float)mSc[1]->GetValue()/100.*del*0.5;
    247       max += (float)mSc[1]->GetValue()/100.*del*0.5;
     273      del = max_lut-min_lut;
     274      min = min_lut-(float)mSc[1]->GetValue()/100.*del*0.5;
     275      max = max_lut+(float)mSc[1]->GetValue()/100.*del*0.5;
    248276    }
    249277    if ( (msg == 2700) || (msg == 2800) ) {
     
    253281      sprintf(buff,"%g", max);
    254282      mText[1]->SetText(buff);
    255     }
    256     lauto = mOpt[1]->GetValue() - 1200;
     283      lauto = 0;
     284    }
     285    else lauto = mOpt[1]->GetValue() - 1200;
    257286    typ = mOpt[0]->GetValue() - 1100;
    258287    if ( (typ < 0) || (typ > 1) )  typ = 0;
    259288    (PIImage::CurrentPIImage())->SetLut(min, max, typlut[typ], lauto);
    260     mSc[0]->SetValue(0);
    261     mSc[1]->SetValue(0);
     289    if (msg == 2500) {
     290      min_lut = min;   max_lut = max;
     291      mSc[0]->SetValue(0);
     292      mSc[1]->SetValue(0);
     293      }
    262294//    ((PIImage::CurrentPIImage())->Lut())->Print();
    263295    }
     
    271303    {
    272304    PIImage* pimg = PIImage::CurrentPIImage();
    273     printf(" --DBG-- msg= %ld  pimg= %lx \n", (long)msg, (long)pimg);
    274305    int zm = msg-3200;
    275306    pimg->SetZoom(zm, false);
     
    289320    if ((snx != sx) || (sny != sy))
    290321      {
     322      int szinc[2];
    291323      pimg->SetOffset(0, 0, false);
    292       if (((PIContainer*)(pimg-Parent()))->NbChilds() == 1) 
    293         ((PIContainer*)(pimg-Parent()))->SetSize(snx, sny);
     324      szinc[0] = snx-sx;   szinc[1] = sny-sy;
     325      pimg->Send(pimg->Msg(), PIMsg_ResizeRequest, szinc); 
    294326      }
    295327    else   pimg->SetOffset(0, 0);
     
    306338  case 5203 :
    307339    mpii->ChangeAxesConfiguration(false, false, true);
     340    break;
     341
     342
     343  case 5300 :
     344    mpii->SetDrawAxesFlags(kAxesNone);
     345    mpii->ShowCursor(false);
     346    mpii->MyElDrawer()->ElDelAll();
     347    mpii->Refresh();
     348    break;
     349
     350  case 5321 :
     351    mpii->ShowCursor(true);
     352    break;
     353
     354  case 5331 :
     355    mpii->SetDrawAxesFlags();
    308356    break;
    309357
     
    324372  PIImage::CurrentPIImage()->SetColMap(cmap[msg-201]);
    325373
    326 }
    327 
    328 // --------------------------------------------------------------
    329 
    330 /* --Methode-- */
    331 PIImgMenu::PIImgMenu(PIApplication* par)
    332         : PIMenu(par->Menubar(), "ImgTools")
    333 {
    334 pdm[0] = new PIMenu(this, "AutoLut");
    335 pdm[0]->AppendItem("+3 Sig", 303);
    336 pdm[0]->AppendItem("+2 Sig", 302);
    337 pdm[0]->AppendItem("+1 Sig", 301);
    338 pdm[0]->AppendItem("-1 Sig", 299);
    339 pdm[0]->AppendItem("-2 Sig", 298);
    340 AppendPDMenu(pdm[0]);
    341 
    342 pdm[1] = new PIMenu(this, "Zoom");
    343 pdm[1]->AppendItem("Agr. x10", 110);
    344 pdm[1]->AppendItem("Agr. x 8", 108);
    345 pdm[1]->AppendItem("Agr. x 6", 106);
    346 pdm[1]->AppendItem("Agr. x 5", 105);
    347 pdm[1]->AppendItem("Agr. x 4", 104);
    348 pdm[1]->AppendItem("Agr. x 3", 103);
    349 pdm[1]->AppendItem("Agr. x 2", 102);
    350 pdm[1]->AppendItem("Zoom x1", 101);
    351 pdm[1]->AppendItem("Red. / 2", 98);
    352 pdm[1]->AppendItem("Red. / 3", 97);
    353 pdm[1]->AppendItem("Red. / 4", 96);
    354 pdm[1]->AppendItem("Red. / 5", 95);
    355 pdm[1]->AppendItem("Red. / 6", 94);
    356 pdm[1]->AppendItem("Red. / 8", 92);
    357 pdm[1]->AppendItem("Red. /10", 90);
    358 AppendPDMenu(pdm[1]);
    359 
    360 pdm[2] = new PIMenu(this, "ColMap");
    361 pdm[2]->AppendItem("Grey32", 201);
    362 pdm[2]->AppendItem("GreyInv32", 202);
    363 pdm[2]->AppendItem("ColRJ32", 203);
    364 pdm[2]->AppendItem("ColBR32", 204);
    365 pdm[2]->AppendItem("ColRV32", 205);
    366 AppendPDMenu(pdm[2]);
    367 
    368 AppendItem("Sz x 1", 5101);
    369 AppendCheckItem("Show Cursor", 5102);
    370 AppendCheckItem("Show Axes", 5103);
    371 pdm[3] = new PIMenu(this, "Conf. Axes");
    372 pdm[3]->AppendItem("Invert-X",  5201);
    373 pdm[3]->AppendItem("Invert-Y",  5202);
    374 pdm[3]->AppendItem("Exchange X-Y",  5203);
    375 AppendPDMenu(pdm[3]);
    376 
    377 AppendItem("Lut...", 5300);
    378 
    379 mLW = new PIImgLutWind(par);
    380 }
    381 
    382 /* --Methode-- */
    383 PIImgMenu::~PIImgMenu()
    384 {
    385 int i;
    386 for(i=0; i<4; i++)  delete pdm[i];
    387 delete mLW;
    388 }
    389 
    390 /* --Methode-- */
    391 void PIImgMenu::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
    392 {
    393 CMapId cmap[5] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
    394                    CMAP_COLBR32, CMAP_COLRV32 } ;
    395 if (PIImage::CurrentPIImage() == NULL)  return;
    396 msg = UserMsg(msg);
    397 if ((msg <= 110) && (msg >= 90))  // Zoom
    398   PIImage::CurrentPIImage()->SetZoom((int)(msg-100));
    399 else if ((msg > 200) && (msg < 206)) // Changement de couleur
    400   PIImage::CurrentPIImage()->SetColMap(cmap[msg-201]);
    401 else if ((msg > 290) && (msg < 310))
    402   PIImage::CurrentPIImage()->SetLut( PIImage::CurrentPIImage()->Lut()->Min(), PIImage::CurrentPIImage()->Lut()->Max(),
    403                                  kLutType_Lin, msg-300);
    404 else if ((msg > 500) && (msg < 505)) {
    405   PIImage* mpii = PIImage::CurrentPIImage();
    406   float x1 = (mpii->Lut())->Min();
    407   float x2 = (mpii->Lut())->Max();
    408   float dx = 0.1*(x2-x1);
    409   int typ  = (mpii->Lut())->Type();
    410   switch (msg)
    411     {
    412     case 501 :
    413       mpii->SetLut(x1-dx, x2, typ);
    414       break;
    415     case 502 :
    416       mpii->SetLut(x1+dx, x2, typ);
    417       break;
    418     case 503 :
    419       mpii->SetLut(x1, x2-dx, typ);
    420       break;
    421     case 504 :
    422       mpii->SetLut(x1, x2+dx, typ);
    423       break;
    424     default :
    425       break;
    426     }
    427 
    428 }
    429 else {
    430   PIImage* mpii = PIImage::CurrentPIImage();
    431   switch (msg)
    432     {
    433   case 5101 :
    434     mpii->SetOffset(0, 0, false);
    435     mpii->SetZoom(1, true);
    436     break;
    437 
    438   case 5102 :
    439     if (*((bool *)data))  mpii->ShowCursor(true);
    440     else  mpii->ShowCursor(false);
    441     break;
    442 
    443   case 5103 :
    444     if (*((bool *)data))  mpii->SetDrawAxesFlags();
    445     else  mpii->SetDrawAxesFlags(kAxesNone);
    446     break;
    447 
    448   case 5201 :
    449     mpii->ChangeAxesConfiguration(true, false, false);
    450     break;
    451   case 5202 :
    452     mpii->ChangeAxesConfiguration(false, true, false);
    453     break;
    454   case 5203 :
    455     mpii->ChangeAxesConfiguration(false, false, true);
    456     break;
    457 
    458   case 5300 :
    459     mLW->Show();
    460     break;
    461 
    462   default :
    463     break;
    464   }
    465 }
    466374return;
    467375}
     376
  • trunk/SophyaPI/PI/piimgtools.h

    r116 r118  
    88#include "pisysdep.h"
    99#include PISTDWDG_H
    10 #include PIMENU_H
    1110#include PIOPTMENU_H
    1211#include PIWIN_H
    1312#include PIAPP_H
    1413
    15 // ------ Menu des options et fenetre de dialogue pour changement de LUT --------
     14// ------ fenetre de dialogue pour changement de LUT et options de PIImage --------
     15// --------------------------------------------------------------------------------
    1616
    17 // --------------------------------------------------------------
    1817class PIImgLutWind : public PIWindow {
    1918public :
     
    3534  PILabel* mOlb[2];
    3635  PIScale* mSc[2];
     36  float min_lut,max_lut;
    3737// Pour la couleur et le zoom
    3838  PIOptMenu* mOptzc[2];
    3939// Pour expand et compress
    4040  PIButton* mButsz[5];
    41 // Pour options d'affichage
    42   PIButton* mButoa[6];
    4341// Config axes
    4442  PIButton* mButcax[3];
     43// Options show/hide
     44  PIButton* mButoa[5];
    4545};
    4646
    4747
    48 class PIImgMenu : public PIMenu
    49 {
    50 public :
    51                         PIImgMenu(PIApplication* app);
    52  virtual                ~PIImgMenu();
    53 protected:
    54   virtual void          Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
    55 PIMenu* pdm[4];
    56 PIImgLutWind* mLW;
    57 };
    58 
    5948
    6049#endif
  • trunk/SophyaPI/PI/pioptmenux.cc

    r114 r118  
    4545int n = 0;
    4646CreateXtWdg(nom, xmPushButtonWidgetClass, NULL, sx, sy, px, py);
     47XtSetArg(warg[n],XmNhighlightThickness, 0);  n++;
    4748XtSetArg(warg[n], XmNrecomputeSize, FALSE); n++;
    4849XtSetArg(warg[n],XmNnavigationType,XmNONE);  n++;
  • trunk/SophyaPI/PI/pisurfdr.cc

    r116 r118  
    5454  D *= 1.5;
    5555 
    56   Set3DView((xmin+xmax)/2., (ymin+ymax)/2, (zmin+zmax)*0.4,
     56  Set3DView((xmin+xmax)/2., (ymin+ymax)/2, zmin+(zmax-zmin)*0.4,
    5757            (xmin+xmax)/2.+D , (ymin+ymax)/2.+2.*D , zmin+(zmax-zmin)*0.1, 0.3, 0.3); 
    5858//  printf("PISurfaceDrawer::UpdateSize() : %g-%g  %g-%g  %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D);
Note: See TracChangeset for help on using the changeset viewer.