[339] | 1 | // Cette classe est maintenant obsolete: generaldata <==> ntuple pour le dessin
|
---|
| 2 |
|
---|
[165] | 3 | #include <stdio.h>
|
---|
[2615] | 4 | #include "sopnamsp.h"
|
---|
[165] | 5 | #include "pigfd2.h"
|
---|
| 6 |
|
---|
| 7 | /* --Methode-- */
|
---|
| 8 | PIGenFitDat3D::PIGenFitDat3D(GeneralFitData* gfd, bool ad)
|
---|
| 9 | : PIDrawer3D(), mGFD(gfd), mAdDO(ad)
|
---|
| 10 | , VarX(0), VarY(1), ErrX(false), ErrY(false), ErrZ(false)
|
---|
| 11 | {
|
---|
| 12 | SelectXY(0,1);
|
---|
| 13 | SelectErrBar(false,false,false);
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | PIGenFitDat3D::~PIGenFitDat3D()
|
---|
| 17 | {
|
---|
| 18 | if(mAdDO && mGFD) delete mGFD;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | /* --Methode-- */
|
---|
| 22 | void PIGenFitDat3D::SelectXY(int varx,int vary)
|
---|
| 23 | {
|
---|
| 24 | VarX = VarY = -1;
|
---|
| 25 | if(mGFD == NULL) return;
|
---|
| 26 | if(varx<0 || varx>=mGFD->NVar()) return;
|
---|
| 27 | if(vary<0 || vary>=mGFD->NVar()) return;
|
---|
| 28 | VarX = varx; VarY = vary;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | /* --Methode-- */
|
---|
| 32 | void PIGenFitDat3D::SelectErrBar(bool erbx,bool erby,bool erbz)
|
---|
| 33 | {
|
---|
| 34 | ErrX = erbx; ErrY = erby; ErrZ = erbz;
|
---|
| 35 | if(mGFD == NULL) {ErrX = ErrY = ErrZ = false; return;}
|
---|
| 36 | if(!mGFD->HasXErrors()) ErrX = ErrY = false;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | /* --Methode-- */
|
---|
| 40 | void PIGenFitDat3D::UpdateLimits()
|
---|
| 41 | {
|
---|
| 42 | if(!mGFD) return;
|
---|
| 43 | if(mGFD->NData()<=0) return;
|
---|
| 44 | if(VarX<0 || VarY<0) return;
|
---|
| 45 | double xmin=9.e19, xmax=-9.e19, ymin=9.e19, ymax=-9.e19, zmin=9.e19, zmax=-9.e19;
|
---|
[339] | 46 | mGFD->GetMnMx(10*VarX+2,xmin,xmax);
|
---|
| 47 | mGFD->GetMnMx(10*VarY+2,ymin,ymax);
|
---|
| 48 | mGFD->GetMnMx(0,zmin, zmax);
|
---|
[165] | 49 | if(xmax<=xmin) xmax = xmin+1.;
|
---|
| 50 | if(ymax<=ymin) ymax = ymin+1.;
|
---|
| 51 | if(zmax<=zmin) zmax = zmin+1.;
|
---|
| 52 | // Voir commentaires pintuple3d.cc
|
---|
[205] | 53 | double D = xmax-xmin;
|
---|
[165] | 54 | if (D < (ymax-ymin)) D = ymax-ymin;
|
---|
| 55 | D *= 1.4;
|
---|
| 56 | Set3DView((xmin+xmax)/2., (ymin+ymax)/2, (zmin+zmax)/2.,
|
---|
[185] | 57 | (xmin+xmax)/2.+D , (ymin+ymax)/2.-2.5*D , zmin+(zmax-zmin)*0.85, 0.25, 0.25);
|
---|
[171] | 58 |
|
---|
[185] | 59 | x3Min = xmin; x3Max = xmax;
|
---|
| 60 | y3Min = ymin; y3Max = ymax;
|
---|
| 61 | z3Min = zmin; z3Max = zmax;
|
---|
[171] | 62 |
|
---|
[165] | 63 | }
|
---|
| 64 |
|
---|
| 65 | /* --Methode-- */
|
---|
[205] | 66 | void PIGenFitDat3D::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
|
---|
[165] | 67 | {
|
---|
[185] | 68 | // On trace les axes - En attendant de faire mieux - Reza 8/12/98
|
---|
| 69 | if (axesFlags != kAxesNone) DrawAxes(g);
|
---|
| 70 |
|
---|
[165] | 71 | if (!mGFD) return;
|
---|
| 72 | if(mGFD->NData()<=0) return;
|
---|
| 73 | if(VarX<0 || VarY<0) return;
|
---|
[185] | 74 |
|
---|
[165] | 75 | // On plotte les barre d'erreurs ligne demandee explicitement
|
---|
[1905] | 76 | if(GetGraphicAtt().GetLineAtt()!=PI_NotDefLineAtt) SelectErrBar(true,true,true);
|
---|
[165] | 77 |
|
---|
[440] | 78 | #if defined(CC_HAS_RTTI_SUPPORT)
|
---|
[165] | 79 | PIGraphic3D* g3 = dynamic_cast<PIGraphic3D*>(g);
|
---|
| 80 | #else
|
---|
| 81 | PIGraphic3D* g3 = (PIGraphic3D*)(g);
|
---|
| 82 | #endif
|
---|
| 83 |
|
---|
[1905] | 84 | if (GetGraphicAtt().GetLineAtt() == PI_NotDefLineAtt) g3->SelLine(PI_ThinLine);
|
---|
[165] | 85 |
|
---|
[205] | 86 | double xp,yp,zp,er;
|
---|
[165] | 87 | for (int i=0; i<mGFD->NData(); i++) {
|
---|
| 88 | xp = mGFD->Absc(VarX,i);
|
---|
| 89 | yp = mGFD->Absc(VarY,i);
|
---|
| 90 | zp = mGFD->Val(i);
|
---|
| 91 | if(ErrX) {
|
---|
| 92 | er = mGFD->EAbsc(VarX,i);
|
---|
| 93 | if(er>0.) g3->DrawLine3D(xp-er,yp,zp,xp+er,yp,zp);
|
---|
| 94 | }
|
---|
| 95 | if(ErrY) {
|
---|
| 96 | er = mGFD->EAbsc(VarY,i);
|
---|
| 97 | g3->DrawLine3D(xp,yp-er,zp,xp,yp+er,zp);
|
---|
| 98 | }
|
---|
| 99 | if(ErrZ) {
|
---|
| 100 | er = mGFD->EVal(i);
|
---|
| 101 | g3->DrawLine3D(xp,yp,zp-er,xp,yp,zp+er);
|
---|
| 102 | }
|
---|
| 103 | g3->DrawMarker3D(xp,yp,zp);
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | return;
|
---|
| 107 | }
|
---|
[339] | 108 |
|
---|