本文整理汇总了C++中MainWidget::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ MainWidget::isVisible方法的具体用法?C++ MainWidget::isVisible怎么用?C++ MainWidget::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWidget
的用法示例。
在下文中一共展示了MainWidget::isVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
string localFilename = "";
bool binary = false;
for (char c; (c = getopt(argc, argv, "bol:h")) != -1; ) {
switch (c) {
case 'b':
binary = true;
break;
case 'o':
overrideCovariances = true;
break;
case 'l':
localFilename = optarg;
break;
case 'h':
printUsage(argv[0]);
return 0;
default:
printUsage(argv[0]);
return 1;
}
}
if (optind != argc) {
printUsage(argv[0]);
return 1;
}
// starting up the QApplication
QApplication qapp(argc, argv);
MainWidget mw;
QGLGraphViewer& viewer = *mw.viewer;
viewer.graph.setUseDrawList(true);
viewer.graph.setGraph(&graphs[0].graph);
viewer.graph.setHirarchy(&graphs[0].hirarchy);
mw.show();
pthread_t stdinReadingThread;
if (localFilename.size()) { // just load a graph and display this graph
cout << "Loading file " << localFilename << " ... " << flush;
ifstream ifs(localFilename.c_str());
if (!ifs) {
cerr << "Unable to open " << localFilename << endl;
return 1;
}
if (!binary)
graphs[0].graph.load(ifs);
else
graphs[0].graph.loadBinary(ifs);
if (graphs[0].graph.vertices().size() == 0) {
cerr << "\ttrying to load 2D graph ..." << endl;
ifs.clear();
ifs.seekg(0, ios::beg);
PoseGraph2D auxGraph;
auxGraph.load(ifs);
if (auxGraph.vertices().size() > 0) { // now convert everything to 3D for displaying
convert2DGraphTo3D(auxGraph, graphs[0].graph);
}
}
cout << "done." << endl;
} else {
// start the thread that reads stdin
int thread_status = pthread_create( &stdinReadingThread, NULL, readStdinThread, static_cast<void*>(&viewer.graph));
if (thread_status != 0) {
cerr << "unable to create stdin thread" << endl;
}
}
while (mw.isVisible()) {
pthread_mutex_lock( &graphMutex );
if (s_drawNeeded) {
s_drawNeeded = false;
viewer.updateGL();
}
qapp.processEvents();
pthread_mutex_unlock( &graphMutex );
usleep(10000);
}
return 0;
}