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