Changeset 204 in Sophya for trunk/SophyaPI
- Timestamp:
- Mar 1, 1999, 6:03:26 PM (27 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/lut.cc
r106 r204 14 14 /* --Methode-- */ 15 15 16 LUT::LUT( float min, floatmax, unsigned short ncol, int typ, int ntable)16 LUT::LUT(double min, double max, unsigned short ncol, int typ, int ntable) 17 17 { 18 18 int nlev; … … 21 21 nlev = ncol-2; 22 22 if (nlev < 1) nlev = 1; 23 bornes = new float[nlev+1];23 bornes = new double[nlev+1]; 24 24 25 25 if (bornes == NULL) return; … … 40 40 41 41 /* --Methode-- */ 42 void LUT::SetLut( float min, floatmax, int typ)42 void LUT::SetLut(double min, double max, int typ) 43 43 { 44 44 … … 49 49 { 50 50 int i; 51 floatdx;51 double dx; 52 52 double dlx; 53 53 switch (typ) 54 54 { 55 55 case kLutType_Lin : 56 dx = (max-min)/( float)nLevel;56 dx = (max-min)/(double)nLevel; 57 57 for(i=0; i<nLevel; i++) 58 bornes[i] = min+( float)i*dx;58 bornes[i] = min+(double)i*dx; 59 59 break; 60 60 case kLutType_Log : 61 dlx = log(max-min) / ( float)nLevel;61 dlx = log(max-min) / (double)nLevel; 62 62 for(i=0; i<nLevel; i++) 63 bornes[i] = min+( float)exp((double)i*dlx);63 bornes[i] = min+(double)exp((double)i*dlx); 64 64 break; 65 65 default: … … 87 87 88 88 /* --Methode-- */ 89 unsigned short LUT::Apply( floatx)89 unsigned short LUT::Apply(double x) 90 90 { 91 91 int i; … … 102 102 table = new unsigned short [nt-2]; 103 103 tablebinwidth = (Max()-Min())/(nt-2); 104 floatx = Min()+0.5*tablebinwidth;104 double x = Min()+0.5*tablebinwidth; 105 105 for(int i=0; i<nt-2; i++) { table[i] = Apply(x); x += tablebinwidth; } 106 106 } -
trunk/SophyaPI/PI/lut.h
r127 r204 19 19 public: 20 20 21 LUT( float min, floatmax, 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); 22 22 ~LUT(); 23 void SetLut( float min, floatmax, int typ=0);23 void SetLut(double min, double max, int typ=0); 24 24 void Print(); 25 unsigned short Apply( floatx);26 inline unsigned short ApplyFast( floatx)25 unsigned short Apply(double x); 26 inline unsigned short ApplyFast(double x) 27 27 { 28 28 if (x < Min()) return(0); … … 32 32 } 33 33 34 inline floatMin() { return(bornes[0]); };35 inline floatMax() { return(bornes[nLevel]); };34 inline double Min() { return(bornes[0]); }; 35 inline double Max() { return(bornes[nLevel]); }; 36 36 inline int Type() { return(type); }; 37 37 inline int NCol() { return(nLevel+2); }; … … 42 42 int type; 43 43 int nLevel; 44 float* bornes;44 double * bornes; 45 45 unsigned short * table; 46 floattablebinwidth;46 double tablebinwidth; 47 47 48 48 }; -
trunk/SophyaPI/PI/parradapter.cc
r140 r204 22 22 23 23 /* --Methode-- */ 24 void P1DArrayAdapter::DefineXCoordinate( float x0, floatdx)24 void P1DArrayAdapter::DefineXCoordinate(double x0, double dx) 25 25 { 26 26 mOx = x0; mDx = dx; … … 28 28 29 29 /* --Methode-- */ 30 floatP1DArrayAdapter::X(int i)30 double P1DArrayAdapter::X(int i) 31 31 { 32 32 return(mOx+mDx*i); … … 60 60 61 61 /* --Methode-- */ 62 void P2DArrayAdapter::DefineXYCoordinates( float x0, float y0, float dx, floatdy)62 void P2DArrayAdapter::DefineXYCoordinates(double x0, double y0, double dx, double dy) 63 63 { 64 64 mOx = x0; mOy = y0; … … 67 67 68 68 /* --Methode-- */ 69 void P2DArrayAdapter::XYfromxy(int ix, int iy, float& x, float& y)69 void P2DArrayAdapter::XYfromxy(int ix, int iy, double& x, double& y) 70 70 { 71 71 x = mOx+ix*mDx; … … 74 74 75 75 /* --Methode-- */ 76 int P2DArrayAdapter::CheckDyn( float& min, float& max, float& moy, float& sig, int& nbnul, int& nbsat, int vit)76 int P2DArrayAdapter::CheckDyn(double& min, double& max, double& moy, double& sig, int& nbnul, int& nbsat, int vit) 77 77 { 78 78 // TIMEF ; … … 85 85 86 86 if (min >= max) { min = -9.e19; max = 9.e19; } 87 floatminpix = max;88 floatmaxpix = min;89 floatpixv;87 double minpix = max; 88 double maxpix = min; 89 double pixv; 90 90 // printf("DEBUG_CHECKDYN-IN %d - %g %g ", vit, min, max); 91 91 … … 130 130 131 131 /* --Methode-- */ 132 void P2DArrayAdapter::ComputeLut_PicHisto( float& min, float& max, int nbsig, floatfracmax)132 void P2DArrayAdapter::ComputeLut_PicHisto(double& min, double& max, int nbsig, double fracmax) 133 133 { 134 134 // TIMEF ; … … 143 143 144 144 // Variable decrivant l'histogramme 145 floatminhis, maxhis, binwidth;145 double minhis, maxhis, binwidth; 146 146 int under,over,tothis; 147 147 int *phis; 148 148 int *q; 149 149 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; } 150 double MINDYNAMIC = 1.e-8; /* Gamme dynamique minimale (MaxAff-MinAff)*/ 151 double FRACPIC = 0.6065; /* Valeur de exp(-0.5) */ 152 153 154 155 if ( 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 } 158 161 if ( min >= (max-MINDYNAMIC) ) max = min+MINDYNAMIC; 159 162 minhis = min; … … 164 167 maxhis = nbin*binwidth + minhis; 165 168 } 169 // printf("DEBUG nbin minhis maxhis binwidth = %d %g %g %g \n", nbin, minhis, maxhis, binwidth); 166 170 167 171 /* allocation dynamique de memoire et mise a zero de l'histogramme */ … … 202 206 203 207 /* On va chercher le sigma du fond SigmaLeft, SigmaRight */ 204 int hmin = (int) ( ( float)(hmax) * FRACPIC ) ;208 int hmin = (int) ( (double)(hmax) * FRACPIC ) ; 205 209 206 210 int sigr = 0; … … 215 219 if (nbsig < 0) { /* On considere le cas ou NbSigmas est negatif */ 216 220 if ( (bin = binmax+nbsig*sigl) < 0 ) bin = 0; 217 min = minhis + ( float)bin*binwidth;221 min = minhis + (double)bin*binwidth; 218 222 if ( (bin = binmax-nbsig*sigr) >= nbin ) bin = nbin-1; 219 max = minhis + ( float)bin*binwidth;223 max = minhis + (double)bin*binwidth; 220 224 if (max < (min+MINDYNAMIC)) max = min+MINDYNAMIC; 221 225 delete[] phis; return; … … 235 239 int nbpix = 0; 236 240 for( q = phis+bin ; q < phis+nbin ; q++) nbpix += (*q); 237 nbpix = (int_4)(( float)nbpix * fracmax);241 nbpix = (int_4)((double)nbpix * fracmax); 238 242 int nbpix2 = 0; q = phis+bin; 239 243 int k = bin; … … 241 245 { nbpix2 += (*q); k++; q++; } 242 246 243 max = minhis + ( float)k*binwidth;247 max = minhis + (double)k*binwidth; 244 248 delete[] phis; 245 249 if (max < (min+MINDYNAMIC)) max = min+MINDYNAMIC; … … 258 262 int npx, npy, nppx, nppy, nszp, oszp; 259 263 int i,j,k,l; 260 floatvpx;264 double vpx; 261 265 262 266 … … 310 314 } 311 315 else if (zm < -1) { // Compression 312 float fv = (float)(zmm*zmm);316 double fv = (double)(zmm*zmm); 313 317 for(j=ofy; j<ofy+npy; j+=zmm) 314 318 for(i=ofx; i<ofx+npx; i+=zmm) { … … 341 345 } 342 346 else if (zm < -1) { // Compression 343 float fv = (float)(zmm*zmm);347 double fv = (double)(zmm*zmm); 344 348 for(j=ofy; j<ofy+npy; j+=zmm) 345 349 for(i=ofx; i<ofx+npx; i+=zmm) { -
trunk/SophyaPI/PI/parradapter.h
r140 r204 16 16 virtual ~P1DArrayAdapter(); 17 17 18 virtual floatValue(int i) = 0;18 virtual double Value(int i) = 0; 19 19 inline int Size() { return (mSize) ; } 20 virtual void DefineXCoordinate( float x0, floatdx);21 virtual floatX(int i);20 virtual void DefineXCoordinate(double x0, double dx); 21 virtual double X(int i); 22 22 23 23 protected : 24 24 int mSize; 25 floatmOx, mDx;25 double mOx, mDx; 26 26 }; 27 27 … … 41 41 { invx = invX; invy = invY; exy = eXY; } 42 42 43 virtual void DefineXYCoordinates( float x0, float y0, float dx, floatdy);43 virtual void DefineXYCoordinates(double x0, double y0, double dx, double dy); 44 44 // Doit etre defini par les classes derivees 45 virtual floatValue(int ix, int iy) = 0;45 virtual double Value(int ix, int iy) = 0; 46 46 47 virtual void XYfromxy(int ix, int iy, float& x, float& y);47 virtual void XYfromxy(int ix, int iy, double& x, double& y); 48 48 49 49 inline int XSize() { return ( eXY ? sY : sX ) ; } 50 50 inline int YSize() { return ( eXY ? sX : sY ) ; } 51 51 52 inline void XYCoord(int i, int j, float& x, float& y)52 inline void XYCoord(int i, int j, double& x, double& y) 53 53 { int ix, iy; IJ2xy(i, j, ix, iy); 54 54 XYfromxy(ix, iy, x, y); } 55 inline void Coord(int i, int j, float& x, float& y)56 { int ix, iy; floatf; 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); 57 57 XYfromxy(ix, iy, x, y); if (eXY) {f=x; x=y; y=f; } } 58 inline floatoperator() (int i, int j)58 inline double operator() (int i, int j) 59 59 { int ix, iy; IJ2xy(i, j, ix, iy); 60 60 return Value(ix, iy); } … … 65 65 66 66 // 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); 68 68 // Calcul AutoLut 69 virtual void ComputeLut_PicHisto( float& min, float& max, int nbsig=1, floatfracmax=0.95);69 virtual void ComputeLut_PicHisto(double& min, double& max, int nbsig=1, double fracmax=0.95); 70 70 71 71 // Calcul pixmap avec un LUT … … 75 75 protected : 76 76 int sX, sY; 77 floatmOx, mDx, mOy, mDy;77 double mOx, mDx, mOy, mDy; 78 78 int sgnX, sgnY; 79 79 int offX, offY; … … 89 89 90 90 virtual ~P1DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; } 91 virtual floatValue(int i)91 virtual double Value(int i) 92 92 { if ( (i < 0) || (i >= mSize) ) return(0.); 93 93 return(mData[i]); } … … 106 106 107 107 virtual ~P2DAdapter() { if ( (aDel) && (mData != NULL) ) delete[] mData; } 108 virtual floatValue(int ix, int iy)108 virtual double Value(int ix, int iy) 109 109 { if ( (ix < 0) || (iy < 0) || (ix >= sX) || (iy >= sY) ) return(0.); 110 110 return(mData[ix+iy*sX]); } -
trunk/SophyaPI/PI/pi3ddrw.cc
r194 r204 38 38 // PIDrawer3D() 39 39 // Cosntructeur 40 // void Set3DView_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi, -41 // float dax, float day, float co, floatdco=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) 42 42 // Définition de la vue 3D. Voir "PIGraphic3D::Set3DCS_Obs(...)" 43 // void Set3DView( float xc, float yc, float zc, float xo, float yo, floatzo, -44 // float dax, float day, float dco=0.2, floatpsi=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.) 45 45 // 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) 48 48 // 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, floatyy2, -50 // float zz1, float zz2, float xl1, floatxl2, -51 // float yl1, float yl2, float zl1, floatzl2)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) 52 52 // Trace une boîte avec les coordonnées matérialisant la vue 3D. 53 53 //-- … … 73 73 74 74 /* --Methode-- */ 75 void PIDrawer3D::Set3DView_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi,76 float dax, float day, float co, floatdco)75 void PIDrawer3D::Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi, 76 double dax, double day, double co, double dco) 77 77 { 78 78 tO = teta; fO = phi; pO = psi; … … 83 83 84 84 /* --Methode-- */ 85 void PIDrawer3D::Set3DView( float xc, float yc, float zc, float xo, float yo, floatzo,86 float dax, float day, float dco, floatpsi)85 void PIDrawer3D::Set3DView(double xc, double yc, double zc, double xo, double yo, double zo, 86 double dax, double day, double dco, double psi) 87 87 { 88 88 xC = xc; yC = yc; zC = zc; … … 95 95 96 96 /* --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)97 bool 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) 99 99 { 100 100 xo = xO; yo = yO; zo = zO; … … 136 136 /* --Methode-- */ 137 137 void PIDrawer3D::Draw3DBoxe(PIGraphic3D* g3, 138 float xx1, float xx2, float yy1, floatyy2,139 float zz1, float zz2, float xl1, floatxl2,140 float yl1, float yl2, float zl1, floatzl2)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) 141 141 { 142 142 if (mLAtt == PI_NotDefLineAtt) g3->SelLine(PI_ThinLine); … … 161 161 x1 = x2 = xx1; y1 = y2 = yy1; z1 = z2 = zz1; 162 162 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.)); 164 164 z1 = zz1; z2 = zz1-0.02*(zz2-zz1); 165 165 y1 = y2 = yy1; … … 167 167 z2 = zz1-0.05*(zz2-zz1); 168 168 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.)); 170 170 g3->DrawString3D(x2, y2, z2, strg); 171 171 } … … 184 184 x1 = x2 = xx2; y1 = y2 = yy1; z1 = z2 = zz1; 185 185 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.)); 187 187 z2 = zz1-0.02*(zz2-zz1); 188 188 x1 = x2 = xx2; … … 190 190 z2 = zz1-0.05*(zz2-zz1); 191 191 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.)); 193 193 g3->DrawString3D(x2, y2, z2, strg); 194 194 } … … 207 207 x1 = x2 = xx1; y1 = y2 = yy1; z1 = z2 = zz1; 208 208 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.)); 210 210 y2 = yy1-0.015*(yy2-yy1); 211 211 x2 = xx1-0.015*(xx2-xx1); … … 213 213 x2 = xx1-0.1*(xx2-xx1); 214 214 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.)); 216 216 g3->DrawString3D(x2, y2, z2, strg); 217 217 } … … 311 311 312 312 /* --Methode-- */ 313 void PIDraw3DWdg::Set3DView_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi,314 float dax, float day, float co, floatdco)313 void PIDraw3DWdg::Set3DView_Obs(double xo, double yo, double zo, double teta, double phi, double psi, 314 double dax, double day, double co, double dco) 315 315 { 316 316 mGr3d->Set3DCS_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); … … 326 326 327 327 /* --Methode-- */ 328 void PIDraw3DWdg::Set3DView( float xc, float yc, float zc, float xo, float yo, floatzo,329 float dax, float day, float dco, floatpsi)328 void PIDraw3DWdg::Set3DView(double xc, double yc, double zc, double xo, double yo, double zo, 329 double dax, double day, double dco, double psi) 330 330 { 331 331 mGr3d->Set3DCS(xc, yc, zc, xo, yo, zo, dax, day, dco, psi); … … 341 341 342 342 /* --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)343 bool 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) 345 345 { 346 346 return(mGr3d->Get3DCS(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco)); … … 360 360 if (dr3 == NULL) return; 361 361 dr3->UpdateLimits(); 362 floatxo, 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; 363 363 bool vobs; 364 364 vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); … … 372 372 void PIDraw3DWdg::SetDrawers3DView() 373 373 { 374 floatxc, yc, zc, xo, yo, zo;375 floatteta, phi, psi;376 floatdax, day, co, dco;374 double xc, yc, zc, xo, yo, zo; 375 double teta, phi, psi; 376 double dax, day, co, dco; 377 377 bool vo; 378 378 vo = mGr3d->Get3DCS( xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); … … 398 398 if (!vfixed) { 399 399 dr3->UpdateLimits(); 400 floatxo, 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; 401 401 bool vobs; 402 402 vobs = dr3->Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); … … 405 405 } 406 406 else { 407 floatxc, 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; 408 408 if ( Get3DView(xc, yc, zc, xo, yo, zo, teta, phi, psi, dax, day, co, dco) ) 409 409 dr3->Set3DView_Obs(xo, yo, zo, teta, phi, psi, dax, day, co, dco); … … 468 468 strncpy(pc, (char*)pdata, ll-1); pc[ll-1] = '\0'; 469 469 // 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()); 471 mBDrw->ElAddText((double)mPx/(double)XSize(), 1.-(double)mPy/(double)YSize(), pc ); 472 472 mBDrw->Refresh(); 473 473 } … … 477 477 { 478 478 mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize()); 479 floatxo, yo, zo;480 floatteta, phi, psi;481 floatdax, day, co, dco;479 double xo, yo, zo; 480 double teta, phi, psi; 481 double dax, day, co, dco; 482 482 mGr3d->Get3DCS(cXc, cYc, cZc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 483 483 // puts("\n PIDraw3DWdg::But2Press() "); … … 525 525 { 526 526 DrawXYZAxes(); 527 floatteta, phi;527 double teta, phi; 528 528 529 529 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()); 532 532 mGr3d->RotateObject(teta, phi, false); 533 533 } 534 534 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()); 537 537 mGr3d->RotateObserver(teta, phi, 0., false); 538 538 } … … 569 569 void PIDraw3DWdg::But3Press(int x, int y) 570 570 { 571 floatxo, yo, zo;572 floatteta, phi, psi;573 floatdax, day, co, dco;571 double xo, yo, zo; 572 double teta, phi, psi; 573 double dax, day, co, dco; 574 574 mGr3d->Get3DCS(cXc, cYc, cZc, xo, yo, zo, teta, phi, psi, dax, day, co, dco); 575 575 mGr3d->SetBaseGraphic(mWGrC, 0, 0, XSize(), YSize()); … … 597 597 { 598 598 DrawXYZAxes(); 599 float rapx = (float)(lPx-x)/XSize();599 double rapx = (double)(lPx-x)/XSize(); 600 600 if (rapx > 0.) rapx = rapx*2.+1; 601 601 else rapx += 1.; 602 602 if (rapx < 0.3) rapx = 0.3; 603 603 if (rapx > 3.) rapx = 3.; 604 float rapy = (float)(y-lPy)/YSize();604 double rapy = (double)(y-lPy)/YSize(); 605 605 if (rapy > 0.) rapy = rapy*2.+1; 606 606 else rapy += 1.; … … 649 649 // mGr3d->DrawCircle(0., 0., daxO*0.30); 650 650 char buff[256]; 651 floatxc,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; 652 652 mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco); 653 653 sprintf(buff, " C: %g %g %g -> O: %g %g %g (T/P0= %g %g) ", xc,yc,zc, xo, yo, zo, cTeta, cPhi); … … 676 676 y -= YSize()/2; 677 677 678 float fx = (float)x/XSize();679 float fy = (float)y/YSize();678 double fx = (double)x/XSize(); 679 double fy = (double)y/YSize(); 680 680 if ( (fx<0.2) && (fx>-0.2) && (fy<0.2) && (fy>-0.2) ) { 681 681 … … 694 694 isw++; 695 695 mGr3d->PrintCS(); 696 floatxc,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; 697 697 mGr3d->Get3DCS(xc,yc,zc,xo,yo,zo,teta,phi,psi,dax,day,co,dco); 698 698 mGr3d->Set3DCS(xc,yc,zc,xo,yo,zo,dax,day,dco,psi); -
trunk/SophyaPI/PI/pi3ddrw.h
r184 r204 22 22 virtual ~PIDrawer3D(); 23 23 24 virtual void Set3DView_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi,25 float dax, float day, float co, floatdco=0.2);26 virtual void Set3DView( float xc, float yc, float zc, float xo, float yo, floatzo,27 float dax, float day, float dco=0.2, floatpsi=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); 30 30 31 31 virtual PIGraphicUC* SetDrwWdg(PIBaseWdgGen* drw, int x0, int y0, int dx, int dy, PIGraphicGen* g); 32 32 33 33 virtual void DrawAxes(PIGraphicUC* g); 34 virtual void Draw3DBoxe(PIGraphic3D* g3, float xx1, float xx2, float yy1, floatyy2,35 float zz1, float zz2, float xl1, floatxl2,36 float yl1, float yl2, float zl1, floatzl2);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); 37 37 38 floatXMin3() const {return x3Min;}39 floatXMax3() const {return x3Max;}40 floatYMin3() const {return y3Min;}41 floatYMax3() const {return y3Max;}42 floatZMin3() const {return z3Min;}43 floatZMax3() 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;} 44 44 45 45 protected : 46 floatxO, yO, zO; // Position observateur = camera47 floatxC, yC, zC; // Position centre du champ48 floattO,fO,pO; // Orientation observateur (Teta, Phi, Psi, Angles d Euler)49 floatdaxO, dayO; // Demi-ouverture de la camera suivant les deux axes de projection (xp/zp, yp/zp)50 floatlCO, dlCO; // Distance Camera-Centre du champ et profondeur de champ46 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 51 51 bool v3D_obs; // Si defini par Set3DView_Obs 52 floatx3Min, x3Max; // Pour delimiter le cube 3D53 floaty3Min, y3Max; // Pour delimiter le cube 3D54 floatz3Min, z3Max; // Pour delimiter le cube 3D52 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 55 55 }; 56 56 … … 68 68 69 69 70 virtual void Set3DView_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi,71 float dax, float day, float co, floatdco=0.2);72 virtual void Set3DView( float xc, float yc, float zc, float xo, float yo, floatzo,73 float dax, float day, float dco=0.2, floatpsi=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); 76 76 77 77 virtual void Update3DView(); // Vue 3-D a partir de Drawer No 1 … … 114 114 int lPx, lPy; // dernier position pointeur 115 115 PIColors lCol; // Couleur 116 floatcTeta, cPhi, cUlen; // Pour garder valeurs avant rotation, Unite de longeur117 floatcXc, cYc, cZc; // Pour garder position du centre de champ118 floatclCO, cDax, cDay; // Pour garder les valeurs avant Zoom In/Out116 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 119 119 bool rOfg; // si Vrai on fait tourner l'objet et pas la camera 120 120 bool axfg; // si Vrai on trace les axes -
trunk/SophyaPI/PI/pibwdggen.cc
r180 r204 10 10 #include "pidrwtools.h" 11 11 12 static inline void fl_swap(float& a, float& b) { floattmp = a; a = b; b = tmp; }12 static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp; } 13 13 14 14 //++ … … 314 314 // si "psz=true", les coordonnées sont supposées être des facteurs multiplicatifs 315 315 // des dimensions de l'objet. 316 // void SetDefaultDrawerLimits( float xmin, float xmax, float ymin, floatymax, -316 // void SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax, - 317 317 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 318 318 // Définition du système de coordonnées par défaut d'un drawer attaché en "autolim=true" … … 328 328 329 329 /* --Methode-- */ 330 void PIBaseWdgGen::SetDefaultDrawerLimits( float xmin, float xmax, float ymin, floatymax,330 void PIBaseWdgGen::SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax, 331 331 int axrl, int ayud) 332 332 { … … 483 483 void PIBaseWdgGen::CallDrawers(PIGraphic* g, int x0, int y0, int dx, int dy) 484 484 { 485 floatxmin,ymin, xmax, ymax;485 double xmin,ymin, xmax, ymax; 486 486 PIGraphicUC* guc; 487 487 int drx0, dry0, drdx, drdy; … … 489 489 490 490 if (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 ; 495 495 } 496 496 else { … … 510 510 else { 511 511 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 ; 516 516 } 517 517 else { … … 534 534 guc->GrC2UC(XSize(), YSize(), xmax, ymax); 535 535 } 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); 538 538 (*it).drw->Draw(guc, xmin, ymin, xmax, ymax); 539 539 g->RestoreGraphicAtt(); … … 547 547 void PIBaseWdgGen::CallDrawer(int id) 548 548 { 549 floatxmin,ymin, xmax, ymax;549 double xmin,ymin, xmax, ymax; 550 550 PIGraphicUC* guc; 551 551 int drx0, dry0, drdx, drdy; … … 555 555 556 556 if (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 ; 561 561 } 562 562 else { … … 572 572 else { 573 573 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 ; 578 578 } 579 579 else { … … 590 590 guc->GrC2UC(0, 0, xmin, ymin); 591 591 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); 594 594 (*it).drw->Draw(guc, xmin, ymin, xmax, ymax); 595 595 g->RestoreGraphicAtt(); -
trunk/SophyaPI/PI/pibwdggen.h
r180 r204 85 85 virtual void SetDefaultDrawRectangle(PIGrCoord x1, PIGrCoord y1, 86 86 PIGrCoord x2, PIGrCoord y2, bool psz=true); 87 virtual void SetDefaultDrawerLimits( float xmin, float xmax, float ymin, floatymax,87 virtual void SetDefaultDrawerLimits(double xmin, double xmax, double ymin, double ymax, 88 88 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 89 89 virtual int AddDrawer(PIDrawer* drw, PIGrCoord x1, PIGrCoord y1, … … 118 118 PIGrCoord mDrX1, mDrY1, mDrX2, mDrY2; 119 119 bool mDrElastic; // true --> Coord en fraction de la taille 120 floatmDrXmin, mDrXmax, mDrYmin, mDrYmax; // Limites par defaut - UC120 double mDrXmin, mDrXmax, mDrYmin, mDrYmax; // Limites par defaut - UC 121 121 int mDXdir, mDYdir; // Sens des axes par defaut 122 122 -
trunk/SophyaPI/PI/pidrawer.cc
r202 r204 59 59 60 60 //++ 61 // void SetLimits( float xmin, float xmax, float ymin, floatymax, -61 // void SetLimits(double xmin, double xmax, double ymin, double ymax, - 62 62 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 63 63 // Définit les limites du système de coordonnées. … … 71 71 72 72 void 73 PIDrawer::SetLimits( float xmin, float xmax, float ymin, floatymax,73 PIDrawer::SetLimits(double xmin, double xmax, double ymin, double ymax, 74 74 int axrl, int ayud) 75 75 { 76 76 if (axrl == kAxeDirAuto) { 77 floatff;77 double ff; 78 78 if (xmax < xmin) { axrl = kAxeDirRtoL; ff=xmin; xmin=xmax; xmax=ff; } 79 79 else axrl = kAxeDirLtoR; 80 80 } 81 81 if (ayud == kAxeDirAuto) { 82 floatff;82 double ff; 83 83 if (ymax < ymin) { ayud = kAxeDirUpDown; ff=ymin; ymin=ymax; ymax=ff; } 84 84 else ayud = kAxeDirDownUp; … … 100 100 101 101 //++ 102 // void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax)102 // void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax) 103 103 // Méthode qui est appelé lorsquer l'objet PIDrawer doit rafraichir la zone 104 104 // définie par "xmin-xmax" , "ymin-ymax" dans le système de coordonnées du … … 227 227 228 228 /* --Methode-Static-- */ 229 void PIDrawer::BestTicks( float rmin,float rmax,int nticks,float& majt)229 void PIDrawer::BestTicks(double rmin,double rmax,int nticks,double& majt) 230 230 { 231 231 double d = rmax - rmin; … … 336 336 // Longueur des ticks 337 337 338 floatextXMajTickLen = flags&kExtTicks ? xMajTickLen : 0;339 floatintXMajTickLen = flags&kIntTicks ? xMajTickLen : 0;340 floatextXMinTickLen = flags&kExtTicks ? xMinTickLen : 0;341 floatintXMinTickLen = flags&kIntTicks ? xMinTickLen : 0;342 floatextYMajTickLen = flags&kExtTicks ? yMajTickLen : 0;343 floatintYMajTickLen = flags&kIntTicks ? yMajTickLen : 0;344 floatextYMinTickLen = flags&kExtTicks ? yMinTickLen : 0;345 floatintYMinTickLen = 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; 346 346 347 347 // La grille en pointilles … … 395 395 396 396 void 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, floatxStep)404 { 405 for ( floatx=xBeg; x<=xMax; x += xStep)397 PIDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/) 398 { 399 } 400 401 402 void 403 PIDrawer::DrawHTicks(PIGraphicUC* g, double y, double tickUp, double tickDown, double xBeg, double xStep) 404 { 405 for (double x=xBeg; x<=xMax; x += xStep) 406 406 g->DrawLine(x, y-tickDown, x, y+tickUp); 407 407 } 408 408 409 409 void 410 PIDrawer::DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, floatyStep)411 { 412 for ( floaty=yBeg; y<=yMax; y += yStep)410 PIDrawer::DrawVTicks(PIGraphicUC* g, double x, double tickLeft, double tickRight, double yBeg, double yStep) 411 { 412 for (double y=yBeg; y<=yMax; y += yStep) 413 413 g->DrawLine(x-tickLeft, y, x+tickRight, y); 414 414 } 415 415 416 416 void 417 PIDrawer::DrawHLabels(PIGraphicUC* g, float y, float xBeg, floatxStep, int just)418 { 419 floatxOffset = 0;417 PIDrawer::DrawHLabels(PIGraphicUC* g, double y, double xBeg, double xStep, int just) 418 { 419 double xOffset = 0; 420 420 int kk; 421 421 g->SelFontSz(xMajTickLen*4.); 422 for ( floatx=xBeg; x<=xMax; x += xStep) {422 for (double x=xBeg; x<=xMax; x += xStep) { 423 423 char label[20]; sprintf(label, "%-6g", x); 424 424 for(kk=0; kk<20; kk++) 425 425 if (label[kk] == ' ') { label[kk] = '\0' ; break; } 426 floatlargeur = g->CalcStringWidth(label);426 double largeur = g->CalcStringWidth(label); 427 427 if (just == 1) 428 428 xOffset = -largeur; … … 437 437 438 438 void 439 PIDrawer::DrawVLabels(PIGraphicUC* g, float x, float yBeg, floatyStep, int just)440 { 441 floatxOffset = 0;439 PIDrawer::DrawVLabels(PIGraphicUC* g, double x, double yBeg, double yStep, int just) 440 { 441 double xOffset = 0; 442 442 g->SelFontSz(xMajTickLen*4.); 443 for ( floaty=yBeg; y<=yMax; y += yStep) {443 for (double y=yBeg; y<=yMax; y += yStep) { 444 444 char label[20]; sprintf(label, "%-6g", y); 445 floatlargeur = g->CalcStringWidth(label);445 double largeur = g->CalcStringWidth(label); 446 446 if (just == 1) 447 447 xOffset = -largeur; … … 461 461 g->SelLine(PI_ThinDashedLine); 462 462 463 for ( floatx=xFirstMajTick; x<=xMax; x += xMajTickStep)463 for (double x=xFirstMajTick; x<=xMax; x += xMajTickStep) 464 464 g->DrawLine(x, yMin, x, yMax); 465 465 466 for ( floaty=yFirstMajTick; y<=yMax; y += yMajTickStep)466 for (double y=yFirstMajTick; y<=yMax; y += yMajTickStep) 467 467 g->DrawLine(xMin, y, xMax, y); 468 468 … … 501 501 502 502 /* --Methode-- */ 503 void PIElDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float /*ymin*/, float /*xmax*/, float/*ymax*/)503 void PIElDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double /*ymin*/, double /*xmax*/, double /*ymax*/) 504 504 { 505 505 DrawAxes(g); // Trace des axes … … 512 512 aYdir = false; // Vrai si Axe Y de Haut vers Bas 513 513 PIGrCoord gas, gds; 514 floatfx, fy, fh;514 double fx, fy, fh; 515 515 // fh = g->GetFontHeightUC(gas, gds); 516 516 fh = 0.075*(YMax()-YMin()); -
trunk/SophyaPI/PI/pidrawer.h
r202 r204 34 34 virtual ~PIDrawer(); 35 35 36 virtual void SetLimits( float xmin, float xmax, float ymin, floatymax,36 virtual void SetLimits(double xmin, double xmax, double ymin, double ymax, 37 37 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 38 38 … … 40 40 virtual void SetAxesFlags(unsigned int flags=kAxesNone); 41 41 42 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax);42 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 43 43 44 44 virtual void Refresh(); // Recalcule les limites et reaffiche 45 45 virtual void UpdateLimits(); // Calcule et change les limites 46 46 47 floatXMin() const {return xMin;}48 floatXMax() const {return xMax;}49 floatYMin() const {return yMin;}50 floatYMax() 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;} 51 51 inline unsigned int GetAxesFlags() { return(axesFlags); } 52 52 … … 68 68 // --- Methode static ---- 69 69 // 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); 71 71 72 72 // Les objets/methodes suivants devraient etre protected … … 84 84 void CalcTicks(); 85 85 86 void DrawHTicks(PIGraphicUC* g, float y, float tickUp, float tickDown, float xBeg, floatxStep);87 void DrawVTicks(PIGraphicUC* g, float x, float tickLeft, float tickRight, float yBeg, floatyStep);88 void DrawHLabels(PIGraphicUC* g, float y, float xBeg, floatxStep, int just=0);89 void DrawVLabels(PIGraphicUC* g, float x, float yBeg, floatyStep, 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); 90 90 void DrawGrid(PIGraphicUC* g); 91 91 92 92 93 floatxMin, xMax, yMin, yMax; // Valeurs en unites user93 double xMin, xMax, yMin, yMax; // Valeurs en unites user 94 94 int xW0, yW0, xWd, yWd; // Origine/largeur ds la fenetre de trace 95 95 bool aXdir, aYdir; // Sens des axes horiz, vertical 96 96 int aXFlg, aYFlg; 97 97 98 floatxFirstMajTick, xFirstMinTick;99 floatyFirstMajTick, yFirstMinTick;100 floatxMajTickStep, xMinTickStep;101 floatyMajTickStep, yMinTickStep;102 floatxMajTickLen, xMinTickLen;103 floatyMajTickLen, 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; 104 104 105 105 int limitsFixed; … … 139 139 virtual void SetTitles(string const & tt, string const & tb); 140 140 141 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax);141 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 142 142 143 143 inline int ElAddLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, -
trunk/SophyaPI/PI/pidrwtools.cc
r202 r204 332 332 333 333 char strg[64]; 334 floatxmin, xmax, ymin, ymax;334 double xmin, xmax, ymin, ymax; 335 335 int axrl = kAxeDirLtoR; 336 336 int ayud = kAxeDirDownUp; … … 340 340 341 341 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); 344 344 if (mCkb[0]->GetState()) axrl = kAxeDirRtoL ; 345 345 if (mCkb[1]->GetState()) ayud = kAxeDirUpDown; -
trunk/SophyaPI/PI/pigraph3d.cc
r183 r204 75 75 76 76 //++ 77 // void Set3DCS_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi, -78 // float dax, float day, float co, floatdco=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) 79 79 // Définition du système de projection 3D à l'aide de la position de l'observateur 80 80 // et de la direction de visée. … … 86 86 //| dco : profondeur de champ 87 87 // 88 // void Set3DCS( float xc, float yc, float zc, float xo, float yo, floatzo, -89 // float dax, float day, float dco=0.2, floatpsi=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.) 90 90 // Définition du système de projection 3D à partir de la position de l'observateur et 91 91 // du centre du champ. … … 106 106 #endif 107 107 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) 108 static double deuxpi = 2*M_PI; 109 110 /* --Methode-- */ 111 void PIGraphic3D::Set3DCS_Obs(double xo, double yo, double zo, double teta, double phi, double psi, 112 double dax, double day, double co, double dco) 114 113 { 115 114 sO = true; … … 149 148 150 149 /* --Methode-- */ 151 void PIGraphic3D::Set3DCS( float xc, float yc, float zc, float xo, float yo, floatzo,152 float dax, float day, float dco, floatpsi)150 void PIGraphic3D::Set3DCS(double xc, double yc, double zc, double xo, double yo, double zo, 151 double dax, double day, double dco, double psi) 153 152 { 154 153 sO = false; … … 185 184 tO = acos(ct); 186 185 if (lxy < 1.e-6) { fO = 0.; cf = 0.; } 187 else { cf = dx/lxy; fO = acos(cf); if (dy < 0.) fO = d deuxpi-fO; }186 else { cf = dx/lxy; fO = acos(cf); if (dy < 0.) fO = deuxpi-fO; } 188 187 // (Teta,Phi) = Direction de visee 189 188 // Les angles d'Euler correspondants sont Teta, Phi+Pi/2 … … 201 200 202 201 //++ 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); 205 204 // Renvoie les paramètres de définition du système de projection 3D. 206 205 // "Rc= true" si défini par "Set3DCS_Obs()" 207 206 // 208 // void RotateObserver( float teta, float phi, floatpsi=0., bool rel=true)207 // void RotateObserver(double teta, double phi, double psi=0., bool rel=true) 209 208 // Positionne l'observateur (la caméra) en maintenant la position 210 209 // du centre de champ fixe. Si "rel=false" : "teta, phi" determine la nouvelle 211 210 // direction de visée. Si "rel=false" : la direction de visée est tournée 212 211 // de l'angle "teta,phi". 213 // void RotateObject( float teta, floatphi, bool rel=true)212 // void RotateObject(double teta, double phi, bool rel=true) 214 213 // Repostionne le centre du champ en maintenant la position de l'observateur fixe. 215 214 // Si "rel=false" : "teta, phi" determine la nouvelle direction de visée. 216 215 // Si "rel=false" : la direction de visée est tournée de l'angle "teta,phi". 217 216 // 218 // void ZoomInOut( float fco, float fdax, floatfday, bool rel=true)217 // void ZoomInOut(double fco, double fdax, double fday, bool rel=true) 219 218 // Eloigne ou approche l'observateur et modifie l'ouverture du plan image. 220 219 // si "real=true" : "fco, fdax, fday" sont des facteurs multiplicatifs … … 225 224 226 225 /* --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)226 bool 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) 229 228 { 230 229 xc = xC; yc = yC; zc = zC; … … 238 237 239 238 /* --Methode-- */ 240 void PIGraphic3D::RotateObserver( float teta, float phi, floatpsi, bool rel)239 void PIGraphic3D::RotateObserver(double teta, double phi, double psi, bool rel) 241 240 // Positionne l'observateur (la camera) de maniere a ce que la direction de 242 241 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true) … … 251 250 while (teta > deuxpi) teta -= deuxpi; 252 251 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; } 253 floatxo,yo,zo;252 double xo,yo,zo; 254 253 zo = -cos((double)teta)*lCO+zC; 255 254 xo = -sin((double)teta)*cos((double)phi)*lCO+xC; … … 259 258 260 259 /* --Methode-- */ 261 void PIGraphic3D::RotateObject( float teta, floatphi, bool rel)260 void PIGraphic3D::RotateObject(double teta, double phi, bool rel) 262 261 // Positionne l'objet (centre du champ) de maniere a ce que la direction de 263 262 // visee soit tO=teta, pO=phi (rel=false) / tO+=teta pO+=phi (rel=true) … … 271 270 while (teta > deuxpi) teta -= deuxpi; 272 271 if (teta > M_PI) { teta = M_PI-teta; phi = phi+M_PI; } 273 floatxc,yc,zc;272 double xc,yc,zc; 274 273 zc = cos((double)teta)*lCO+zO; 275 274 xc = sin((double)teta)*cos((double)phi)*lCO+xO; … … 279 278 280 279 /* --Methode-- */ 281 void PIGraphic3D::ZoomInOut( float fco, float fdax, floatfday, bool rel)280 void PIGraphic3D::ZoomInOut(double fco, double fdax, double fday, bool rel) 282 281 { 283 282 if (fco < 0.001) fco = 1.; … … 291 290 } 292 291 else dl = fco; 293 floatxo,yo,zo;292 double xo,yo,zo; 294 293 if (dl < 1.e-5) dl = 1.e-5; 295 294 zo = zC-cos((double)tO)*dl; … … 301 300 302 301 /* --Methode-- */ 303 void PIGraphic3D::C3DC2ObsCS( float x, float y, float z, float& xp, float& yp, float& zp)302 void PIGraphic3D::C3DC2ObsCS(double x, double y, double z, double& xp, double& yp, double& zp) 304 303 { 305 304 double xc, yc, zc; … … 311 310 312 311 /* --Methode-- */ 313 void PIGraphic3D::Proj3DC2GrC( float x, float y, float z, float& xpix, float& ypix)312 void PIGraphic3D::Proj3DC2GrC(double x, double y, double z, double& xpix, double& ypix) 314 313 { 315 314 double xc, yc, zc; 316 floatxp, yp, zp;315 double xp, yp, zp; 317 316 xc = x-xO; yc = y-yO; zc = z-zO; 318 317 xp = RE[0][0]*xc+RE[0][1]*yc+RE[0][2]*zc; … … 321 320 if ((zp>-1.e-6) && (zp < 1.e-6)) // Protection Divide/0 322 321 { 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); 325 324 // 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); 326 325 // 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); … … 353 352 { 354 353 if (!mGrC) return; 355 floatxf, yf;354 double xf, yf; 356 355 Proj3DC2GrC(x0, y0, z0, xf, yf); 357 356 mGrC->DrawString(xf, yf, s); … … 363 362 { 364 363 if (!mGrC) return; 365 floatxf, yf;364 double xf, yf; 366 365 Proj3DC2GrC(x0, y0, z0, xf, yf); 367 366 mGrC->DrawOpaqueString(xf, yf, s); … … 374 373 { 375 374 if (!mGrC) return; 376 floatxf1, yf1, xf2, yf2;375 double xf1, yf1, xf2, yf2; 377 376 Proj3DC2GrC(x1, y1, z1, xf1, yf1); 378 377 Proj3DC2GrC(x2, y2, z2, xf2, yf2); 379 378 // 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 ); 382 381 mGrC->DrawLine(xf1, yf1, xf2, yf2); 383 382 } … … 391 390 PIGrCoord *pxc, *pyc; 392 391 int i; 393 floatxf, yf;392 double xf, yf; 394 393 395 394 if (!mGrC) return; … … 414 413 PIGrCoord *pxc, *pyc; 415 414 int i; 416 floatxf, yf;415 double xf, yf; 417 416 418 417 if (!mGrC) return; … … 434 433 { 435 434 if (!mGrC) return; 436 floatxf, yf;435 double xf, yf; 437 436 Proj3DC2GrC(x0, y0, z0, xf, yf); 438 437 mGrC->DrawMarker(xf, yf); … … 446 445 PIGrCoord *pxc, *pyc; 447 446 int i; 448 floatxf, yf;447 double xf, yf; 449 448 450 449 if (!mGrC) return; … … 473 472 printf("RE[3][3]= %g %g %g | %g %g %g | %g %g %g\n", 474 473 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 floatx,y,z,xp,yp,zp, xpix, ypix;474 double x,y,z,xp,yp,zp, xpix, ypix; 476 475 x = xC, y = yC, z= zC; 477 476 C3DC2ObsCS(x, y, z, xp, yp, zp); -
trunk/SophyaPI/PI/pigraph3d.h
r158 r204 20 20 21 21 // Definition du systeme de projection 3D-2D 22 virtual void Set3DCS_Obs( float xo, float yo, float zo, float teta, float phi, floatpsi,23 float dax, float day, float co, floatdco=0.2);24 virtual void Set3DCS( float xc, float yc, float zc, float xo, float yo, floatzo,25 float dax, float day, float dco=0.2, floatpsi=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); 28 28 29 29 virtual void PrintCS(); // Pour debugger 30 virtual void RotateObserver( float teta, float phi, floatpsi=0., bool rel=true);31 virtual void RotateObject( float teta, floatphi, bool rel=true);32 virtual void ZoomInOut( float fco, float fdax, floatfday, 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); 33 33 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); 36 36 37 37 virtual void DrawString3D(PIGrCoord x0, PIGrCoord y0, PIGrCoord z0, const char* s); -
trunk/SophyaPI/PI/pigraphgen.cc
r190 r204 145 145 // void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) 146 146 // Tracé d'un polygone plein de la couleur d'avant-plan. 147 // void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, floatdegfin)147 // void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin) 148 148 // Tracé d'un arc de cercle ou d'ellipse, inclu dans le "(x0,y0)" , "dx,dy" 149 149 // entre les angles (en degré) "degdeb" - "degfin" 150 // void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, floatdegfin)150 // void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin) 151 151 // Tracé d'un arc plein, inclu dans le "(x0,y0)" , "dx,dy" 152 152 // entre les angles (en degré) "degdeb" - "degfin" … … 338 338 // operator float() 339 339 // Conversion en réél "float" 340 // operator double() 341 // Conversion en réél "double" 340 342 //-- 341 343 //++ -
trunk/SophyaPI/PI/pigraphgen.h
r190 r204 43 43 44 44 45 // Classe pour gerer indifferement des coordonnees floatou int45 // Classe pour gerer indifferement des coordonnees double ou int 46 46 class PIGrCoord { 47 47 public: 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;} 52 52 inline operator int() { return(iv); } 53 53 inline operator short() { return((short)iv); } 54 54 inline operator unsigned int() { return((unsigned int)iv); } 55 55 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); } 60 61 int iv; 61 float fv;62 double dv; 62 63 }; 63 64 … … 96 97 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) = 0; 97 98 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 98 float degdeb, float degfin)= 0;99 double degdeb, double degfin) = 0; 99 100 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 100 float degdeb, float degfin)= 0;101 double degdeb, double degfin) = 0; 101 102 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0) = 0; 102 103 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n) = 0; -
trunk/SophyaPI/PI/pigraphps.cc
r163 r204 29 29 //-- 30 30 //++ 31 // PIGraphicPS(PSFile * psf, float x0, float y0, float dx, floatdy)31 // PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy) 32 32 // Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf". 33 33 // "(x0, y0)" détermine l'origine du nouveau bloc rectangulaire sur 34 34 // la page et "dx, dy" l'extension du bloc. 35 // PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, floatofy)35 // PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx, double ofy) 36 36 // Création d'un objet "PIGraphicPS" à partir d'un objet "PSFIle* psf" 37 37 //| x0 = wdg->XPos()+ofx y0 = wdg->YPos()+ofy … … 43 43 44 44 /* --Methode-- */ 45 PIGraphicPS::PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx, floatofy)45 PIGraphicPS::PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx, double ofy) 46 46 : PIGraphicGen() 47 47 { 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, floatdy)48 BuildFromPSFile(psf, (double)wdg->XPos()+ofx, (double)wdg->YPos()+ofy, 49 (double)wdg->XSize(), (double)wdg->YSize() ); 50 } 51 52 /* --Methode-- */ 53 PIGraphicPS::PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy) 54 54 : PIGraphicGen() 55 55 { … … 71 71 72 72 /* --Methode-- */ 73 void PIGraphicPS::BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, floatdy)73 void PIGraphicPS::BuildFromPSFile(PSFile * psf, double x0, double y0, double dx, double dy) 74 74 { 75 75 mPSOut = psf; … … 111 111 { 112 112 if(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 ?? */ 114 114 return; 115 115 } … … 119 119 { 120 120 if(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 ?? */ 122 122 return; 123 123 } … … 128 128 { 129 129 if(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); 131 131 return; 132 132 } … … 137 137 { 138 138 if(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); 140 140 return; 141 141 } … … 145 145 { 146 146 if(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); 148 148 return; 149 149 } … … 153 153 { 154 154 if(mPSOut) 155 mPSOut->DrawCircle(( float)x0,(float)y0,(float)r,mFCol,mLAtt);155 mPSOut->DrawCircle((double)x0,(double)y0,(double)r,mFCol,mLAtt); 156 156 return; 157 157 } … … 161 161 { 162 162 if(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); 164 164 return; 165 165 } … … 181 181 { 182 182 int i; 183 float*xtmp;184 float*ytmp;183 double *xtmp; 184 double *ytmp; 185 185 186 186 if(! mPSOut) return; 187 187 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 // floatxoff,yoff;188 xtmp = new double[n]; 189 ytmp = new double[n]; 190 for(i = 0 ; i < n ; i++) {xtmp[i] = (double)x[i] ; ytmp[i] = (double)y[i] ; } 191 //double xoff,yoff; 192 192 //if (cinc) { xoff=yoff=0.; } // Coord en mode incremental 193 //else { xoff = ( float)x[0]; yoff = (float)y[0]; } // Coord en mode absolu194 //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]; 196 196 //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; 199 199 //} 200 200 mPSOut->DrawPolygon(xtmp,ytmp,n,mFCol,mLAtt,cinc); … … 210 210 { 211 211 int i; 212 float*xtmp;213 float*ytmp;212 double *xtmp; 213 double *ytmp; 214 214 215 215 if(! mPSOut) return; 216 216 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 // floatxoff,yoff;217 xtmp = new double[n]; 218 ytmp = new double[n]; 219 for(i = 0 ; i < n ; i++) {xtmp[i] = (double)x[i] ; ytmp[i] = (double)y[i] ; } 220 //double xoff,yoff; 221 221 //if (cinc) { xoff=yoff=0.; } // Coord en mode incremental 222 //else { xoff = ( float)x[0]; yoff = (float)y[0]; } // Coord en mode absolu223 //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]; 225 225 //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; 228 228 //} 229 229 mPSOut->DrawFPolygon(xtmp,ytmp,n,mFCol,mFCol,mLAtt,cinc); … … 235 235 236 236 /* --Methode-- */ 237 void PIGraphicPS::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, floatdegfin)237 void PIGraphicPS::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,double degdeb, double degfin) 238 238 { 239 239 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire … … 241 241 242 242 /* --Methode-- */ 243 void PIGraphicPS::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, float degdeb, floatdegfin)243 void PIGraphicPS::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy,double degdeb, double degfin) 244 244 { 245 245 // $CHECK$ Reza/ Nicolas 12 Nov 98 - A faire … … 250 250 { 251 251 if(mPSOut) 252 mPSOut->DrawMarker(( float)x0,(float)y0,mMrk,mFCol,mMrkSz);252 mPSOut->DrawMarker((double)x0,(double)y0,mMrk,mFCol,mMrkSz); 253 253 return; 254 254 } … … 258 258 { 259 259 int i; 260 float*xtmp;261 float*ytmp;260 double *xtmp; 261 double *ytmp; 262 262 263 263 if( !mPSOut) return; 264 264 265 xtmp = new float[n];266 ytmp = new float[n];265 xtmp = new double[n]; 266 ytmp = new double[n]; 267 267 for(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]; 270 270 } 271 271 mPSOut->DrawMarkers(xtmp,ytmp,n,mMrk,mFCol, mMrkSz); … … 284 284 if ((pix == NULL) || (cmap == NULL)) return; 285 285 if(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); 287 287 return; 288 288 } … … 455 455 PIGrCoord PIGraphicPS::CalcStringWidth(char const* s) 456 456 { 457 return(( float)(mFSize*strlen(s)*0.5)); /* facteur 0.5 ad'hoc $CHECK$ Voir Nicolas ! */457 return((double)(mFSize*strlen(s)*0.5)); /* facteur 0.5 ad'hoc $CHECK$ Voir Nicolas ! */ 458 458 } 459 459 -
trunk/SophyaPI/PI/pigraphps.h
r158 r204 9 9 { 10 10 public: 11 PIGraphicPS(PSFile * psf, PIWdg* wdg, float ofx=0., floatofy=0.);12 PIGraphicPS(PSFile * psf, float x0, float y0, float dx, floatdy);11 PIGraphicPS(PSFile * psf, PIWdg* wdg, double ofx=0., double ofy=0.); 12 PIGraphicPS(PSFile * psf, double x0, double y0, double dx, double dy); 13 13 virtual ~PIGraphicPS(); 14 14 … … 32 32 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 33 33 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 34 float degdeb, floatdegfin);34 double degdeb, double degfin); 35 35 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 36 float degdeb, floatdegfin);36 double degdeb, double degfin); 37 37 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 38 38 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); … … 74 74 75 75 protected: 76 void BuildFromPSFile(PSFile * psf, float x0, float y0, float dx, floatdy);76 void BuildFromPSFile(PSFile * psf, double x0, double y0, double dx, double dy); 77 77 78 78 PSFile * mPSOut; /* Fichier PostScript */ 79 floatmXmin, mYmin;80 floatmXmax, mYmax;79 double mXmin, mYmin; 80 double mXmax, mYmax; 81 81 82 82 PIColors mFCol, mBCol; -
trunk/SophyaPI/PI/pigraphuc.cc
r202 r204 21 21 22 22 // Pour echanger deux valeurs PIGrCoord 23 static inline void fl_swap(float& a, float& b) { floattmp = a; a = b; b = tmp; }23 static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp; } 24 24 25 25 //++ … … 88 88 //-- 89 89 //++ 90 // void SetUCS( float xmin, float xmax, float ymin, floatymax, -90 // void SetUCS(double xmin, double xmax, double ymin, double ymax, - 91 91 // int axrl=kAxeDirSame, int ayud=kAxeDirSame) 92 92 // Définit le système de coordonnées utilisateur. Axe X de "xmin" à "xmax" , … … 103 103 // Par défaut : "xmin=ymin=0." , "ymin=ymax=0." , "kAxeDirLtoR" , "kAxeDirDownUp" 104 104 // 105 // void UC2GrC( float x, float y, float& xpix, float& ypix)105 // void UC2GrC(double x, double y, double& xpix, double& ypix) 106 106 // Transformation de coordonnées utilisateur "(x,y)" en coordoonnées 107 107 // 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) 109 109 // 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) 111 111 // Transformation de distances selon X,Y en coordonnées utilisateur "dx, dy" en distance 112 112 // 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) 114 114 // Transformation de distances selon X,Y dans l'espace graphique de départ en distance 115 115 // dans l'espace de coordonnées utilisateur. … … 117 117 118 118 /* --Methode-- */ 119 void PIGraphicUC::SetUCS( float xmin, float xmax, float ymin, floatymax,119 void PIGraphicUC::SetUCS(double xmin, double xmax, double ymin, double ymax, 120 120 int axrl, int ayud) 121 121 { 122 122 123 123 if (axrl == kAxeDirAuto) { 124 floatff;124 double ff; 125 125 if (xmax < xmin) { axrl = kAxeDirRtoL; ff=xmin; xmin=xmax; xmax=ff; } 126 126 else axrl = kAxeDirLtoR; 127 127 } 128 128 if (ayud == kAxeDirAuto) { 129 floatff;129 double ff; 130 130 if (ymax < ymin) { ayud = kAxeDirUpDown; ff=ymin; ymin=ymax; ymax=ff; } 131 131 else ayud = kAxeDirDownUp; … … 165 165 166 166 /* --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)167 void 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-- */ 174 void PIGraphicUC::GrC2UC(double xpix, double ypix, double& x, double& y) 175 175 { 176 176 x = (xpix-xOrg)/xScale; … … 179 179 180 180 /* --Methode-- */ 181 void PIGraphicUC::DUC2GrC( float dx, float dy, float& dxpix, float& dypix)181 void PIGraphicUC::DUC2GrC(double dx, double dy, double& dxpix, double& dypix) 182 182 { 183 183 dxpix = dx*xScale; … … 188 188 189 189 /* --Methode-- */ 190 void PIGraphicUC::DGrC2UC( float dxpix, float dypix, float& dx, float& dy)190 void PIGraphicUC::DGrC2UC(double dxpix, double dypix, double& dx, double& dy) 191 191 { 192 192 dx = dxpix/xScale; … … 200 200 { 201 201 if (!mGrC) return; 202 floatx, y, dx, dy;202 double x, y, dx, dy; 203 203 x = xc; dx = dxc; 204 204 y = yc; dy = dyc; … … 227 227 } 228 228 229 floatxf, yf, xf2, yf2;229 double xf, yf, xf2, yf2; 230 230 UC2GrC(x, y, xf, yf); 231 231 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); 234 234 mGrC->Erase(xf, yf, xf2-xf, yf2-yf); 235 235 } … … 239 239 { 240 240 if (!mGrC) return; 241 floatxf, yf;241 double xf, yf; 242 242 UC2GrC(x, y, xf, yf); 243 243 mGrC->DrawString(xf, yf, s, pos); … … 248 248 { 249 249 if (!mGrC) return; 250 floatxf, yf;250 double xf, yf; 251 251 UC2GrC(x, y, xf, yf); 252 252 mGrC->DrawOpaqueString(xf, yf, s, pos); … … 258 258 259 259 if (!mGrC) return; 260 floatx1, y1, x2, y2;260 double x1, y1, x2, y2; 261 261 x1 = xc1; y1 = yc1; 262 262 x2 = xc2; y2 = yc2; … … 267 267 if (y1 > yMax && y2 > yMax) return; 268 268 if (x2 < x1) { 269 fl_swap(x1,x2);270 fl_swap(y1,y2);269 dbl_swap(x1,x2); 270 dbl_swap(y1,y2); 271 271 } 272 272 if (x2>xMax) { … … 279 279 } 280 280 if (y2 < y1) { 281 fl_swap(x1,x2);282 fl_swap(y1,y2);281 dbl_swap(x1,x2); 282 dbl_swap(y1,y2); 283 283 } 284 284 if (y2>yMax) { … … 292 292 } 293 293 294 floatxf1, yf1, xf2, yf2;294 double xf1, yf1, xf2, yf2; 295 295 UC2GrC(x1, y1, xf1, yf1); 296 296 UC2GrC(x2, y2, xf2, yf2); … … 304 304 { 305 305 if (!mGrC) return; 306 floatx, y, dx, dy;306 double x, y, dx, dy; 307 307 x = xc; dx = dxc; 308 308 y = yc; dy = dyc; … … 331 331 } 332 332 333 floatxf, yf, xf2, yf2;333 double xf, yf, xf2, yf2; 334 334 UC2GrC(x, y, xf, yf); 335 335 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); 338 338 mGrC->DrawBox(xf, yf, xf2-xf, yf2-yf); 339 339 } … … 343 343 { 344 344 if (!mGrC) return; 345 floatx, y, dx, dy;345 double x, y, dx, dy; 346 346 x = xc; dx = dxc; 347 347 y = yc; dy = dyc; … … 370 370 } 371 371 372 floatxf, yf, xf2, yf2;372 double xf, yf, xf2, yf2; 373 373 UC2GrC(x, y, xf, yf); 374 374 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); 377 377 mGrC->DrawFBox(xf, yf, xf2-xf, yf2-yf); 378 378 } … … 383 383 if (!mGrC) return; 384 384 385 floatxf, yf, rf,rfy;385 double xf, yf, rf,rfy; 386 386 UC2GrC(x, y, xf, yf); 387 387 DUC2GrC(r,r,rf,rfy); … … 395 395 if (!mGrC) return; 396 396 397 floatxf, yf, rf, rfy;397 double xf, yf, rf, rfy; 398 398 UC2GrC(x, y, xf, yf); 399 399 DUC2GrC(r,r,rf,rfy); … … 407 407 if (!mGrC) return; 408 408 409 floatxf, yf, dxf, dyf;409 double xf, yf, dxf, dyf; 410 410 UC2GrC(x0, y0, xf, yf); 411 411 DUC2GrC(dx, dy, dxf, dyf); … … 418 418 if (!mGrC) return; 419 419 420 floatxf, yf, dxf, dyf;420 double xf, yf, dxf, dyf; 421 421 UC2GrC(x0, y0, xf, yf); 422 422 DUC2GrC(dx, dy, dxf, dyf); … … 432 432 PIGrCoord *pxc, *pyc; 433 433 int i; 434 floatxf, yf;434 double xf, yf; 435 435 436 436 if (!mGrC) return; … … 454 454 PIGrCoord *pxc, *pyc; 455 455 int i; 456 floatxf, yf;456 double xf, yf; 457 457 458 458 if (!mGrC) return; … … 473 473 /* --Methode-- */ 474 474 void PIGraphicUC::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 475 float degdeb, floatdegfin)476 { 477 if (!mGrC) return; 478 479 floatxf, yf, dxf, dyf;475 double degdeb, double degfin) 476 { 477 if (!mGrC) return; 478 479 double xf, yf, dxf, dyf; 480 480 UC2GrC(x0, y0, xf, yf); 481 481 DUC2GrC(dx, dy, dxf, dyf); … … 484 484 /* --Methode-- */ 485 485 void PIGraphicUC::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 486 float degdeb, floatdegfin)487 { 488 if (!mGrC) return; 489 490 floatxf, yf, dxf, dyf;486 double degdeb, double degfin) 487 { 488 if (!mGrC) return; 489 490 double xf, yf, dxf, dyf; 491 491 UC2GrC(x0, y0, xf, yf); 492 492 DUC2GrC(dx, dy, dxf, dyf); … … 498 498 { 499 499 if (!mGrC) return; 500 floatxf, yf;500 double xf, yf; 501 501 UC2GrC(x0, y0, xf, yf); 502 502 mGrC->DrawMarker(xf, yf); … … 510 510 PIGrCoord *pxc, *pyc; 511 511 int i; 512 floatxf, yf;512 double xf, yf; 513 513 514 514 if (!mGrC) return; … … 533 533 if ( (sx < 1) || (sy < 1) ) return; 534 534 if ((pix == NULL) || (cmap == NULL)) return; 535 floatxf,yf;535 double xf,yf; 536 536 UC2GrC(x, y, xf, yf); 537 537 mGrC->DrawPixmap(xf, yf, pix, sx, sy, cmap); … … 618 618 { 619 619 if (!mGrC) return; 620 floatfx, fy;621 DUC2GrC(( float)sz, (float)sz, fx, fy);620 double fx, fy; 621 DUC2GrC((double)sz, (double)sz, fx, fy); 622 622 int npt = (int)fy; 623 623 if (npt < 8) npt = 8; … … 631 631 { 632 632 if (!mGrC) return; 633 floatfx, fy;634 DUC2GrC(( float)sz, (float)sz, fx, fy);633 double fx, fy; 634 DUC2GrC((double)sz, (double)sz, fx, fy); 635 635 int isz = int(0.5*(fx+fy+1)); 636 636 mGrC->SelMarker( isz, mrk); … … 711 711 if (!mGrC) return(0); 712 712 int h,a,d; 713 floatfh, fa, fd, x;713 double fh, fa, fd, x; 714 714 h = mGrC->GetFontHeight(a, d) ; 715 715 DGrC2UC(0., h, x, fh); … … 732 732 { 733 733 if (!mGrC) return(0.); 734 floatdx = mGrC->CalcStringWidth(s);735 floatdxx, dxy;734 double dx = mGrC->CalcStringWidth(s); 735 double dxx, dxy; 736 736 DGrC2UC(dx, dx, dxx, dxy); 737 737 return(dxx); -
trunk/SophyaPI/PI/pigraphuc.h
r158 r204 32 32 33 33 // Definition des coordonnees utilisateur 34 virtual void SetUCS( float xmin, float xmax, float ymin, floatymax,34 virtual void SetUCS(double xmin, double xmax, double ymin, double ymax, 35 35 int axrl=kAxeDirSame, int ayud=kAxeDirSame); 36 36 … … 49 49 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 50 50 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 51 float degdeb, floatdegfin);51 double degdeb, double degfin); 52 52 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 53 float degdeb, floatdegfin);53 double degdeb, double degfin); 54 54 55 55 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); … … 97 97 98 98 // 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); 103 103 104 104 void NoClip() {clip = false; } … … 110 110 PIGraphicGen* mGrC; 111 111 112 floatxMin, xMax, yMin, yMax; // Valeurs en unites user113 floatxOrg, yOrg; // Position en pixels de (0.0, 0.0)114 floatxScale, yScale; // Pixels par unites graphiques115 floatxW0, yW0, xWd, yWd; // Origine/largeur ds la fenetre de trace112 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 116 116 bool aXdir, aYdir; // Sens des axes horiz, vertical 117 117 bool clip; -
trunk/SophyaPI/PI/pigraphx.cc
r190 r204 240 240 /* --Methode-- */ 241 241 void PIGraphicX::DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 242 float degdeb, floatdegfin)242 double degdeb, double degfin) 243 243 { 244 244 XDrawArc(XtDisplay (MyWdg()), mWId, DefGC(), … … 249 249 /* --Methode-- */ 250 250 void PIGraphicX::DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 251 float degdeb, floatdegfin)251 double degdeb, double degfin) 252 252 { 253 253 XFillArc(XtDisplay (MyWdg()), mWId, DefGC(), -
trunk/SophyaPI/PI/pigraphx.h
r180 r204 33 33 virtual void DrawFPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true); 34 34 virtual void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 35 float degdeb, floatdegfin);35 double degdeb, double degfin); 36 36 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 37 float degdeb, floatdegfin);37 double degdeb, double degfin); 38 38 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 39 39 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); -
trunk/SophyaPI/PI/piimage.cc
r202 r204 153 153 // SetSize(img->XSize(), img->YSize()); 154 154 CenterPave(); 155 floatmin=1., max=-1., moy, sig;155 double min=1., max=-1., moy, sig; 156 156 int nbnul, nbsat; 157 157 img->CheckDyn(min, max, moy, sig, nbnul, nbsat); … … 217 217 if (showinfo && img) { 218 218 char buff[256]; 219 floatx,y;219 double x,y; 220 220 img->XYCoord(xpav, ypav, x, y); 221 221 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", … … 237 237 238 238 /* --Methode-- */ 239 void PIImage::SetLut( float min, floatmax, int typlut, int lauto, bool refr)239 void PIImage::SetLut(double min, double max, int typlut, int lauto, bool refr) 240 240 { 241 241 if (lut) delete(lut); … … 243 243 { 244 244 int nbsig = lauto; 245 floatfracmax = 1. - 0.05*nbsig;245 double fracmax = 1. - 0.05*nbsig; 246 246 img->ComputeLut_PicHisto(min, max, nbsig, fracmax); 247 247 } … … 381 381 else { 382 382 char buff[256]; 383 floatx,y;383 double x,y; 384 384 img->XYCoord(xpav, ypav, x, y); 385 385 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", … … 423 423 if (showinfo && img) { 424 424 char buff[256]; 425 floatx,y;425 double x,y; 426 426 img->XYCoord(xpav, ypav, x, y); 427 427 sprintf(buff," X= %g , Y= %g Pix= %g (%d,%d) ", … … 567 567 { 568 568 char buff[256]; 569 floatx,y;569 double x,y; 570 570 img->XYCoord(xp, yp, x, y); 571 571 sprintf(buff," X= %g , Y= %g Pix= %g (C= %d,%d) ", … … 669 669 char pc[256]; 670 670 strncpy(pc, (char*)pdata, ll-1); pc[ll-1] = '\0'; 671 floatfx, fy;671 double fx, fy; 672 672 img->Coord(xpav, ypav, fx, fy); 673 673 mdrw->ElAddText(fx, fy, pc ); … … 717 717 PosW2Img(xw1, yw1, &x1, &y1); 718 718 PosW2Img(xw2, yw2, &x2, &y2); 719 floatfx1,fy1, fx2, fy2;719 double fx1,fy1, fx2, fy2; 720 720 img->Coord(x1,y1, fx1, fy2); // fy1 et fy2 echange expres pour utiliser kAxeDirAuto 721 721 img->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 47 47 48 48 // Gestion du choix de LUT, facteur d agrandissement, table de couleur 49 void SetLut( float min, floatmax, int typlut=kLutType_Lin,49 void SetLut(double min, double max, int typlut=kLutType_Lin, 50 50 int lauto=0, bool refr=true); 51 51 void SetLut(LUT *clut, bool refr=true); -
trunk/SophyaPI/PI/piimgtools.cc
r163 r204 246 246 void PIImgTools::Process(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/) 247 247 { 248 floatmin, max, del;248 double min, max, del; 249 249 int lauto, typ; 250 250 int typlut[2] = {kLutType_Lin, kLutType_Log} ; … … 266 266 if (msg == 2700) { 267 267 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; 270 270 } 271 271 if (msg == 2800) { 272 272 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; 275 275 } 276 276 if ( (msg == 2700) || (msg == 2800) ) { -
trunk/SophyaPI/PI/pimenux.cc
r187 r204 100 100 PIMenuX::~PIMenuX() 101 101 { 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 104 104 delete[] mBut ; 105 105 } -
trunk/SophyaPI/PI/piscdrawwdg.cc
r202 r204 33 33 //-- 34 34 35 static inline void fl_swap(float& a, float& b) { floattmp = a; a = b; b = tmp; }35 static inline void dbl_swap(double& a, double& b) { double tmp = a; a = b; b = tmp; } 36 36 37 37 //++ … … 44 44 // long kind() 45 45 // Renvoie le type ("=PIScDrawWdg::ClassId") 46 // void SetLimits( float xmin, float xmax, float ymin, floatymax, -46 // void SetLimits(double xmin, double xmax, double ymin, double ymax, - 47 47 // int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false) 48 48 // Définit les limites de coordonnées. … … 111 111 112 112 void 113 PIScDrawWdg::SetLimits( float xmin, float xmax, float ymin, floatymax,113 PIScDrawWdg::SetLimits(double xmin, double xmax, double ymin, double ymax, 114 114 int axrl, int ayud, bool tmp) 115 115 { … … 177 177 // Gestion affichage coordonnees du point 178 178 179 string PIScDrawWdg::GetClickText( float x, floaty)179 string PIScDrawWdg::GetClickText(double x, double y) 180 180 // Donne le texte a afficher pour position x,y 181 181 { … … 224 224 { 225 225 226 floatdx, dy;226 double dx, dy; 227 227 mBDrw->GetGraphicUC()->GrC2UC(xp, yp, dx, dy); 228 228 mPPos[0] = dx; mPPos[1] = dy; … … 271 271 SetLimits(xMinS, xMaxS, yMinS, yMaxS, kAxeDirSame, kAxeDirSame ); 272 272 else { 273 floatxl,yl,xh,yh;273 double xl,yl,xh,yh; 274 274 mBDrw->GetGraphicUC()->GrC2UC(xBegDrag, yBegDrag, xl, yl); 275 275 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); 278 278 SetLimits(xl,xh,yl,yh, kAxeDirSame, kAxeDirSame, true); 279 279 } … … 323 323 { 324 324 if (mSz <= 0) return; 325 floatxmin, xmax, ymin, ymax;325 double xmin, xmax, ymin, ymax; 326 326 int i=0; 327 floatcv;327 double cv; 328 328 if (mAy) { 329 329 xmin = xmax = mAx->Value(0); … … 351 351 } 352 352 353 floatdx, dy;353 double dx, dy; 354 354 dx = 0.02*(xmax-xmin); 355 355 dy = 0.02*(ymax-ymin); … … 361 361 362 362 /* --Methode-- */ 363 void PIYfXDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax)364 { 365 floatxp,yp;363 void PIYfXDrawer::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax) 364 { 365 double xp,yp; 366 366 int i; 367 367 … … 381 381 382 382 // Trace des lignes 383 floatxp2, yp2;383 double xp2, yp2; 384 384 if (mAy) { xp2 = mAx->Value(0); yp2 = mAy->Value(0); } 385 385 else { xp2 = mAx->X(0); yp2 = mAx->Value(0); } … … 412 412 /* --Methode-- */ 413 413 void 414 PIFuncDrawer::Draw(PIGraphicUC* g, float /*xmin*/, float/*ymin*/, float/*xmax*/, float/*ymax*/)414 PIFuncDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/) 415 415 { 416 416 PIGrCoord x1, x2, y1, y2; 417 417 g->GetGrSpace(x1, x2, y1, y2); 418 floatxMax = x2;419 floatxMin = x1;420 floatyMax = y2;421 floatyMin = y1;422 floatxStep = (xMax - xMin)/100;423 floatxOld = xMin;424 floatyOld = mFunc(xMin);425 for ( floatx = 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) { 426 426 double y = mFunc(x); 427 427 if (y>yMin && yOld>yMin && -
trunk/SophyaPI/PI/piscdrawwdg.h
r202 r204 26 26 virtual long kind() {return ClassId; } 27 27 28 virtual void SetLimits( float xmin, float xmax, float ymin, floatymax,28 virtual void SetLimits(double xmin, double xmax, double ymin, double ymax, 29 29 int axrl=kAxeDirSame, int ayud=kAxeDirSame, bool tmp=false); 30 30 virtual void UpdateLimits(); // Calcule et change les limites a partir de Drawer-No-1 … … 42 42 inline PIElDrawer* BaseDrawer() { return mBDrw; }; 43 43 44 floatXMin() const {return mBDrw->XMin();}45 floatXMax() const {return mBDrw->XMax();}46 floatYMin() const {return mBDrw->YMin();}47 floatYMax() const {return mBDrw->YMax();}48 floatXPPos() const { return mPPos[0]; }49 floatYPPos() 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]; } 50 50 int LimitsFixed() const {return mBDrw->LimitsFixed();} 51 51 void FreeLimits() { mBDrw->FreeLimits(); } 52 52 53 53 54 virtual string GetClickText( float x, floaty); // Donne le texte a afficher pour position x,y54 virtual string GetClickText(double x, double y); // Donne le texte a afficher pour position x,y 55 55 56 56 void SetTextWin(PILabel * tw, bool trw=true, int tx=300, int ty=30); … … 68 68 69 69 protected: 70 floatxMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom71 floatmPPos[2]; // Position click souris X,Y70 double xMinS, xMaxS, yMinS, yMaxS; // Sauvegarde pour zoom 71 double mPPos[2]; // Position click souris X,Y 72 72 73 73 PIElDrawer* mBDrw; … … 99 99 virtual ~PIYfXDrawer(); 100 100 101 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax);101 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 102 102 virtual void UpdateLimits(); 103 103 … … 120 120 virtual ~PIFuncDrawer(); 121 121 122 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax);122 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 123 123 protected: 124 124 FUNC mFunc; -
trunk/SophyaPI/PI/pistzwin.cc
r190 r204 177 177 int k; 178 178 for(k=0; k<NbChilds(); k++) { 179 psf->NewPage(( float)XSize(), (float)YSize(),PI_Auto);179 psf->NewPage((double)XSize(), (double)YSize(),PI_Auto); 180 180 GetChild(k)->PSPrint(psf, ofx, ofy); 181 181 } -
trunk/SophyaPI/PI/pisurfdr.cc
r184 r204 13 13 arr->XYfromxy(arr->XSize(),arr->YSize(),mXmax, mYmax); 14 14 if (asxy) mScy = (mXmax-mXmin)/(mYmax-mYmin); 15 floatscm = ((mXmax-mXmin) > (mYmax-mYmin)) ? (mXmax-mXmin) : (mYmax-mYmin);16 int i,j; floatcv;15 double scm = ((mXmax-mXmin) > (mYmax-mYmin)) ? (mXmax-mXmin) : (mYmax-mYmin); 16 int i,j; double cv; 17 17 mZmin = mZmax = arr->Value(0,0); 18 18 for(i=0; i<arr->XSize(); i++) … … 26 26 // printf("PISurfaceDrawer::PISurfaceDrawer Min/Max: %g,%g %g,%g %g,%g Sc: %g %g %g \n", 27 27 // mXmin, mXmax, mYmin, mYmax, mZmin, mZmax, mScx, mScy, mScz); 28 floatzmin = mZmin;29 floatzmax = mZmax;30 floatdzz = (mZmax-mZmin)*0.05;28 double zmin = mZmin; 29 double zmax = mZmax; 30 double dzz = (mZmax-mZmin)*0.05; 31 31 mLut = new LUT(zmin-dzz*2, zmax-dzz, 256); 32 32 } … … 43 43 { 44 44 if (mArr == NULL) return; 45 floatxmin, xmax, ymin, ymax, zmin, zmax;45 double xmin, xmax, ymin, ymax, zmin, zmax; 46 46 xmin = mXmin*mScx; xmax = mXmax*mScx; 47 47 ymin = mYmin*mScy; ymax = mYmax*mScy; … … 50 50 // Distance D = Max(xmax-xmin,ymin-ymax)*2 51 51 // Observateur en O = X+D, Yc+2*D 52 floatD = xmax-xmin;52 double D = xmax-xmin; 53 53 if (D < (ymax-ymin)) D = ymax-ymin; 54 54 D *= 1.4; … … 70 70 71 71 typedef struct /* structures pour trier en ZP les facettes */ 72 { double dp; floatzh; int ij; } ZPSORT;72 { double dp; double zh; int ij; } ZPSORT; 73 73 /* Nouvelle-Fonction */ 74 74 static int ijzpsort(const void * sp1, const void * sp2) … … 96 96 97 97 /* --Methode-- */ 98 void PISurfaceDrawer::Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax)98 void PISurfaceDrawer::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax) 99 99 { 100 100 // On trace les axes - En attendant de faire mieux - Reza 8/12/98 … … 116 116 117 117 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 floatdx,dy; // taille du bin118 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 123 123 dx = (mXmax-mXmin)*mScx/xsz; 124 124 dy = (mYmax-mYmin)*mScy/ysz; … … 126 126 int i1,j1; 127 127 int i,j,k,l; 128 floatx,y,z,xp,yp,zp;128 double x,y,z,xp,yp,zp; 129 129 130 130 k = 0; -
trunk/SophyaPI/PI/pisurfdr.h
r184 r204 17 17 virtual void UpdateLimits(); // Calcule et change la vue-3D 18 18 19 virtual void Draw(PIGraphicUC* g, float xmin, float ymin, float xmax, floatymax);19 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); 20 20 virtual void DrawAxes(PIGraphicUC* g); 21 21 … … 23 23 P2DArrayAdapter* mArr; 24 24 bool mAda; 25 floatmScz, mScx, mScy;26 floatmXmin, mXmax;27 floatmYmin, mYmax;28 floatmZmin, mZmax;25 double mScz, mScx, mScy; 26 double mXmin, mXmax; 27 double mYmin, mYmax; 28 double mZmin, mZmax; 29 29 LUT* mLut; 30 30 }; -
trunk/SophyaPI/PI/piwdggen.cc
r190 r204 254 254 255 255 if (!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());256 psf->NewBloc((double)ofx+XPos(), (double)ofy+YPos(), (double)XSize(), (double)YSize(), 257 (double)XSize(), (double)YSize()); 258 psf->DrawBox(0., 0., (double)XSize(), (double)YSize()); 259 259 sprintf(str,"PIWdgGen::PSPrint() Kind=%ld Name= %s", kind(), Nom().c_str()); 260 260 psf->DrawString(12., 12., str, PI_Black, PI_RomanFont, 10); -
trunk/SophyaPI/PI/piwdgx.cc
r190 r204 195 195 UnManage(); 196 196 if (curselwdg == this) { SelectionLost(); curselwdg = NULL; } 197 if (!sdw) XtDestroyWidget(sdw); 197 if (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 } 198 206 } 199 207 -
trunk/SophyaPI/PI/piwdgx.h
r190 r204 15 15 typedef WidgetClass SysDWdgClass; 16 16 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 };22 17 23 18 class PIWdgX : public PIWdgGen … … 95 90 96 91 protected: 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 97 99 int InitXt(int narg=0, char *arg[]=NULL); 98 100 -
trunk/SophyaPI/PI/piwindowx.cc
r163 r204 92 92 93 93 CreateXtWdg(nom, xmFormWidgetClass, pwm->XtWdg(), sx, sy, 0, 0); 94 wmis = k_wmi_cascade; 94 95 } 95 96 … … 97 98 PIWindowX::~PIWindowX() 98 99 { 100 Hide(); 99 101 delete pwm; 100 102 } -
trunk/SophyaPI/PI/psfile.cc
r164 r204 243 243 /* Dimensions des divers formats */ 244 244 struct PaperSize { 245 floatwidth ;246 floatheight ;245 double width ; 246 double height ; 247 247 }; 248 248 struct PaperSize PaperSizeTable[] = { … … 254 254 255 255 256 float cm2pt(floatx);256 double cm2pt(double x); 257 257 258 258 … … 278 278 //-- 279 279 //++ 280 // PSFile (const char * FileName, floatsc = 1.0)280 // PSFile (const char * FileName, double sc = 1.0) 281 281 // Créateur pour fichier Encapsulated Postscript 282 282 // PSFile (const char * FileName, PIOrientation orientation, - 283 283 // PIPaperSize paperSize= PI_A4, - 284 // float marginX = 5.0, floatmarginY = 5.0 )284 // double marginX = 5.0, double marginY = 5.0 ) 285 285 // Créateur pour fichier Postscript 286 286 //-- … … 294 294 * 295 295 */ 296 PSFile::PSFile(const char * FileName, floatsc)296 PSFile::PSFile(const char * FileName, double sc) 297 297 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__) 298 298 : mPSFileName(FileName==NULL? "unnamed.eps" : const_cast<char *>(FileName)), … … 359 359 PIOrientation orientation, 360 360 PIPaperSize paperSize, 361 float marginX, floatmarginY)361 double marginX, double marginY) 362 362 #if defined(__DECCXX) || defined(__KCC__) || defined(__aCC__) 363 363 : mPSFileName (FileName == NULL ? "unnamed.ps" : const_cast<char *>(FileName)), … … 471 471 } 472 472 473 void PSFile::NewPage( float Dx, floatDy, PIOrientation orientation) {474 475 floattw, th; /* largeur & hauteur corrigees des marges */473 void PSFile::NewPage(double Dx, double Dy, PIOrientation orientation) { 474 475 double tw, th; /* largeur & hauteur corrigees des marges */ 476 476 477 477 /* On ferme ce qui doit l'etre ... */ … … 635 635 636 636 637 void PSFile::NewBloc( float x0, float y0, float Tx, floatTy,638 float Dx, floatDy){637 void PSFile::NewBloc(double x0, double y0, double Tx, double Ty, 638 double Dx, double Dy){ 639 639 640 640 /* Si pas de page, on s'en va */ … … 692 692 PIColor tmp = cmap.GetColor(cid) ; 693 693 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.) ; 697 697 } 698 698 … … 704 704 705 705 706 void PSFile::DrawString ( float x, floaty, const char *s,706 void PSFile::DrawString (double x, double y, const char *s, 707 707 PIColors DrawColor, 708 708 PIFontAtt FontAtt, … … 730 730 731 731 732 void PSFile::DrawLine ( float x1, float y1, float x2, floaty2,732 void PSFile::DrawLine (double x1, double y1, double x2, double y2, 733 733 PIColors DrawColor, 734 734 PILineAtt LineAtt) { … … 769 769 770 770 771 void PSFile::DrawBox( float x0, float y0, float Tx, floatTy,771 void PSFile::DrawBox(double x0, double y0, double Tx, double Ty, 772 772 PIColors DrawColor, 773 773 PILineAtt LineAtt) { … … 791 791 792 792 793 void PSFile::DrawFBox( float x0, float y0, float Tx, floatTy,793 void PSFile::DrawFBox(double x0, double y0, double Tx, double Ty, 794 794 PIColors DrawColor, 795 795 PIColors FillColor, … … 818 818 819 819 820 void PSFile::DrawCircle ( float x0, float y0, floatr,820 void PSFile::DrawCircle (double x0, double y0, double r, 821 821 PIColors DrawColor, 822 822 PILineAtt LineAtt) { … … 840 840 841 841 842 void PSFile::DrawFCircle ( float x0, float y0, floatr,842 void PSFile::DrawFCircle (double x0, double y0, double r, 843 843 PIColors DrawColor, 844 844 PIColors FillColor, … … 872 872 873 873 // Les coordonnees sont supposees etre en mode incremental . 874 void PSFile::DrawPolygon ( float *x, float*y, int n,874 void PSFile::DrawPolygon (double *x, double *y, int n, 875 875 PIColors DrawColor, 876 876 PILineAtt LineAtt, bool cinc) { … … 901 901 902 902 903 void PSFile::DrawFPolygon( float *x, float*y, int n,903 void PSFile::DrawFPolygon(double *x, double *y, int n, 904 904 PIColors DrawColor, 905 905 PIColors FillColor, … … 938 938 939 939 940 void PSFile::DrawMarker ( float x0, floaty0,940 void PSFile::DrawMarker (double x0, double y0, 941 941 PIMarker MrkType, 942 942 PIColors DrawColor, … … 965 965 * 966 966 */ 967 void PSFile::DrawMarkers ( float *x0, float*y0, int n,967 void PSFile::DrawMarkers (double *x0, double *y0, int n, 968 968 PIMarker MrkType, 969 969 PIColors DrawColor, … … 989 989 } 990 990 991 void PSFile::Image( float x0, float y0, float Tx, floatTy,991 void PSFile::Image(double x0, double y0, double Tx, double Ty, 992 992 int Nx, int Ny, 993 993 unsigned char *Pict, … … 1034 1034 */ 1035 1035 1036 float cm2pt(floatx) {1036 double cm2pt(double x) { 1037 1037 return (x*28.35); 1038 1038 } -
trunk/SophyaPI/PI/psfile.h
r177 r204 51 51 /* Valable pour une page, ou un bloc */ 52 52 /*typedef struct { 53 * floatX0; Coordonnes sommet NO54 * floatY0; en unites courantes55 * floatTx; Format56 * floatTy; en unites courantes57 * floatDx; Coord sommet SE58 * floatDy; en unites courantes53 * 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 59 59 * int orientation; LANDSCAPE OU PORTRAIT 60 60 *} Format; … … 75 75 public: 76 76 /* Production fichier eps */ 77 PSFile (const char * FileName, floatsc = 1.0);77 PSFile (const char * FileName, double sc = 1.0); 78 78 /* Production fichier ps */ 79 79 PSFile (const char * FileName, PIOrientation orientation, 80 80 PIPaperSize paperSize= PI_A4, 81 float marginX = 5.0, floatmarginY = 5.0 ) ;81 double marginX = 5.0, double marginY = 5.0 ) ; 82 82 83 83 virtual ~PSFile(); … … 96 96 virtual PIMarker GetMarker(); 97 97 98 virtual void NewPage( float Dx, floatDy, PIOrientation orientation);98 virtual void NewPage(double Dx, double Dy, PIOrientation orientation); 99 99 virtual void EndPage(); 100 virtual void NewBloc( float x0, float y0, float Tx, floatTy,101 float Dx, floatDy);100 virtual void NewBloc(double x0, double y0, double Tx, double Ty, 101 double Dx, double Dy); 102 102 virtual void EndBloc(); 103 103 … … 106 106 107 107 /* Trace */ 108 virtual void DrawString ( float x, floaty, const char *s,108 virtual void DrawString (double x, double y, const char *s, 109 109 PIColors DrawColor = PI_NotDefColor, 110 110 PIFontAtt FontAtt = PI_NotDefFontAtt, 111 111 int FontSize = 8); 112 virtual void DrawLine ( float x1, float y1, float x2, floaty2,113 PIColors DrawColor = PI_NotDefColor, 114 PILineAtt LineAtt = PI_NotDefLineAtt); 115 virtual void DrawBox ( float x0, float y0, float Tx, floatTy,116 PIColors DrawColor = PI_NotDefColor, 117 PILineAtt LineAtt = PI_NotDefLineAtt); 118 virtual void DrawFBox ( float x0, float y0, float Tx, floatTy,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, 119 119 PIColors DrawColor = PI_NotDefColor, 120 120 PIColors FillColor = PI_NotDefColor, 121 121 PILineAtt LineAtt = PI_NotDefLineAtt); 122 virtual void DrawCircle ( float x0, float y0, floatr,123 PIColors DrawColor = PI_NotDefColor, 124 PILineAtt LineAtt = PI_NotDefLineAtt); 125 virtual void DrawFCircle ( float x0, float y0, floatr,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, 126 126 PIColors DrawColor = PI_NotDefColor, 127 127 PIColors FillColor = PI_NotDefColor, 128 128 PILineAtt LineAtt = PI_NotDefLineAtt); 129 virtual void DrawPolygon ( float *x, float*y, int n,129 virtual void DrawPolygon (double *x, double *y, int n, 130 130 PIColors DrawColor = PI_NotDefColor, 131 131 PILineAtt LineAtt = PI_NotDefLineAtt, 132 132 bool cinc = true); 133 virtual void DrawFPolygon( float *x, float*y, int n,133 virtual void DrawFPolygon(double *x, double *y, int n, 134 134 PIColors DrawColor = PI_NotDefColor, 135 135 PIColors FillColor = PI_NotDefColor, 136 136 PILineAtt LineAtt = PI_NotDefLineAtt, 137 137 bool cinc = true); 138 virtual void DrawMarker ( float x0, floaty0,138 virtual void DrawMarker (double x0, double y0, 139 139 PIMarker MrkType = PI_NotDefMarker, 140 140 PIColors DrawColor = PI_NotDefColor, 141 141 int MarkerSize=14); 142 virtual void DrawMarkers ( float *x0, float*y0, int n,142 virtual void DrawMarkers (double *x0, double *y0, int n, 143 143 PIMarker MrkType = PI_NotDefMarker, 144 144 PIColors DrawColor = PI_NotDefColor, 145 145 int MarkerSize=14); 146 146 147 virtual void Image( float x0, float y0, float Tx, floatTy,147 virtual void Image(double x0, double y0, double Tx, double Ty, 148 148 int Nx, int Ny, 149 149 unsigned char *pict, … … 155 155 int num; 156 156 char* label; 157 floatX0, Y0; /* coordonnees sommet NO */158 floatTx, Ty; /* Format */159 floatDx, Dy; /* Repere utilisateur */157 double X0, Y0; /* coordonnees sommet NO */ 158 double Tx, Ty; /* Format */ 159 double Dx, Dy; /* Repere utilisateur */ 160 160 long begin,end,tmp; /* offsets dans le fichier */ 161 161 } Bloc ; … … 167 167 int num; 168 168 int BlocCounter; 169 floatDx,Dy; /* Sommet SE (unites utilisateur) */169 double Dx,Dy; /* Sommet SE (unites utilisateur) */ 170 170 PIOrientation orientation; 171 171 long begin, end, tmp; /* Offsets dans le fichier */ … … 179 179 FILE * mPSFile; 180 180 const char * mPSFileName; 181 floatTw,Th ; /* Format, en cm */182 floatWMargin,HMargin ; /* Marges minimales */181 double Tw,Th ; /* Format, en cm */ 182 double WMargin,HMargin ; /* Marges minimales */ 183 183 int isEPS; /* Vrai si PostScript Encapsule */ 184 184 long boundingBox; /* Endroit ou est specifiee la bb */ 185 float scale;/* boundingbox = Dx*scale ; Dy*scale */185 double scale; /* boundingbox = Dx*scale ; Dy*scale */ 186 186 PIPaperSize mPaperSize ; 187 187 int PageCounter; /* nbr pages */
Note:
See TracChangeset
for help on using the changeset viewer.