4 // ---------------------------------------------------------------------------
8 // This file is part of the ALICE Geometry Database .
10 // Author: Joana E. Santo
12 // ---------------------------------------------------------------------------
15 #include <TVirtualPad.h>
17 #include "AliGShape.h"
19 #include "AliGeometry.h"
21 //---------------------------------------------------------------------------
25 AliGShape::AliGShape()
27 /* Default Constructor */
32 //---------------------------------------------------------------------------
34 AliGShape::AliGShape(Text_t* name, Text_t* title): TNamed(name, title), TAttLine(), TAttFill()
39 //---------------------------------------------------------------------------
41 AliGShape::AliGShape( AliGShape* shape )
43 /* Copy Constructor */
44 fColor = shape->fColor;
48 //---------------------------------------------------------------------------
50 void AliGShape::Paint(Option_t *)
52 // This method must be overridden by the real shape implementation.
53 // AbstractMethod("Paint");
56 // ---------------------------------------------------------------------------
58 Int_t AliGShape::DistancetoPrimitive(Int_t, Int_t)
60 TView *view = gPad->GetView();
61 gPad->SetSelected(view);
65 // ---------------------------------------------------------------------------
67 void AliGShape::PaintShape(X3DBuffer *buff, Bool_t rangeView)
69 //*-*-*-*-*Paint 3-D shape in current pad with its current attributes*-*-*-*-*
70 //*-* ==========================================================
74 Float_t *point = &(buff->points[0]);
75 for (Int_t j = 0; j < buff->numPoints; j++) {
76 // printf("Before %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
77 gAliGeometry->Local2Master(&point[3*j],&point[3*j]);
78 // printf("After %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
81 Float_t points[6], x0, y0, z0, x1, y1, z1;
82 const Int_t kExpandView = 2;
85 x0 = y0 = z0 = x1 = y1 = z1 = buff->points[0];
87 TAttLine::Modify(); //Change line attributes only if necessary
88 TAttFill::Modify(); //Change fill area attributes only if necessary
90 for (Int_t i = 0; i < buff->numSegs; i++) {
91 i0 = 3*buff->segs[3*i+1];
92 points[0] = buff->points[i0++];
93 points[1] = buff->points[i0++];
94 points[2] = buff->points[i0];
96 i0 = 3*buff->segs[3*i+2];
97 points[3] = buff->points[i0++];
98 points[4] = buff->points[i0++];
99 points[5] = buff->points[i0];
101 x0 = points[0] < x0 ? points[0] : x0;
102 y0 = points[1] < y0 ? points[1] : y0;
103 z0 = points[2] < z0 ? points[2] : z0;
104 x1 = points[0] > x1 ? points[0] : x1;
105 y1 = points[1] > y1 ? points[1] : y1;
106 z1 = points[2] > z1 ? points[2] : z1;
108 Float_t *ptpoints_0 = &points[0];
109 Float_t *ptpoints_3 = &points[3];
111 //printf("Painting from %f to %f\n",*ptpoints_0, *ptpoints_3);
113 gPad->PaintLine3D(ptpoints_0, ptpoints_3);
114 // gPad->PaintLine3D(&points[0], &points[3]);
117 TView *view = gPad->GetView();
118 //cout << "x0,y0,x1,y1=" << x0 << y0 << x1 << y1 << endl;
119 if (view->GetAutoRange()) view->SetRange(-500,-500,-500,500,500,500,kExpandView);
121 // if (view->GetAutoRange()) view->SetRange(-1,-1,-1,1,1,1,kExpandView);
126 // ---------------------------------------------------------------------------
128 void AliGShape::SetPoints(Float_t *) {
129 AbstractMethod("SetPoints(Float_t *buffer)");
132 // ---------------------------------------------------------------------------