Logo ROOT   6.08/07
Reference Guide
TVolume.cxx
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valery Fine 10/12/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "Riostream.h"
13 #include <stdlib.h>
14 
15 #include "TROOT.h"
16 #include "TClass.h"
17 #include "TVirtualPad.h"
18 #include "TView.h"
19 #include "TGeometry.h"
20 #include "TRotMatrix.h"
21 #include "TShape.h"
22 #include "TVolume.h"
23 #include "TBrowser.h"
24 #include "X3DBuffer.h"
25 
26 #include "TTablePadView3D.h"
27 #include "TCanvas.h"
28 
29 #include "TRotMatrix.h"
30 #include "TVolumePosition.h"
31 #include "TVirtualViewer3D.h"
32 #include "TBuffer3D.h"
33 
34 #if 0
35 const Int_t kVectorSize = 3;
37 const Int_t kMAXLEVELS = 20;
38 
41 static Int_t gGeomLevel = 0;
42 
43 TVolume *gNode;
44 #endif
45 //R__EXTERN Size3D gSize3D;
46 static TRotMatrix *gIdentity = 0;
47 
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// TVolume description
52 ///
53 /// A TVolume object is used to build the geometry hierarchy.
54 /// Since TVolume is derived from TDataSet class it may contain other volumes.
55 ///
56 /// A geometry volume has attributes:
57 /// - name and title
58 /// - pointer to the referenced shape (see TShape).
59 /// - list of TVolumePosition object defining the position of the nested volumes
60 /// with respect to the mother node.
61 ///
62 ///
63 /// A volume can be drawn.
64 
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 //// Volume default constructor
68 
70 {
71  fShape = 0;
72  fListOfShapes = 0;
73  fVisibility = kBothVisible;
74  if (!gGeometry) new TGeometry;
75 }
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 //// Volume normal constructor
79 ////
80 //// name is the name of the node
81 //// title is title
82 //// shapename is the name of the referenced shape
83 
84 TVolume::TVolume(const char *name, const char *title, const char *shapename, Option_t *option)
85  :TObjectSet(name),TAttLine(), TAttFill(),fShape(0),fListOfShapes(0)
86 {
87 #ifdef WIN32
88 /// The color "1" - default produces a very bad 3D image with OpenGL
89  Color_t lcolor = 16;
90  SetLineColor(lcolor);
91 #endif
92  static Int_t counter = 0;
93  counter++;
94  SetTitle(title);
95  if(!(counter%1000))std::cout<<"TVolume count="<<counter<<" name="<<name<<std::endl;
96  if (!gGeometry) new TGeometry;
97  Add(gGeometry->GetShape(shapename),kTRUE);
98 // fParent = gGeometry->GetCurrenTVolume();
99  fOption = option;
101 
103 }
104 
105 ////////////////////////////////////////////////////////////////////////////////
106 //// Volume normal constructor
107 ////
108 //// name is the name of the node
109 //// title is title
110 //// shape is the pointer to the shape definition
111 
112 TVolume::TVolume(const char *name, const char *title, TShape *shape, Option_t *option)
114 {
115 #ifdef WIN32
116 /// The color "1" - default produces a very bad 3D image with OpenGL
117  Color_t lcolor = 16;
118  SetLineColor(lcolor);
119 #endif
120 
121  if (!gGeometry) new TGeometry;
122  Add(shape,kTRUE);
123  fOption = option;
125  SetTitle(title);
126  if(shape) ImportShapeAttributes();
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// ENodeSEEN Visibility flag 00 - everything visible,
131 /// 10 - this invisible, but sons are visible
132 /// 01 - this visible but sons
133 /// 11 - neither this nor its sons are visible
134 /// Maps the value of the visibility flag to <a href="https://cern-tex.web.cern.ch/cern-tex/geant_html3/node128.html#SECTION056000000000000000000000">GEANT 3.21 "volume attributes"</a>
135 
137 {
138  const Int_t mapVis[4] = {1, -2, 0, -1 };
139  return mapVis[vis];
140 }
141 
142 ////////////////////////////////////////////////////////////////////////////////
143 /// ENodeSEEN TVolume::MapGEANT2StNodeVis(Int_t vis)
144 /// Maps the value of <a href="https://cern-tex.web.cern.ch/cern-tex/geant_html3/node128.html#SECTION056000000000000000000000">GEANT 3.21 "volume attributes"</a> to the visibility flag
145 
147 {
148  const Int_t mapVis[4] = {1, -2, 0, -1 };
149  Int_t i;
150 // for (i =0; i<3;i++) if (mapVis[i] == vis) return (ENodeSEEN)i;
151  for (i =0; i<3;i++) if (mapVis[i] == vis) return i;
152  return kBothVisible;
153 }
154 
155 ////////////////////////////////////////////////////////////////////////////////
156 /// Convert a TNode object into a TVolume
157 
159 {
160  SetName(rootNode.GetName());
161  SetTitle(rootNode.GetTitle());
163  fOption = rootNode.GetOption();
164  Add(rootNode.GetShape(),kTRUE);
165 
166  SetLineColor(rootNode.GetLineColor());
167  SetLineStyle(rootNode.GetLineStyle());
168  SetLineWidth(rootNode.GetLineWidth());
169  SetFillColor(rootNode.GetFillColor());
170  SetFillStyle(rootNode.GetFillStyle());
171 
172  TList *nodes = rootNode.GetListOfNodes();
173  if (nodes) {
174  TIter next(nodes);
175  TNode *node = 0;
176  while ( (node = (TNode *) next()) ){
177  TVolume *nextNode = new TVolume(*node);
178  Add(nextNode,node->GetX(),node->GetY(),node->GetZ(),node->GetMatrix());
179  }
180  }
181 }
182 
183 ////////////////////////////////////////////////////////////////////////////////
184 ///to be documented
185 
186 void TVolume::Add(TShape *shape, Bool_t IsMaster)
187 {
188  if (!shape) return;
189  if (!fListOfShapes) fListOfShapes = new TList;
190  fListOfShapes->Add(shape);
191  if (IsMaster) fShape = shape;
192 }
193 
194 ////////////////////////////////////////////////////////////////////////////////
195 /// Convert a TVolume object into a TNode
196 
198 {
199  Double_t x=0;
200  Double_t y=0;
201  Double_t z=0;
202  const TRotMatrix* matrix = 0;
203  if (position) {
204  x=position->GetX();
205  y=position->GetY();
206  z=position->GetZ();
207  matrix = position->GetMatrix();
208  }
209 // const Char_t *path = Path();
210 // printf("%s: %s/%s, shape=%s/%s\n",path,GetName(),GetTitle(),GetShape()->GetName(),GetShape()->ClassName());
211  TNode *newNode = new TNode(GetName(),GetTitle(),GetShape(),x,y,z,(TRotMatrix* )matrix,GetOption());
213 
214  newNode->SetLineColor(GetLineColor());
215  newNode->SetLineStyle(GetLineStyle());
216  newNode->SetLineWidth(GetLineWidth());
217  newNode->SetFillColor(GetFillColor());
218  newNode->SetFillStyle(GetFillStyle());
219 
220  TList *positions = GetListOfPositions();
221  if (positions) {
222  TIter next(positions);
223  TVolumePosition *pos = 0;
224  while ( (pos = (TVolumePosition *) next()) ){
225  TVolume *node = pos->GetNode();
226  if (node) {
227  newNode->cd();
228  node->CreateTNode(pos);
229  }
230  }
231  }
232  newNode->ImportShapeAttributes();
233  return newNode;
234 }
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 //// Volume default destructor
238 
240 {
241  // Hmm, here we are in the troubles, in theory we have to find all
242  // place where this node is sitting but we don't (yet :-()
243 
244  if (GetListOfPositions()) {
247  }
249 }
250 
251 ////////////////////////////////////////////////////////////////////////////////
252 /// to be documented
253 
255 {
257  if ( GetListOfPositions()) GetListOfPositions()->Add(position);
258  else Error("Add","Can not create list of positions for the current node <%s>:<%s>",GetName(),GetTitle());
259 }
260 
261 ////////////////////////////////////////////////////////////////////////////////
262 /// to be documented
263 
265 {
266  TVolumePosition *position = nodePosition;
267  if (!node) return 0;
268  if (!position) position = new TVolumePosition(node); // Create default position
269  // The object must be placed at once. Check it:
270  if (!(GetCollection() && GetCollection()->FindObject(node)) ) TDataSet::Add(node);
271  Add(position);
272  return position;
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 ////
277 //// volume the pointer to the volume to be placed
278 //// x,y,z are the offsets of the volume with respect to his mother
279 //// matrix is the pointer to the rotation matrix
280 //// id is a unique position id
281 
283  TRotMatrix *matrix, UInt_t id, Option_t *)
284 {
285  if (!volume) return 0;
286  TRotMatrix *rotation = matrix;
287  if(!rotation) rotation = GetIdentity();
288  TVolumePosition *position = new TVolumePosition(volume,x,y,z,rotation);
289  position->SetId(id);
290  return Add(volume,position);
291 }
292 
293 ////////////////////////////////////////////////////////////////////////////////
294 ////
295 //// volume the pointer to the volume to be placed
296 //// x,y,z are the offsets of the volume with respect to his mother
297 //// matrixname is the name of the rotation matrix
298 //// id is a unique position id
299 
301  const char *matrixname, UInt_t id, Option_t *)
302 {
303  if (!volume) return 0;
304  TRotMatrix *rotation = 0;
305  if (matrixname && strlen(matrixname)) rotation = gGeometry->GetRotMatrix(matrixname);
306  if (!rotation) rotation = GetIdentity();
307  TVolumePosition *position = new TVolumePosition(volume,x,y,z,rotation);
308  position->SetId(id);
309  return Add(volume,position);
310 }
311 
312 ////////////////////////////////////////////////////////////////////////////////
313 /// to be documented
314 
316 {
317  if (GetListOfPositions()){
318  TVolumePosition *nodePosition = 0;
319  TIter next(GetListOfPositions());
320  Int_t posNumber = 0;
321  while ( (nodePosition = (TVolumePosition *)next()) ) {
322  posNumber = nodePosition->GetId();
323  TString posName = "*";
324  posName += nodePosition->GetNode()->GetTitle();
325  char num[10];
326  posName += ";";
327  snprintf(num,10,"%d",posNumber);
328  posName += num;
329  b->Add(nodePosition,posName.Data());
330  }
331  }
332 }
333 ////////////////////////////////////////////////////////////////////////////////
334 /// to be documented
335 
337 {
338  return DistancetoNodePrimitive(px,py);
339 }
340 
341 ////////////////////////////////////////////////////////////////////////////////
342 //// Compute distance from point px,py to a TVolumeView
343 ///
344 //// Compute the closest distance of approach from point px,py to the position of
345 //// this volume.
346 //// The distance is computed in pixels units.
347 ////
348 //// It is restricted by 2 levels of TVolumes
349 
351 {
352  const Int_t big = 9999;
353  if ( GetVisibility() == kNoneVisible ) return big;
354 
355  const Int_t inaxis = 7;
356  const Int_t maxdist = 5;
357 
358  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
359  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
360  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
361  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
362 
363 ///- return if point is not in the user area
364  if (px < puxmin - inaxis) return big;
365  if (py > puymin + inaxis) return big;
366  if (px > puxmax + inaxis) return big;
367  if (py < puymax - inaxis) return big;
368 
369  TView *view =gPad->GetView();
370  if (!view) return big;
371 
372  static TVolumePosition nullPosition;
373  TVolumePosition *position = pos;
374  if (!position) position = &nullPosition;
375  if (pos) position->UpdatePosition();
376  Int_t dist = big;
377  if ( !(GetVisibility() & kThisUnvisible ) ) {
378  TShape *shape = 0;
379  TIter nextShape(fListOfShapes);
380  while ((shape = (TShape *)nextShape())) {
381  ///- Distance to the next referenced shape if visible
382  if (shape->GetVisibility()) {
383  Int_t dshape = shape->DistancetoPrimitive(px,py);
384  if (dshape < maxdist) {
385  gPad->SetSelected(this);
386  return 0;
387  }
388  if (dshape < dist) dist = dshape;
389  }
390  }
391  }
392 
393  if ( (GetVisibility() & kSonUnvisible) ) return dist;
394 
395 ///- Loop on all sons
396  TList *posList = GetListOfPositions();
397  Int_t dnode = dist;
398  if (posList && posList->GetSize()) {
399  gGeometry->PushLevel();
400  TVolumePosition *thisPosition;
401  TObject *obj;
402  TIter next(posList);
403  while ((obj = next())) {
404  thisPosition = (TVolumePosition*)obj;
405  TVolume *node = thisPosition->GetNode();
406  dnode = node->DistancetoNodePrimitive(px,py,thisPosition);
407  if (dnode <= 0) break;
408  if (dnode < dist) dist = dnode;
409  if (gGeometry->GeomLevel() > 2) break;
410  }
411  gGeometry->PopLevel();
412  }
413 
414  if (gGeometry->GeomLevel()==0 && dnode > maxdist) {
415  gPad->SetSelected(view);
416  return 0;
417  } else
418  return dnode;
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 //// Draw Referenced node with current parameters
423 
424 void TVolume::Draw(Option_t *option)
425 {
426  TString opt = option;
427  opt.ToLower();
428 ///- Clear pad if option "same" not given
429  if (!gPad) {
430  gROOT->MakeDefCanvas();
431  }
432  if (!opt.Contains("same")) gPad->Clear();
433 
434  // Check geometry level
435 
436  Int_t iopt = atoi(option);
437  TDataSet *parent = 0;
438  char buffer[10];
439  if (iopt < 0) {
440  // set the "positive option"
441  snprintf(buffer,10,"%d",-iopt);
442  option = buffer;
443  // select parent to draw
444  parent = this;
445  do parent = parent->GetParent();
446  while (parent && ++iopt);
447  }
448  if (parent) parent->AppendPad(option);
449  else AppendPad(option);
450 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,03,05)
451  // the new (4.03/05) way to active 3D viewer
452  // Create a 3-D view
453  TView *view = gPad->GetView();
454  if (!view) {
455  view = TView::CreateView(1,0,0);
456  // Set the view to perform a first autorange (frame) draw.
457  // TViewer3DPad will revert view to normal painting after this
458  view->SetAutoRange(kTRUE);
459  }
460 
461  // Create a 3D viewer to draw us
462 // gPad->GetViewer3D(option);
463  gPad->GetViewer3D();
464 #else
465  Paint(option);
466 #endif
467 }
468 
469 
470 ////////////////////////////////////////////////////////////////////////////////
471 //// Draw only Sons of this node
472 
474 {
476  Draw(option);
477 }
478 
479 
480 ////////////////////////////////////////////////////////////////////////////////
481 //// Execute action corresponding to one event
482 ////
483 //// This member function must be implemented to realize the action
484 //// corresponding to the mouse click on the object in the window
485 
487 {
488 // if (gPad->GetView())
489 // gPad->GetView()->ExecuteRotateView(event, px, py);
490 
491 // if (!gPad->GetListOfPrimitives()->FindObject(this)) gPad->SetCursor(kCross);
492  gPad->SetCursor(kHand);
493 }
494 
495 ////////////////////////////////////////////////////////////////////////////////
496 /// Return a pointer the "identity" matrix
497 
499 {
501  if (!gIdentity) {
502  gIdentity = gGeometry->GetRotMatrix("Identity");
503  if (!gIdentity) {
504  gIdentity = new TRotMatrix();
505  gIdentity->SetName("Identity");
506  gIdentity->SetTitle("Identity matrix");
507  gIdentity->SetMatrix((Double_t *)0);
508  identityMatrix = gIdentity->GetMatrix();
509  memset(identityMatrix,0,9*sizeof(Double_t));
510  *identityMatrix = 1;
511  identityMatrix += 4; *identityMatrix = 1;
512  identityMatrix += 4; *identityMatrix = 1;
513  gGeometry->GetListOfMatrices()->AddFirst(gIdentity);
514  }
515  }
516  return gIdentity;
517 }
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// to be documented
521 
522 char *TVolume::GetObjectInfo(Int_t px, Int_t py) const
523 {
524  if (!gPad) return 0;
525  static char info[512];
526  snprintf(info,512,"%s/%s",GetName(),GetTitle());
527  Double_t x[3];
528  ((TPad *)gPad)->AbsPixeltoXY(px,py,x[0],x[1]);
529  x[2] = 0;
530  TView *view =gPad->GetView();
531  if (view) view->NDCtoWC(x, x);
532 
533  TIter nextShape(fListOfShapes);
534  TShape *shape = 0;
535  while( (shape = (TShape *)nextShape()) ) {
536  Int_t nchi = strlen(info);
537  snprintf(&info[nchi],512-nchi," %6.2f/%6.2f: shape=%s/%s",x[0],x[1],shape->GetName(),shape->ClassName());
538  }
539  return info;
540 }
541 
542 ////////////////////////////////////////////////////////////////////////////////
543 //// Copy shape attributes as node attributes
544 
546 {
547  if (fShape) {
553  }
554 
555  if (!GetCollection()) return;
556  TVolume *volume;
557  TIter next(GetCollection());
558  while ( (volume = (TVolume *)next()) )
559  volume->ImportShapeAttributes();
560 }
561 
562 ////////////////////////////////////////////////////////////////////////////////
563 ////- Draw Referenced node
564 
566 {
569  PaintNodePosition(opt);
570  return;
571 }
572 
573 ////////////////////////////////////////////////////////////////////////////////
574 //// Paint Referenced volume with current parameters
575 ////
576 ////
577 //// vis = 1 (default) shape is drawn
578 //// vis = 0 shape is not drawn but its sons may be not drawn
579 //// vis = -1 shape is not drawn. Its sons are not drawn
580 //// vis = -2 shape is drawn. Its sons are not drawn
581 
583 {
584  if ( GetVisibility() == kNoneVisible ) return;
585 
586  static TVolumePosition nullPosition;
587 
588 // restrict the levels for "range" option
589  Int_t level = gGeometry->GeomLevel();
590 // if (option && option[0]=='r' && level > 3 && strcmp(option,"range") == 0) return;
591  if ((!(GetVisibility() & kThisUnvisible)) && option && option[0]=='r' && level > 3 ) return;
592  Int_t iopt = 0;
593  if (option) iopt = atoi(option);
594  if ( (0 < iopt) && (iopt <= level) ) return;
595 
596  TTablePadView3D *view3D = (TTablePadView3D*)gPad->GetView3D();
597  TVirtualViewer3D * viewer3D = gPad->GetViewer3D();
598 
599  TVolumePosition *position = pos;
600  if (!position) position = &nullPosition;
601 
602  // PaintPosition does change the current matrix and it MUST be called FIRST !!!
603 
604  position->UpdatePosition(option);
605 
606  if ( viewer3D && !(GetVisibility() & kThisUnvisible)) PaintShape(option);
607 
608  if (GetVisibility() & kSonUnvisible) return;
609 
610 ///- Paint all sons
611  TList *posList = GetListOfPositions();
612  if (posList && posList->GetSize()) {
613  gGeometry->PushLevel();
614  TVolumePosition *thisPosition;
615  TIter next(posList);
616  while ((thisPosition = (TVolumePosition *)next())) {
617  if (view3D) view3D->PushMatrix();
618 
619  TVolume *volume = thisPosition->GetNode();
620  if (volume) volume->PaintNodePosition(option,thisPosition);
621 
622  if (view3D) view3D->PopMatrix();
623  }
624  gGeometry->PopLevel();
625  }
626 }
627 
628 ////////////////////////////////////////////////////////////////////////////////
629 /// Paint shape of the volume
630 /// To be called from the TObject::Paint method only
631 
633 {
634  Bool_t rangeView = option && option[0]=='r';
635  if (!rangeView) {
638  }
639 
640  if ( (GetVisibility() & kThisUnvisible) ) return;
641 
642  TIter nextShape(fListOfShapes);
643  TShape *shape = 0;
644  while( (shape = (TShape *)nextShape()) ) {
645  if (!rangeView) {
646  shape->SetLineColor(GetLineColor());
647  shape->SetLineStyle(GetLineStyle());
648  shape->SetLineWidth(GetLineWidth());
649  shape->SetFillColor(GetFillColor());
650  shape->SetFillStyle(GetFillStyle());
651  TTablePadView3D *view3D = (TTablePadView3D*)gPad->GetView3D();
652  gPad->GetViewer3D();
653  if (view3D)
654  view3D->SetLineAttr(GetLineColor(),GetLineWidth(),option);
655  }
656 
657 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,03,05)
658  // It MUST be the TShape::Paint method:
659  Bool_t viewerWantsSons = kTRUE;
660  TVirtualViewer3D * viewer3D = gPad->GetViewer3D();
661  if (viewer3D) {
662  // We only provide master frame positions in these shapes
663  // so don't ask viewer preference
664 
665  // Ask all shapes for kCore/kBoundingBox/kShapeSpecific
666  // Not all will support the last two - which is fine
667  const TBuffer3D & buffer =
669 
670  // TShape sets buffer id based on TNode * gNode
671  // As we not using TNode we need to override this
672  const_cast<TBuffer3D &>(buffer).fID = this;
673 
674  Int_t reqSections = viewer3D->AddObject(buffer, &viewerWantsSons);
675  if (reqSections != TBuffer3D::kNone) {
676  fShape->GetBuffer3D(reqSections);
677  viewer3D->AddObject(buffer);
678  }
679  }
680 #else
681  shape->Paint(option);
682 #endif
683  }
684 }
685 
686 ////////////////////////////////////////////////////////////////////////////////
687 /// DeletePosition deletes the position of the TVolume *node from this TVolume
688 /// and removes that volume from the list of the nodes of this TVolume
689 
691 {
692  if (!position) return;
693 
694  if (GetListOfPositions()) {
696  while (lnk) {
697  TVolumePosition *nextPosition = (TVolumePosition *)(lnk->GetObject());
698  if (nextPosition && nextPosition == position) {
699  TVolume *node = nextPosition->GetNode();
700  GetListOfPositions()->Remove(lnk);
701  delete nextPosition;
702  Remove(node);
703  break;
704  }
705  lnk = lnk->Next();
706  }
707  }
708 }
709 
710 ////////////////////////////////////////////////////////////////////////////////
711 /// GetRange
712 ///
713 /// Calculates the size of 3 box the volume occupies,
714 /// Return:
715 /// two floating point arrays with the bound of box
716 /// surrounding all shapes of this TVolumeView
717 
719 {
720  TVirtualPad *savePad = gPad;
721  // Create a dummy TPad;
722  TCanvas dummyPad("--Dumm--","dum",1,1);
723  // Asking 3D TView
724  TView *view = TView::CreateView(1,0,0);
725 
728  view->SetAutoRange(kTRUE);
729  Paint("range");
730  view->GetRange(&min[0],&max[0]);
731  delete view;
732  // restore "current pad"
733  if (savePad) savePad->cd();
734 }
735 
736 ////////////////////////////////////////////////////////////////////////////////
737 //// Set visibility for this volume and its sons
738 ///
739 /// ENodeSEEN Visibility flag 00 - everything visible,
740 /// 10 - this invisible, but sons are visible
741 /// 01 - this visible but sons
742 /// 11 - neither this nor its sons are visible
743 
745 {
746  fVisibility = vis;
747 }
748 
749 ////////////////////////////////////////////////////////////////////////////////
750 //// *Return total size of this 3-D volume with its attributes
751 
752 void TVolume::Sizeof3D() const
753 {
754  if (!(GetVisibility() & kThisUnvisible) ) {
755  TIter nextShape(fListOfShapes);
756  TShape *shape = 0;
757  while( (shape = (TShape *)nextShape()) ) {
758  if (shape->GetVisibility()) shape->Sizeof3D();
759  }
760  }
761 
762  if ( GetVisibility() & kSonUnvisible ) return;
763 
764  if (!Nodes()) return;
765  TVolume *node;
766  TObject *obj;
767  TIter next(Nodes());
768  while ((obj = next())) {
769  node = (TVolume*)obj;
770  node->Sizeof3D();
771  }
772 }
virtual void DeletePosition(TVolumePosition *position)
DeletePosition deletes the position of the TVolume *node from this TVolume and removes that volume fr...
Definition: TVolume.cxx:690
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition: TBrowser.cxx:261
virtual Double_t GetY() const
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual UInt_t GetId() const
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:56
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: THashList.cxx:68
static Double_t gTranslation[kMAXLEVELS][kVectorSize]
Definition: TNode.cxx:32
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
virtual void Add(TDataSet *dataset)
Definition: TDataSet.h:150
virtual ENodeSEEN GetVisibility() const
Definition: TVolume.h:88
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:405
TRotMatrix * GetRotMatrix(const char *name) const
Return pointer to RotMatrix with name.
Definition: TGeometry.cxx:356
virtual TRotMatrix * GetMatrix() const
Definition: TNode.h:76
TList * GetListOfNodes() const
Definition: TNode.h:75
static Int_t MapGEANT2StNodeVis(Int_t vis)
ENodeSEEN TVolume::MapGEANT2StNodeVis(Int_t vis) Maps the value of GEANT 3.21 "volume attributes" to ...
Definition: TVolume.cxx:146
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Computes distance from point (px,py) to the object.
Definition: TObject.cxx:246
float Float_t
Definition: RtypesCore.h:53
static Int_t MapStNode2GEANTVis(ENodeSEEN vis)
ENodeSEEN Visibility flag 00 - everything visible, 10 - this invisible, but sons are visible 01 - thi...
Definition: TVolume.cxx:136
static Int_t gGeomLevel
Definition: TNode.cxx:34
const char Option_t
Definition: RtypesCore.h:62
ENodeSEEN
Definition: TVolume.h:44
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
virtual void cd(const char *path=0)
Change Current Reference node to this.
Definition: TNode.cxx:250
See TView3D.
Definition: TView.h:29
const Int_t kMAXLEVELS
Definition: TGeometry.h:31
TNode description.
Definition: TNode.h:43
#define gROOT
Definition: TROOT.h:364
TList * fListOfShapes
Definition: TVolume.h:50
ENodeSEEN fVisibility
Definition: TVolume.h:52
Basic string class.
Definition: TString.h:137
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1089
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Double_t GetX() const
Definition: TNode.h:83
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:44
virtual void Draw(Option_t *depth="3")
Default Draw method for all objects.
Definition: TVolume.cxx:424
virtual Double_t GetZ() const
virtual void Remove(TDataSet *set)
Remiove the "set" from this TDataSet.
Definition: TDataSet.cxx:641
void identityMatrix(AMatrix &X)
Set matrix to the identity matrix.
Definition: Utility.h:40
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:232
virtual void SetMatrix(const Double_t *matrix)
copy predefined 3x3 matrix into TRotMatrix object
Definition: TRotMatrix.cxx:216
virtual void NDCtoWC(const Float_t *pn, Float_t *pw)=0
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:41
virtual void PaintShape(Option_t *option="")
Paint shape of the volume To be called from the TObject::Paint method only.
Definition: TVolume.cxx:632
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections) const
Stub to avoid forcing implementation at this stage.
Definition: TShape.cxx:253
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:165
const TRotMatrix * GetMatrix() const
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:40
#define SafeDelete(p)
Definition: RConfig.h:507
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:188
Fill Area Attributes class.
Definition: TAttFill.h:24
Double_t x[n]
Definition: legend1.C:17
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Definition: TVolume.cxx:565
virtual void Add(TDataSet *dataset)
Definition: TVolume.h:103
const Int_t kVectorSize
Definition: TGeometry.h:32
virtual void SetVisibility(Int_t vis=1)
Set visibility for this node and its sons.
Definition: TNode.cxx:759
Int_t GeomLevel() const
Definition: TGeometry.h:78
virtual void SetVisibility(ENodeSEEN vis=TVolume::kBothVisible)
Set visibility for this volume and its sons.
Definition: TVolume.cxx:744
virtual void Modify()
Change current fill area attributes if necessary.
Definition: TAttFill.cxx:209
virtual void ImportShapeAttributes()
Definition: TVolume.cxx:545
TShape * GetShape() const
Definition: TNode.h:81
const Option_t * GetOption() const
Definition: TVolume.h:84
virtual TList * GetListOfPositions()
Definition: TVolume.h:89
TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TDataSet.h:101
virtual Int_t PushLevel()
Definition: TGeometry.h:103
TShape * fShape
Definition: TVolume.h:49
Abstract 3D shapes viewer.
static TRotMatrix * GetIdentity()
Return a pointer the "identity" matrix.
Definition: TVolume.cxx:498
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
short Color_t
Definition: RtypesCore.h:79
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
to be documented
Definition: TVolume.cxx:336
A doubly linked list.
Definition: TList.h:47
TGeometry description.
Definition: TGeometry.h:43
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
R__EXTERN TNode * gNode
Definition: TShape.h:80
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TRotMatrix.h:71
virtual Double_t GetX(Int_t indx=0) const
virtual ~TVolume()
Definition: TVolume.cxx:239
static TRotMatrix * gIdentity
Definition: TVolume.cxx:46
This is the base class for all geometry shapes.
Definition: TShape.h:47
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
const Option_t * GetOption() const
Definition: TNode.h:79
virtual void PaintNodePosition(Option_t *option="", TVolumePosition *postion=0)
Definition: TVolume.cxx:582
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:42
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:675
virtual void Browse(TBrowser *b)
to be documented
Definition: TVolume.cxx:315
virtual void UpdatePosition(Option_t *option="")
to be documented
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
virtual TNode * CreateTNode(const TVolumePosition *position=0)
Convert a TVolume object into a TNode.
Definition: TVolume.cxx:197
unsigned int UInt_t
Definition: RtypesCore.h:42
TVolume()
TVolume description.
Definition: TVolume.cxx:69
The most important graphics class in the ROOT system.
Definition: TPad.h:37
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
virtual void ImportShapeAttributes()
Copy shape attributes as node attributes.
Definition: TNode.cxx:410
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
Definition: TVolume.cxx:486
virtual TList * Nodes() const
Definition: TVolume.h:94
virtual TObjLink * FirstLink() const
Definition: TList.h:101
virtual void SetId(UInt_t id)
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:39
virtual void DrawOnly(Option_t *option="")
Definition: TVolume.cxx:473
virtual void Paint(Option_t *option="")
This method is used only when a shape is painted outside a TNode.
Definition: TShape.cxx:143
The Canvas class.
Definition: TCanvas.h:41
THashList * GetListOfMatrices() const
Definition: TGeometry.h:82
#define ClassImp(name)
Definition: Rtypes.h:279
virtual char * GetObjectInfo(Int_t px, Int_t py) const
to be documented
Definition: TVolume.cxx:522
double Double_t
Definition: RtypesCore.h:55
virtual void Sizeof3D() const
Set total size of this 3D object (used by X3D interface).
Definition: TVolume.cxx:752
Double_t y[n]
Definition: legend1.C:17
TString fOption
Definition: TVolume.h:51
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:35
virtual Double_t GetY() const
Definition: TNode.h:84
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
void SetPositionsList(TList *list=0)
Definition: TVolume.h:61
virtual Int_t DistancetoNodePrimitive(Int_t px, Int_t py, TVolumePosition *position=0)
Compute distance from point px,py to a TVolumeView.
Definition: TVolume.cxx:350
const Int_t kMatrixSize
Definition: TGeometry.h:33
virtual void SetLineAttr(Color_t color, Int_t width, Option_t *opt="")
virtual void SetGeomLevel(Int_t level=0)
Definition: TGeometry.h:108
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:48
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
Definition: TView.cxx:36
virtual TVolume * GetNode() const
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
virtual void UpdateTempMatrix(Double_t x=0, Double_t y=0, Double_t z=0, TRotMatrix *matrix=0)
Update temp matrix.
Definition: TGeometry.cxx:661
TShape * GetShape() const
Definition: TVolume.h:85
virtual void Add(TObject *obj)
Definition: TList.h:81
virtual void GetLocalRange(Float_t *min, Float_t *max)
GetRange.
Definition: TVolume.cxx:718
virtual void GetRange(Float_t *min, Float_t *max)=0
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
#define snprintf
Definition: civetweb.c:822
static Double_t gRotMatrix[kMAXLEVELS][kMatrixSize]
Definition: TNode.cxx:33
#define gPad
Definition: TVirtualPad.h:289
virtual void Sizeof3D() const
Set total size of this 3D object (used by X3D interface).
Definition: TAtt3D.cxx:27
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition: TAttFill.h:36
virtual void PopMatrix()
virtual Int_t GetSize() const
Definition: TCollection.h:95
virtual Double_t GetZ() const
Definition: TNode.h:85
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
R__EXTERN TGeometry * gGeometry
Definition: TGeometry.h:162
virtual Int_t PopLevel()
Definition: TGeometry.h:104
Int_t GetVisibility() const
Definition: TShape.h:70
Line Attributes class.
Definition: TAttLine.h:24
char name[80]
Definition: TGX11.cxx:109
virtual TSeqCollection * GetCollection() const
Definition: TDataSet.h:105
virtual void PushMatrix()
Int_t GetVisibility() const
Definition: TNode.h:82
TShape * GetShape(const char *name) const
Return pointer to Shape with name.
Definition: TGeometry.cxx:379
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual TDataSet * GetParent() const
Definition: TDataSet.h:111
const char * Data() const
Definition: TString.h:349