Go to the documentation of this file.00001 #include <cstdio>
00002 #include <iostream>
00003 #include <hrpModel/ModelLoaderUtil.h>
00004 #include "hrpsys/util/GLbody.h"
00005 #include "hrpsys/util/GLlink.h"
00006 #include "hrpsys/util/GLutil.h"
00007 #include "OnlineViewer_impl.h"
00008 #include "GLscene.h"
00009
00010 using namespace OpenHRP;
00011
00012 OnlineViewer_impl::OnlineViewer_impl(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, GLscene *i_scene, LogManager<OpenHRP::WorldState> *i_log)
00013 :
00014 orb(CORBA::ORB::_duplicate(orb)),
00015 poa(PortableServer::POA::_duplicate(poa)),
00016 scene(i_scene), log(i_log)
00017 {
00018 }
00019
00020 OnlineViewer_impl::~OnlineViewer_impl()
00021 {
00022 }
00023
00024 PortableServer::POA_ptr OnlineViewer_impl::_default_POA()
00025 {
00026 return PortableServer::POA::_duplicate(poa);
00027 }
00028
00029 void OnlineViewer_impl::update(const WorldState& state)
00030 {
00031 log->add(state);
00032 }
00033
00034 void OnlineViewer_impl::load(const char* name_, const char* url)
00035 {
00036 if (!scene->body(name_)){
00037 std::cout << "load(" << url << ")" << std::endl;
00038 OpenHRP::ModelLoader_var ml = hrp::getModelLoader(orb);
00039 OpenHRP::ModelLoader::ModelLoadOption opt;
00040 opt.readImage = true;
00041 opt.AABBdata.length(0);
00042 opt.AABBtype = OpenHRP::ModelLoader::AABB_NUM;
00043 BodyInfo_var binfo = ml->getBodyInfoEx(url, opt);
00044 GLbody *glbody = new GLbody();
00045 hrp::BodyPtr body(glbody);
00046 hrp::loadBodyFromBodyInfo(body, binfo, false, GLlinkFactory);
00047 body->setName(name_);
00048 loadShapeFromBodyInfo(glbody, binfo);
00049 scene->addBody(body);
00050 }
00051 }
00052
00053 void OnlineViewer_impl::clearLog()
00054 {
00055 log->clear();
00056 }
00057
00058 void OnlineViewer_impl::clearData()
00059 {
00060 }
00061
00062 void OnlineViewer_impl::drawScene(const WorldState& state)
00063 {
00064 }
00065
00066 void OnlineViewer_impl::setLineWidth(::CORBA::Float width)
00067 {
00068 }
00069
00070 void OnlineViewer_impl::setLineScale(::CORBA::Float scale)
00071 {
00072 }
00073
00074 ::CORBA::Boolean OnlineViewer_impl::getPosture(const char* robotId, DblSequence_out posture)
00075 {
00076 return true;
00077 }
00078
00079 void OnlineViewer_impl::setLogName(const char* name)
00080 {
00081 }
00082