Improvements in the looks
[u/mrichter/AliRoot.git] / GEODB / AliGShape.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
18*/
19
ab2f6604 20// -*- C++ -*-
21//
22// 1998/10/22
23// ---------------------------------------------------------------------------
24//
25// AliGShape Class
26//
27// This file is part of the ALICE Geometry Database .
28//
29// Author: Joana E. Santo
30//
31// ---------------------------------------------------------------------------
32
33#include <TView.h>
34#include <TVirtualPad.h>
35#include <iostream.h>
36#include "AliGShape.h"
37#include "AliGNode.h"
38#include "AliGeometry.h"
39
40//---------------------------------------------------------------------------
41
42ClassImp(AliGShape)
43
44AliGShape::AliGShape()
45{
46 /* Default Constructor */
47 fName = "";
48 fTitle = "";
49}
50
51//---------------------------------------------------------------------------
52
53AliGShape::AliGShape(Text_t* name, Text_t* title): TNamed(name, title), TAttLine(), TAttFill()
54{
55 /* Constructor */
56}
57
58//---------------------------------------------------------------------------
59
60AliGShape::AliGShape( AliGShape* shape )
61{
62 /* Copy Constructor */
63 fColor = shape->fColor;
64}
65
66
67//---------------------------------------------------------------------------
68
69void AliGShape::Paint(Option_t *)
70{
71 // This method must be overridden by the real shape implementation.
72 // AbstractMethod("Paint");
73}
74
75// ---------------------------------------------------------------------------
76
77Int_t AliGShape::DistancetoPrimitive(Int_t, Int_t)
78{
79 TView *view = gPad->GetView();
80 gPad->SetSelected(view);
81 return 0;
82}
83
84// ---------------------------------------------------------------------------
85
86void AliGShape::PaintShape(X3DBuffer *buff, Bool_t rangeView)
87{
88//*-*-*-*-*Paint 3-D shape in current pad with its current attributes*-*-*-*-*
89//*-* ==========================================================
90
91 if (!buff) return;
92
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]);
98 }
99
100 Float_t points[6], x0, y0, z0, x1, y1, z1;
101 const Int_t kExpandView = 2;
102 int i0;
103
104 x0 = y0 = z0 = x1 = y1 = z1 = buff->points[0];
105
106 TAttLine::Modify(); //Change line attributes only if necessary
107 TAttFill::Modify(); //Change fill area attributes only if necessary
108
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];
114
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];
119
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;
126
127 Float_t *ptpoints_0 = &points[0];
128 Float_t *ptpoints_3 = &points[3];
129
130 //printf("Painting from %f to %f\n",*ptpoints_0, *ptpoints_3);
131
132 gPad->PaintLine3D(ptpoints_0, ptpoints_3);
133// gPad->PaintLine3D(&points[0], &points[3]);
134 }
135
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);
139
140 // if (view->GetAutoRange()) view->SetRange(-1,-1,-1,1,1,1,kExpandView);
141}
142
143
144
145// ---------------------------------------------------------------------------
146
147void AliGShape::SetPoints(Float_t *) {
148 AbstractMethod("SetPoints(Float_t *buffer)");
149}
150
151// ---------------------------------------------------------------------------
152
153