00001 // @(#)root/eve:$Id: TEveGeoShapeExtract.cxx 36892 2010-11-24 10:24:35Z matevz $ 00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #include "TEveGeoShapeExtract.h" 00013 #include "TEveGeoNode.h" 00014 #include "TEveGeoShape.h" 00015 00016 #include "TList.h" 00017 #include "TGeoManager.h" 00018 #include "TGeoShape.h" 00019 00020 //============================================================================== 00021 // TEveGeoShapeExtract 00022 //============================================================================== 00023 00024 //______________________________________________________________________________ 00025 // 00026 // Globally positioned TGeoShape with rendering attributes and an 00027 // optional list of daughter shape-extracts. 00028 // 00029 // Vessel to carry hand-picked geometry from gled to reve. 00030 // This class exists in both frameworks. 00031 00032 ClassImp(TEveGeoShapeExtract); 00033 00034 //______________________________________________________________________________ 00035 TEveGeoShapeExtract::TEveGeoShapeExtract(const char* n, const char* t) : 00036 TNamed (n,t), 00037 fRnrSelf (kTRUE), 00038 fRnrElements (kTRUE), 00039 fRnrFrame (kTRUE), 00040 fMiniFrame (kTRUE), 00041 fShape (0), 00042 fElements (0) 00043 { 00044 // Constructor. 00045 00046 memset(fTrans, 0, sizeof(fTrans)); 00047 fTrans[0] = fTrans[5] = fTrans[10] = fTrans[15] = 1; 00048 fRGBA [0] = fRGBA [1] = fRGBA [2] = fRGBA [3] = 1; 00049 fRGBALine[0] = fRGBALine[1] = fRGBALine[2] = 0; fRGBALine[3] = 1; 00050 gGeoManager = TEveGeoShape::GetGeoMangeur(); // To inforce phony geo-manager on load time. 00051 } 00052 00053 //______________________________________________________________________________ 00054 TEveGeoShapeExtract::~TEveGeoShapeExtract() 00055 { 00056 // Destructor. Delete shape and elements. 00057 00058 delete fShape; 00059 delete fElements; 00060 } 00061 00062 /******************************************************************************/ 00063 00064 //______________________________________________________________________________ 00065 Bool_t TEveGeoShapeExtract::HasElements() 00066 { 00067 // True if has at least one element. 00068 00069 return fElements != 0 && fElements->GetSize() > 0; 00070 } 00071 00072 //______________________________________________________________________________ 00073 void TEveGeoShapeExtract::AddElement(TEveGeoShapeExtract* gse) 00074 { 00075 // Add a child element. 00076 00077 if (fElements == 0) 00078 fElements = new TList; 00079 00080 fElements->Add(gse); 00081 } 00082 00083 /******************************************************************************/ 00084 00085 //______________________________________________________________________________ 00086 void TEveGeoShapeExtract::SetTrans(const Double_t arr[16]) 00087 { 00088 // Set transformation matrix. 00089 00090 for(Int_t i=0; i<16; ++i) 00091 fTrans[i] = arr[i]; 00092 } 00093 00094 //______________________________________________________________________________ 00095 void TEveGeoShapeExtract::SetRGBA(const Float_t arr[4]) 00096 { 00097 // Set RGBA color. 00098 00099 for(Int_t i=0; i<4; ++i) 00100 fRGBA[i] = arr[i]; 00101 } 00102 00103 //______________________________________________________________________________ 00104 void TEveGeoShapeExtract::SetRGBALine(const Float_t arr[4]) 00105 { 00106 // Set RGBA color for line. 00107 00108 for(Int_t i=0; i<4; ++i) 00109 fRGBALine[i] = arr[i]; 00110 }