#include <Type.h>
Collaboration diagram for OnXSvc::Type< 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 () |
Type (const CLID &aCLID, const std::string &aType, const std::string &aLocation, IUserInterfaceSvc *aUISvc, ISoConversionSvc *aSoCnvSvc, IDataProviderSvc *aDataProviderSvc) | |
virtual | ~Type () |
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 ObjectVector< Object > | Collection |
Private Attributes | |
const CLID & | fCLID |
std::string | fType |
std::string | fLocation |
Lib::IIterator * | fIterator |
IConverter * | fConverter |
Definition at line 53 of file Type.h.
typedef ObjectVector<Object> OnXSvc::Type< Object >::Collection [private] |
OnXSvc::Type< Object >::Type | ( | const CLID & | aCLID, | |
const std::string & | aType, | |||
const std::string & | aLocation, | |||
IUserInterfaceSvc * | aUISvc, | |||
ISoConversionSvc * | aSoCnvSvc, | |||
IDataProviderSvc * | aDataProviderSvc | |||
) | [inline] |
Definition at line 152 of file Type.h.
00158 :OnX::BaseType(aUISvc->printer()) 00159 ,fCLID(aCLID) 00160 ,fType(aType) 00161 ,fLocation(aLocation) 00162 ,fIterator(0) 00163 ,fConverter(0) 00164 //,fCollection(0) 00165 ,fSoRegion(0) 00166 ,fUISvc(aUISvc) 00167 ,fSoCnvSvc(aSoCnvSvc) 00168 ,fDataProviderSvc(aDataProviderSvc) { 00169 00170 if(!fUISvc) { 00171 Lib::Out out(printer()); 00172 out << "OnXSvc::Type<> :" 00173 << " can't get a IUserInterfaceSvc." 00174 << Lib::endl; 00175 } 00176 00177 //fCollection = new Collection(); 00178 }
virtual OnXSvc::Type< Object >::~Type | ( | ) | [inline, virtual] |
virtual void* OnXSvc::Type< Object >::cast | ( | const std::string & | aClass | ) | const [inline, virtual] |
Definition at line 57 of file Type.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::Type< Object >::name | ( | ) | const [inline, virtual] |
virtual Lib::IIterator* OnXSvc::Type< Object >::iterator | ( | ) | [inline, virtual] |
Definition at line 67 of file Type.h.
00067 { 00068 if(fIterator) return fIterator; 00069 if(!fDataProviderSvc) { 00070 Lib::Out out(printer()); 00071 out << "OnXSvc::Type<>::iterator :" 00072 << " no data provider found." 00073 << Lib::endl; 00074 return new Iterator< 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::Type<>::iterator :" 00083 << " retreiveObject failed." 00084 << Lib::endl; 00085 return new Iterator< Object >(); 00086 } 00087 Collection* collection = dynamic_cast<Collection*>(dataObject); 00088 if(!collection) { 00089 Lib::Out out(printer()); 00090 out << "OnXSvc::Type<>::iterator :" 00091 << " dynamic_cast failed." 00092 << Lib::endl; 00093 return new Iterator< Object >(); 00094 } 00095 return new Iterator< Object >(collection); 00096 }
virtual void OnXSvc::Type< Object >::setIterator | ( | Lib::IIterator * | aIterator | ) | [inline, virtual] |
virtual void OnXSvc::Type< Object >::beginVisualize | ( | ) | [inline, virtual] |
Definition at line 99 of file Type.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::Type<>::beginVisualize :" 00108 << " can't get a ISession." 00109 << Lib::endl; 00110 fSoRegion = 0; 00111 return; 00112 } 00113 fSoRegion = fUISvc->currentSoRegion(); 00114 }
virtual void OnXSvc::Type< Object >::endVisualize | ( | ) | [inline, virtual] |
void OnXSvc::Type< Object >::setLocation | ( | const std::string & | aLocation | ) | [inline] |
const std::string& OnXSvc::Type< Object >::location | ( | ) | const [inline] |
bool OnXSvc::Type< Object >::setLocationFromSession | ( | bool | verbose = true |
) | [inline, protected] |
Definition at line 185 of file Type.h.
00185 { 00186 if(!fUISvc) return false; 00187 ISession* session = fUISvc->session(); 00188 if(!session) return false; 00189 std::string value; 00190 if(!session->parameterValue(fType+".location",value)) { 00191 if(verbose) { 00192 Lib::Out out(printer()); 00193 out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :" 00194 << " Session parameter " << fType << ".location not found." 00195 << Lib::endl; 00196 } 00197 return false; 00198 } 00199 if(value=="") { 00200 if(verbose) { 00201 Lib::Out out(printer()); 00202 out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :" 00203 << " Session parameter " << fType << ".location empty." 00204 << Lib::endl; 00205 } 00206 return false; 00207 } 00208 if(verbose) { 00209 Lib::Out out(printer()); 00210 out << "OnXSvc::Type<" << fType << ">::setLocationFromSession :" 00211 << " set location \"" << value << "\"" 00212 << Lib::endl; 00213 } 00214 setLocation(value); 00215 return true; 00216 }
bool OnXSvc::Type< Object >::attribute | ( | const std::string & | aWhat, | |
std::string & | aValue | |||
) | const [inline, protected] |
bool OnXSvc::Type< Object >::attribute | ( | const std::string & | aWhat, | |
float & | aR, | |||
float & | aG, | |||
float & | aB | |||
) | const [inline, protected] |
Definition at line 224 of file Type.h.
00224 { 00225 aR = 0.5F; 00226 aG = 0.5F; 00227 aB = 0.5F; 00228 if(!fUISvc) return false; 00229 ISession* session = fUISvc->session(); 00230 if(!session) return false; 00231 std::string value; 00232 if(!session->parameterValue(aWhat,value)) return false; 00233 double r,g,b; 00234 if(!Lib::smanip::torgb(value,r,g,b)) return false; 00235 aR = (float)r; 00236 aG = (float)g; 00237 aB = (float)b; 00238 return true; 00239 }
bool OnXSvc::Type< Object >::modelingSolid | ( | ) | const [inline, protected] |
Definition at line 240 of file Type.h.
00240 { 00241 if(!fUISvc) return true; 00242 ISession* session = fUISvc->session(); 00243 if(!session) return true; 00244 std::string value; 00245 if(!session->parameterValue("modeling.modeling",value)) return true; 00246 return (value=="solid" ? true : false); 00247 }
const CLID& OnXSvc::Type< Object >::fCLID [private] |
std::string OnXSvc::Type< Object >::fType [private] |
std::string OnXSvc::Type< Object >::fLocation [private] |
Lib::IIterator* OnXSvc::Type< Object >::fIterator [private] |
IConverter* OnXSvc::Type< Object >::fConverter [private] |
SoRegion* OnXSvc::Type< Object >::fSoRegion [protected] |
IUserInterfaceSvc* OnXSvc::Type< Object >::fUISvc [protected] |
ISoConversionSvc* OnXSvc::Type< Object >::fSoCnvSvc [protected] |
IDataProviderSvc* OnXSvc::Type< Object >::fDataProviderSvc [protected] |