Introducing Copyright include file
[u/mrichter/AliRoot.git] / GEODB / AliGShape.cxx
CommitLineData
ab2f6604 1// -*- C++ -*-
2//
3// 1998/10/22
4// ---------------------------------------------------------------------------
5//
6// AliGShape Class
7//
8// This file is part of the ALICE Geometry Database .
9//
10// Author: Joana E. Santo
11//
12// ---------------------------------------------------------------------------
13
14#include <TView.h>
15#include <TVirtualPad.h>
16#include <iostream.h>
17#include "AliGShape.h"
18#include "AliGNode.h"
19#include "AliGeometry.h"
20
21//---------------------------------------------------------------------------
22
23ClassImp(AliGShape)
24
25AliGShape::AliGShape()
26{
27 /* Default Constructor */
28 fName = "";
29 fTitle = "";
30}
31
32//---------------------------------------------------------------------------
33
34AliGShape::AliGShape(Text_t* name, Text_t* title): TNamed(name, title), TAttLine(), TAttFill()
35{
36 /* Constructor */
37}
38
39//---------------------------------------------------------------------------
40
41AliGShape::AliGShape( AliGShape* shape )
42{
43 /* Copy Constructor */
44 fColor = shape->fColor;
45}
46
47
48//---------------------------------------------------------------------------
49
50void AliGShape::Paint(Option_t *)
51{
52 // This method must be overridden by the real shape implementation.
53 // AbstractMethod("Paint");
54}
55
56// ---------------------------------------------------------------------------
57
58Int_t AliGShape::DistancetoPrimitive(Int_t, Int_t)
59{
60 TView *view = gPad->GetView();
61 gPad->SetSelected(view);
62 return 0;
63}
64
65// ---------------------------------------------------------------------------
66
67void AliGShape::PaintShape(X3DBuffer *buff, Bool_t rangeView)
68{
69//*-*-*-*-*Paint 3-D shape in current pad with its current attributes*-*-*-*-*
70//*-* ==========================================================
71
72 if (!buff) return;
73
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]);
79 }
80
81 Float_t points[6], x0, y0, z0, x1, y1, z1;
82 const Int_t kExpandView = 2;
83 int i0;
84
85 x0 = y0 = z0 = x1 = y1 = z1 = buff->points[0];
86
87 TAttLine::Modify(); //Change line attributes only if necessary
88 TAttFill::Modify(); //Change fill area attributes only if necessary
89
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];
95
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];
100
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;
107
108 Float_t *ptpoints_0 = &points[0];
109 Float_t *ptpoints_3 = &points[3];
110
111 //printf("Painting from %f to %f\n",*ptpoints_0, *ptpoints_3);
112
113 gPad->PaintLine3D(ptpoints_0, ptpoints_3);
114// gPad->PaintLine3D(&points[0], &points[3]);
115 }
116
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);
120
121 // if (view->GetAutoRange()) view->SetRange(-1,-1,-1,1,1,1,kExpandView);
122}
123
124
125
126// ---------------------------------------------------------------------------
127
128void AliGShape::SetPoints(Float_t *) {
129 AbstractMethod("SetPoints(Float_t *buffer)");
130}
131
132// ---------------------------------------------------------------------------
133
134