Changeset 204 in Sophya for trunk/SophyaPI


Ignore:
Timestamp:
Mar 1, 1999, 6:03:26 PM (27 years ago)
Author:
ercodmgr
Message:

1/ Correction d'erreur liee a la gestion de la destruction des Widgets Xt
en particulier pour les PIWindowX
2/ Passage en double de trace en coordonnees graphiques User (UC)
(float -> double)
3/ Passage en double pour les ArrayAdapter

Reza 1/03/99

Location:
trunk/SophyaPI/PI
Files:
36 edited

Legend:

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

    r106 r204  
    1414/* --Methode-- */
    1515
    16 LUT::LUT(float min, float max, unsigned short ncol, int typ, int ntable)
     16LUT::LUT(double min, double max, unsigned short ncol, int typ, int ntable)
    1717{
    1818int nlev;
     
    2121nlev = ncol-2;
    2222if (nlev < 1)  nlev = 1;
    23 bornes = new float[nlev+1];
     23bornes = new double[nlev+1];
    2424
    2525if (bornes == NULL)  return;
     
    4040
    4141/* --Methode-- */
    42 void LUT::SetLut(float min, float max, int typ)
     42void LUT::SetLut(double min, double max, int typ)
    4343{
    4444
     
    4949  {
    5050  int i;
    51   float dx;
     51  double dx;
    5252  double dlx;
    5353  switch (typ)
    5454    {
    5555    case kLutType_Lin :
    56       dx = (max-min)/(float)nLevel;
     56      dx = (max-min)/(double)nLevel;
    5757      for(i=0; i<nLevel; i++)
    58         bornes[i] = min+(float)i*dx;
     58        bornes[i] = min+(double)i*dx;
    5959      break;
    6060    case kLutType_Log :
    61       dlx = log(max-min) / (float)nLevel;
     61      dlx = log(max-min) / (double)nLevel;
    6262      for(i=0; i<nLevel; i++)
    63         bornes[i] = min+(float)exp((double)i*dlx);
     63        bornes[i] = min+(double)exp((double)i*dlx);
    6464      break;
    6565    default:
     
    8787
    8888/* --Methode-- */
    89 unsigned short LUT::Apply(float x)
     89unsigned short LUT::Apply(double x)
    9090{
    9191int i;
     
    102102table = new unsigned short [nt-2];
    103103tablebinwidth = (Max()-Min())/(nt-2);
    104 float x = Min()+0.5*tablebinwidth;
     104double x = Min()+0.5*tablebinwidth;
    105105for(int i=0; i<nt-2; i++)  { table[i] = Apply(x); x += tablebinwidth; }
    106106}
  • trunk/SophyaPI/PI/lut.h

    r127 r204  
    1919public:
    2020 
    21   LUT(float min, float max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable=-1);
     21  LUT(double min, double max, unsigned short ncol=16, int typ=kLutType_Lin, int ntable=-1);
    2222  ~LUT();
    23   void SetLut(float min, float max, int typ=0);
     23  void SetLut(double min, double max, int typ=0);
    2424  void Print();
    25   unsigned short Apply(float x);
    26   inline unsigned short ApplyFast(float x)
     25  unsigned short Apply(double x);
     26  inline unsigned short ApplyFast(double x)
    2727    {
    2828    if (x < Min())  return(0);
     
    3232    }
    3333
    34   inline float Min() { return(bornes[0]); };
    35   inline float Max() { return(bornes[nLevel]); };
     34  inline double Min() { return(bornes[0]); };
     35  inline double Max() { return(bornes[nLevel]); };
    3636  inline int Type() { return(type); };
    3737  inline int NCol() { return(nLevel+2); };
     
    4242  int type;
    4343  int nLevel;
    44   float * bornes;
     44  double * bornes;
    4545  unsigned short * table;
    46   float tablebinwidth;
     46  double tablebinwidth;
    4747
    4848};
  • trunk/SophyaPI/PI/parradapter.cc

    r140 r204  
    2222
    2323/* --Methode-- */
    24 void P1DArrayAdapter::DefineXCoordinate(float x0, float dx)
     24void P1DArrayAdapter::DefineXCoordinate(double x0, double dx)
    2525{
    2626mOx = x0;  mDx = dx;
     
    2828
    2929/* --Methode-- */
    30 float P1DArrayAdapter::X(int i)
     30double P1DArrayAdapter::X(int i)
    3131{
    3232return(mOx+mDx*i);
     
    6060
    6161/* --Methode-- */
    62 void P2DArrayAdapter::DefineXYCoordinates(float x0, float y0, float dx, float dy)
     62void P2DArrayAdapter::DefineXYCoordinates(double x0, double y0, double dx, double dy)
    6363{
    6464mOx = x0;   mOy = y0;
     
    6767
    6868/* --Methode-- */
    69 void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)
     69void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y)
    7070{
    7171x = mOx+ix*mDx;
     
    7474
    7575/* --Methode-- */
    76 int P2DArrayAdapter::CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)
     76int P2DArrayAdapter::CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit)
    7777{
    7878// TIMEF ;
     
    8585
    8686if (min >= max) { min = -9.e19; max = 9.e19; }
    87 float minpix = max;
    88 float maxpix = min;
    89 float pixv;
     87double minpix = max;
     88double maxpix = min;
     89double pixv;
    9090// printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max);
    9191
     
    130130
    131131/* --Methode-- */
    132 void P2DArrayAdapter::ComputeLut_PicHisto(float& min, float& max, int nbsig, float fracmax)
     132void P2DArrayAdapter::ComputeLut_PicHisto(double& min, double& max, int nbsig, double fracmax)
    133133{
    134134// TIMEF ;
     
    143143
    144144//  Variable decrivant l'histogramme
    145 float minhis, maxhis, binwidth;
     145double minhis, maxhis, binwidth;
    146146int under,over,tothis;
    147147int *phis;
    148148int *q;
    149149
    150 float MINDYNAMIC = 1.e-5;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
    151 float FRACPIC = 0.6065;            /*  Valeur de exp(-0.5)   */
    152 
    153 
    154 int nbnul, nbsat, nok;
    155 float moy, sig;
    156 if ( min >= (max-MINDYNAMIC) ) nok = CheckDyn(min, max, moy, sig, nbnul, nbsat);
    157 if (nok < 1) { min=0.; max = 1.; return; }
     150double MINDYNAMIC = 1.e-8;          /* Gamme dynamique minimale (MaxAff-MinAff)*/
     151double FRACPIC = 0.6065;            /*  Valeur de exp(-0.5)   */
     152
     153
     154
     155if ( min >= (max-MINDYNAMIC) ) {
     156  int nbnul, nbsat, nok;
     157  double moy, sig;
     158  nok = CheckDyn(min, max, moy, sig, nbnul, nbsat, vitesse);
     159  if (nok < 1) { min=0.; max = 1.;  return; }
     160  }
    158161if ( min >= (max-MINDYNAMIC) )  max = min+MINDYNAMIC;
    159162minhis = min;
     
    164167  maxhis = nbin*binwidth + minhis;
    165168  }
     169// printf("DEBUG nbin minhis maxhis binwidth = %d %g %g %g \n", nbin, minhis, maxhis, binwidth);
    166170
    167171/* allocation dynamique de memoire et mise a zero de l'histogramme */
     
    202206
    203207/*   On va chercher le sigma du fond  SigmaLeft, SigmaRight */
    204 int hmin = (int) ( (float)(hmax) * FRACPIC ) ;
     208int hmin = (int) ( (double)(hmax) * FRACPIC ) ;
    205209
    206210int sigr = 0;
     
    215219if (nbsig < 0)  {  /*   On considere le cas ou NbSigmas est negatif   */
    216220  if ( (bin = binmax+nbsig*sigl) < 0 )  bin = 0;
    217   min = minhis + (float)bin*binwidth;
     221  min = minhis + (double)bin*binwidth;
    218222  if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1;
    219   max = minhis + (float)bin*binwidth;
     223  max = minhis + (double)bin*binwidth;
    220224  if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
    221225  delete[] phis;  return;
     
    235239int nbpix = 0;
    236240for( q = phis+bin ; q < phis+nbin ; q++)  nbpix += (*q);
    237 nbpix = (int_4)((float)nbpix * fracmax);
     241nbpix = (int_4)((double)nbpix * fracmax);
    238242int nbpix2 = 0; q = phis+bin;
    239243int k = bin;
     
    241245  { nbpix2 += (*q); k++; q++; }
    242246
    243 max = minhis + (float)k*binwidth;
     247max = minhis + (double)k*binwidth;
    244248delete[] phis;
    245249if (max < (min+MINDYNAMIC))  max = min+MINDYNAMIC;
     
    258262int npx, npy, nppx, nppy, nszp, oszp;
    259263int i,j,k,l;
    260 float vpx;
     264double vpx;
    261265
    262266
     
    310314    }
    311315  else if (zm < -1) {       // Compression
    312     float fv = (float)(zmm*zmm);
     316    double fv = (double)(zmm*zmm);
    313317    for(j=ofy; j<ofy+npy; j+=zmm)
    314318      for(i=ofx; i<ofx+npx; i+=zmm) {
     
    341345    }
    342346  else if (zm < -1) {       // Compression
    343     float fv = (float)(zmm*zmm);
     347    double fv = (double)(zmm*zmm);
    344348    for(j=ofy; j<ofy+npy; j+=zmm)
    345349      for(i=ofx; i<ofx+npx; i+=zmm) {
  • trunk/SophyaPI/PI/parradapter.h

    r140 r204  
    1616  virtual         ~P1DArrayAdapter();
    1717 
    18   virtual float   Value(int i) = 0;
     18  virtual double  Value(int i) = 0;
    1919  inline  int     Size() { return (mSize) ; }
    20   virtual void    DefineXCoordinate(float x0, float dx);
    21   virtual float   X(int i);
     20  virtual void    DefineXCoordinate(double x0, double dx);
     21  virtual double  X(int i);
    2222     
    2323protected :
    2424  int mSize;
    25   float mOx, mDx;
     25  double mOx, mDx;
    2626};
    2727
     
    4141                               { invx = invX; invy = invY; exy = eXY; }
    4242
    43   virtual void    DefineXYCoordinates(float x0, float y0, float dx, float dy);
     43  virtual void    DefineXYCoordinates(double x0, double y0, double dx, double dy);
    4444// Doit etre defini par les classes derivees
    45   virtual float   Value(int ix, int iy) = 0;   
     45  virtual double  Value(int ix, int iy) = 0;   
    4646
    47   virtual void    XYfromxy(int ix, int iy, float& x, float& y);
     47  virtual void    XYfromxy(int ix, int iy, double& x, double& y);
    4848
    4949  inline  int     XSize() { return ( eXY ? sY : sX ) ; }
    5050  inline  int     YSize() { return ( eXY ? sX : sY ) ; }
    5151
    52   inline  void    XYCoord(int i, int j, float& x, float& y)
     52  inline  void    XYCoord(int i, int j, double& x, double& y)
    5353                         { int ix, iy;  IJ2xy(i, j, ix, iy);
    5454                           XYfromxy(ix, iy, x, y); }
    55   inline  void    Coord(int i, int j, float& x, float& y)
    56                        { int ix, iy;  float f; IJ2xy(i, j, ix, iy);
     55  inline  void    Coord(int i, int j, double& x, double& y)
     56                       { int ix, iy;  double f; IJ2xy(i, j, ix, iy);
    5757                       XYfromxy(ix, iy, x, y); if (eXY) {f=x; x=y; y=f; } }
    58   inline  float   operator() (int i, int j)
     58  inline  double  operator() (int i, int j)
    5959                         { int ix, iy;  IJ2xy(i, j, ix, iy);
    6060                         return Value(ix, iy); }
     
    6565
    6666//    Calcul Min-Max, Moy-Sig
    67   virtual int     CheckDyn(float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit=10);
     67  virtual int     CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit=10);
    6868//    Calcul AutoLut
    69   virtual void    ComputeLut_PicHisto(float& min, float& max, int nbsig=1, float fracmax=0.95);
     69  virtual void    ComputeLut_PicHisto(double& min, double& max, int nbsig=1, double fracmax=0.95);
    7070
    7171//    Calcul pixmap avec un LUT
     
    7575protected :
    7676  int sX, sY;
    77   float mOx, mDx, mOy, mDy;
     77  double mOx, mDx, mOy, mDy;
    7878  int sgnX, sgnY;
    7979  int offX, offY;
     
    8989
    9090  virtual         ~P1DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; }
    91   virtual float   Value(int i)
     91  virtual double  Value(int i)
    9292                    {  if ( (i < 0) || (i >= mSize) ) return(0.);
    9393                    return(mData[i]); }
     
    106106
    107107  virtual         ~P2DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; }
    108   virtual float   Value(int ix, int iy)
     108  virtual double   Value(int ix, int iy)
    109109                    {  if ( (ix < 0)  || (iy < 0) || (ix >= sX) || (iy >= sY) ) return(0.);
    110110                    return(mData[ix+iy*sX]); }
  • trunk/SophyaPI/PI/pi3ddrw.cc

    r194 r204  
    3838// PIDrawer3D()
    3939//      Cosntructeur
    40 // void Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi, -
    41 //               float dax, float day, float co, float dco=0.2)
     40// void Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi, -
     41//               double dax, double day, double co, double dco=0.2)
    4242//      Définition de la vue 3D. Voir "PIGraphic3D::Set3DCS_Obs(...)"
    43 // void Set3DView(float xc, float yc, float zc, float xo, float yo, float zo, -
    44 //                float dax, float day, float dco=0.2, float psi=0.)
     43// void Set3DView(double xc, double yc, double zc, double xo, double yo, double zo, -
     44//                double dax, double day, double dco=0.2, double psi=0.)
    4545//      Définition de la vue 3D. Voir "PIGraphic3D::Set3DCS(...)"
    46 // bool Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, -
    47 //                float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco)
     46// bool Get3DView(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo, -
     47//                double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco)
    4848//      Renvoie la définition de la Vue-3D. Retourne "true " si définie par "Set3DView_Obs()"
    49 // void Draw3DBoxe(PIGraphic3D* g3, float xx1, float xx2, float yy1, float yy2,  -
    50 //                 float zz1, float zz2, float xl1, float xl2, -
    51 //                 float yl1, float yl2, float zl1, float zl2)
     49// void Draw3DBoxe(PIGraphic3D* g3, double xx1, double xx2, double yy1, double yy2,  -
     50//                 double zz1, double zz2, double xl1, double xl2, -
     51//                 double yl1, double yl2, double zl1, double zl2)
    5252//      Trace une boîte avec les coordonnées matérialisant la vue 3D.
    5353//--
     
    7373
    7474/* --Methode-- */
    75 void PIDrawer3D::Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    76                                float dax, float day, float co, float dco)
     75void PIDrawer3D::Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     76                               double dax, double day, double co, double dco)
    7777{
    7878  tO = teta;  fO = phi;  pO = psi;
     
    8383
    8484/* --Methode-- */
    85 void PIDrawer3D::Set3DView(float xc, float yc, float zc, float xo, float yo, float zo,
    86                            float dax, float day, float dco, float psi)
     85void PIDrawer3D::Set3DView(double xc, double yc, double zc, double xo, double yo, double zo,
     86                           double dax, double day, double dco, double psi)
    8787{
    8888  xC = xc;  yC = yc;  zC = zc;
     
    9595
    9696/* --Methode-- */
    97 bool PIDrawer3D::Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo,
    98                            float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco)
     97bool PIDrawer3D::Get3DView(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo,
     98                           double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco)
    9999{
    100100  xo = xO;  yo = yO;  zo = zO;
     
    136136/* --Methode-- */
    137137void PIDrawer3D::Draw3DBoxe(PIGraphic3D* g3,
    138                             float xx1, float xx2, float yy1, float yy2,
    139                             float zz1, float zz2, float xl1, float xl2,
    140                             float yl1, float yl2, float zl1, float zl2)
     138                            double xx1, double xx2, double yy1, double yy2,
     139                            double zz1, double zz2, double xl1, double xl2,
     140                            double yl1, double yl2, double zl1, double zl2)
    141141{
    142142  if (mLAtt == PI_NotDefLineAtt)    g3->SelLine(PI_ThinLine);
     
    161161  x1 = x2 = xx1;   y1 = y2 = yy1;  z1 = z2 = zz1;
    162162  for (k=0; k<NTicks; k++) {
    163     x1 = x2 = (xx1+(float)k*(xx2-xx1)/(NTicks-1.));
     163    x1 = x2 = (xx1+(double)k*(xx2-xx1)/(NTicks-1.));
    164164    z1 = zz1; z2 = zz1-0.02*(zz2-zz1);
    165165    y1 = y2 = yy1;
     
    167167    z2 = zz1-0.05*(zz2-zz1);
    168168    y2 = yy1-0.075*(yy2-yy1); 
    169     sprintf(strg,"%.2g", xl1+(float)k*(xl2-xl1)/(NTicks-1.));
     169    sprintf(strg,"%.2g", xl1+(double)k*(xl2-xl1)/(NTicks-1.));
    170170    g3->DrawString3D(x2, y2, z2, strg);
    171171    }
     
    184184  x1 = x2 = xx2;   y1 = y2 = yy1;  z1 = z2 = zz1;
    185185  for (k=1; k<NTicks; k++) {   // Attention, par le tick 0 pour Y
    186     y1 = y2 = (yy1+(float)k*(yy2-yy1)/(NTicks-1.));
     186    y1 = y2 = (yy1+(double)k*(yy2-yy1)/(NTicks-1.));
    187187    z2 = zz1-0.02*(zz2-zz1);
    188188    x1 = x2 = xx2;
     
    190190    z2 = zz1-0.05*(zz2-zz1);
    191191    x2 = xx2+0.075*(xx2-xx1); 
    192     sprintf(strg,"%.2g", yl1+(float)k*(yl2-yl1)/(NTicks-1.));
     192    sprintf(strg,"%.2g", yl1+(double)k*(yl2-yl1)/(NTicks-1.));
    193193    g3->DrawString3D(x2, y2, z2, strg);
    194194    }
     
    207207  x1 = x2 = xx1;   y1 = y2 = yy1;  z1 = z2 = zz1;
    208208  for (k=0; k<NTicks; k++) {
    209     z1 = z2 = (zz1+(float)k*(zz2-zz1)/(NTicks-1.));
     209    z1 = z2 = (zz1+(double)k*(zz2-zz1)/(NTicks-1.));
    210210    y2 = yy1-0.015*(yy2-yy1);
    211211    x2 = xx1-0.015*(xx2-xx1);
     
    213213    x2 = xx1-0.1*(xx2-xx1); 
    214214    y2 = yy1-0.1*(yy2-yy1); 
    215     sprintf(strg,"%.2g", zl1+(float)k*(zl2-zl1)/(NTicks-1.));
     215    sprintf(strg,"%.2g", zl1+(double)k*(zl2-zl1)/(NTicks-1.));
    216216    g3->DrawString3D(x2, y2, z2, strg);
    217217    }
     
    311311
    312312/* --Methode-- */
    313 void PIDraw3DWdg::Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    314                                 float dax, float day, float co, float dco)
     313void PIDraw3DWdg::Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     314                                double dax, double day, double co, double dco)
    315315{
    316316  mGr3d->Set3DCS_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco);
     
    326326
    327327/* --Methode-- */
    328 void PIDraw3DWdg::Set3DView(float xc, float yc, float zc, float xo, float yo, float zo,
    329                             float dax, float day, float dco, float psi)
     328void PIDraw3DWdg::Set3DView(double xc, double yc, double zc, double xo, double yo, double zo,
     329                            double dax, double day, double dco, double psi)
    330330{
    331331  mGr3d->Set3DCS(xc, yc, zc, xo, yo, zo, dax, day, dco, psi);
     
    341341
    342342/* --Methode-- */
    343 bool PIDraw3DWdg::Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo,
    344                             float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco)
     343bool PIDraw3DWdg::Get3DView(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo,
     344                            double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco)
    345345{
    346346  return(mGr3d->Get3DCS(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco));
     
    360360  if (dr3 == NULL)  return;
    361361  dr3->UpdateLimits();
    362   float xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco;
     362  double xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco;
    363363  bool vobs;
    364364  vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco);
     
    372372void PIDraw3DWdg::SetDrawers3DView()
    373373{
    374   float xc, yc, zc, xo, yo, zo;
    375   float teta, phi, psi;
    376   float dax, day, co, dco;
     374  double xc, yc, zc, xo, yo, zo;
     375  double teta, phi, psi;
     376  double dax, day, co, dco;
    377377  bool vo;
    378378  vo = mGr3d->Get3DCS( xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco);
     
    398398if (!vfixed)  {
    399399  dr3->UpdateLimits();
    400   float xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco;
     400  double xo, yo, zo, xc, yc, zc, teta, phi, psi, dax, day, co, dco;
    401401  bool vobs;
    402402  vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco);
     
    405405  }
    406406else {
    407   float xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco;
     407  double xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco;
    408408  if ( Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco) )
    409409      dr3->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco);
     
    468468strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
    469469// printf("PIDraw3DWdg::PasteSelection() / Debug  %s - %d %d -> %g %g \n", pc,
    470 //        mPx, mPy, (float)mPx/(float)XSize(), 1.-(float)mPy/(float)YSize());
    471 mBDrw->ElAddText((float)mPx/(float)XSize(), 1.-(float)mPy/(float)YSize(), pc );
     470//        mPx, mPy, (double)mPx/(double)XSize(), 1.-(double)mPy/(double)YSize());
     471mBDrw->ElAddText((double)mPx/(double)XSize(), 1.-(double)mPy/(double)YSize(), pc );
    472472mBDrw->Refresh();
    473473}
     
    477477{
    478478  mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize());
    479   float xo, yo, zo;
    480   float teta, phi, psi;
    481   float dax, day, co, dco;
     479  double xo, yo, zo;
     480  double teta, phi, psi;
     481  double dax, day, co, dco;
    482482  mGr3d->Get3DCS(cXc, cYc, cZc, xo, yo, zo, teta, phi, psi, dax, day, co, dco);
    483483//   puts("\n PIDraw3DWdg::But2Press() ");
     
    525525{
    526526  DrawXYZAxes();
    527   float teta, phi;
     527  double teta, phi;
    528528
    529529  if (rOfg) {
    530     phi = cPhi + (M_PI*0.25*(float)(x-lPx)/XSize());
    531     teta = cTeta - (M_PI*0.25*(float)(y-lPy)/YSize());
     530    phi = cPhi + (M_PI*0.25*(double)(x-lPx)/XSize());
     531    teta = cTeta - (M_PI*0.25*(double)(y-lPy)/YSize());
    532532    mGr3d->RotateObject(teta, phi, false);
    533533    }
    534534  else {
    535     phi = cPhi - (M_PI*0.5*(float)(x-lPx)/XSize());
    536     teta = cTeta + (M_PI*0.5*(float)(y-lPy)/YSize());
     535    phi = cPhi - (M_PI*0.5*(double)(x-lPx)/XSize());
     536    teta = cTeta + (M_PI*0.5*(double)(y-lPy)/YSize());
    537537    mGr3d->RotateObserver(teta, phi, 0., false);
    538538    }
     
    569569void PIDraw3DWdg::But3Press(int x, int y)
    570570{
    571   float xo, yo, zo;
    572   float teta, phi, psi;
    573   float dax, day, co, dco;
     571  double xo, yo, zo;
     572  double teta, phi, psi;
     573  double dax, day, co, dco;
    574574  mGr3d->Get3DCS(cXc, cYc, cZc, xo, yo, zo, teta, phi, psi, dax, day, co, dco);
    575575  mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize());
     
    597597{
    598598  DrawXYZAxes();
    599   float rapx = (float)(lPx-x)/XSize();
     599  double rapx = (double)(lPx-x)/XSize();
    600600  if (rapx > 0.) rapx = rapx*2.+1;
    601601  else rapx += 1.;
    602602  if (rapx < 0.3)  rapx = 0.3;
    603603  if (rapx > 3.)  rapx = 3.;
    604   float rapy = (float)(y-lPy)/YSize();
     604  double rapy = (double)(y-lPy)/YSize();
    605605  if (rapy > 0.) rapy = rapy*2.+1;
    606606  else rapy += 1.;
     
    649649//   mGr3d->DrawCircle(0., 0., daxO*0.30);
    650650  char buff[256];
    651   float xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco;
     651  double xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco;
    652652  mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco);
    653653  sprintf(buff, " C: %g %g %g -> O: %g %g %g  (T/P0= %g %g)     ", xc,yc,zc, xo, yo, zo, cTeta, cPhi);
     
    676676y -= YSize()/2;
    677677
    678 float fx = (float)x/XSize();
    679 float fy = (float)y/YSize();
     678double fx = (double)x/XSize();
     679double fy = (double)y/YSize();
    680680if ( (fx<0.2) && (fx>-0.2) && (fy<0.2) && (fy>-0.2) ) {
    681681 
     
    694694  isw++;
    695695  mGr3d->PrintCS();
    696   float xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco;
     696  double xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco;
    697697  mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco);
    698698  mGr3d->Set3DCS(xc,yc,zc,xo,yo,zo,dax,day,dco,psi);
  • trunk/SophyaPI/PI/pi3ddrw.h

    r184 r204  
    2222  virtual               ~PIDrawer3D();
    2323
    24   virtual void          Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    25                                       float dax, float day, float co, float dco=0.2);
    26   virtual void          Set3DView(float xc, float yc, float zc, float xo, float yo, float zo,
    27                                   float dax, float day, float dco=0.2, float psi=0.);
    28   bool                  Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo,
    29                                   float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco);
     24  virtual void          Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     25                                      double dax, double day, double co, double dco=0.2);
     26  virtual void          Set3DView(double xc, double yc, double zc, double xo, double yo, double zo,
     27                                  double dax, double day, double dco=0.2, double psi=0.);
     28  bool                  Get3DView(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo,
     29                                  double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco);
    3030 
    3131  virtual PIGraphicUC*  SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g);
    3232
    3333  virtual void          DrawAxes(PIGraphicUC* g);
    34   virtual void          Draw3DBoxe(PIGraphic3D* g3, float xx1, float xx2, float yy1, float yy2,
    35                                                     float zz1, float zz2, float xl1, float xl2,
    36                                                     float yl1, float yl2, float zl1, float zl2);
     34  virtual void          Draw3DBoxe(PIGraphic3D* g3, double xx1, double xx2, double yy1, double yy2,
     35                                                    double zz1, double zz2, double xl1, double xl2,
     36                                                    double yl1, double yl2, double zl1, double zl2);
    3737
    38   float XMin3() const {return x3Min;}
    39   float XMax3() const {return x3Max;}
    40   float YMin3() const {return y3Min;}
    41   float YMax3() const {return y3Max;}
    42   float ZMin3() const {return z3Min;}
    43   float ZMax3() const {return z3Max;}
     38  double XMin3() const {return x3Min;}
     39  double XMax3() const {return x3Max;}
     40  double YMin3() const {return y3Min;}
     41  double YMax3() const {return y3Max;}
     42  double ZMin3() const {return z3Min;}
     43  double ZMax3() const {return z3Max;}
    4444
    4545protected :
    46   float xO, yO, zO;  // Position observateur = camera
    47   float xC, yC, zC;  // Position centre du champ
    48   float tO,fO,pO;    // Orientation observateur (Teta, Phi, Psi, Angles d Euler)
    49   float daxO, dayO;  // Demi-ouverture de la camera suivant les deux axes de projection (xp/zp, yp/zp)
    50   float lCO, dlCO;   // Distance Camera-Centre du champ et profondeur de champ
     46  double xO, yO, zO;  // Position observateur = camera
     47  double xC, yC, zC;  // Position centre du champ
     48  double tO,fO,pO;    // Orientation observateur (Teta, Phi, Psi, Angles d Euler)
     49  double daxO, dayO;  // Demi-ouverture de la camera suivant les deux axes de projection (xp/zp, yp/zp)
     50  double lCO, dlCO;   // Distance Camera-Centre du champ et profondeur de champ
    5151  bool v3D_obs;      // Si defini par Set3DView_Obs
    52   float x3Min, x3Max;  // Pour delimiter le cube 3D
    53   float y3Min, y3Max;  // Pour delimiter le cube 3D
    54   float z3Min, z3Max;  // Pour delimiter le cube 3D
     52  double x3Min, x3Max;  // Pour delimiter le cube 3D
     53  double y3Min, y3Max;  // Pour delimiter le cube 3D
     54  double z3Min, z3Max;  // Pour delimiter le cube 3D
    5555};
    5656
     
    6868
    6969
    70   virtual void          Set3DView_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    71                                       float dax, float day, float co, float dco=0.2);
    72   virtual void          Set3DView(float xc, float yc, float zc, float xo, float yo, float zo,
    73                                   float dax, float day, float dco=0.2, float psi=0.);
    74   bool                  Get3DView(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo,
    75                                   float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco);
     70  virtual void          Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     71                                      double dax, double day, double co, double dco=0.2);
     72  virtual void          Set3DView(double xc, double yc, double zc, double xo, double yo, double zo,
     73                                  double dax, double day, double dco=0.2, double psi=0.);
     74  bool                  Get3DView(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo,
     75                                  double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco);
    7676
    7777  virtual void          Update3DView();   // Vue 3-D a partir de Drawer No 1
     
    114114  int lPx, lPy;         // dernier position pointeur
    115115  PIColors lCol;        // Couleur
    116   float cTeta, cPhi, cUlen;    // Pour garder valeurs avant rotation, Unite de longeur
    117   float cXc, cYc, cZc;         // Pour garder position du centre de champ
    118   float clCO, cDax, cDay;      // Pour garder les valeurs avant Zoom In/Out
     116  double cTeta, cPhi, cUlen;    // Pour garder valeurs avant rotation, Unite de longeur
     117  double cXc, cYc, cZc;         // Pour garder position du centre de champ
     118  double clCO, cDax, cDay;      // Pour garder les valeurs avant Zoom In/Out
    119119  bool  rOfg;                  // si Vrai  on fait tourner l'objet et pas la camera
    120120  bool  axfg;                  // si Vrai on trace les axes
  • trunk/SophyaPI/PI/pibwdggen.cc

    r180 r204  
    1010#include "pidrwtools.h"
    1111
    12 static inline void fl_swap(float& a, float& b) { float tmp = a; a = b; b = tmp;  }
     12static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp;  }
    1313
    1414//++
     
    314314//      si "psz=true", les coordonnées sont supposées être des facteurs multiplicatifs
    315315//      des dimensions de l'objet.
    316 // void  SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax, -
     316// void  SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax, -
    317317//                              int axrl=kAxeDirSame, int ayud=kAxeDirSame)
    318318//      Définition du système de coordonnées par défaut d'un drawer attaché en "autolim=true"
     
    328328
    329329/* --Methode-- */
    330 void PIBaseWdgGen::SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
     330void PIBaseWdgGen::SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax,
    331331                                          int axrl, int ayud)
    332332{
     
    483483void PIBaseWdgGen::CallDrawers(PIGraphic* g, int x0, int y0, int dx, int dy)
    484484{
    485 float xmin,ymin, xmax, ymax;
     485double xmin,ymin, xmax, ymax;
    486486PIGraphicUC* guc;
    487487int drx0, dry0, drdx, drdy;
     
    489489
    490490if (mDrElastic) {
    491   ddrx0 = (int)((float) mDrX1 * (float)XSize());
    492   ddry0 = (int)((float) mDrY1 * (float)YSize());
    493   ddrdx = (int)((float) mDrX2 * (float)XSize()) - ddrx0 ;
    494   ddrdy = (int)((float) mDrY2 * (float)YSize()) - ddry0 ;
     491  ddrx0 = (int)((double) mDrX1 * (double)XSize());
     492  ddry0 = (int)((double) mDrY1 * (double)YSize());
     493  ddrdx = (int)((double) mDrX2 * (double)XSize()) - ddrx0 ;
     494  ddrdy = (int)((double) mDrY2 * (double)YSize()) - ddry0 ;
    495495  }
    496496else {
     
    510510  else {
    511511    if ( (*it).elastic  ) {   // Taille/position defin en fraction de la taille du PIBaseWdg
    512       drx0 = (int)((float)(*it).x1 * (float)XSize());
    513       dry0 = (int)((float)(*it).y1 * (float)YSize());
    514       drdx = (int)((float)(*it).x2 * (float)XSize()) - drx0 ;
    515       drdy = (int)((float)(*it).y2 * (float)YSize()) - dry0 ;
     512      drx0 = (int)((double)(*it).x1 * (double)XSize());
     513      dry0 = (int)((double)(*it).y1 * (double)YSize());
     514      drdx = (int)((double)(*it).x2 * (double)XSize()) - drx0 ;
     515      drdy = (int)((double)(*it).y2 * (double)YSize()) - dry0 ;
    516516      }
    517517    else {
     
    534534    guc->GrC2UC(XSize(), YSize(), xmax, ymax);   
    535535    }
    536   if (xmin > xmax)  fl_swap(xmin,xmax);
    537   if (ymin > ymax)  fl_swap(ymin,ymax);
     536  if (xmin > xmax)  dbl_swap(xmin,xmax);
     537  if (ymin > ymax)  dbl_swap(ymin,ymax);
    538538  (*it).drw->Draw(guc, xmin, ymin, xmax, ymax);
    539539  g->RestoreGraphicAtt();
     
    547547void PIBaseWdgGen::CallDrawer(int id)
    548548{
    549 float xmin,ymin, xmax, ymax;
     549double xmin,ymin, xmax, ymax;
    550550PIGraphicUC* guc;
    551551int drx0, dry0, drdx, drdy;
     
    555555
    556556if (mDrElastic) {
    557   ddrx0 = (int)((float) mDrX1 * (float)XSize());
    558   ddry0 = (int)((float) mDrY1 * (float)YSize());
    559   ddrdx = (int)((float) mDrX2 * (float)XSize()) - ddrx0 ;
    560   ddrdy = (int)((float) mDrY2 * (float)YSize()) - ddry0 ;
     557  ddrx0 = (int)((double) mDrX1 * (double)XSize());
     558  ddry0 = (int)((double) mDrY1 * (double)YSize());
     559  ddrdx = (int)((double) mDrX2 * (double)XSize()) - ddrx0 ;
     560  ddrdy = (int)((double) mDrY2 * (double)YSize()) - ddry0 ;
    561561  }
    562562else {
     
    572572    else {
    573573      if ( (*it).elastic  ) {   // Taille/position defin en fraction de la taille du PIBaseWdg
    574         drx0 = (int)((float)(*it).x1 * (float)XSize());
    575         dry0 = (int)((float)(*it).y1 * (float)YSize());
    576         drdx = (int)((float)(*it).x2 * (float)XSize()) - drx0 ;
    577         drdy = (int)((float)(*it).y2 * (float)YSize()) - dry0 ;
     574        drx0 = (int)((double)(*it).x1 * (double)XSize());
     575        dry0 = (int)((double)(*it).y1 * (double)YSize());
     576        drdx = (int)((double)(*it).x2 * (double)XSize()) - drx0 ;
     577        drdy = (int)((double)(*it).y2 * (double)YSize()) - dry0 ;
    578578        }
    579579      else {
     
    590590    guc->GrC2UC(0, 0, xmin, ymin);
    591591    guc->GrC2UC(XSize(), YSize(), xmax, ymax);     
    592     if (xmin > xmax)  fl_swap(xmin,xmax);
    593     if (ymin > ymax)  fl_swap(ymin,ymax);
     592    if (xmin > xmax)  dbl_swap(xmin,xmax);
     593    if (ymin > ymax)  dbl_swap(ymin,ymax);
    594594    (*it).drw->Draw(guc, xmin, ymin, xmax, ymax);
    595595    g->RestoreGraphicAtt();   
  • trunk/SophyaPI/PI/pibwdggen.h

    r180 r204  
    8585  virtual void       SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1,
    8686                                             PIGrCoord x2, PIGrCoord y2, bool psz=true);
    87   virtual void       SetDefaultDrawerLimits(float xmin, float xmax, float ymin, float ymax,
     87  virtual void       SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax,
    8888                                            int axrl=kAxeDirSame, int ayud=kAxeDirSame);
    8989  virtual int        AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1,
     
    118118  PIGrCoord mDrX1, mDrY1,  mDrX2,  mDrY2; 
    119119  bool mDrElastic;   // true --> Coord en fraction de la taille
    120   float mDrXmin, mDrXmax, mDrYmin, mDrYmax;   // Limites par defaut - UC
     120  double mDrXmin, mDrXmax, mDrYmin, mDrYmax;   // Limites par defaut - UC
    121121  int  mDXdir, mDYdir;                        // Sens des axes par defaut
    122122
  • trunk/SophyaPI/PI/pidrawer.cc

    r202 r204  
    5959
    6060//++
    61 // void  SetLimits(float xmin, float xmax, float ymin, float ymax, -
     61// void  SetLimits(double xmin, double xmax, double ymin, double ymax, -
    6262//                 int axrl=kAxeDirSame, int ayud=kAxeDirSame)
    6363//      Définit les limites du système de coordonnées.
     
    7171
    7272void
    73 PIDrawer::SetLimits(float xmin, float xmax, float ymin, float ymax,
     73PIDrawer::SetLimits(double xmin, double xmax, double ymin, double ymax,
    7474                    int axrl, int ayud)
    7575{
    7676  if (axrl == kAxeDirAuto) {
    77     float ff;
     77    double ff;
    7878    if (xmax < xmin)  { axrl = kAxeDirRtoL;   ff=xmin;  xmin=xmax;  xmax=ff; }
    7979    else  axrl = kAxeDirLtoR;
    8080  }
    8181  if (ayud == kAxeDirAuto) {
    82     float ff;
     82    double ff;
    8383    if (ymax < ymin)  { ayud = kAxeDirUpDown;   ff=ymin;  ymin=ymax;  ymax=ff; }
    8484    else  ayud = kAxeDirDownUp;
     
    100100
    101101//++
    102 //  void  Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
     102//  void  Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
    103103//      Méthode qui est appelé lorsquer l'objet PIDrawer doit rafraichir la zone
    104104//      définie par "xmin-xmax" , "ymin-ymax" dans le système de coordonnées du
     
    227227
    228228/* --Methode-Static-- */
    229 void PIDrawer::BestTicks(float rmin,float rmax,int nticks,float& majt)
     229void PIDrawer::BestTicks(double rmin,double rmax,int nticks,double& majt)
    230230{
    231231double d = rmax - rmin;
     
    336336    // Longueur des ticks
    337337   
    338     float extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
    339     float intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
    340     float extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
    341     float intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
    342     float extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
    343     float intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
    344     float extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
    345     float intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
     338    double extXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;
     339    double intXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;
     340    double extXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;
     341    double intXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;
     342    double extYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;
     343    double intYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;
     344    double extYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;
     345    double intYMinTickLen = flags&kIntTicks ? yMinTickLen : 0;
    346346
    347347    // La grille en pointilles
     
    395395
    396396void
    397 PIDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
    398 {
    399 }
    400 
    401 
    402 void
    403 PIDrawer::DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep)
    404 {
    405   for (float x=xBeg; x<=xMax; x += xStep)
     397PIDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
     398{
     399}
     400
     401
     402void
     403PIDrawer::DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep)
     404{
     405  for (double x=xBeg; x<=xMax; x += xStep)
    406406    g->DrawLine(x, y-tickDown, x, y+tickUp);
    407407}
    408408
    409409void
    410 PIDrawer::DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep)
    411 {
    412   for (float y=yBeg; y<=yMax; y += yStep)
     410PIDrawer::DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep)
     411{
     412  for (double y=yBeg; y<=yMax; y += yStep)
    413413    g->DrawLine(x-tickLeft, y, x+tickRight, y);
    414414}
    415415
    416416void
    417 PIDrawer::DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just)
    418 {
    419   float xOffset = 0;
     417PIDrawer::DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, int just)
     418{
     419  double xOffset = 0;
    420420  int kk;
    421421  g->SelFontSz(xMajTickLen*4.);
    422   for (float x=xBeg; x<=xMax; x += xStep) {
     422  for (double x=xBeg; x<=xMax; x += xStep) {
    423423      char label[20]; sprintf(label, "%-6g", x);
    424424      for(kk=0; kk<20; kk++)
    425425        if (label[kk] == ' ')   { label[kk] = '\0' ; break; }
    426       float largeur = g->CalcStringWidth(label);
     426      double largeur = g->CalcStringWidth(label);
    427427      if (just == 1)
    428428        xOffset = -largeur;
     
    437437
    438438void
    439 PIDrawer::DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just)
    440 {
    441   float xOffset = 0;
     439PIDrawer::DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, int just)
     440{
     441  double xOffset = 0;
    442442  g->SelFontSz(xMajTickLen*4.);
    443   for (float y=yBeg; y<=yMax; y += yStep) {
     443  for (double y=yBeg; y<=yMax; y += yStep) {
    444444      char label[20]; sprintf(label, "%-6g", y);
    445       float largeur = g->CalcStringWidth(label);
     445      double largeur = g->CalcStringWidth(label);
    446446      if (just == 1)
    447447        xOffset = -largeur;
     
    461461  g->SelLine(PI_ThinDashedLine);
    462462
    463   for (float x=xFirstMajTick; x<=xMax; x += xMajTickStep)
     463  for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep)
    464464    g->DrawLine(x, yMin, x, yMax);
    465465
    466   for (float y=yFirstMajTick; y<=yMax; y += yMajTickStep)
     466  for (double y=yFirstMajTick; y<=yMax; y += yMajTickStep)
    467467    g->DrawLine(xMin, y, xMax, y);
    468468
     
    501501
    502502/* --Methode-- */
    503 void  PIElDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float /*ymax*/)
     503void  PIElDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/)
    504504{
    505505DrawAxes(g);   // Trace des axes
     
    512512  aYdir = false;  // Vrai si Axe Y de Haut vers Bas
    513513  PIGrCoord gas, gds;
    514   float fx, fy, fh;
     514  double fx, fy, fh;
    515515//  fh = g->GetFontHeightUC(gas, gds);
    516516  fh = 0.075*(YMax()-YMin());
  • trunk/SophyaPI/PI/pidrawer.h

    r202 r204  
    3434  virtual           ~PIDrawer();
    3535
    36   virtual void       SetLimits(float xmin, float xmax, float ymin, float ymax,
     36  virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax,
    3737                               int axrl=kAxeDirSame, int ayud=kAxeDirSame);
    3838
     
    4040  virtual void       SetAxesFlags(unsigned int flags=kAxesNone);
    4141   
    42   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     42  virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    4343   
    4444  virtual void       Refresh();      // Recalcule les limites et reaffiche
    4545  virtual void       UpdateLimits();   // Calcule et change les limites 
    4646
    47   float XMin() const {return xMin;}
    48   float XMax() const {return xMax;}
    49   float YMin() const {return yMin;}
    50   float YMax() const {return yMax;}
     47  double XMin() const {return xMin;}
     48  double XMax() const {return xMax;}
     49  double YMin() const {return yMin;}
     50  double YMax() const {return yMax;}
    5151  inline unsigned int GetAxesFlags() { return(axesFlags); }
    5252 
     
    6868//  --- Methode static ----
    6969//  Calcul des Distances optimales des subdivisions
    70   static void        BestTicks(float rmin,float rmax,int nticks,float& majt);
     70  static void        BestTicks(double rmin,double rmax,int nticks,double& majt);
    7171
    7272//  Les objets/methodes suivants devraient etre protected     
     
    8484  void CalcTicks();
    8585
    86   void DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, float xStep);
    87   void DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, float yStep);
    88   void DrawHLabels(PIGraphicUC* g, float y, float xBeg, float xStep, int just=0);
    89   void DrawVLabels(PIGraphicUC* g, float x, float yBeg, float yStep, int just=0);
     86  void DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep);
     87  void DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep);
     88  void DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, int just=0);
     89  void DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, int just=0);
    9090  void DrawGrid(PIGraphicUC* g);
    9191
    9292 
    93   float xMin, xMax, yMin, yMax;  // Valeurs en unites user
     93  double xMin, xMax, yMin, yMax;  // Valeurs en unites user
    9494  int xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
    9595  bool   aXdir, aYdir;           // Sens des axes horiz, vertical
    9696  int aXFlg, aYFlg;
    9797
    98   float xFirstMajTick, xFirstMinTick;
    99   float yFirstMajTick, yFirstMinTick;
    100   float xMajTickStep, xMinTickStep;
    101   float yMajTickStep, yMinTickStep;
    102   float xMajTickLen,  xMinTickLen;
    103   float yMajTickLen,  yMinTickLen;
     98  double xFirstMajTick, xFirstMinTick;
     99  double yFirstMajTick, yFirstMinTick;
     100  double xMajTickStep, xMinTickStep;
     101  double yMajTickStep, yMinTickStep;
     102  double xMajTickLen,  xMinTickLen;
     103  double yMajTickLen,  yMinTickLen;
    104104 
    105105  int limitsFixed;
     
    139139  virtual void       SetTitles(string const & tt, string const & tb);
    140140
    141   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     141  virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    142142
    143143  inline int         ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2,
  • trunk/SophyaPI/PI/pidrwtools.cc

    r202 r204  
    332332
    333333char strg[64];
    334 float xmin, xmax, ymin, ymax;
     334double xmin, xmax, ymin, ymax;
    335335int axrl = kAxeDirLtoR;
    336336int ayud = kAxeDirDownUp;
     
    340340
    341341  case 2600 :
    342     sscanf(mText[0]->GetText().c_str(), "%g %g" , &xmin, &xmax);
    343     sscanf(mText[1]->GetText().c_str(), "%g %g" , &ymin, &ymax);
     342    sscanf(mText[0]->GetText().c_str(), "%lg %lg" , &xmin, &xmax);
     343    sscanf(mText[1]->GetText().c_str(), "%lg %lg" , &ymin, &ymax);
    344344    if (mCkb[0]->GetState())  axrl = kAxeDirRtoL ;
    345345    if (mCkb[1]->GetState())  ayud = kAxeDirUpDown;
  • trunk/SophyaPI/PI/pigraph3d.cc

    r183 r204  
    7575
    7676//++
    77 // void  Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi, -
    78 //                  float dax, float day, float co, float dco=0.2)
     77// void  Set3DCS_Obs(double xo, double yo, double zo, double teta, double phi, double psi, -
     78//                  double dax, double day, double co, double dco=0.2)
    7979//      Définition du système de projection 3D à l'aide de la position de l'observateur
    8080//      et de la direction de visée.
     
    8686//|     dco : profondeur de champ
    8787//
    88 // void  Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo, -
    89 //               float dax, float day, float dco=0.2, float psi=0.)
     88// void  Set3DCS(double xc, double yc, double zc, double xo, double yo, double zo, -
     89//               double dax, double day, double dco=0.2, double psi=0.)
    9090//      Définition du système de projection 3D à partir de la position de l'observateur et
    9191//      du centre du champ.
     
    106106#endif
    107107
    108 static float deuxpi = 2*M_PI;
    109 static double ddeuxpi = 2*M_PI;
    110 
    111 /* --Methode-- */
    112 void PIGraphic3D::Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    113                               float dax, float day, float co, float dco)
     108static double deuxpi = 2*M_PI;
     109
     110/* --Methode-- */
     111void PIGraphic3D::Set3DCS_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     112                              double dax, double day, double co, double dco)
    114113{
    115114  sO = true;
     
    149148
    150149/* --Methode-- */
    151 void PIGraphic3D::Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo,
    152                           float dax, float day, float dco, float psi)
     150void PIGraphic3D::Set3DCS(double xc, double yc, double zc, double xo, double yo, double zo,
     151                          double dax, double day, double dco, double psi)
    153152{
    154153  sO = false;
     
    185184  tO = acos(ct);
    186185  if (lxy < 1.e-6) { fO = 0.;  cf = 0.;  }
    187   else {  cf = dx/lxy;  fO = acos(cf);  if (dy < 0.)  fO = ddeuxpi-fO;   }
     186  else {  cf = dx/lxy;  fO = acos(cf);  if (dy < 0.)  fO = deuxpi-fO;   }
    188187// (Teta,Phi) = Direction de visee
    189188// Les angles d'Euler correspondants sont Teta, Phi+Pi/2
     
    201200
    202201//++
    203 // bool Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, -
    204 //             float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco);
     202// bool Get3DCS(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo, -
     203//             double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco);
    205204//      Renvoie les paramètres de définition du système de projection 3D.
    206205//      "Rc= true" si défini par  "Set3DCS_Obs()"
    207206//     
    208 // void  RotateObserver(float teta, float phi, float psi=0., bool rel=true)
     207// void  RotateObserver(double teta, double phi, double psi=0., bool rel=true)
    209208//      Positionne l'observateur (la caméra) en maintenant la position 
    210209//      du centre de champ fixe. Si "rel=false" : "teta, phi" determine la nouvelle
    211210//      direction de visée. Si "rel=false" : la direction de visée est tournée
    212211//      de l'angle "teta,phi".
    213 // void  RotateObject(float teta, float phi, bool rel=true)
     212// void  RotateObject(double teta, double phi, bool rel=true)
    214213//      Repostionne le centre du champ en maintenant la position de l'observateur fixe.
    215214//      Si "rel=false" : "teta, phi" determine la nouvelle direction de visée.
    216215//      Si "rel=false" : la direction de visée est tournée de l'angle "teta,phi".
    217216//
    218 // void  ZoomInOut(float fco, float fdax, float fday, bool rel=true)
     217// void  ZoomInOut(double fco, double fdax, double fday, bool rel=true)
    219218//      Eloigne ou approche l'observateur et modifie l'ouverture du plan image.
    220219//      si "real=true" : "fco, fdax, fday" sont des facteurs multiplicatifs
     
    225224
    226225/* --Methode-- */
    227 bool PIGraphic3D::Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo,
    228                           float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco)
     226bool PIGraphic3D::Get3DCS(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo,
     227                          double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco)
    229228{
    230229  xc = xC;  yc = yC;  zc = zC;
     
    238237
    239238/* --Methode-- */
    240 void PIGraphic3D::RotateObserver(float teta, float phi, float psi, bool rel)
     239void PIGraphic3D::RotateObserver(double teta, double phi, double psi, bool rel)
    241240// Positionne l'observateur (la camera) de maniere a ce que la direction de
    242241// visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true)
     
    251250  while (teta > deuxpi)  teta -= deuxpi;
    252251  if (teta > M_PI)  { teta = M_PI-teta;  phi = phi+M_PI; }
    253   float xo,yo,zo;
     252  double xo,yo,zo;
    254253  zo = -cos((double)teta)*lCO+zC;
    255254  xo = -sin((double)teta)*cos((double)phi)*lCO+xC;
     
    259258
    260259/* --Methode-- */
    261 void PIGraphic3D::RotateObject(float teta, float phi, bool rel)
     260void PIGraphic3D::RotateObject(double teta, double phi, bool rel)
    262261// Positionne l'objet (centre du champ) de maniere a ce que la direction de
    263262// visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true)
     
    271270  while (teta > deuxpi)  teta -= deuxpi;
    272271  if (teta > M_PI)  { teta = M_PI-teta;  phi = phi+M_PI; }
    273   float xc,yc,zc;
     272  double xc,yc,zc;
    274273  zc = cos((double)teta)*lCO+zO;
    275274  xc = sin((double)teta)*cos((double)phi)*lCO+xO;
     
    279278
    280279/* --Methode-- */
    281 void PIGraphic3D::ZoomInOut(float fco, float fdax, float fday, bool rel)
     280void PIGraphic3D::ZoomInOut(double fco, double fdax, double fday, bool rel)
    282281{
    283282  if (fco < 0.001) fco = 1.;
     
    291290  }
    292291  else dl = fco;
    293   float xo,yo,zo;
     292  double xo,yo,zo;
    294293  if (dl < 1.e-5) dl = 1.e-5;
    295294  zo = zC-cos((double)tO)*dl;
     
    301300
    302301/* --Methode-- */
    303 void PIGraphic3D::C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp)
     302void PIGraphic3D::C3DC2ObsCS(double x, double y, double z, double& xp, double& yp, double& zp)
    304303{
    305304  double xc, yc, zc;
     
    311310
    312311/* --Methode-- */
    313 void PIGraphic3D::Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix)
     312void PIGraphic3D::Proj3DC2GrC(double x, double y, double z, double& xpix, double& ypix)
    314313{
    315314  double xc, yc, zc;
    316   float xp, yp, zp;
     315  double xp, yp, zp;
    317316  xc = x-xO;   yc = y-yO;    zc = z-zO;
    318317  xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc;   
     
    321320  if ((zp>-1.e-6) && (zp < 1.e-6))   // Protection Divide/0
    322321    { xpix = ypix = 0.;   return; }
    323   xpix = (float)(xOrg + (xp/zp)*xScale);
    324   ypix = (float)(yOrg + (yp/zp)*yScale);
     322  xpix = (double)(xOrg + (xp/zp)*xScale);
     323  ypix = (double)(yOrg + (yp/zp)*yScale);
    325324//  printf("-DBG-Proj3DC2GrC() %g %g %g -> %g %g %g -> %g %g %g -> (%g %g)\n", x,y,z,xc,yc,zc,xp,yp,zp,xp/zp,yp/zp);
    326325//  printf("-DBG- ... (%g %g %g - %g %g) %g %g - %g %g -> %g %g \n", xO,yO,zO, tO,fO, xOrg, yOrg,xScale,yScale ,xpix,ypix);
     
    353352{
    354353  if (!mGrC) return;
    355   float xf, yf;
     354  double xf, yf;
    356355  Proj3DC2GrC(x0, y0, z0, xf, yf);
    357356  mGrC->DrawString(xf, yf, s);
     
    363362{
    364363  if (!mGrC) return;
    365   float xf, yf;
     364  double xf, yf;
    366365  Proj3DC2GrC(x0, y0, z0, xf, yf);
    367366  mGrC->DrawOpaqueString(xf, yf, s);
     
    374373{
    375374  if (!mGrC) return;
    376   float xf1, yf1, xf2, yf2;
     375  double xf1, yf1, xf2, yf2;
    377376  Proj3DC2GrC(x1, y1, z1, xf1, yf1);
    378377  Proj3DC2GrC(x2, y2, z2, xf2, yf2);
    379378//  printf("-DBG-DrawLine3D() : %g %g %g -> %g %g | %g %g %g -> %g %g\n",
    380 //         (float)x1, (float)y1, (float)z1, xf1, yf1,
    381 //         (float)x2, (float)y2, (float)z2, xf2, yf2 );
     379//         (double)x1, (double)y1, (double)z1, xf1, yf1,
     380//         (double)x2, (double)y2, (double)z2, xf2, yf2 );
    382381  mGrC->DrawLine(xf1, yf1, xf2, yf2);
    383382}
     
    391390  PIGrCoord *pxc, *pyc;
    392391  int i;
    393   float xf, yf;
     392  double xf, yf;
    394393 
    395394  if (!mGrC) return;
     
    414413  PIGrCoord *pxc, *pyc;
    415414  int i;
    416   float xf, yf;
     415  double xf, yf;
    417416 
    418417  if (!mGrC) return;
     
    434433{
    435434  if (!mGrC) return;
    436   float xf, yf;
     435  double xf, yf;
    437436  Proj3DC2GrC(x0, y0, z0, xf, yf);
    438437  mGrC->DrawMarker(xf, yf);
     
    446445  PIGrCoord *pxc, *pyc;
    447446  int i;
    448   float xf, yf;
     447  double xf, yf;
    449448 
    450449  if (!mGrC) return;
     
    473472printf("RE[3][3]=  %g %g %g | %g %g %g | %g %g %g\n",
    474473        RE[0][0], RE[0][1], RE[0][2], RE[1][0], RE[1][1], RE[1][2], RE[2][0], RE[2][1], RE[2][2]);
    475 float x,y,z,xp,yp,zp, xpix, ypix;
     474double x,y,z,xp,yp,zp, xpix, ypix;
    476475x = xC, y = yC, z= zC;
    477476C3DC2ObsCS(x, y, z, xp, yp, zp);
  • trunk/SophyaPI/PI/pigraph3d.h

    r158 r204  
    2020
    2121//  Definition du systeme de projection 3D-2D
    22   virtual void       Set3DCS_Obs(float xo, float yo, float zo, float teta, float phi, float psi,
    23                                  float dax, float day, float co, float dco=0.2);
    24   virtual void       Set3DCS(float xc, float yc, float zc, float xo, float yo, float zo,
    25                              float dax, float day, float dco=0.2, float psi=0.);
    26   virtual bool       Get3DCS(float& xc, float& yc, float& zc, float& xo, float& yo, float& zo, 
    27                              float& teta, float& phi, float& psi, float& dax, float& day, float& co, float& dco);
     22  virtual void       Set3DCS_Obs(double xo, double yo, double zo, double teta, double phi, double psi,
     23                                 double dax, double day, double co, double dco=0.2);
     24  virtual void       Set3DCS(double xc, double yc, double zc, double xo, double yo, double zo,
     25                             double dax, double day, double dco=0.2, double psi=0.);
     26  virtual bool       Get3DCS(double& xc, double& yc, double& zc, double& xo, double& yo, double& zo, 
     27                             double& teta, double& phi, double& psi, double& dax, double& day, double& co, double& dco);
    2828
    2929  virtual void       PrintCS();  // Pour debugger
    30   virtual void       RotateObserver(float teta, float phi, float psi=0., bool rel=true);
    31   virtual void       RotateObject(float teta, float phi, bool rel=true);
    32   virtual void       ZoomInOut(float fco, float fdax, float fday, bool rel=true);
     30  virtual void       RotateObserver(double teta, double phi, double psi=0., bool rel=true);
     31  virtual void       RotateObject(double teta, double phi, bool rel=true);
     32  virtual void       ZoomInOut(double fco, double fdax, double fday, bool rel=true);
    3333
    34   virtual void       C3DC2ObsCS(float x, float y, float z, float& xp, float& yp, float& zp);
    35   virtual void       Proj3DC2GrC(float x, float y, float z, float& xpix, float& ypix);
     34  virtual void       C3DC2ObsCS(double x, double y, double z, double& xp, double& yp, double& zp);
     35  virtual void       Proj3DC2GrC(double x, double y, double z, double& xpix, double& ypix);
    3636 
    3737  virtual void       DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s);
  • trunk/SophyaPI/PI/pigraphgen.cc

    r190 r204  
    145145// void  DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true)
    146146//      Tracé d'un polygone plein de la couleur d'avant-plan.
    147 // void  DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, float degfin)
     147// void  DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin)
    148148//      Tracé d'un arc de cercle ou d'ellipse, inclu dans le "(x0,y0)" , "dx,dy"
    149149//      entre les angles (en degré) "degdeb" - "degfin"
    150 // void  DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, float degfin)
     150// void  DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin)
    151151//      Tracé d'un arc plein, inclu dans le "(x0,y0)" , "dx,dy"
    152152//      entre les angles (en degré) "degdeb" - "degfin"
     
    338338// operator float()
    339339//      Conversion en réél "float"
     340// operator double()
     341//      Conversion en réél "double"
    340342//--
    341343//++
  • trunk/SophyaPI/PI/pigraphgen.h

    r190 r204  
    4343
    4444
    45 //  Classe pour gerer indifferement des coordonnees float ou int
     45//  Classe pour gerer indifferement des coordonnees double ou int
    4646class PIGrCoord {
    4747public:
    48   inline PIGrCoord() { iv = 0; fv = 0.;}
    49   inline PIGrCoord(int a) { iv = a; fv = (float)a;}
    50   inline PIGrCoord(float a) { iv = (int)a; fv = a;}
    51   inline PIGrCoord(double a) { iv = (int)a; fv = (float)a;}
     48  inline PIGrCoord() { iv = 0; dv = 0.;}
     49  inline PIGrCoord(int a) { iv = a; dv = (double)a;}
     50  inline PIGrCoord(float a) { iv = (int)a; dv = (double)a;}
     51  inline PIGrCoord(double a) { iv = (int)a; dv = a;}
    5252  inline operator int() { return(iv); }
    5353  inline operator short() { return((short)iv); }
    5454  inline operator unsigned int() { return((unsigned int)iv); }
    5555  inline operator unsigned short() { return((unsigned short)iv); }
    56   inline operator float() { return(fv); }
    57   inline PIGrCoord& operator= (int a) { iv = a; fv = (float)a; return(*this); }
    58   inline PIGrCoord& operator= (float a) { iv = (int)a; fv = a; return(*this); }
    59   inline PIGrCoord& operator= (double a) { iv = (int)a; fv = (float)a; return(*this); }
     56  inline operator float() { return((float)dv); }
     57  inline operator double() { return(dv); }
     58  inline PIGrCoord& operator= (int a) { iv = a; dv = (double)a; return(*this); }
     59  inline PIGrCoord& operator= (float a) { iv = (int)a; dv = (double)a; return(*this); }
     60  inline PIGrCoord& operator= (double a) { iv = (int)a; dv = a; return(*this); }
    6061  int iv;
    61   float fv;
     62  double dv;
    6263};
    6364
     
    9697  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true)   = 0; 
    9798  virtual void       DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    98                              float degdeb, float degfin)                               = 0;
     99                             double degdeb, double degfin)                             = 0;
    99100  virtual void       DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    100                               float degdeb, float degfin)                              = 0;
     101                              double degdeb, double degfin)                            = 0;
    101102  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0)                            = 0;
    102103  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n)                    = 0;
  • trunk/SophyaPI/PI/pigraphps.cc

    r163 r204  
    2929//--
    3030//++
    31 // PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy)
     31// PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy)
    3232//      Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf".
    3333//      "(x0, y0)" détermine l'origine du nouveau bloc rectangulaire sur
    3434//      la page et "dx, dy" l'extension du bloc.
    35 // PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, float ofy)
     35// PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx, double ofy)
    3636//      Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf"
    3737//|     x0 = wdg->XPos()+ofx    y0 = wdg->YPos()+ofy
     
    4343
    4444/* --Methode-- */
    45 PIGraphicPS::PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, float ofy)
     45PIGraphicPS::PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx, double ofy)
    4646: PIGraphicGen()
    4747{
    48 BuildFromPSFile(psf, (float)wdg->XPos()+ofx, (float)wdg->YPos()+ofy,
    49                      (float)wdg->XSize(), (float)wdg->YSize() ); 
    50 }
    51 
    52 /* --Methode-- */
    53 PIGraphicPS::PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy)
     48BuildFromPSFile(psf, (double)wdg->XPos()+ofx, (double)wdg->YPos()+ofy,
     49                     (double)wdg->XSize(), (double)wdg->YSize() ); 
     50}
     51
     52/* --Methode-- */
     53PIGraphicPS::PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy)
    5454: PIGraphicGen()
    5555{
     
    7171
    7272/* --Methode-- */
    73 void PIGraphicPS::BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, float dy)
     73void PIGraphicPS::BuildFromPSFile(PSFile * psf, double x0, double y0, double dx, double dy)
    7474{
    7575mPSOut = psf;
     
    111111{
    112112if(mPSOut)
    113   mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
     113  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    114114return;
    115115}
     
    119119{
    120120if(mPSOut)
    121   mPSOut->DrawString((float)x,(float)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
     121  mPSOut->DrawString((double)x,(double)y,s,mFCol,mFAtt,mFSize); /* $CHECK$ PIFontSize ?? */
    122122return;
    123123}
     
    128128{
    129129if(mPSOut)
    130   mPSOut->DrawLine((float)x1,(float)y1,(float)x2,(float)y2,mFCol,mLAtt);
     130  mPSOut->DrawLine((double)x1,(double)y1,(double)x2,(double)y2,mFCol,mLAtt);
    131131return;
    132132}
     
    137137{
    138138if(mPSOut)
    139   mPSOut->DrawBox((float)x0,(float)y0,(float)dx,(float)dy,mFCol,mLAtt);
     139  mPSOut->DrawBox((double)x0,(double)y0,(double)dx,(double)dy,mFCol,mLAtt);
    140140return;
    141141}
     
    145145{
    146146if(mPSOut)
    147   mPSOut->DrawFBox((float)x0,(float)y0,(float)dx,(float)dy, mFCol, mFCol, mLAtt);
     147  mPSOut->DrawFBox((double)x0,(double)y0,(double)dx,(double)dy, mFCol, mFCol, mLAtt);
    148148return;
    149149}
     
    153153{
    154154if(mPSOut)
    155   mPSOut->DrawCircle((float)x0,(float)y0,(float)r,mFCol,mLAtt);
     155  mPSOut->DrawCircle((double)x0,(double)y0,(double)r,mFCol,mLAtt);
    156156return;
    157157}
     
    161161{
    162162if(mPSOut)
    163   mPSOut->DrawFCircle((float)x0,(float)y0,(float)r,mFCol,mFCol,mLAtt);
     163  mPSOut->DrawFCircle((double)x0,(double)y0,(double)r,mFCol,mFCol,mLAtt);
    164164return;
    165165}
     
    181181{
    182182int i;
    183 float *xtmp;
    184 float *ytmp;
     183double *xtmp;
     184double *ytmp;
    185185
    186186if(! mPSOut) return;
    187187
    188 xtmp = new float[n];
    189 ytmp = new float[n];
    190 for(i = 0 ; i < n ; i++) {xtmp[i] = (float)x[i] ; ytmp[i] = (float)y[i] ; }
    191 //float xoff,yoff;
     188xtmp = new double[n];
     189ytmp = new double[n];
     190for(i = 0 ; i < n ; i++) {xtmp[i] = (double)x[i] ; ytmp[i] = (double)y[i] ; }
     191//double xoff,yoff;
    192192//if (cinc) { xoff=yoff=0.; }   // Coord en mode incremental
    193 //else { xoff = (float)x[0];  yoff = (float)y[0]; }   //   Coord en mode absolu
    194 //xtmp[0] = (float)x[0];
    195 //ytmp[0] = (float)y[0];
     193//else { xoff = (double)x[0];  yoff = (double)y[0]; }   //   Coord en mode absolu
     194//xtmp[0] = (double)x[0];
     195//ytmp[0] = (double)y[0];
    196196//for(i=1;i<n;i++) {
    197 //  xtmp[i] = (float)x[i]-xoff;
    198 //  ytmp[i] = (float)y[i]-yoff;
     197//  xtmp[i] = (double)x[i]-xoff;
     198//  ytmp[i] = (double)y[i]-yoff;
    199199//}
    200200mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt,cinc);
     
    210210{
    211211int i;
    212 float *xtmp;
    213 float *ytmp;
     212double *xtmp;
     213double *ytmp;
    214214
    215215if(! mPSOut) return;
    216216
    217 xtmp = new float[n];
    218 ytmp = new float[n];
    219 for(i = 0 ; i < n ; i++) {xtmp[i] = (float)x[i] ; ytmp[i] = (float)y[i] ; }
    220 //float xoff,yoff;
     217xtmp = new double[n];
     218ytmp = new double[n];
     219for(i = 0 ; i < n ; i++) {xtmp[i] = (double)x[i] ; ytmp[i] = (double)y[i] ; }
     220//double xoff,yoff;
    221221//if (cinc) { xoff=yoff=0.; }   // Coord en mode incremental
    222 //else { xoff = (float)x[0];  yoff = (float)y[0]; }   //   Coord en mode absolu
    223 //xtmp[0] = (float)x[0];
    224 //ytmp[0] = (float)y[0];
     222//else { xoff = (double)x[0];  yoff = (double)y[0]; }   //   Coord en mode absolu
     223//xtmp[0] = (double)x[0];
     224//ytmp[0] = (double)y[0];
    225225//for(i=1;i<n;i++) {
    226 //  xtmp[i] = (float)x[i]-xoff;
    227 //  ytmp[i] = (float)y[i]-yoff;
     226//  xtmp[i] = (double)x[i]-xoff;
     227//  ytmp[i] = (double)y[i]-yoff;
    228228//}
    229229mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt,cinc);
     
    235235
    236236/* --Methode-- */
    237 void PIGraphicPS::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,float degdeb, float degfin)
     237void PIGraphicPS::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,double degdeb, double degfin)
    238238{
    239239// $CHECK$ Reza/ Nicolas  12 Nov 98 - A faire
     
    241241
    242242/* --Methode-- */
    243 void PIGraphicPS::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,float degdeb, float degfin)
     243void PIGraphicPS::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,double degdeb, double degfin)
    244244{
    245245// $CHECK$ Reza/ Nicolas  12 Nov 98 - A faire
     
    250250{
    251251if(mPSOut)
    252   mPSOut->DrawMarker((float)x0,(float)y0,mMrk,mFCol,mMrkSz);
     252  mPSOut->DrawMarker((double)x0,(double)y0,mMrk,mFCol,mMrkSz);
    253253return;
    254254}
     
    258258{
    259259int i;
    260 float *xtmp;
    261 float *ytmp;
     260double *xtmp;
     261double *ytmp;
    262262
    263263if( !mPSOut)  return;
    264264
    265 xtmp = new float[n];
    266 ytmp = new float[n];
     265xtmp = new double[n];
     266ytmp = new double[n];
    267267for(i=0;i<n;i++){
    268   xtmp[i] = (float)x[i];
    269   ytmp[i] = (float)y[i];
     268  xtmp[i] = (double)x[i];
     269  ytmp[i] = (double)y[i];
    270270}
    271271mPSOut->DrawMarkers(xtmp,ytmp,n,mMrk,mFCol, mMrkSz);
     
    284284if ((pix == NULL) || (cmap == NULL)) return;
    285285if(mPSOut)
    286   mPSOut->Image((float)x, (float)y, (float)sx, (float)sy, sx, sy, pix, cmap);
     286  mPSOut->Image((double)x, (double)y, (double)sx, (double)sy, sx, sy, pix, cmap);
    287287return;
    288288}
     
    455455PIGrCoord PIGraphicPS::CalcStringWidth(char const* s)
    456456{
    457 return((float)(mFSize*strlen(s)*0.5));   /*  facteur 0.5 ad'hoc $CHECK$  Voir Nicolas ! */
     457return((double)(mFSize*strlen(s)*0.5));   /*  facteur 0.5 ad'hoc $CHECK$  Voir Nicolas ! */
    458458}
    459459
  • trunk/SophyaPI/PI/pigraphps.h

    r158 r204  
    99{
    1010public:
    11                      PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx=0., float ofy=0.);
    12                      PIGraphicPS(PSFile * psf, float x0, float y0, float dx, float dy);
     11                     PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx=0., double ofy=0.);
     12                     PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy);
    1313  virtual           ~PIGraphicPS();
    1414
     
    3232  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 
    3333  virtual void       DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    34                              float degdeb, float degfin);
     34                             double degdeb, double degfin);
    3535  virtual void       DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    36                               float degdeb, float degfin);
     36                              double degdeb, double degfin);
    3737  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
    3838  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
     
    7474
    7575protected:
    76   void           BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, float dy);
     76  void           BuildFromPSFile(PSFile * psf, double x0, double y0, double dx, double dy);
    7777
    7878  PSFile * mPSOut;  /* Fichier PostScript */
    79   float mXmin, mYmin;
    80   float mXmax, mYmax;
     79  double mXmin, mYmin;
     80  double mXmax, mYmax;
    8181
    8282  PIColors  mFCol, mBCol;
  • trunk/SophyaPI/PI/pigraphuc.cc

    r202 r204  
    2121
    2222// Pour echanger deux valeurs PIGrCoord
    23 static inline void fl_swap(float& a, float& b) { float tmp = a; a = b; b = tmp; }
     23static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp; }
    2424
    2525//++
     
    8888//--
    8989//++
    90 // void       SetUCS(float xmin, float xmax, float ymin, float ymax, -
     90// void       SetUCS(double xmin, double xmax, double ymin, double ymax, -
    9191// int axrl=kAxeDirSame, int ayud=kAxeDirSame)
    9292//      Définit le système de coordonnées utilisateur. Axe X de "xmin" à "xmax" ,
     
    103103//      Par défaut : "xmin=ymin=0." , "ymin=ymax=0." , "kAxeDirLtoR" , "kAxeDirDownUp"
    104104//
    105 // void  UC2GrC(float x, float y, float& xpix, float& ypix)
     105// void  UC2GrC(double x, double y, double& xpix, double& ypix)
    106106//      Transformation de coordonnées utilisateur "(x,y)" en coordoonnées
    107107//      de l'espace graphic de départ "(xpix, ypix)"
    108 // void  GrC2UC(float xpix, float ypix, float& x, float& y)
     108// void  GrC2UC(double xpix, double ypix, double& x, double& y)
    109109//      Transformation de coordonnées de l'espace graphic de départ. en coordonnées utilisateur.
    110 // void  DUC2GrC(float dx, float dy, float& dxpix, float& dypix)
     110// void  DUC2GrC(double dx, double dy, double& dxpix, double& dypix)
    111111//      Transformation de distances selon X,Y en coordonnées utilisateur "dx, dy" en distance
    112112//      dans l'espace graphique de départ "dxpix , dypix".
    113 // void  DGrC2UC(float dxpix, float dypix, float& dx, float& dy)
     113// void  DGrC2UC(double dxpix, double dypix, double& dx, double& dy)
    114114//      Transformation de distances selon X,Y dans l'espace graphique de départ en distance
    115115//      dans l'espace de  coordonnées utilisateur.
     
    117117
    118118/* --Methode-- */
    119 void PIGraphicUC::SetUCS(float xmin, float xmax, float ymin, float ymax,
     119void PIGraphicUC::SetUCS(double xmin, double xmax, double ymin, double ymax,
    120120                         int axrl, int ayud)
    121121{
    122122
    123123  if (axrl == kAxeDirAuto) {
    124     float ff;
     124    double ff;
    125125    if (xmax < xmin)  { axrl = kAxeDirRtoL;   ff=xmin;  xmin=xmax;  xmax=ff; }
    126126    else  axrl = kAxeDirLtoR;
    127127  }
    128128  if (ayud == kAxeDirAuto) {
    129     float ff;
     129    double ff;
    130130    if (ymax < ymin)  { ayud = kAxeDirUpDown;   ff=ymin;  ymin=ymax;  ymax=ff; }
    131131    else  ayud = kAxeDirDownUp;
     
    165165
    166166/* --Methode-- */
    167 void PIGraphicUC::UC2GrC(float x, float y, float& xpix, float& ypix)
    168 {
    169   xpix = (float)(xOrg + x*xScale); 
    170   ypix = (float)(yOrg + y*yScale); 
    171 }
    172 
    173 /* --Methode-- */
    174 void PIGraphicUC::GrC2UC(float xpix, float ypix, float& x, float& y)
     167void PIGraphicUC::UC2GrC(double x, double y, double& xpix, double& ypix)
     168{
     169  xpix = (double)(xOrg + x*xScale); 
     170  ypix = (double)(yOrg + y*yScale); 
     171}
     172
     173/* --Methode-- */
     174void PIGraphicUC::GrC2UC(double xpix, double ypix, double& x, double& y)
    175175{
    176176  x = (xpix-xOrg)/xScale;
     
    179179
    180180/* --Methode-- */
    181 void PIGraphicUC::DUC2GrC(float dx, float dy, float& dxpix, float& dypix)
     181void PIGraphicUC::DUC2GrC(double dx, double dy, double& dxpix, double& dypix)
    182182{
    183183  dxpix = dx*xScale;
     
    188188
    189189/* --Methode-- */
    190 void PIGraphicUC::DGrC2UC(float dxpix, float dypix, float& dx, float& dy)
     190void PIGraphicUC::DGrC2UC(double dxpix, double dypix, double& dx, double& dy)
    191191{
    192192  dx = dxpix/xScale;
     
    200200{
    201201  if (!mGrC) return;
    202   float x, y, dx, dy;
     202  double x, y, dx, dy;
    203203  x = xc;  dx = dxc;
    204204  y = yc;  dy = dyc;
     
    227227  }
    228228
    229   float xf, yf, xf2, yf2;
     229  double xf, yf, xf2, yf2;
    230230  UC2GrC(x, y, xf, yf);
    231231  UC2GrC(x+dx, y+dy, xf2, yf2);
    232   if (xf2 < xf)  fl_swap(xf, xf2);
    233   if (yf2 < yf)  fl_swap(yf, yf2);
     232  if (xf2 < xf)  dbl_swap(xf, xf2);
     233  if (yf2 < yf)  dbl_swap(yf, yf2);
    234234  mGrC->Erase(xf, yf, xf2-xf, yf2-yf);
    235235}
     
    239239{
    240240  if (!mGrC) return;
    241   float xf, yf;
     241  double xf, yf;
    242242  UC2GrC(x, y, xf, yf);
    243243  mGrC->DrawString(xf, yf, s, pos); 
     
    248248{
    249249  if (!mGrC) return;
    250   float xf, yf;
     250  double xf, yf;
    251251  UC2GrC(x, y, xf, yf);
    252252  mGrC->DrawOpaqueString(xf, yf, s, pos); 
     
    258258 
    259259  if (!mGrC) return;
    260   float x1, y1, x2, y2;
     260  double x1, y1, x2, y2;
    261261  x1 = xc1;  y1 = yc1;
    262262  x2 = xc2;  y2 = yc2;
     
    267267    if (y1 > yMax && y2 > yMax) return;
    268268    if (x2 < x1) {
    269       fl_swap(x1,x2);
    270       fl_swap(y1,y2);
     269      dbl_swap(x1,x2);
     270      dbl_swap(y1,y2);
    271271    }
    272272    if (x2>xMax) {
     
    279279    }
    280280    if (y2 < y1) {
    281       fl_swap(x1,x2);
    282       fl_swap(y1,y2);
     281      dbl_swap(x1,x2);
     282      dbl_swap(y1,y2);
    283283    }
    284284    if (y2>yMax) {
     
    292292  }
    293293
    294   float xf1, yf1, xf2, yf2;
     294  double xf1, yf1, xf2, yf2;
    295295  UC2GrC(x1, y1, xf1, yf1);
    296296  UC2GrC(x2, y2, xf2, yf2);
     
    304304{
    305305  if (!mGrC) return;
    306   float x, y, dx, dy;
     306  double x, y, dx, dy;
    307307  x = xc;  dx = dxc;
    308308  y = yc;  dy = dyc;
     
    331331  }
    332332
    333   float xf, yf, xf2, yf2;
     333  double xf, yf, xf2, yf2;
    334334  UC2GrC(x, y, xf, yf);
    335335  UC2GrC(x+dx, y+dy, xf2, yf2);
    336   if (xf2 < xf)  fl_swap(xf, xf2);
    337   if (yf2 < yf)  fl_swap(yf, yf2);
     336  if (xf2 < xf)  dbl_swap(xf, xf2);
     337  if (yf2 < yf)  dbl_swap(yf, yf2);
    338338  mGrC->DrawBox(xf, yf, xf2-xf, yf2-yf);
    339339
     
    343343{
    344344  if (!mGrC) return;
    345   float x, y, dx, dy;
     345  double x, y, dx, dy;
    346346  x = xc;  dx = dxc;
    347347  y = yc;  dy = dyc;
     
    370370  }
    371371
    372   float xf, yf, xf2, yf2;
     372  double xf, yf, xf2, yf2;
    373373  UC2GrC(x, y, xf, yf);
    374374  UC2GrC(x+dx, y+dy, xf2, yf2);
    375   if (xf2 < xf)  fl_swap(xf, xf2);
    376   if (yf2 < yf)  fl_swap(yf, yf2);
     375  if (xf2 < xf)  dbl_swap(xf, xf2);
     376  if (yf2 < yf)  dbl_swap(yf, yf2);
    377377  mGrC->DrawFBox(xf, yf, xf2-xf, yf2-yf);
    378378
     
    383383  if (!mGrC) return;
    384384
    385   float xf, yf, rf,rfy;
     385  double xf, yf, rf,rfy;
    386386  UC2GrC(x, y, xf, yf);
    387387  DUC2GrC(r,r,rf,rfy);
     
    395395  if (!mGrC) return;
    396396
    397   float xf, yf, rf, rfy;
     397  double xf, yf, rf, rfy;
    398398  UC2GrC(x, y, xf, yf);
    399399  DUC2GrC(r,r,rf,rfy);
     
    407407  if (!mGrC) return;
    408408
    409   float xf, yf, dxf, dyf;
     409  double xf, yf, dxf, dyf;
    410410  UC2GrC(x0, y0, xf, yf);
    411411  DUC2GrC(dx, dy, dxf, dyf);
     
    418418  if (!mGrC) return;
    419419
    420   float xf, yf, dxf, dyf;
     420  double xf, yf, dxf, dyf;
    421421  UC2GrC(x0, y0, xf, yf);
    422422  DUC2GrC(dx, dy, dxf, dyf);
     
    432432  PIGrCoord *pxc, *pyc;
    433433  int i;
    434   float xf, yf;
     434  double xf, yf;
    435435 
    436436  if (!mGrC) return;
     
    454454  PIGrCoord *pxc, *pyc;
    455455  int i;
    456   float xf, yf;
     456  double xf, yf;
    457457 
    458458  if (!mGrC) return;
     
    473473/* --Methode-- */
    474474void PIGraphicUC::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    475                           float degdeb, float degfin)
    476 {
    477   if (!mGrC) return;
    478 
    479   float xf, yf, dxf, dyf;
     475                          double degdeb, double degfin)
     476{
     477  if (!mGrC) return;
     478
     479  double xf, yf, dxf, dyf;
    480480  UC2GrC(x0, y0, xf, yf);
    481481  DUC2GrC(dx, dy, dxf, dyf);
     
    484484/* --Methode-- */
    485485void PIGraphicUC::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    486                            float degdeb, float degfin)
    487 {
    488   if (!mGrC) return;
    489 
    490   float xf, yf, dxf, dyf;
     486                           double degdeb, double degfin)
     487{
     488  if (!mGrC) return;
     489
     490  double xf, yf, dxf, dyf;
    491491  UC2GrC(x0, y0, xf, yf);
    492492  DUC2GrC(dx, dy, dxf, dyf);
     
    498498{
    499499  if (!mGrC) return;
    500   float xf, yf;
     500  double xf, yf;
    501501  UC2GrC(x0, y0, xf, yf);
    502502  mGrC->DrawMarker(xf, yf);
     
    510510  PIGrCoord *pxc, *pyc;
    511511  int i;
    512   float xf, yf;
     512  double xf, yf;
    513513 
    514514  if (!mGrC) return;
     
    533533  if ( (sx < 1) || (sy < 1) )  return;
    534534  if ((pix == NULL) || (cmap == NULL)) return;
    535   float xf,yf;
     535  double xf,yf;
    536536  UC2GrC(x, y, xf, yf);
    537537  mGrC->DrawPixmap(xf, yf, pix, sx, sy, cmap);
     
    618618{
    619619  if (!mGrC) return;
    620   float fx, fy;
    621   DUC2GrC((float)sz, (float)sz, fx, fy);
     620  double fx, fy;
     621  DUC2GrC((double)sz, (double)sz, fx, fy);
    622622  int npt = (int)fy;
    623623  if (npt < 8) npt = 8;
     
    631631{
    632632  if (!mGrC) return;
    633   float fx, fy;
    634   DUC2GrC((float)sz, (float)sz, fx, fy);
     633  double fx, fy;
     634  DUC2GrC((double)sz, (double)sz, fx, fy);
    635635  int isz = int(0.5*(fx+fy+1));
    636636  mGrC->SelMarker( isz, mrk);
     
    711711  if (!mGrC) return(0);
    712712  int h,a,d;
    713   float fh, fa, fd, x;
     713  double fh, fa, fd, x;
    714714  h = mGrC->GetFontHeight(a, d) ;
    715715  DGrC2UC(0., h, x, fh);
     
    732732{
    733733  if (!mGrC) return(0.);
    734   float dx = mGrC->CalcStringWidth(s);
    735   float dxx, dxy;
     734  double dx = mGrC->CalcStringWidth(s);
     735  double dxx, dxy;
    736736  DGrC2UC(dx, dx, dxx, dxy);
    737737  return(dxx);
  • trunk/SophyaPI/PI/pigraphuc.h

    r158 r204  
    3232
    3333//  Definition des coordonnees utilisateur
    34   virtual void       SetUCS(float xmin, float xmax, float ymin, float ymax,
     34  virtual void       SetUCS(double xmin, double xmax, double ymin, double ymax,
    3535                            int axrl=kAxeDirSame, int ayud=kAxeDirSame);     
    3636
     
    4949  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true);
    5050  virtual void       DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    51                              float degdeb, float degfin);
     51                             double degdeb, double degfin);
    5252  virtual void       DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    53                               float degdeb, float degfin);
     53                              double degdeb, double degfin);
    5454 
    5555  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
     
    9797
    9898//  Transformation des ccordonnees
    99   virtual void       UC2GrC(float x, float y, float& xpix, float& ypix);
    100   virtual void       GrC2UC(float xpix, float ypix, float& x, float& y);
    101   virtual void       DUC2GrC(float dx, float dy, float& dxpix, float& dypix);
    102   virtual void       DGrC2UC(float dxpix, float dypix, float& dx, float& dy);
     99  virtual void       UC2GrC(double x, double y, double& xpix, double& ypix);
     100  virtual void       GrC2UC(double xpix, double ypix, double& x, double& y);
     101  virtual void       DUC2GrC(double dx, double dy, double& dxpix, double& dypix);
     102  virtual void       DGrC2UC(double dxpix, double dypix, double& dx, double& dy);
    103103
    104104  void   NoClip() {clip = false; }
     
    110110  PIGraphicGen* mGrC;
    111111
    112   float xMin, xMax, yMin, yMax; // Valeurs en unites user
    113   float xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
    114   float xScale, yScale;         // Pixels par unites graphiques
    115   float xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
     112  double xMin, xMax, yMin, yMax; // Valeurs en unites user
     113  double xOrg, yOrg;             // Position en pixels de (0.0, 0.0)
     114  double xScale, yScale;         // Pixels par unites graphiques
     115  double xW0, yW0, xWd, yWd;        // Origine/largeur ds la fenetre de trace
    116116  bool   aXdir, aYdir;           // Sens des axes horiz, vertical
    117117  bool   clip;
  • trunk/SophyaPI/PI/pigraphx.cc

    r190 r204  
    240240/* --Methode-- */
    241241void PIGraphicX::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    242                          float degdeb, float degfin)
     242                         double degdeb, double degfin)
    243243{
    244244XDrawArc(XtDisplay (MyWdg()), mWId, DefGC(),
     
    249249/* --Methode-- */
    250250void PIGraphicX::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    251                          float degdeb, float degfin)
     251                         double degdeb, double degfin)
    252252{
    253253XFillArc(XtDisplay (MyWdg()), mWId, DefGC(),
  • trunk/SophyaPI/PI/pigraphx.h

    r180 r204  
    3333  virtual void       DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 
    3434  virtual void       DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    35                              float degdeb, float degfin);
     35                             double degdeb, double degfin);
    3636  virtual void       DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,
    37                               float degdeb, float degfin);
     37                              double degdeb, double degfin);
    3838  virtual void       DrawMarker(PIGrCoord x0, PIGrCoord y0);
    3939  virtual void       DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n);
  • trunk/SophyaPI/PI/piimage.cc

    r202 r204  
    153153//  SetSize(img->XSize(), img->YSize());
    154154  CenterPave();
    155   float min=1., max=-1., moy, sig;
     155  double min=1., max=-1., moy, sig;
    156156  int nbnul, nbsat;
    157157  img->CheckDyn(min, max, moy, sig, nbnul, nbsat);
     
    217217if (showinfo && img)  {
    218218  char buff[256];
    219   float x,y;
     219  double x,y;
    220220  img->XYCoord(xpav, ypav, x, y);
    221221  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     
    237237
    238238/* --Methode-- */
    239 void PIImage::SetLut(float min, float max, int typlut, int lauto, bool refr)
     239void PIImage::SetLut(double min, double max, int typlut, int lauto, bool refr)
    240240{
    241241if (lut) delete(lut);
     
    243243  {
    244244  int nbsig = lauto; 
    245   float fracmax = 1. - 0.05*nbsig;
     245  double fracmax = 1. - 0.05*nbsig;
    246246  img->ComputeLut_PicHisto(min, max, nbsig, fracmax);
    247247  }
     
    381381else {
    382382  char buff[256];
    383   float x,y;
     383  double x,y;
    384384  img->XYCoord(xpav, ypav, x, y);
    385385  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     
    423423if (showinfo && img) {
    424424  char buff[256];
    425   float x,y;
     425  double x,y;
    426426  img->XYCoord(xpav, ypav, x, y);
    427427  sprintf(buff," X= %g , Y= %g  Pix= %g (%d,%d)      ",
     
    567567 {
    568568 char buff[256]; 
    569  float x,y;
     569 double x,y;
    570570 img->XYCoord(xp, yp, x, y);
    571571 sprintf(buff," X= %g , Y= %g  Pix= %g  (C= %d,%d)   ",
     
    669669char pc[256];
    670670strncpy(pc, (char*)pdata, ll-1);  pc[ll-1] = '\0';
    671 float fx, fy;
     671double fx, fy;
    672672img->Coord(xpav, ypav, fx, fy);
    673673mdrw->ElAddText(fx, fy, pc );
     
    717717PosW2Img(xw1, yw1, &x1, &y1);
    718718PosW2Img(xw2, yw2, &x2, &y2);
    719 float fx1,fy1, fx2, fy2;
     719double fx1,fy1, fx2, fy2;
    720720img->Coord(x1,y1, fx1, fy2);  // fy1 et fy2 echange expres pour utiliser kAxeDirAuto 
    721721img->Coord(x2,y2, fx2, fy1);  // En effet Image de haut vers bas, Axes de bas vers haut par defaut
  • trunk/SophyaPI/PI/piimage.h

    r128 r204  
    4747
    4848//  Gestion du choix de LUT, facteur d agrandissement, table de couleur
    49   void SetLut(float min, float max, int typlut=kLutType_Lin,
     49  void SetLut(double min, double max, int typlut=kLutType_Lin,
    5050              int lauto=0, bool refr=true);
    5151  void SetLut(LUT *clut, bool refr=true);
  • trunk/SophyaPI/PI/piimgtools.cc

    r163 r204  
    246246void PIImgTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
    247247{
    248 float min, max, del;
     248double min, max, del;
    249249int lauto, typ;
    250250int typlut[2] = {kLutType_Lin, kLutType_Log} ;
     
    266266    if (msg == 2700) {
    267267      del = max_lut-min_lut;
    268       min = min_lut+(float)mSc[0]->GetValue()/100*del;
    269       max = max_lut+(float)mSc[0]->GetValue()/100*del;
     268      min = min_lut+(double)mSc[0]->GetValue()/100*del;
     269      max = max_lut+(double)mSc[0]->GetValue()/100*del;
    270270    }
    271271    if (msg == 2800) {
    272272      del = max_lut-min_lut;
    273       min = min_lut-(float)mSc[1]->GetValue()/100.*del*0.5;
    274       max = max_lut+(float)mSc[1]->GetValue()/100.*del*0.5;
     273      min = min_lut-(double)mSc[1]->GetValue()/100.*del*0.5;
     274      max = max_lut+(double)mSc[1]->GetValue()/100.*del*0.5;
    275275    }
    276276    if ( (msg == 2700) || (msg == 2800) ) {
  • trunk/SophyaPI/PI/pimenux.cc

    r187 r204  
    100100PIMenuX::~PIMenuX()
    101101{
    102 for(int i=0; i<mNItem; i++)
    103   XtDestroyWidget(mBut[i].itb);
     102// for(int i=0; i<mNItem; i++)
     103//  XtDestroyWidget(mBut[i].itb); Le destroy est fait par le widget menu lui-meme
    104104delete[] mBut ;
    105105}
  • trunk/SophyaPI/PI/piscdrawwdg.cc

    r202 r204  
    3333//--
    3434
    35 static inline void fl_swap(float& a, float& b) { float tmp = a; a = b; b = tmp;  }
     35static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp;  }
    3636
    3737//++
     
    4444// long  kind()
    4545//      Renvoie le type ("=PIScDrawWdg::ClassId")
    46 // void SetLimits(float xmin, float xmax, float ymin, float ymax, -
     46// void SetLimits(double xmin, double xmax, double ymin, double ymax, -
    4747//           int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false)
    4848//      Définit les limites de coordonnées.
     
    111111
    112112void
    113 PIScDrawWdg::SetLimits(float xmin, float xmax, float ymin, float ymax,
     113PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax,
    114114                       int axrl, int ayud, bool tmp)
    115115{
     
    177177// Gestion affichage coordonnees du point
    178178
    179 string   PIScDrawWdg::GetClickText(float x, float y)
     179string   PIScDrawWdg::GetClickText(double x, double y)
    180180// Donne le texte a afficher pour position x,y 
    181181{
     
    224224{
    225225
    226   float dx, dy;
     226  double dx, dy;
    227227  mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy);
    228228  mPPos[0] = dx;  mPPos[1] = dy;
     
    271271    SetLimits(xMinS, xMaxS, yMinS, yMaxS, kAxeDirSame, kAxeDirSame );
    272272  else {
    273     float xl,yl,xh,yh;
     273    double xl,yl,xh,yh;
    274274    mBDrw->GetGraphicUC()->GrC2UC(xBegDrag, yBegDrag, xl, yl);
    275275    mBDrw->GetGraphicUC()->GrC2UC(xEndDrag, yEndDrag, xh, yh);
    276     if (xl > xh) fl_swap(xl, xh);
    277     if (yl > yh) fl_swap(yl, yh);
     276    if (xl > xh) dbl_swap(xl, xh);
     277    if (yl > yh) dbl_swap(yl, yh);
    278278    SetLimits(xl,xh,yl,yh, kAxeDirSame, kAxeDirSame, true);
    279279  }
     
    323323{
    324324  if (mSz <= 0)  return;
    325   float xmin, xmax, ymin, ymax;
     325  double xmin, xmax, ymin, ymax;
    326326  int i=0;
    327   float cv;
     327  double cv;
    328328  if (mAy) {
    329329    xmin = xmax = mAx->Value(0);
     
    351351    }
    352352
    353   float dx, dy;
     353  double dx, dy;
    354354  dx = 0.02*(xmax-xmin);
    355355  dy = 0.02*(ymax-ymin);
     
    361361
    362362/* --Methode-- */
    363 void PIYfXDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
    364 {
    365   float xp,yp;
     363void PIYfXDrawer::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
     364{
     365  double xp,yp;
    366366  int i;
    367367
     
    381381
    382382// Trace des lignes
    383   float xp2, yp2;
     383  double xp2, yp2;
    384384  if (mAy) { xp2 = mAx->Value(0); yp2 = mAy->Value(0); }
    385385  else { xp2 = mAx->X(0);  yp2 = mAx->Value(0); }
     
    412412/* --Methode-- */
    413413void
    414 PIFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)
     414PIFuncDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
    415415{
    416416  PIGrCoord x1, x2, y1, y2;
    417417  g->GetGrSpace(x1, x2, y1, y2);
    418   float xMax = x2;
    419   float xMin = x1;
    420   float yMax = y2;
    421   float yMin = y1;
    422   float xStep = (xMax - xMin)/100;
    423   float xOld = xMin;
    424   float yOld = mFunc(xMin);
    425   for (float x = xMin+xStep; x<xMax; x+=xStep) {
     418  double xMax = x2;
     419  double xMin = x1;
     420  double yMax = y2;
     421  double yMin = y1;
     422  double xStep = (xMax - xMin)/100;
     423  double xOld = xMin;
     424  double yOld = mFunc(xMin);
     425  for (double x = xMin+xStep; x<xMax; x+=xStep) {
    426426    double y = mFunc(x);
    427427    if (y>yMin && yOld>yMin &&
  • trunk/SophyaPI/PI/piscdrawwdg.h

    r202 r204  
    2626  virtual long       kind() {return ClassId; }
    2727 
    28   virtual void       SetLimits(float xmin, float xmax, float ymin, float ymax,
     28  virtual void       SetLimits(double xmin, double xmax, double ymin, double ymax,
    2929                               int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false);
    3030  virtual void       UpdateLimits();  // Calcule et change les limites a partir de Drawer-No-1
     
    4242  inline PIElDrawer* BaseDrawer() { return mBDrw; };
    4343
    44   float XMin() const {return mBDrw->XMin();}
    45   float XMax() const {return mBDrw->XMax();}
    46   float YMin() const {return mBDrw->YMin();}
    47   float YMax() const {return mBDrw->YMax();}
    48   float XPPos() const { return mPPos[0]; }
    49   float YPPos() const { return mPPos[1]; }
     44  double XMin() const {return mBDrw->XMin();}
     45  double XMax() const {return mBDrw->XMax();}
     46  double YMin() const {return mBDrw->YMin();}
     47  double YMax() const {return mBDrw->YMax();}
     48  double XPPos() const { return mPPos[0]; }
     49  double YPPos() const { return mPPos[1]; }
    5050  int    LimitsFixed() const {return mBDrw->LimitsFixed();}
    5151  void   FreeLimits() { mBDrw->FreeLimits(); }
    5252   
    5353
    54   virtual string     GetClickText(float x, float y); // Donne le texte a afficher pour position x,y
     54  virtual string     GetClickText(double x, double y); // Donne le texte a afficher pour position x,y
    5555
    5656  void               SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30);
     
    6868 
    6969protected:
    70   float xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
    71   float mPPos[2];               // Position click souris X,Y
     70  double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom
     71  double mPPos[2];               // Position click souris X,Y
    7272
    7373  PIElDrawer* mBDrw;
     
    9999  virtual           ~PIYfXDrawer();
    100100 
    101   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     101  virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    102102  virtual void       UpdateLimits();
    103103 
     
    120120  virtual           ~PIFuncDrawer();
    121121 
    122   virtual void       Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     122  virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    123123protected:
    124124  FUNC               mFunc;
  • trunk/SophyaPI/PI/pistzwin.cc

    r190 r204  
    177177int k;
    178178for(k=0; k<NbChilds(); k++) {
    179   psf->NewPage((float)XSize(), (float)YSize(),PI_Auto);
     179  psf->NewPage((double)XSize(), (double)YSize(),PI_Auto);
    180180  GetChild(k)->PSPrint(psf, ofx, ofy);
    181181  }
  • trunk/SophyaPI/PI/pisurfdr.cc

    r184 r204  
    1313  arr->XYfromxy(arr->XSize(),arr->YSize(),mXmax, mYmax);
    1414  if (asxy)  mScy = (mXmax-mXmin)/(mYmax-mYmin);
    15   float scm =  ((mXmax-mXmin) > (mYmax-mYmin)) ? (mXmax-mXmin)  : (mYmax-mYmin);
    16   int i,j;   float cv;
     15  double scm =  ((mXmax-mXmin) > (mYmax-mYmin)) ? (mXmax-mXmin)  : (mYmax-mYmin);
     16  int i,j;   double cv;
    1717  mZmin = mZmax = arr->Value(0,0);
    1818  for(i=0; i<arr->XSize(); i++)
     
    2626//  printf("PISurfaceDrawer::PISurfaceDrawer Min/Max: %g,%g  %g,%g  %g,%g  Sc: %g %g %g \n",
    2727//          mXmin, mXmax, mYmin, mYmax, mZmin, mZmax, mScx, mScy, mScz);
    28   float zmin = mZmin;
    29   float zmax = mZmax;
    30   float dzz = (mZmax-mZmin)*0.05;
     28  double zmin = mZmin;
     29  double zmax = mZmax;
     30  double dzz = (mZmax-mZmin)*0.05;
    3131  mLut = new LUT(zmin-dzz*2, zmax-dzz, 256);
    3232}
     
    4343{
    4444  if (mArr == NULL)  return;
    45   float xmin, xmax, ymin, ymax, zmin, zmax;
     45  double xmin, xmax, ymin, ymax, zmin, zmax;
    4646  xmin = mXmin*mScx;  xmax = mXmax*mScx;
    4747  ymin = mYmin*mScy;  ymax = mYmax*mScy;
     
    5050// Distance D = Max(xmax-xmin,ymin-ymax)*2
    5151// Observateur en O = X+D, Yc+2*D
    52   float D = xmax-xmin;
     52  double D = xmax-xmin;
    5353  if (D < (ymax-ymin))  D = ymax-ymin;
    5454  D *= 1.4;
     
    7070
    7171typedef struct   /*  structures pour trier en ZP les facettes */
    72   { double dp;  float zh;  int ij;  } ZPSORT;
     72  { double dp;  double zh;  int ij;  } ZPSORT;
    7373/* Nouvelle-Fonction */
    7474static int ijzpsort(const void * sp1, const void * sp2)
     
    9696
    9797/* --Methode-- */
    98 void PISurfaceDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax)
     98void PISurfaceDrawer::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
    9999{
    100100// On trace les axes - En attendant de faire mieux - Reza 8/12/98
     
    116116
    117117  ZPSORT* ijzp = new ZPSORT[xsz*ysz];
    118   float* xw = new float[(xsz+1)*(ysz+1)];
    119   float* yw = new float[(xsz+1)*(ysz+1)];
    120   float* zw = new float[(xsz+1)*(ysz+1)];
    121 
    122   float dx,dy;   // taille du bin
     118  double* xw = new double[(xsz+1)*(ysz+1)];
     119  double* yw = new double[(xsz+1)*(ysz+1)];
     120  double* zw = new double[(xsz+1)*(ysz+1)];
     121
     122  double dx,dy;   // taille du bin
    123123  dx = (mXmax-mXmin)*mScx/xsz;
    124124  dy = (mYmax-mYmin)*mScy/ysz;
     
    126126  int i1,j1;
    127127  int i,j,k,l;
    128   float x,y,z,xp,yp,zp;
     128  double x,y,z,xp,yp,zp;
    129129
    130130  k = 0;
  • trunk/SophyaPI/PI/pisurfdr.h

    r184 r204  
    1717  virtual void          UpdateLimits();   // Calcule et change la vue-3D
    1818
    19   virtual void          Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, float ymax);
     19  virtual void          Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    2020  virtual void          DrawAxes(PIGraphicUC* g);
    2121
     
    2323  P2DArrayAdapter* mArr;
    2424  bool mAda;
    25   float mScz, mScx, mScy;
    26   float mXmin, mXmax;
    27   float mYmin, mYmax;
    28   float mZmin, mZmax;
     25  double mScz, mScx, mScy;
     26  double mXmin, mXmax;
     27  double mYmin, mYmax;
     28  double mZmin, mZmax;
    2929  LUT* mLut;
    3030};
  • trunk/SophyaPI/PI/piwdggen.cc

    r190 r204  
    254254
    255255if (!psf) return;
    256 psf->NewBloc((float)ofx+XPos(), (float)ofy+YPos(), (float)XSize(), (float)YSize(),
    257              (float)XSize(), (float)YSize());
    258 psf->DrawBox(0., 0., (float)XSize(), (float)YSize());
     256psf->NewBloc((double)ofx+XPos(), (double)ofy+YPos(), (double)XSize(), (double)YSize(),
     257             (double)XSize(), (double)YSize());
     258psf->DrawBox(0., 0., (double)XSize(), (double)YSize());
    259259sprintf(str,"PIWdgGen::PSPrint() Kind=%ld Name= %s", kind(), Nom().c_str());
    260260psf->DrawString(12., 12., str, PI_Black, PI_RomanFont, 10);
  • trunk/SophyaPI/PI/piwdgx.cc

    r190 r204  
    195195UnManage();
    196196if (curselwdg == this)  { SelectionLost(); curselwdg = NULL; }
    197 if (!sdw)  XtDestroyWidget(sdw);
     197if (sdw)  {
     198// Pour gerer la double structure en Widget des PIWindowX
     199  if (wmis == k_wmi_normal) XtDestroyWidget(sdw);
     200  else if (wmis == k_wmi_cascade) {
     201    SysDWdg pwdg = XtParent(sdw);
     202    XtDestroyWidget(sdw);
     203    if (pwdg) XtDestroyWidget(pwdg);
     204    }
     205  }
    198206}
    199207
  • trunk/SophyaPI/PI/piwdgx.h

    r190 r204  
    1515typedef WidgetClass SysDWdgClass;
    1616
    17 
    18 enum WmIntState { k_wmi_unknown=0,
    19                   k_wmi_normal=1, k_wmi_toplevel=2,
    20                   k_wmi_transient=3, k_wmi_override=4,
    21                   k_wmi_appshell=5 };
    2217
    2318class PIWdgX : public PIWdgGen
     
    9590
    9691protected:
     92// Definit le type de Widget, en particulier pour la gestion des feneteres de haut niveau
     93// k_wmi_cascade : Widget cree en cascade d'un autre (Exemple pour PIWIndowX)
     94  enum WmIntState { k_wmi_unknown=0,
     95                    k_wmi_normal=1, k_wmi_toplevel=2,
     96                    k_wmi_transient=3, k_wmi_override=4,
     97                    k_wmi_appshell=5, k_wmi_cascade=6 };
     98
    9799  int           InitXt(int narg=0, char *arg[]=NULL);
    98100
  • trunk/SophyaPI/PI/piwindowx.cc

    r163 r204  
    9292
    9393CreateXtWdg(nom, xmFormWidgetClass, pwm->XtWdg(), sx, sy, 0, 0);
     94wmis = k_wmi_cascade;
    9495}
    9596
     
    9798PIWindowX::~PIWindowX()
    9899{
     100Hide();
    99101delete pwm;
    100102}
  • trunk/SophyaPI/PI/psfile.cc

    r164 r204  
    243243/* Dimensions des divers formats */
    244244  struct PaperSize {
    245       float width ;
    246       float height ;
     245      double width ;
     246      double height ;
    247247  };
    248248struct PaperSize PaperSizeTable[] = {
     
    254254
    255255
    256 float cm2pt(float x);
     256double cm2pt(double x);
    257257
    258258
     
    278278//--
    279279//++
    280 // PSFile (const char * FileName, float sc = 1.0)
     280// PSFile (const char * FileName, double sc = 1.0)
    281281//      Créateur pour fichier Encapsulated Postscript
    282282// PSFile (const char * FileName, PIOrientation orientation, -
    283283//         PIPaperSize paperSize= PI_A4, -
    284 //         float marginX = 5.0, float marginY = 5.0 )
     284//         double marginX = 5.0, double marginY = 5.0 )
    285285//      Créateur pour fichier Postscript
    286286//--
     
    294294 *
    295295 */
    296 PSFile::PSFile(const char * FileName, float sc)
     296PSFile::PSFile(const char * FileName, double sc)
    297297#if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)
    298298    : mPSFileName(FileName==NULL? "unnamed.eps" : const_cast<char *>(FileName)),
     
    359359               PIOrientation orientation,
    360360               PIPaperSize   paperSize,
    361                float marginX, float marginY)
     361               double marginX, double marginY)
    362362#if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__)
    363363 :  mPSFileName (FileName == NULL ? "unnamed.ps" : const_cast<char *>(FileName)),
     
    471471}
    472472
    473 void  PSFile::NewPage(float Dx, float Dy, PIOrientation orientation) {
    474 
    475 float  tw, th; /* largeur & hauteur corrigees des marges */
     473void  PSFile::NewPage(double Dx, double Dy, PIOrientation orientation) {
     474
     475double  tw, th; /* largeur & hauteur corrigees des marges */
    476476
    477477    /* On ferme ce qui doit l'etre ... */
     
    635635
    636636
    637 void  PSFile::NewBloc(float x0, float y0, float Tx, float Ty,
    638                               float Dx, float Dy){
     637void  PSFile::NewBloc(double x0, double y0, double Tx, double Ty,
     638                              double Dx, double Dy){
    639639
    640640    /* Si pas de page, on s'en va */
     
    692692  PIColor tmp = cmap.GetColor(cid) ;
    693693  fprintf(mPSFile, "/ur %.3f def /ug %.3f def /ub %.3f def \n",
    694           (float)(tmp.red)/65535.,
    695           (float)(tmp.green)/65535.,
    696           (float)(tmp.blue)/65535.) ;
     694          (double)(tmp.red)/65535.,
     695          (double)(tmp.green)/65535.,
     696          (double)(tmp.blue)/65535.) ;
    697697}
    698698
     
    704704
    705705
    706 void  PSFile::DrawString  (float x,  float y, const char *s,
     706void  PSFile::DrawString  (double x,  double y, const char *s,
    707707                           PIColors DrawColor,
    708708                           PIFontAtt FontAtt,
     
    730730
    731731
    732 void  PSFile::DrawLine    (float x1, float y1, float x2, float y2,
     732void  PSFile::DrawLine    (double x1, double y1, double x2, double y2,
    733733                   PIColors DrawColor,
    734734                   PILineAtt LineAtt) {
     
    769769
    770770
    771 void  PSFile::DrawBox(float x0, float y0, float Tx, float Ty,
     771void  PSFile::DrawBox(double x0, double y0, double Tx, double Ty,
    772772                      PIColors  DrawColor,
    773773                      PILineAtt LineAtt) {
     
    791791
    792792
    793 void  PSFile::DrawFBox(float x0, float y0, float Tx, float Ty,
     793void  PSFile::DrawFBox(double x0, double y0, double Tx, double Ty,
    794794                   PIColors DrawColor,
    795795                   PIColors FillColor,
     
    818818
    819819
    820 void  PSFile::DrawCircle  (float x0, float y0, float r,
     820void  PSFile::DrawCircle  (double x0, double y0, double r,
    821821                           PIColors DrawColor,
    822822                           PILineAtt LineAtt) {
     
    840840
    841841
    842 void  PSFile::DrawFCircle (float x0, float y0, float r,
     842void  PSFile::DrawFCircle (double x0, double y0, double r,
    843843                   PIColors DrawColor,
    844844                   PIColors FillColor,
     
    872872
    873873// Les coordonnees sont supposees etre en mode incremental .
    874 void  PSFile::DrawPolygon (float *x, float *y, int n,
     874void  PSFile::DrawPolygon (double *x, double *y, int n,
    875875                   PIColors DrawColor,
    876876                   PILineAtt LineAtt, bool cinc) {
     
    901901
    902902
    903 void  PSFile::DrawFPolygon(float *x, float *y, int n,
     903void  PSFile::DrawFPolygon(double *x, double *y, int n,
    904904                   PIColors DrawColor,
    905905                   PIColors FillColor,
     
    938938
    939939
    940 void  PSFile::DrawMarker  (float x0, float y0,
     940void  PSFile::DrawMarker  (double x0, double y0,
    941941                           PIMarker MrkType,   
    942942                           PIColors DrawColor,
     
    965965 *
    966966 */
    967 void  PSFile::DrawMarkers (float *x0, float *y0, int n,
     967void  PSFile::DrawMarkers (double *x0, double *y0, int n,
    968968                           PIMarker MrkType,
    969969                           PIColors DrawColor,
     
    989989}
    990990
    991 void PSFile::Image(float x0, float y0, float Tx, float Ty,
     991void PSFile::Image(double x0, double y0, double Tx, double Ty,
    992992                   int Nx, int Ny,
    993993                   unsigned char *Pict,
     
    10341034 */
    10351035
    1036 float cm2pt(float x) {
     1036double cm2pt(double x) {
    10371037    return (x*28.35);
    10381038}
  • trunk/SophyaPI/PI/psfile.h

    r177 r204  
    5151/* Valable pour une page, ou un bloc */
    5252/*typedef struct {
    53  *  float X0;          Coordonnes sommet NO 
    54  *  float Y0;           en unites courantes 
    55  *  float Tx;          Format               
    56  *  float Ty;           en unites courantes 
    57  *  float Dx;          Coord sommet SE       
    58  *  float Dy;           en unites courantes 
     53 *  double X0;          Coordonnes sommet NO 
     54 *  double Y0;           en unites courantes 
     55 *  double Tx;          Format               
     56 *  double Ty;           en unites courantes 
     57 *  double Dx;          Coord sommet SE       
     58 *  double Dy;           en unites courantes 
    5959 *  int orientation;   LANDSCAPE OU PORTRAIT
    6060 *} Format;
     
    7575public:
    7676    /* Production fichier eps */
    77     PSFile (const char * FileName, float sc = 1.0);
     77    PSFile (const char * FileName, double sc = 1.0);
    7878    /* Production fichier ps  */
    7979    PSFile (const char * FileName, PIOrientation orientation,
    8080            PIPaperSize paperSize= PI_A4,
    81             float marginX = 5.0, float marginY = 5.0 ) ;
     81            double marginX = 5.0, double marginY = 5.0 ) ;
    8282
    8383    virtual      ~PSFile();
     
    9696    virtual PIMarker    GetMarker();
    9797
    98     virtual void  NewPage(float Dx, float Dy, PIOrientation orientation);
     98    virtual void  NewPage(double Dx, double Dy, PIOrientation orientation);
    9999    virtual void  EndPage();
    100     virtual void  NewBloc(float x0, float y0, float Tx, float Ty,
    101                           float Dx, float Dy);
     100    virtual void  NewBloc(double x0, double y0, double Tx, double Ty,
     101                          double Dx, double Dy);
    102102    virtual void  EndBloc();
    103103
     
    106106
    107107    /* Trace */
    108     virtual void  DrawString  (float x,  float y, const char *s,
     108    virtual void  DrawString  (double x,  double y, const char *s,
    109109                               PIColors DrawColor  = PI_NotDefColor,
    110110                               PIFontAtt FontAtt   = PI_NotDefFontAtt,
    111111                               int FontSize        = 8);
    112     virtual void  DrawLine    (float x1, float y1, float x2, float y2,
    113                                PIColors DrawColor  = PI_NotDefColor,
    114                                PILineAtt LineAtt   = PI_NotDefLineAtt);
    115     virtual void  DrawBox     (float x0, float y0, float Tx, float Ty,
    116                                PIColors DrawColor  = PI_NotDefColor,
    117                                PILineAtt LineAtt   = PI_NotDefLineAtt);
    118     virtual void  DrawFBox    (float x0, float y0, float Tx, float Ty,
     112    virtual void  DrawLine    (double x1, double y1, double x2, double y2,
     113                               PIColors DrawColor  = PI_NotDefColor,
     114                               PILineAtt LineAtt   = PI_NotDefLineAtt);
     115    virtual void  DrawBox     (double x0, double y0, double Tx, double Ty,
     116                               PIColors DrawColor  = PI_NotDefColor,
     117                               PILineAtt LineAtt   = PI_NotDefLineAtt);
     118    virtual void  DrawFBox    (double x0, double y0, double Tx, double Ty,
    119119                               PIColors DrawColor  = PI_NotDefColor,
    120120                               PIColors FillColor  = PI_NotDefColor,
    121121                               PILineAtt LineAtt   = PI_NotDefLineAtt);
    122     virtual void  DrawCircle  (float x0, float y0, float r,
    123                                PIColors DrawColor  = PI_NotDefColor,
    124                                PILineAtt LineAtt   = PI_NotDefLineAtt);
    125     virtual void  DrawFCircle (float x0, float y0, float r,
     122    virtual void  DrawCircle  (double x0, double y0, double r,
     123                               PIColors DrawColor  = PI_NotDefColor,
     124                               PILineAtt LineAtt   = PI_NotDefLineAtt);
     125    virtual void  DrawFCircle (double x0, double y0, double r,
    126126                               PIColors DrawColor  = PI_NotDefColor,
    127127                               PIColors FillColor  = PI_NotDefColor,
    128128                               PILineAtt LineAtt   = PI_NotDefLineAtt);
    129     virtual void  DrawPolygon (float *x, float *y, int n,
     129    virtual void  DrawPolygon (double *x, double *y, int n,
    130130                               PIColors DrawColor  = PI_NotDefColor,
    131131                               PILineAtt LineAtt   = PI_NotDefLineAtt,
    132132                               bool cinc = true);
    133     virtual void  DrawFPolygon(float *x, float *y, int n,
     133    virtual void  DrawFPolygon(double *x, double *y, int n,
    134134                               PIColors DrawColor  = PI_NotDefColor,
    135135                               PIColors FillColor  = PI_NotDefColor,
    136136                               PILineAtt LineAtt   = PI_NotDefLineAtt,
    137137                               bool cinc = true);
    138     virtual void  DrawMarker  (float x0, float y0,
     138    virtual void  DrawMarker  (double x0, double y0,
    139139                               PIMarker MrkType    = PI_NotDefMarker,
    140140                               PIColors DrawColor  = PI_NotDefColor,
    141141                               int MarkerSize=14);
    142     virtual void  DrawMarkers (float *x0, float *y0, int n,
     142    virtual void  DrawMarkers (double *x0, double *y0, int n,
    143143                               PIMarker MrkType    = PI_NotDefMarker,
    144144                               PIColors DrawColor  = PI_NotDefColor,
    145145                               int MarkerSize=14);
    146146
    147     virtual void  Image(float x0, float y0, float Tx, float Ty,
     147    virtual void  Image(double x0, double y0, double Tx, double Ty,
    148148                        int Nx, int Ny,
    149149                        unsigned char *pict,
     
    155155        int    num;
    156156        char*  label;
    157         float  X0, Y0;            /* coordonnees sommet NO */
    158         float  Tx, Ty;            /* Format */
    159         float  Dx, Dy;            /* Repere utilisateur */
     157        double  X0, Y0;            /* coordonnees sommet NO */
     158        double  Tx, Ty;            /* Format */
     159        double  Dx, Dy;            /* Repere utilisateur */
    160160        long  begin,end,tmp;   /* offsets dans le fichier */
    161161    } Bloc ;
     
    167167        int num;
    168168        int BlocCounter;
    169         float Dx,Dy;              /* Sommet SE (unites utilisateur) */
     169        double Dx,Dy;              /* Sommet SE (unites utilisateur) */
    170170        PIOrientation orientation;
    171171        long  begin, end, tmp;    /* Offsets dans le fichier */
     
    179179    FILE *   mPSFile;
    180180    const char *   mPSFileName;
    181     float    Tw,Th ;              /* Format, en cm */
    182     float    WMargin,HMargin ;    /* Marges minimales */
     181    double    Tw,Th ;              /* Format, en cm */
     182    double    WMargin,HMargin ;    /* Marges minimales */
    183183    int      isEPS;               /* Vrai si PostScript Encapsule */
    184184    long     boundingBox;         /* Endroit ou est specifiee la bb */
    185     float    scale;               /* boundingbox = Dx*scale ; Dy*scale */
     185    double    scale;              /* boundingbox = Dx*scale ; Dy*scale */
    186186    PIPaperSize mPaperSize ;
    187187    int      PageCounter;         /* nbr pages */
Note: See TracChangeset for help on using the changeset viewer.