Changeset 1549 in Sophya


Ignore:
Timestamp:
Jun 27, 2001, 10:11:31 AM (24 years ago)
Author:
ansari
Message:

Introduction de la possibilite d'afficher des informations complementaires en fonction de la position souris ds PIImage - (Extension de l'interface P2DArrayAdapter) - Reza 27/6/2001

Location:
trunk/SophyaPI/PI
Files:
3 edited

Legend:

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

    r1040 r1549  
    113113invX = invY = eXY = false;
    114114DefineXYCoordinates(0.,0.,1.,1.);
     115SetInfoStringFunction(NULL);
    115116}
    116117
     
    143144x = mOx+ix*mDx;
    144145y = mOy+iy*mDy;
     146}
     147
     148static char ibuff[256];
     149
     150/* --Methode-- */
     151char * P2DArrayAdapter::InfoString(int ix, int iy)
     152{
     153  double x,y;
     154  this->Coord(ix, iy, x, y);
     155  char * isr = "";
     156  if (ISFunc)  isr = ISFunc(this, ix, iy);
     157  sprintf(ibuff,"X= %g Y= %g  Pix= %8g %s        ",
     158          x, y , this->Value(ix, iy), isr );
     159  return (ibuff);
    145160}
    146161
  • trunk/SophyaPI/PI/parradapter.h

    r292 r1549  
    2828// autres classes de PI qui operent sur des structures
    2929// de type Tableaux 2-D (images, ...)
     30class P2DArrayAdapter;
    3031
     32typedef char * (* P2DAA_InfoStringFunc) (P2DArrayAdapter * aa, int ix, int iy);
     33/* Longueur de retour de P2DAA_InfoString : 128 char */
     34 
    3135class P2DArrayAdapter {
    3236public :
     
    4549
    4650  virtual void    XYfromxy(int ix, int iy, double& x, double& y);
     51
     52  virtual char *  InfoString(int ix, int iy);
     53
     54  inline  void    SetInfoStringFunction(P2DAA_InfoStringFunc isf)
     55                  { ISFunc = isf; }
    4756
    4857  inline  int     XSize() { return ( eXY ? sY : sX ) ; }
     
    7887  int offX, offY;
    7988  bool invX, invY, eXY;
     89
     90  P2DAA_InfoStringFunc ISFunc;
     91
    8092};
    8193
  • trunk/SophyaPI/PI/piimage.cc

    r1503 r1549  
    310310showinfo = si;
    311311if (showinfo && img)  {
    312   char buff[256];
    313   double x,y;
    314   img->Coord(xpav, ypav, x, y);
    315   sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
    316           x, y , (*img)(xpav, ypav), xpav, ypav );
    317   DrawInfo(mWGrC, buff);
     312  char * ibuff = img->InfoString(xpav, ypav);
     313  DrawInfo(mWGrC, ibuff);
    318314  }
    319315else DrawInfo(mWGrC, NULL);
     
    572568  }
    573569else {
    574   char buff[256];
    575   double x,y;
    576   img->Coord(xpav, ypav, x, y);
    577   sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
    578           x, y , (*img)(xpav, ypav), xpav, ypav );
    579   if (ustrtw || atrtw)  trtlb->SetLabel((string)buff);
    580   else DrawInfo(mWGrC, buff);
     570  char * ibuff = img->InfoString(xpav, ypav);
     571  if (ustrtw || atrtw)  trtlb->SetLabel((string)ibuff);
     572  else DrawInfo(mWGrC, ibuff);
    581573  }
    582574if (zow != NULL)   ComputeZoomPixmap();
     
    616608
    617609if (showinfo && img) {
    618   char buff[256];
    619   double x,y;
    620   img->Coord(xpav, ypav, x, y);
    621   sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
    622         x, y , (*img)(xpav, ypav), xpav, ypav );
    623   DrawInfo(mWGrC, buff);
     610  char * ibuff = img->InfoString(xpav, ypav);
     611  DrawInfo(mWGrC, ibuff);
    624612  }
    625613
     
    773761
    774762 {
    775  char buff[256]; 
    776  double x,y;
    777  img->Coord(xp, yp, x, y);
    778  sprintf(buff," X= %g , Y= %g  Pix= %g  (C= %d,%d)   ",
    779          x, y , (*img)(xp, yp),  (xp+xpv0)/2, (yp+ypv0)/2 );
    780  if (ustrtw || atrtw) trtlb->SetLabel((string)buff);
    781  else DrawInfo(mWGrC, buff);
     763  char * ibuff = img->InfoString((xp+xpv0)/2, (yp+ypv0)/2 );
     764 if (ustrtw || atrtw) trtlb->SetLabel((string)ibuff);
     765 else DrawInfo(mWGrC, ibuff);
    782766 }
    783767
Note: See TracChangeset for help on using the changeset viewer.