12 #include "hrpsys/util/Project.h" 13 #include <hrpModel/ModelLoaderUtil.h> 14 #include "hrpsys/util/GLbody.h" 15 #include "hrpsys/util/GLlink.h" 16 #include "hrpsys/util/GLutil.h" 18 #include "hrpsys/idl/HRPDataTypes.hh" 26 "implementation_id",
"Viewer",
27 "type_name",
"Viewer",
28 "description",
"viewer component",
29 "version", HRPSYS_PACKAGE_VERSION,
31 "category",
"example",
32 "activity_type",
"DataFlowComponent",
35 "lang_type",
"compile",
37 "conf.default.project",
"",
45 m_sceneStateIn(
"state", m_sceneState),
48 m_window(&m_scene, &m_log),
62 std::cout <<
m_profile.instance_name <<
": onInitialize()" << std::endl;
114 std::cout <<
m_profile.instance_name<<
": onActivated(" << ec_id <<
")" << std::endl;
117 std::string nameServer = rtcManager.
getConfig()[
"corba.nameservers"];
118 int comPos = nameServer.find(
",");
120 comPos = nameServer.length();
122 nameServer = nameServer.substr(0, comPos);
126 std::cerr <<
"Project file is not specified." << std::endl;
127 return RTC::RTC_ERROR;
135 for (std::map<std::string, ModelItem>::iterator it=prj.
models().begin();
136 it != prj.
models().end(); it++){
137 OpenHRP::BodyInfo_var binfo;
139 CosNaming::NamingContext::_duplicate(
naming.getRootContext()));
140 if (CORBA::is_nil(binfo)){
141 std::cerr <<
"failed to load model[" << it->second.url.c_str() <<
"]" 148 body->setName(it->first);
149 m_scene.WorldBase::addBody(body);
159 std::cout <<
m_profile.instance_name<<
": onDeactivated(" << ec_id <<
")" << std::endl;
161 for (std::map<std::string, RTCGLbody *>::iterator it =
m_bodies.begin();
181 for (std::map<std::string, RTCGLbody *>::iterator it=
m_bodies.begin();
238 RTC::Delete<Viewer>);
ComponentProfile m_profile
png_infop png_charpp int png_charpp profile
void enableRingBuffer(int len)
HRPMODEL_API OpenHRP::BodyInfo_var loadBodyInfo(const char *url, int &argc, char *argv[])
InPort< OpenHRP::SceneState > m_sceneStateIn
bool parse(const std::string &filename)
virtual ~Viewer()
Destructor.
bool init(int w=0, int h=0, bool resizable=true)
HRPMODEL_API bool loadBodyFromBodyInfo(BodyPtr body, OpenHRP::BodyInfo_ptr bodyInfo, bool loadGeometryForCollisionDetection=false, Link *(*f)()=NULL)
void loadShapeFromBodyInfo(GLbody *body, BodyInfo_var i_binfo, GLshape *(*shapeFactory)())
virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id)
static Manager & instance()
void ViewerInit(RTC::Manager *manager)
coil::Properties & getConfig()
hrp::Link * GLlinkFactory()
ExecutionContextHandle_t UniqueId
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
OpenHRP::SceneState m_sceneState
std::map< std::string, RTCGLbody * > m_bodies
virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id)
std::map< std::string, ModelItem > & models()
virtual RTC::ReturnCode_t onInitialize()
Viewer(RTC::Manager *manager)
Constructor.
virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id)
bool addInPort(const char *name, InPortBase &inport)
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
static const char * component_spec[]
LogManager< OpenHRP::SceneState > m_log