#include <KeyedType.h>
Collaboration diagram for OnXSvc::KeyedType< Object >:
Public Member Functions | |
virtual void * | cast (const std::string &aClass) const |
virtual std::string | name () const |
virtual Lib::IIterator * | iterator () |
virtual void | setIterator (Lib::IIterator *aIterator) |
virtual void | beginVisualize () |
virtual void | endVisualize () |
KeyedType (const CLID &aCLID, const std::string &aType, const std::string &aLocation, IUserInterfaceSvc *aUISvc, ISoConversionSvc *aSoCnvSvc, IDataProviderSvc *aDataProviderSvc) | |
virtual | ~KeyedType () |
void | setLocation (const std::string &aLocation) |
const std::string & | location () const |
Protected Member Functions | |
bool | setLocationFromSession (bool verbose=true) |
bool | attribute (const std::string &aWhat, std::string &aValue) const |
bool | attribute (const std::string &aWhat, float &aR, float &aG, float &aB) const |
bool | modelingSolid () const |
Protected Attributes | |
SoRegion * | fSoRegion |
IUserInterfaceSvc * | fUISvc |
ISoConversionSvc * | fSoCnvSvc |
IDataProviderSvc * | fDataProviderSvc |
Private Types | |
typedef KeyedContainer< Object, Containers::HashMap > | Collection |
Private Attributes | |
const CLID & | fCLID |
std::string | fType |
std::string | fLocation |
Lib::IIterator * | fIterator |
IConverter * | fConverter |
Definition at line 53 of file KeyedType.h.
typedef KeyedContainer< Object, Containers::HashMap> OnXSvc::KeyedType< Object >::Collection [private] |
Definition at line 55 of file KeyedType.h.
OnXSvc::KeyedType< Object >::KeyedType | ( | const CLID & | aCLID, | |
const std::string & | aType, | |||
const std::string & | aLocation, | |||
IUserInterfaceSvc * | aUISvc, | |||
ISoConversionSvc * | aSoCnvSvc, | |||
IDataProviderSvc * | aDataProviderSvc | |||
) | [inline] |
Definition at line 151 of file KeyedType.h.
00157 :OnX::BaseType(aUISvc->printer()) 00158 ,fCLID(aCLID) 00159 ,fType(aType) 00160 ,fLocation(aLocation) 00161 ,fIterator(0) 00162 ,fConverter(0) 00163 //,fCollection(0) 00164 ,fSoRegion(0) 00165 ,fUISvc(aUISvc) 00166 ,fSoCnvSvc(aSoCnvSvc) 00167 ,fDataProviderSvc(aDataProviderSvc){ 00168 00169 if(!fUISvc) { 00170 Lib::Out out(printer()); 00171 out << "OnXSvc::KeyedType<> :" 00172 << " can't get a IUserInterfaceSvc." 00173 << Lib::endl; 00174 } 00175 00176 //fCollection = new Collection(); 00177 }
virtual OnXSvc::KeyedType< Object >::~KeyedType | ( | ) | [inline, virtual] |
virtual void* OnXSvc::KeyedType< Object >::cast | ( | const std::string & | aClass | ) | const [inline, virtual] |
Definition at line 57 of file KeyedType.h.
00057 { 00058 //FIXME : needed with g++-3.23 so that 00059 // the virtuality over the safe cast works ! 00060 if(aClass=="Slash::Data::IVisualizer") { 00061 return (void*)static_cast<const Slash::Data::IVisualizer*>(this); 00062 } else { 00063 return OnX::BaseType::cast(aClass); 00064 } 00065 }
virtual std::string OnXSvc::KeyedType< Object >::name | ( | ) | const [inline, virtual] |
virtual Lib::IIterator* OnXSvc::KeyedType< Object >::iterator | ( | ) | [inline, virtual] |
Definition at line 67 of file KeyedType.h.
00067 { 00068 if(fIterator) return fIterator; 00069 if(!fDataProviderSvc) { 00070 Lib::Out out(printer()); 00071 out << "OnXSvc::KeyedType<>::iterator :" 00072 << " no data provider found." 00073 << Lib::endl; 00074 return new KeyedIterator< Object >(); 00075 } 00076 SmartDataPtr<DataObject> smartDataObject(fDataProviderSvc,fLocation); 00077 if(smartDataObject) {} 00078 DataObject* dataObject = 0; 00079 StatusCode sc = fDataProviderSvc->retrieveObject(fLocation, dataObject); 00080 if(!sc.isSuccess()) { 00081 Lib::Out out(printer()); 00082 out << "OnXSvc::KeyedType<>::iterator :" 00083 << " retreiveObject failed." 00084 << Lib::endl; 00085 return new KeyedIterator< Object >(); 00086 } 00087 Collection* collection = dynamic_cast<Collection*>(dataObject); 00088 if(!collection) { 00089 Lib::Out out(printer()); 00090 out << "OnXSvc::KeyedType<>::iterator :" 00091 << " dynamic_cast failed." 00092 << Lib::endl; 00093 return new KeyedIterator< Object >(); 00094 } 00095 return new KeyedIterator< Object >(collection); 00096 }
virtual void OnXSvc::KeyedType< Object >::setIterator | ( | Lib::IIterator * | aIterator | ) | [inline, virtual] |
virtual void OnXSvc::KeyedType< Object >::beginVisualize | ( | ) | [inline, virtual] |
Definition at line 99 of file KeyedType.h.
00099 { 00100 if(!fUISvc) { 00101 fSoRegion = 0; 00102 return; 00103 } 00104 ISession* session = fUISvc->session(); 00105 if(!session) { 00106 Lib::Out out(printer()); 00107 out << "OnXSvc::KeyedType<>::beginVisualize :" 00108 << " can't get a ISession." 00109 << Lib::endl; 00110 fSoRegion = 0; 00111 return; 00112 } 00113 fSoRegion = fUISvc->currentSoRegion(); 00114 }
virtual void OnXSvc::KeyedType< Object >::endVisualize | ( | ) | [inline, virtual] |
void OnXSvc::KeyedType< Object >::setLocation | ( | const std::string & | aLocation | ) | [inline] |
const std::string& OnXSvc::KeyedType< Object >::location | ( | ) | const [inline] |
bool OnXSvc::KeyedType< Object >::setLocationFromSession | ( | bool | verbose = true |
) | [inline, protected] |
Definition at line 184 of file KeyedType.h.
00184 { 00185 if(!fUISvc) return false; 00186 ISession* session = fUISvc->session(); 00187 if(!session) return false; 00188 std::string value; 00189 if(!session->parameterValue(fType+".location",value)) { 00190 if(verbose) { 00191 Lib::Out out(printer()); 00192 out << "OnXSvc::KeyedType<" << fType << ">::setLocationFromSession :" 00193 << " Session parameter " << fType << ".location not found." 00194 << Lib::endl; 00195 } 00196 return false; 00197 } 00198 if(value=="") { 00199 if(verbose) { 00200 Lib::Out out(printer()); 00201 out << "OnXSvc::KeyedType<" << fType << ">::setLocationFromSession :" 00202 << " Session parameter " << fType << ".location empty." 00203 << Lib::endl; 00204 } 00205 return false; 00206 } 00207 if(verbose) { 00208 Lib::Out out(printer()); 00209 out << "OnXSvc::KeyedType<" << fType << ">::setLocationFromSession :" 00210 << " set location \"" << value << "\"" 00211 << Lib::endl; 00212 } 00213 setLocation(value); 00214 return true; 00215 }
bool OnXSvc::KeyedType< Object >::attribute | ( | const std::string & | aWhat, | |
std::string & | aValue | |||
) | const [inline, protected] |
bool OnXSvc::KeyedType< Object >::attribute | ( | const std::string & | aWhat, | |
float & | aR, | |||
float & | aG, | |||
float & | aB | |||
) | const [inline, protected] |
Definition at line 223 of file KeyedType.h.
00223 { 00224 aR = 0.5F; 00225 aG = 0.5F; 00226 aB = 0.5F; 00227 if(!fUISvc) return false; 00228 ISession* session = fUISvc->session(); 00229 if(!session) return false; 00230 std::string value; 00231 if(!session->parameterValue(aWhat,value)) return false; 00232 double r,g,b; 00233 if(!Lib::smanip::torgb(value,r,g,b)) return false; 00234 aR = (float)r; 00235 aG = (float)g; 00236 aB = (float)b; 00237 return true; 00238 }
bool OnXSvc::KeyedType< Object >::modelingSolid | ( | ) | const [inline, protected] |
Definition at line 239 of file KeyedType.h.
00239 { 00240 if(!fUISvc) return true; 00241 ISession* session = fUISvc->session(); 00242 if(!session) return true; 00243 std::string value; 00244 if(!session->parameterValue("modeling.modeling",value)) return true; 00245 return (value=="solid" ? true : false); 00246 }
const CLID& OnXSvc::KeyedType< Object >::fCLID [private] |
Definition at line 248 of file KeyedType.h.
std::string OnXSvc::KeyedType< Object >::fType [private] |
Definition at line 249 of file KeyedType.h.
std::string OnXSvc::KeyedType< Object >::fLocation [private] |
Definition at line 250 of file KeyedType.h.
Lib::IIterator* OnXSvc::KeyedType< Object >::fIterator [private] |
Definition at line 251 of file KeyedType.h.
IConverter* OnXSvc::KeyedType< Object >::fConverter [private] |
Definition at line 252 of file KeyedType.h.
SoRegion* OnXSvc::KeyedType< Object >::fSoRegion [protected] |
Definition at line 255 of file KeyedType.h.
IUserInterfaceSvc* OnXSvc::KeyedType< Object >::fUISvc [protected] |
Definition at line 256 of file KeyedType.h.
ISoConversionSvc* OnXSvc::KeyedType< Object >::fSoCnvSvc [protected] |
Definition at line 257 of file KeyedType.h.
IDataProviderSvc* OnXSvc::KeyedType< Object >::fDataProviderSvc [protected] |
Definition at line 258 of file KeyedType.h.