1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
23 // ---------------------------------------------------------------------------
27 // This file is part of the ALICE Geometry Database .
29 // Author: Joana E. Santo
31 // ---------------------------------------------------------------------------
34 #include <TVirtualPad.h>
36 #include "AliGShape.h"
38 #include "AliGeometry.h"
40 //---------------------------------------------------------------------------
44 AliGShape::AliGShape()
46 /* Default Constructor */
51 //---------------------------------------------------------------------------
53 AliGShape::AliGShape(Text_t* name, Text_t* title): TNamed(name, title), TAttLine(), TAttFill()
58 //---------------------------------------------------------------------------
60 AliGShape::AliGShape( AliGShape* shape )
62 /* Copy Constructor */
63 fColor = shape->fColor;
67 //---------------------------------------------------------------------------
69 void AliGShape::Paint(Option_t *)
71 // This method must be overridden by the real shape implementation.
72 // AbstractMethod("Paint");
75 // ---------------------------------------------------------------------------
77 Int_t AliGShape::DistancetoPrimitive(Int_t, Int_t)
79 TView *view = gPad->GetView();
80 gPad->SetSelected(view);
84 // ---------------------------------------------------------------------------
86 void AliGShape::PaintShape(X3DBuffer *buff, Bool_t rangeView)
88 //*-*-*-*-*Paint 3-D shape in current pad with its current attributes*-*-*-*-*
89 //*-* ==========================================================
93 Float_t *point = &(buff->points[0]);
94 for (Int_t j = 0; j < buff->numPoints; j++) {
95 // printf("Before %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
96 gAliGeometry->Local2Master(&point[3*j],&point[3*j]);
97 // printf("After %f %f %f\n",point[3*j],point[3*j+1],point[3*j+2]);
100 Float_t points[6], x0, y0, z0, x1, y1, z1;
101 const Int_t kExpandView = 2;
104 x0 = y0 = z0 = x1 = y1 = z1 = buff->points[0];
106 TAttLine::Modify(); //Change line attributes only if necessary
107 TAttFill::Modify(); //Change fill area attributes only if necessary
109 for (Int_t i = 0; i < buff->numSegs; i++) {
110 i0 = 3*buff->segs[3*i+1];
111 points[0] = buff->points[i0++];
112 points[1] = buff->points[i0++];
113 points[2] = buff->points[i0];
115 i0 = 3*buff->segs[3*i+2];
116 points[3] = buff->points[i0++];
117 points[4] = buff->points[i0++];
118 points[5] = buff->points[i0];
120 x0 = points[0] < x0 ? points[0] : x0;
121 y0 = points[1] < y0 ? points[1] : y0;
122 z0 = points[2] < z0 ? points[2] : z0;
123 x1 = points[0] > x1 ? points[0] : x1;
124 y1 = points[1] > y1 ? points[1] : y1;
125 z1 = points[2] > z1 ? points[2] : z1;
127 Float_t *ptpoints_0 = &points[0];
128 Float_t *ptpoints_3 = &points[3];
130 //printf("Painting from %f to %f\n",*ptpoints_0, *ptpoints_3);
132 gPad->PaintLine3D(ptpoints_0, ptpoints_3);
133 // gPad->PaintLine3D(&points[0], &points[3]);
136 TView *view = gPad->GetView();
137 //cout << "x0,y0,x1,y1=" << x0 << y0 << x1 << y1 << endl;
138 if (view->GetAutoRange()) view->SetRange(-500,-500,-500,500,500,500,kExpandView);
140 // if (view->GetAutoRange()) view->SetRange(-1,-1,-1,1,1,1,kExpandView);
145 // ---------------------------------------------------------------------------
147 void AliGShape::SetPoints(Float_t *) {
148 AbstractMethod("SetPoints(Float_t *buffer)");
151 // ---------------------------------------------------------------------------