00001 00002 // this : 00003 #include "SoLVolumeCnv.h" 00004 00005 #include <Lib/Interfaces/ISession.h> 00006 #include <Lib/smanip.h> 00007 00008 #include <GaudiKernel/Converter.h> 00009 #include <GaudiKernel/CnvFactory.h> 00010 #include <GaudiKernel/ISvcLocator.h> 00011 #include <GaudiKernel/MsgStream.h> 00012 00013 #include <DetDesc/CLIDLVolume.h> 00014 #include <DetDesc/LVolume.h> 00015 #include <DetDesc/IGeometryInfo.h> 00016 #include <DetDesc/ILVolume.h> 00017 #include <DetDesc/ISolid.h> 00018 00019 #include <OnXSvc/ISoConversionSvc.h> 00020 #include <OnXSvc/IUserInterfaceSvc.h> 00021 #include <OnXSvc/ClassID.h> 00022 #include <OnXSvc/Helpers.h> 00023 00024 #include "SoDetConverter.h" 00025 00026 DECLARE_CONVERTER_FACTORY(SoLVolumeCnv); 00027 00029 SoLVolumeCnv::SoLVolumeCnv( ISvcLocator* aSvcLoc ) 00030 :SoDetConverter(aSvcLoc, CLID_LVolume) 00033 { 00034 } 00036 StatusCode SoLVolumeCnv::createRep(DataObject* aObject,IOpaqueAddress*&) 00037 00038 00039 { 00040 MsgStream log(messageService(), "SoLVolumeCnv"); 00041 00042 if(!fUISvc) { 00043 log << MSG::INFO << " UI service not found" << endreq; 00044 return StatusCode::SUCCESS; 00045 } 00046 00047 ISession* session = fUISvc->session(); 00048 if(!session) { 00049 log << MSG::INFO << " can't get OnX session." << endreq; 00050 return StatusCode::FAILURE; 00051 } 00052 00053 SoRegion* region = fUISvc->currentSoRegion(); 00054 if(!region) { 00055 log << MSG::INFO << " can't get viewing region." << endreq; 00056 return StatusCode::FAILURE; 00057 } 00058 00059 if(!aObject) { 00060 log << MSG::INFO << " NULL object." << endreq; 00061 return StatusCode::FAILURE; 00062 } 00063 00064 if(!fSoCnvSvc) { 00065 log << MSG::INFO << " SoConversionSvc not found" << endreq; 00066 return StatusCode::FAILURE; 00067 } 00068 00069 std::string value; 00070 bool opened = false; 00071 if(session->parameterValue("modeling.opened",value)) 00072 Lib::smanip::tobool(value,opened); 00073 00074 log << MSG::INFO << "SoLVolumeCnv::createReps() called" << endreq; 00075 00076 const ILVolume* lv = dynamic_cast<const ILVolume*>(aObject); 00077 if(!lv) { 00078 log << MSG::INFO << " DataObject has not ILVolume interface! " << endreq; 00079 return StatusCode::FAILURE; 00080 } 00081 00082 SoNode* node = volumeToSoDetectorTreeKit(*lv,Gaudi::Transform3D(),opened); 00083 if(!node) { 00084 log << MSG::INFO << " no representation" << endreq; 00085 return StatusCode::FAILURE; 00086 } 00087 00088 // Send scene graph to the viewing region (in the "static" sub-scene graph) : 00089 region_addToStaticScene(*region,node); 00090 00091 return StatusCode::SUCCESS; 00092 } 00094 const CLID& SoLVolumeCnv::classID( ) 00095 00096 00097 { 00098 return CLID_LVolume; 00099 } 00101 const unsigned char SoLVolumeCnv::storageType( ) 00102 00103 00104 { 00105 return So_TechnologyType; 00106 }