Changeset 104 in Sophya for trunk/SophyaPI
- Timestamp:
- May 5, 1998, 7:18:25 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/picons.cc
r98 r104 442 442 AssignKeyboard(); 443 443 mWGrC->SelGOMode(PI_GOXOR); 444 mWGrC->SelForeground( mFgC);444 mWGrC->SelForeground(PI_Grey); 445 445 mCPbeginC = x; mCPbeginL = y; 446 446 mCPendC = mCPendL = -1; … … 659 659 } 660 660 lva = mAtt[mLPo[l]+j]; 661 g->SelFont(mFTaille, vafat[lva]); 662 if (lva & PIVA_Select) bgc = PI_Grey; 663 else bgc = dbgc; 661 if (lva & PIVA_Select) 662 { bgc = PI_Grey; g->SelFont(mFTaille, vafat[lva-PIVA_Select]); } 663 else { bgc = dbgc; g->SelFont(mFTaille, vafat[lva]); } 664 664 665 if (lva & PIVA_Reverse) { 665 666 g->SelForeground(bgc); -
trunk/SophyaPI/PI/piimage.cc
r88 r104 105 105 106 106 /* --Methode-- */ 107 void PIImage::SetImage( RzImage*pim, bool refr)107 void PIImage::SetImage(P2DArrayAdapter *pim, bool refr) 108 108 { 109 109 … … 121 121 // SetSize(img->XSize(), img->YSize()); 122 122 CenterPave(); 123 if (img->minPix>img->maxPix) img->CheckDyn(); 124 SetLut(img->minPix, img->maxPix, kLutType_Lin, 1, refr); 123 float min=1., max=-1., moy, sig; 124 int nbnul, nbsat; 125 img->CheckDyn(min, max, moy, sig, nbnul, nbsat); 126 SetLut(min, max, kLutType_Lin, 1, refr); 125 127 } 126 128 return; … … 217 219 { 218 220 if (lut) delete(lut); 219 if (lauto && img) 220 { 221 float fracnul, fracsat; 222 float fnd, sigfnd; 223 float minpix = min; 224 float maxpix = max; 225 int npix = img->XSize()*img->YSize(); 226 int rc = -1; 227 if (npix > 2500) // Ca ne marche pas quand il n'y a pas assez de pixels ... 228 { 229 int vitesse=npix/20000; 230 vitesse = (vitesse < 1) ? 1 : ((vitesse > 25) ? 25 : vitesse ); 231 int nbin=npix/10; 232 nbin = (nbin < 1) ? 1 : ((nbin > 500) ? 500 : nbin ); 233 int nbsig = lauto; 234 float fracmax = 0.95; 235 rc = RzFondSig2Ciel(img, vitesse, fracmax, nbsig, nbin, &minpix, &maxpix, 236 &fnd, &sigfnd, &min, &max, &fracnul, &fracsat); 237 } 238 if (rc != 0) 239 { 240 img->CheckDyn(minpix, maxpix); 241 min = img->moyPix-3.*img->sigPix; 242 max = img->moyPix+3.*img->sigPix; 243 if (min < minpix) min = minpix; 244 if (max > maxpix) max = maxpix; 245 } 221 if (lauto && img) 222 { 223 int nbsig = lauto; 224 float fracmax = 1. - 0.05*nbsig; 225 img->ComputeLut_PicHisto(min, max, nbsig, fracmax); 246 226 } 247 227 … … 366 346 { 367 347 char buff[256]; 368 sprintf(buff,"X= %d , Y= %d PixVal= %g ", /*(char *)Nom().c_str(),*/ 369 xpav, ypav, img->FValue(xpav, ypav)); 348 float x,y; 349 img->XYCoord(xpav, ypav, x, y); 350 sprintf(buff,"X= %g , Y= %g PixVal= %g (%d,%d)", 351 x, y , (*img)(xpav, ypav), xpav, ypav ); 370 352 if (txw) txw->SetLabel((string)buff); 371 353 if (trtlb) trtlb->SetLabel((string)buff); … … 471 453 if (txw || trtlb) 472 454 { 473 char buff[256]; 474 sprintf(buff,"X,Y= %d,%d PixVal= %g (X,Yc= %d,%d)", 475 xp, yp, img->FValue(xp, yp), (xp+xpv0)/2, (yp+ypv0)/2); 455 char buff[256]; 456 float x,y; 457 img->XYCoord(xp, yp, x, y); 458 sprintf(buff,"X= %g , Y= %g PixVal= %g (C= %d,%d)", 459 x, y , (*img)(xp, yp), (xp+xpv0)/2, (yp+ypv0)/2 ); 476 460 if (txw) txw->SetLabel((string)buff); 477 461 if (trtlb) trtlb->SetLabel((string)buff); … … 561 545 } 562 546 563 /* --Methode-- */564 unsigned char * PIImage::ComputePixmap(int ofx, int ofy, int zm,565 int xwsz, int ywsz, unsigned char * opix,566 int * oxsp, int * oysp)567 {568 unsigned char *pix, *pp, ucp;569 int zmm=1;570 int npx, npy, nppx, nppy, nszp, oszp;571 int i,j,k,l;572 float vpx;573 574 575 if ( (img == NULL) || (lut == NULL) )576 { /* printf("PIImage::ComputePixmap:Pb img ou lut %ld %ld \n",577 (long)img, (long)lut); */578 *oxsp = *oysp = 0; return(NULL); }579 580 npx = img->XSize()-ofx;581 npy = img->YSize()-ofy;582 583 if ((zm == 0) || (zm == -1)) zm = 1;584 585 if (zm >= 1)586 {587 if (npx > (xwsz/zm)) npx = xwsz/zm;588 if (npy > (ywsz/zm)) npy = ywsz/zm;589 nppx = npx*zm; nppy = npy*zm;590 }591 if (zm < -1)592 {593 zmm = -zm;594 nppx = npx/zmm; nppy = npy/zmm;595 if (nppx > xwsz) nppx = xwsz;596 if (nppy > ywsz) nppy = ywsz;597 npx = nppx*zmm; npy = nppy*zmm;598 }599 600 oszp = (*oxsp)*(*oysp);601 nszp = nppx*nppy;602 if ( oszp != nszp )603 {604 if (opix) delete[] opix;605 pix = new unsigned char[nppx*nppy];606 if (pix == NULL) { *oxsp = *oysp = 0; ; return(NULL); }607 }608 else pix = opix;609 *oxsp = nppx; *oysp = nppy;610 611 /*612 printf("Debug_ComputePixmap %d %d %d (%d-%d %d-%d)\n",613 ofx, ofy, zm, npx,nppx, npy,nppy);614 */615 616 pp = pix;617 if (zm == 1) // Pas de zoom618 {619 for(j=ofy; j<ofy+npy; j++)620 for(i=ofx; i<ofx+npx; i++)621 { *pp = (unsigned char) lut->Apply(img->FValue(i,j)); pp++; }622 }623 else if (zm < -1) // Compression624 {625 float fv = (float)(zmm*zmm);626 for(j=ofy; j<ofy+npy; j+=zmm)627 for(i=ofx; i<ofx+npx; i+=zmm)628 {629 vpx = 0;630 for(l=0; l<zmm; l++)631 for(k=0; k<zmm; k++)632 vpx += img->FValue(i+k, j+l);633 *pp = (unsigned char) lut->Apply(vpx/fv);634 pp++;635 }636 }637 else // Agrandissement638 {639 for(j=ofy; j<ofy+npy; j++)640 for(i=ofx; i<ofx+npx; i++)641 {642 ucp = (unsigned char) lut->Apply(img->FValue(i,j));643 for(l=0; l<zm; l++)644 {645 pp = pix+((j-ofy)*zm+l)*nppx+((i-ofx)*zm);646 for(k=0; k<zm; k++) { *pp = ucp; pp++; }647 }648 }649 }650 651 return(pix);652 }653 547 654 548 /* --Methode-- */ … … 661 555 ywsz = this->YSize(); 662 556 663 pixm = ComputePixmap(offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm);557 pixm = img->ComputePixmap(lut, offx, offy, zoom, xwsz, ywsz, pixm, &xspxm, &yspxm); 664 558 SetPixmap(pixm, xspxm, yspxm); 665 559 // Refresh(); … … 696 590 if (ofy < 0) ofy = 0; 697 591 698 zpixm = ComputePixmap(ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm);592 zpixm = img->ComputePixmap(lut, ofx, ofy, zm, xwsz, ywsz, zpixm, &xszpxm, &yszpxm); 699 593 zow->SetColMap(GetColMapId(), false); 700 594 zow->SetPixmap(zpixm, xszpxm, yszpxm); … … 725 619 zmgv = zmx; 726 620 if (zmx > 1) zmx = -zmx; 727 gpixm = ComputePixmap(0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm);621 gpixm = img->ComputePixmap(lut, 0, 0, zmx, xwsz, ywsz, gpixm, &xsgpxm, &ysgpxm); 728 622 return; 729 623 } … … 803 697 if ( (winovis || (nbmrk < 1) ) ) return; 804 698 tofx = tofy = 0; 805 if ( img ) { tofx = img->XOrg(); tofy = img->YOrg(); }699 if ( img ) { tofx = tofy = 0; } /* img->XOrg(); tofy = img->YOrg(); $CHECK$ REZA 5/04/98 */ 806 700 tofx += offx; tofy += offy; 807 701 fz = GetZoomF(); -
trunk/SophyaPI/PI/piimage.h
r88 r104 6 6 #define PIIMAGEBASE_H_SEEN 7 7 8 #include "cimage.h" 9 #include "lut.h" 8 #include "parradapter.h" 10 9 11 10 #include "pisysdep.h" … … 30 29 virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); 31 30 32 void SetImage( RzImage* pim, bool refr=true);31 void SetImage(P2DArrayAdapter* pim, bool refr=true); 33 32 void SetAutoDelImage(bool ad = false); 34 33 … … 55 54 virtual void SetColMap(CMapId cmap, bool refr=true); 56 55 57 inline RzImage* Image() { return(img); }56 inline P2DArrayAdapter * Image() { return(img); } 58 57 inline LUT * Lut() { return(lut); } 59 58 inline int XPave() { return(xpav); } ; … … 80 79 private: 81 80 82 unsigned char * ComputePixmap(int ofx, int ofy, int zm,83 int xwsz, int ywsz, unsigned char * opix,84 int * oxszp, int * oyszp);85 81 void ComputePixmap(); 86 82 void ComputeZoomPixmap(); … … 102 98 // Les donnees 103 99 104 RzImage* img;100 P2DArrayAdapter * img; 105 101 bool aisup; 106 102 bool curshow; -
trunk/SophyaPI/PI/pistdwdgx.cc
r98 r104 5 5 #include PISTDWDG_H 6 6 7 // Note du 26/02/98 - Reza 7 // ------- Pb de gestion du focus-keyboard Motif-PIBaseWdg ------- 8 // ** Note du 26/02/98 - Reza 8 9 // Je desactive pour le moment XmNnavigationType et XmNtraversalOn 9 10 // afin d'ameliorer la gestion du focus-keyboard entre Widget Motif 10 11 // et objet Peida - Cela semble avoir un effet secondaire - 11 12 // Il faut que la souris reste dans le widget Text pour taper dedans 13 // ** Note du 30/04/98 - Reza 14 // J'ai modifie le mecanisme de gestion des evenements pour PIBaseWdg 15 // en passant par un EventHandler - Le probleme de gestion du 16 // focus-keyboard n'a pour autant pas ete resolu 17 // Je reactive XmNtraversalOn pour les PIText - Le probleme 18 // d'attribution du focus-keyboard au PIBaseWdg reste si on 19 // met PIText et un PIBaseWdg ds un meme conteneur 20 12 21 13 22 /************* PILabelX ************/ … … 151 160 CreateXtWdg(nom, xmTextWidgetClass, NULL, sx, sy, px, py); 152 161 XtSetArg(warg[n],XmNnavigationType,XmNONE); n++; 153 XtSetArg(warg[n],XmNtraversalOn,FALSE); n++;162 // XtSetArg(warg[n],XmNtraversalOn,FALSE); n++; 154 163 XtSetValues(XtWdg(), warg, n); 155 164 SetMutiLineMode(false); -
trunk/SophyaPI/PI/pixtbase.cc
r103 r104 13 13 14 14 // #define DEBUG_PIXTB 15 16 17 // ------- Pb de gestion du focus-keyboard Motif-PIBaseWdg ------- 18 // ** Note 30/04/98 Reza 19 // Il y un probleme d'attribution du focus-keyboard entre Widget Motif et 20 // PIBaseWdg (Widget PIXtBase) les Attributs XmNnavigationType et XmNtraversalOn 21 // ont ete desactives pour les StdWdgX - Le probleme n'a pas pu etre resolu 22 // meme en attribuant les attributs XmNnavigationType XmNtraversalOn 23 // (et XmNsensitive) a PIXtBase, ni en utilisant 24 // XSetInputFocus(XtDisplay (wdgp), XtWindow(wdgp), RevertToParent, evt->xbutton.time) 25 // Solution pour le moment : 26 // XmNnavigationType =XmNONE et XmNtraversalOn=FALSE pour les PIStdWdgX 27 // sauf pour PIText ou XmNtraversalOn=TRUE 28 15 29 16 30 /* Construction du widget Xt PIXtBase */ … … 24 38 25 39 26 static Boolean acceptfocus_pixtbase (Widget, Time* ); 40 // Si on ne veut pas utiliser XtInheritAcceptFocus 41 // static Boolean acceptfocus_pixtbase (Widget, Time* ); 27 42 28 43 … … 64 79 XtInheritSetValuesAlmost, /* set_values got "Almost" geo reply*/ 65 80 NULL, /* notify that get_values called */ 66 //XtInheritAcceptFocus, /* assign input focus to widget */67 acceptfocus_pixtbase, /* assign input focus to widget */81 XtInheritAcceptFocus, /* assign input focus to widget */ 82 // acceptfocus_pixtbase, /* assign input focus to widget */ 68 83 XtVersion, /* version of intrinsics used */ 69 84 NULL, /* list of callback offsets */ … … 161 176 } 162 177 163 /* Nouvelle-Fonction */178 /* Nouvelle-Fonction 164 179 static Boolean acceptfocus_pixtbase (Widget wdgp , Time* ) 165 180 { 166 printf("acceptfocus_pixtbase() %x %x \n", ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask, ShiftMask );181 // printf("acceptfocus_pixtbase() %lx %x \n", ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask, ShiftMask ); 167 182 if ( ((PIXtBaseWidget)wdgp)->pixtbase.myeventmask & ShiftMask ) return TRUE; 168 183 else return FALSE; 169 184 } 185 */ 170 186 171 187 /* -------- Fonction de traitement des evenements --------- */
Note:
See TracChangeset
for help on using the changeset viewer.