#include"hgeomshapes.h"
#include "hgeomvolume.h"
#include "hgeombasicshape.h"
#include "hgeombrik.h"
#include "hgeomtrap.h"
#include "hgeomtrd1.h"
#include "hgeompgon.h"
#include "hgeompcon.h"
#include "hgeomtube.h"
#include "hgeomtubs.h"
#include "hgeomcone.h"
#include "hgeomcons.h"
#include "hgeomsphe.h"
#include "hgeomeltu.h"
ClassImp(HGeomShapes)
HGeomShapes::HGeomShapes() {
shapes=new TList();
}
HGeomShapes::~HGeomShapes() {
shapes->Delete();
delete shapes;
}
HGeomBasicShape* HGeomShapes::selectShape(HGeomVolume * volu) {
const TString& name(volu->getShape());
return selectShape(name);
}
HGeomBasicShape* HGeomShapes::selectShape(const TString& name) {
TString allShapes[11]={"BOX ","TRAP","TRD1","PGON","PCON","TUBE","TUBS",
"CONE","CONS","SPHE","ELTU"};
TString sName(name);
if (sName.Length()==3) sName+=" ";
HGeomBasicShape* s=(HGeomBasicShape*)shapes->FindObject(sName);
if (s) return s;
Int_t no=-1;
for(Int_t i=0;i<11;i++) {if (sName.CompareTo(allShapes[i])==0) no=i;}
switch(no) {
case 0: {s= new HGeomBrik(); break;}
case 1: {s= new HGeomTrap(); break;}
case 2: {s= new HGeomTrd1(); break;}
case 3: {s= new HGeomPgon(); break;}
case 4: {s= new HGeomPcon(); break;}
case 5: {s= new HGeomTube(); break;}
case 6: {s= new HGeomTubs(); break;}
case 7: {s= new HGeomCone(); break;}
case 8: {s= new HGeomCons(); break;}
case 9: {s= new HGeomSphe(); break;}
case 10: {s= new HGeomEltu(); break;}
default: {
Error("selectShape","shape %s not implemented",name.Data());
}
}
if (s) shapes->Add(s);
return s;
}
Int_t HGeomShapes::readPoints(fstream* pFile,HGeomVolume* volu) {
HGeomBasicShape* s=selectShape(volu);
if (s) return s->readPoints(pFile,volu);
else return 0;
}
Bool_t HGeomShapes::writePoints(fstream* pFile,HGeomVolume* volu) {
HGeomBasicShape* s=selectShape(volu);
if (s) return s->writePoints(pFile,volu);
else return kFALSE;
}
void HGeomShapes::printPoints(HGeomVolume* volu) {
HGeomBasicShape* s=selectShape(volu);
if (s) s->printPoints(volu);
}
Last change: Sat May 22 12:56:38 2010
Last generated: 2010-05-22 12:56
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.