本文整理汇总了C++中EnvironmentBasePtr::GetViewer方法的典型用法代码示例。如果您正苦于以下问题:C++ EnvironmentBasePtr::GetViewer方法的具体用法?C++ EnvironmentBasePtr::GetViewer怎么用?C++ EnvironmentBasePtr::GetViewer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvironmentBasePtr
的用法示例。
在下文中一共展示了EnvironmentBasePtr::GetViewer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char ** argv)
{
//int num = 1;
string scenefilename = "data/lab1.env.xml";
string viewername = RaveGetDefaultViewerType(); //qtcoin
// parse the command line options
int i = 1;
while(i < argc) {
if((strcmp(argv[i], "-h") == 0)||(strcmp(argv[i], "-?") == 0)||(strcmp(argv[i], "/?") == 0)||(strcmp(argv[i], "--help") == 0)||(strcmp(argv[i], "-help") == 0)) {
RAVELOG_INFO("orloadviewer [--num n] [--scene filename] viewername\n");
return 0;
}
else if( strcmp(argv[i], "--scene") == 0 ) {
scenefilename = argv[i+1];
i += 2;
}
else
break;
}
if( i < argc ) {
viewername = argv[i++];
}
RaveInitialize(true); // start openrave core
EnvironmentBasePtr penv = RaveCreateEnvironment(); // create the main environment
RaveSetDebugLevel(Level_Debug);
boost::thread thviewer(boost::bind(SetViewer,penv,viewername));
penv->Load(scenefilename); // load the scene
UserDataPtr pregistration;
while(!pregistration) {
if( !pregistration && !!penv->GetViewer() ) {
pregistration = penv->GetViewer()->RegisterViewerThreadCallback(boost::bind(ViewerCallback,penv->GetViewer()));
}
boost::this_thread::sleep(boost::posix_time::milliseconds(1));
}
thviewer.join(); // wait for the viewer thread to exit
pregistration.reset();
penv->Destroy(); // destroy
return 0;
}