本文整理汇总了C++中showHelp函数的典型用法代码示例。如果您正苦于以下问题:C++ showHelp函数的具体用法?C++ showHelp怎么用?C++ showHelp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showHelp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: refresh
dialog::RESULT textInput::run()
{
if (!init(size_))
{
return dialog::R_NCREAT;
}
refresh();
bool cont = true;
keyMapping::KEYLABEL label = keyMapping::K_UNDEF;
t_uint key = 0;
while (cont)
{
key = readAnyKey();
if (!handleKeyboard(key, label))
{
// Got something that is not recognized as one of
// the keys that are used.
enterKey(key);
continue;
}
switch (label)
{
case keyMapping::K_QUITSCREEN:
{
cont = false;
break;
}
case keyMapping::K_HELP:
{
if (showHelp())
{
// Resized.
return dialog::R_RESIZE;
}
refresh();
break;
}
case keyMapping::K_DELETE:
{
deleteCurrent();
refresh();
break;
}
case keyMapping::K_SELECT:
{
// Done setting session name.
cont = false;
text_entered = true;
break;
}
case keyMapping::K_RESIZE:
{
return dialog::R_RESIZE;
break;
}
default:
{
refresh();
break;
}
}
}
return dialog::R_QUIT;
}
开发者ID:BackupTheBerlios,项目名称:btg-svn,代码行数:69,代码来源:textinput.cpp
示例2: main
int main(int argc, char* argv[])
{
char hostName[200] = DEFAULT_HOSTNAME;
int port = DEFAULT_RESMGR_TPM_PORT; //DEFAULT_TPM_PORT;
TPMI_RH_PROVISION auth = TPM_RH_NULL;
TPMI_DH_OBJECT objectHandle;
TPMI_DH_OBJECT persistentHandle;
setbuf(stdout, NULL);
setvbuf (stdout, NULL, _IONBF, BUFSIZ);
int opt = -1;
const char *optstring = "hvA:H:S:P:p:d:c:";
static struct option long_options[] = {
{"help",0,NULL,'h'},
{"version",0,NULL,'v'},
{"auth",1,NULL,'A'},
{"handle",1,NULL,'H'},
{"persistent",1,NULL,'S'},
{"pwda",1,NULL,'P'},
{"port",1,NULL,'p'},
{"debugLevel",1,NULL,'d'},
{"context",1,NULL,'c'},
{0,0,0,0}
};
int returnVal = 0;
int flagCnt = 0;
int h_flag = 0,
v_flag = 0,
A_flag = 0,
H_flag = 0,
S_flag = 0,
c_flag = 0,
P_flag = 0;
char *contextFile = NULL;
if(argc == 1)
{
showHelp(argv[0]);
return 0;
}
while((opt = getopt_long(argc,argv,optstring,long_options,NULL)) != -1)
{
switch(opt)
{
case 'h':
h_flag = 1;
break;
case 'v':
v_flag = 1;
break;
case 'A':
if(strcmp(optarg,"o") == 0 || strcmp(optarg,"O") == 0)
auth = TPM_RH_OWNER;
else if(strcmp(optarg,"p") == 0 || strcmp(optarg,"P") == 0)
auth = TPM_RH_PLATFORM;
else
{
printf("ERROR: auth '%s' not supported!\n", optarg);
returnVal = -1;
break;
}
A_flag = 1;
break;
case 'H':
if(getSizeUint32Hex(optarg, &objectHandle) != 0)
{
returnVal = -2;
break;
}
printf("\nobjecttHanlde: 0x%x\n\n",objectHandle);
H_flag = 1;
break;
case 'S':
if(getSizeUint32Hex(optarg, &persistentHandle) != 0)
{
returnVal = -3;
break;
}
printf("\npersistentHanlde: 0x%x\n\n",persistentHandle);
S_flag = 1;
break;
case 'P':
if( optarg == NULL || (strlen(optarg) >= sizeof(TPMU_HA)) )
{
printf("\nPlease input the authenticating password(optional,no more than %d characters).\n", (int)sizeof(TPMU_HA)-1);
returnVal = -4;
break;
}
if( strlen(optarg) > 0 )
{
sessionData.hmac.t.size = strlen(optarg);
safeStrNCpy( (char *)&sessionData.hmac.t.buffer[0], optarg, sizeof(sessionData.hmac.t.buffer) );
}
P_flag = 1;
break;
//.........这里部分代码省略.........
开发者ID:atomsoftwarestudios,项目名称:tpm2.0-tools,代码行数:101,代码来源:tpm2_evictcontrol.cpp
示例3: parseCommand
bool parseCommand(int argc, SAP_UC ** argv, OPTIONS* options)
{
if( argc < 2 || !strcmpU(argv[1], cU("-help")) || !strcmpU(argv[1], cU("-?")))
{
showHelp();
return false;
}
else if(!strcmpU(argv[1], cU("-v")))
{
showVersion();
return false;
}
int i = 1;
const SAP_UC * const PATHNAME = cU("PATHNAME=");
const SAP_UC * const PORT = cU("PORT=");
const size_t PATHNAME_LEN = 9;
const size_t PORT_LEN =5;
while(i < argc)
{
const SAP_UC ch1 = argv[i][0];
const SAP_UC ch2 = argv[i++][1];
if(ch1 == cU('-') && ch2) // we found an option
{
if(ch2 == cU('t'))
{
options->trace = 1;
continue;
}
else if(ch2 == cU('i'))
{
options->showSysInfo = true;
continue;
}
if(i > argc - 1 || argv[i][0] == cU('-'))
{
continue;
}
switch (ch2)
{
case cU('h'):
options->ashost = argv[i++];
break;
case cU('s'):
options->sysnr = argv[i++];
break;
case cU('u'):
options->user = argv[i++];
break;
case cU('p'):
options->passwd = argv[i++];
break;
case cU('c'):
options->client = argv[i++];
break;
case cU('l'):
options->language = argv[i++];
break;
case cU('D'):
options->dest = argv[i++];
break;
case cU('F'):
options->function = argv[i++];
break;
case cU('E'):
{
const SAP_UC *param = argv[i++];
if(!strncmpU(param, PATHNAME, PATHNAME_LEN))
{
options->path = param + PATHNAME_LEN;
}
else if(!strncmpU(param, PORT, PORT_LEN))
{
options->port = param + PORT_LEN;
}
}
break;
default:
i++;
break;
}
}
}
return true;
}
开发者ID:sumitp2,项目名称:TestBuildPack2,代码行数:85,代码来源:startrfc.cpp
示例4: _tmain
int _tmain (int argc, _TCHAR **argv)
{
for (int i = 0; i < argc; ++i)
{
out << argv[i] << std::endl;
}
if (argc < 2)
{
showHelp ();
return (0);
}
params_t params;
if (!parseCmdLine (argc - 1, argv + 1, ¶ms))
{
if (otUnknown == params.opType)
{
out << _T (" : unknown operation") << std::endl;
}
else
{
out << _T ("bad command line") << std::endl;
}
return (-1);
}
if (FAILED (initLicensing (AppInfo, params.basesPaths, CLicensingPolicy::cmKeyOnly)))
{
return (-1);
}
// synchronizeKeys (AppInfo, KeyFile1, 0);
#if defined (_WIN32)
SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_NEUTRAL), SORT_DEFAULT));
CComLib comLib;
#endif
switch(params.opType)
{
case otKeyReg :
case otKeyRegAdd : regKey (params.keyFileName, params.keyAddMode); break;
case otKeyRevoke : revokeKey (params.serialNumber); break;
case otCheckActiveKey : checkActiveKey (); break;
case otKeyFileInfo : keyFileInfo (params.keyFileName); break;
case otViewInstalledKeys : viewInstalledKeys (); break;
case otViewBlacklist : viewBlacklist (params.blacklistName); break;
case otCheckAgainstBlacklist: checkAgainstBlackList (params.blacklistName.c_str ()); break;
case otCheckKeyBlacklist : checKeyBlacklist (params.keyFileName, params.blacklistName); break;
case otCheckKeyFile :
case otCheckKeyFileAdd :
checkKeyFile (params.keyFileName, params.keyAddMode); break;
default : break;
}
// recreateTest (AppInfo, params.basesPaths, CLicensingPolicy::cmFullCheck);
return (0);
}
开发者ID:hackshields,项目名称:antivirus,代码行数:63,代码来源:lictool_main.cpp
示例5: main
int
main(int argc, char *argv[])
{
parseCommandLine (argc, argv);
pcl::PointCloud<PointType>::Ptr model (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr model_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<NormalType>::Ptr model_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<NormalType>::Ptr scene_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<DescriptorType>::Ptr model_descriptors (new pcl::PointCloud<DescriptorType> ());
pcl::PointCloud<DescriptorType>::Ptr scene_descriptors (new pcl::PointCloud<DescriptorType> ());
//
// Load clouds
//
if (pcl::io::loadPCDFile (model_filename_, *model) < 0)
{
std::cout << "Error loading model cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
std::cout << "density " << model->is_dense << std::endl;
pcl::PointCloud<PointType>::Ptr model_filtered (new pcl::PointCloud<PointType>());
std::vector<int> filter_index;
pcl::removeNaNFromPointCloud (*model, *model_filtered, filter_index);
model = model_filtered;
if (pcl::io::loadPCDFile (scene_filename_, *scene) < 0)
{
std::cout << "Error loading scene cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
//
// Set up resolution invariance
//
if (use_cloud_resolution_)
{
float resolution = static_cast<float> (computeCloudResolution (model));
if (resolution != 0.0f)
{
model_ss_ *= resolution;
scene_ss_ *= resolution;
rf_rad_ *= resolution;
descr_rad_ *= resolution;
cg_size_ *= resolution;
}
std::cout << "Model resolution: " << resolution << std::endl;
}
std::cout << "Model sampling size: " << model_ss_ << std::endl;
std::cout << "Scene sampling size: " << scene_ss_ << std::endl;
std::cout << "LRF support radius: " << rf_rad_ << std::endl;
std::cout << "SHOT descriptor radius: " << descr_rad_ << std::endl;
std::cout << "Clustering bin size: " << cg_size_ << std::endl << std::endl;
//
// Compute Normals
//
pcl::NormalEstimationOMP<PointType, NormalType> norm_est;
norm_est.setKSearch (10);
norm_est.setInputCloud (model);
norm_est.compute (*model_normals);
norm_est.setInputCloud (scene);
norm_est.compute (*scene_normals);
//
// Downsample Clouds to Extract keypoints
//
pcl::PointCloud<int> sampled_indices;
pcl::UniformSampling<PointType> uniform_sampling;
uniform_sampling.setInputCloud (model);
uniform_sampling.setRadiusSearch (model_ss_);
uniform_sampling.compute (sampled_indices);
pcl::copyPointCloud (*model, sampled_indices.points, *model_keypoints);
std::cout << "Model total points: " << model->size () << "; Selected Keypoints: " << model_keypoints->size () << std::endl;
uniform_sampling.setInputCloud (scene);
uniform_sampling.setRadiusSearch (scene_ss_);
uniform_sampling.compute (sampled_indices);
pcl::copyPointCloud (*scene, sampled_indices.points, *scene_keypoints);
std::cout << "Scene total points: " << scene->size () << "; Selected Keypoints: " << scene_keypoints->size () << std::endl;
//
// Compute Descriptor for keypoints
//
pcl::SHOTEstimationOMP<PointType, NormalType, DescriptorType> descr_est;
descr_est.setRadiusSearch (descr_rad_);
descr_est.setInputCloud (model_keypoints);
descr_est.setInputNormals (model_normals);
descr_est.setSearchSurface (model);
descr_est.compute (*model_descriptors);
//.........这里部分代码省略.........
开发者ID:lwt1104,项目名称:pcl_tool_code,代码行数:101,代码来源:correspondence_grouping+_api.cpp
示例6: main
int main(int argc, char** argv)
{
// Make current directory=path to execuable
char *p = strrchr(argv[0], '/');
if (p != NULL)
{
*p = '\0';
chdir(argv[0]);
}
const char *config_file = "config/config.yml";
const char *name = NULL;
int c;
while ((c = getopt(argc, argv, ":c:n:hv")) != -1)
{
switch (c)
{
case 'c':
config_file = optarg;
break;
case 'n':
name = optarg;
break;
case 'h':
showHelp();
return 0;
case 'v':
printf( "SAYAN server - ultra-fast, modular and super-lightweight web server\n"
"version : sayan/" VERSION "\n"
"build-date : " __DATE__ " " __TIME__ "\n"
"project page : https://jacob-zak/projets/sayan-server/\n"
);
return 0;
case '?':
fprintf(stderr, "unkown option: -%c\n\n", optopt);
showHelp();
return EXIT_FAILURE;
}
}
if ((argc - optind) > 0)
{
fprintf(stderr, "too many arguments\n\n");
showHelp();
return EXIT_FAILURE;
}
/* if (name != NULL) */
/* createNewProject(name); */
PRINT("name, %s", name);
// Load config file
loadConfig("config/config.yml");
/* const Config *config = getConfig(); */
/* PRINT("Config %d", config->port); */
// Init cache
initHttpCache(false);
// openLog(getConfig()->config.log_file, WARNING);
// Run server
/* int procs=get_nprocs(); */
int procs=2;
HttpServer *server=initHttpServer(procs, 1024, procs);
if(getConfig()->isDaemon)
runDaemonServer(server);
else
runNormalServer(server);
// Cleanup
destroyHttpServer(server);
destroyHttpCache();
return (EXIT_SUCCESS);
}
开发者ID:jagu-sayan,项目名称:SayanServer,代码行数:77,代码来源:main.c
示例7: while
//.........这里部分代码省略.........
else
printf("Wrong Filetype %s:%d\n",files->Name.c_str(), files->getType());
}
if (m_sort == FILENAME)
std::sort(playlist.begin(), playlist.end(), comparePictureByFilename);
else if (m_sort == DATE)
std::sort(playlist.begin(), playlist.end(), comparePictureByDate);
}
update = true;
}
}
else if (msg == CRCInput::RC_yellow)
{
if (m_state == MENU && !playlist.empty())
{
playlist.clear();
selected = 0;
update = true;
}
}
else if (msg == CRCInput::RC_blue)
{
if ((m_state == MENU || m_state == VIEW) && (!playlist.empty()))
{
m_time = (long)time(NULL);
view(selected);
m_state=SLIDESHOW;
}
}
else if (msg == CRCInput::RC_help)
{
if (m_state == MENU)
{
showHelp();
paint();
}
}
else if (msg == CRCInput::RC_1)
{
if (m_state != MENU)
m_viewer->Zoom(200/3);
}
else if (msg == CRCInput::RC_2)
{
if (m_state != MENU)
m_viewer->Move(0,-50);
}
else if (msg == CRCInput::RC_3)
{
if (m_state != MENU)
m_viewer->Zoom(150);
}
else if (msg == CRCInput::RC_4)
{
if (m_state != MENU)
m_viewer->Move(-50,0);
}
else if (msg == CRCInput::RC_5)
{
if (!playlist.empty())
{
if (m_sort == FILENAME)
{
m_sort=DATE;
std::sort(playlist.begin(),playlist.end(),comparePictureByDate);
开发者ID:ChakaZulu,项目名称:tuxbox_apps,代码行数:67,代码来源:pictureviewer.cpp
示例8: main
int main(int argc, char **argv){
sqlite3_int64 iBegin; /* Start time of this program */
int quietFlag = 0; /* True if --quiet or -q */
int verboseFlag = 0; /* True if --verbose or -v */
char *zInsSql = 0; /* SQL statement for --load-db or --load-sql */
int iFirstInsArg = 0; /* First argv[] to use for --load-db or --load-sql */
sqlite3 *db = 0; /* The open database connection */
sqlite3_stmt *pStmt; /* A prepared statement */
int rc; /* Result code from SQLite interface calls */
Blob *pSql; /* For looping over SQL scripts */
Blob *pDb; /* For looping over template databases */
int i; /* Loop index for the argv[] loop */
int onlySqlid = -1; /* --sqlid */
int onlyDbid = -1; /* --dbid */
int nativeFlag = 0; /* --native-vfs */
int rebuildFlag = 0; /* --rebuild */
int vdbeLimitFlag = 0; /* --limit-vdbe */
int timeoutTest = 0; /* undocumented --timeout-test flag */
int runFlags = 0; /* Flags sent to runSql() */
char *zMsg = 0; /* Add this message */
int nSrcDb = 0; /* Number of source databases */
char **azSrcDb = 0; /* Array of source database names */
int iSrcDb; /* Loop over all source databases */
int nTest = 0; /* Total number of tests performed */
char *zDbName = ""; /* Appreviated name of a source database */
const char *zFailCode = 0; /* Value of the TEST_FAILURE environment variable */
int cellSzCkFlag = 0; /* --cell-size-check */
int sqlFuzz = 0; /* True for SQL fuzz testing. False for DB fuzz */
int iTimeout = 120; /* Default 120-second timeout */
int nMem = 0; /* Memory limit */
char *zExpDb = 0; /* Write Databases to files in this directory */
char *zExpSql = 0; /* Write SQL to files in this directory */
iBegin = timeOfDay();
#ifdef __unix__
signal(SIGALRM, timeoutHandler);
#endif
g.zArgv0 = argv[0];
zFailCode = getenv("TEST_FAILURE");
for(i=1; i<argc; i++){
const char *z = argv[i];
if( z[0]=='-' ){
z++;
if( z[0]=='-' ) z++;
if( strcmp(z,"cell-size-check")==0 ){
cellSzCkFlag = 1;
}else
if( strcmp(z,"dbid")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
onlyDbid = integerValue(argv[++i]);
}else
if( strcmp(z,"export-db")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
zExpDb = argv[++i];
}else
if( strcmp(z,"export-sql")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
zExpSql = argv[++i];
}else
if( strcmp(z,"help")==0 ){
showHelp();
return 0;
}else
if( strcmp(z,"limit-mem")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
nMem = integerValue(argv[++i]);
}else
if( strcmp(z,"limit-vdbe")==0 ){
vdbeLimitFlag = 1;
}else
if( strcmp(z,"load-sql")==0 ){
zInsSql = "INSERT INTO xsql(sqltext) VALUES(CAST(readfile(?1) AS text))";
iFirstInsArg = i+1;
break;
}else
if( strcmp(z,"load-db")==0 ){
zInsSql = "INSERT INTO db(dbcontent) VALUES(readfile(?1))";
iFirstInsArg = i+1;
break;
}else
if( strcmp(z,"m")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
zMsg = argv[++i];
}else
if( strcmp(z,"native-vfs")==0 ){
nativeFlag = 1;
}else
if( strcmp(z,"quiet")==0 || strcmp(z,"q")==0 ){
quietFlag = 1;
verboseFlag = 0;
}else
if( strcmp(z,"rebuild")==0 ){
rebuildFlag = 1;
}else
if( strcmp(z,"result-trace")==0 ){
runFlags |= SQL_OUTPUT;
}else
if( strcmp(z,"sqlid")==0 ){
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
onlySqlid = integerValue(argv[++i]);
//.........这里部分代码省略.........
开发者ID:jmptrader,项目名称:sqlite,代码行数:101,代码来源:fuzzcheck.c
示例9: main
//.........这里部分代码省略.........
IncSet_drawBar(inc);
break;
case 'M':
{
refreshTimeout = 0;
setSortKey(pl, PERCENT_MEM, panel, settings);
break;
}
case 'T':
{
refreshTimeout = 0;
setSortKey(pl, TIME, panel, settings);
break;
}
case 'U':
{
for (int i = 0; i < Panel_size(panel); i++) {
Process* p = (Process*) Panel_get(panel, i);
p->tag = false;
}
doRefresh = true;
break;
}
case 'P':
{
refreshTimeout = 0;
setSortKey(pl, PERCENT_CPU, panel, settings);
break;
}
case KEY_F(1):
case 'h':
case '?':
{
showHelp(pl);
FunctionBar_draw(defaultBar, NULL);
refreshTimeout = 0;
break;
}
case '\014': // Ctrl+L
{
clear();
FunctionBar_draw(defaultBar, NULL);
refreshTimeout = 0;
break;
}
case ' ':
{
Process* p = (Process*) Panel_getSelected(panel);
if (!p) break;
Process_toggleTag(p);
Panel_onKey(panel, KEY_DOWN);
break;
}
case 's':
{
Process* p = (Process*) Panel_getSelected(panel);
if (!p) break;
TraceScreen* ts = TraceScreen_new(p);
TraceScreen_run(ts);
TraceScreen_delete(ts);
clear();
FunctionBar_draw(defaultBar, NULL);
refreshTimeout = 0;
CRT_enableDelay();
break;
}
开发者ID:Distrotech,项目名称:htop,代码行数:67,代码来源:htop.c
示例10: setWindowTitle
/** The default constructor
*
* \param parent The parent widget
*
*/
RainbruRPG::Gui::QuarantineList::QuarantineList(QWidget* parent)
:QWidget(parent){
setWindowTitle(tr("Quarantine"));
setMinimumSize(500, 150);
// The main layout
QVBoxLayout* vb1=new QVBoxLayout();
this->setLayout(vb1);
// The tool bar
QToolBar* toolBar=new QToolBar(this);
// toolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);
previewAct=new QAction(QIcon(":/images/preview.png"),
tr("Preview"), toolBar);
approveAct=new QAction(QIcon(":/images/accept.png"),
tr("Approve"), toolBar);
deleteAct=new QAction(QIcon(":/images/refuse.png"),
tr("Delete"), toolBar);
QAction* refreshAct=new QAction(tr("Refresh"), toolBar);
QAction* helpAct=new QAction(tr("Help"), toolBar);
previewAct->setEnabled(false);
approveAct->setEnabled(false);
deleteAct->setEnabled(false);
toolBar->addAction(previewAct);
toolBar->addAction(approveAct);
toolBar->addAction(deleteAct);
toolBar->addSeparator();
toolBar->addAction(refreshAct);
toolBar->addSeparator();
toolBar->addAction(helpAct);
vb1->addWidget(toolBar);
labStillInTransfer=new
QLabel("At least one file is still in transfer, it's size and its type "
"could be wrong. You can click the refresh button to update "
"informations and look at FTP server (Ctrl+F) to see if the "
"transfer is finished.");
labStillInTransfer->setVisible(false);
labStillInTransfer->setWordWrap(true);
vb1->addWidget(labStillInTransfer);
// The list widget
tree=new QTreeWidget();
tree->setSortingEnabled(true);
tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
QStringList header;
header << tr("Filename") << tr("Size") << tr("Usage") << tr("Type");
tree->setColumnCount(4);
tree->setHeaderLabels(header);
vb1->addWidget(tree);
refresh();
connect(tree, SIGNAL(itemSelectionChanged()), this,
SLOT(treeSelectionChanged()));
connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
this, SLOT(treeDoubleClicked(QTreeWidgetItem*,int)));
connect(previewAct, SIGNAL(triggered()), this, SLOT(filePreview()));
connect(approveAct, SIGNAL(triggered()), this, SLOT(fileAccept()));
connect(deleteAct, SIGNAL(triggered()), this, SLOT(fileRefused()));
connect(refreshAct, SIGNAL(triggered()), this, SLOT(refresh()));
connect(helpAct, SIGNAL(triggered()), this, SLOT(showHelp()));
}
开发者ID:dreamsxin,项目名称:rainbrurpg,代码行数:78,代码来源:quarantinelist.cpp
示例11: main
int main(int argc, char **argv)
{
FILE *fp;
int width, height, alpha;
unsigned char *image, *fb;
SDL_Surface *screen;
struct triangles *triangles, *best, *absbest;
long long diff;
float percdiff, bestdiff;
/* Initialization */
srand(time(NULL));
state.max_shapes = 64;
state.max_shapes_incremental = 1;
state.temperature = 0.10;
state.generation = 0;
state.absbestdiff = 100; /* 100% is worst diff possible. */
/* Check arity and parse additional args if any. */
if (argc < 4) {
showHelp(argv[0]);
exit(1);
}
if (argc > 4) {
int j;
for (j = 4; j < argc; j++) {
int moreargs = j+1 < argc;
if (!strcmp(argv[j],"--use-triangles") && moreargs) {
opt_use_triangles = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--use-circles") && moreargs) {
opt_use_circles = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--max-shapes") && moreargs) {
state.max_shapes = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--initial-shapes") && moreargs) {
state.max_shapes_incremental = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--restart")) {
opt_restart = 1;
} else if (!strcmp(argv[j],"--help")) {
showHelp(argv[0]);
} else {
fprintf(stderr,"Invalid options.");
showHelp(argv[0]);
exit(1);
}
}
}
/* Sanity check. */
if (state.max_shapes_incremental > state.max_shapes) {
state.max_shapes = state.max_shapes_incremental;
}
/* Load the PNG in memory. */
fp = fopen(argv[1],"rb");
if (!fp) {
perror("Opening PNG file");
exit(1);
}
if ((image = PngLoad(fp,&width,&height,&alpha)) == NULL) {
printf("Can't load the specified image.");
exit(1);
}
printf("Image %d %d, alpha:%d at %p\n", width, height, alpha, image);
fclose(fp);
/* Initialize SDL and allocate our arrays of triangles. */
screen = sdlInit(width,height,0);
fb = malloc(width*height*3);
triangles = mkRandomtriangles(state.max_shapes,width,height);
best = mkRandomtriangles(state.max_shapes,width,height);
absbest = mkRandomtriangles(state.max_shapes,width,height);
state.absbestdiff = bestdiff = 100;
/* Load the binary file if any. */
if (!opt_restart) loadBinary(argv[2],best);
absbest->inuse = best->inuse;
memcpy(absbest->triangles,best->triangles,
sizeof(struct triangle)*best->count);
/* Show the current evolved image and the real image for one scond each. */
memset(fb,0,width*height*3);
drawtriangles(fb,width,height,best);
sdlShowRgb(screen,fb,width,height);
sleep(1);
sdlShowRgb(screen,image,width,height);
sleep(1);
/* Evolve the current solution using simulated annealing. */
while(1) {
state.generation++;
if (state.temperature > 0 && !(state.generation % 10)) {
state.temperature -= 0.00001;
if (state.temperature < 0) state.temperature = 0;
}
/* From time to time allow the current solution to use one more
* triangle, up to the configured max number. */
//.........这里部分代码省略.........
开发者ID:abarax,项目名称:shapeme,代码行数:101,代码来源:shapeme.c
示例12: showHelp
void HelpViewer::homeClicked()
{
showHelp(HelpViewer::USERMANUAL);
}
开发者ID:aseba-community,项目名称:aseba,代码行数:4,代码来源:HelpViewer.cpp
示例13: started
//.........这里部分代码省略.........
accelGyroSettingsData.accel_scale[AccelGyroSettings::ACCEL_SCALE_Y] = 1;
accelGyroSettingsData.accel_scale[AccelGyroSettings::ACCEL_SCALE_Z] = 1;
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_X] = 0;
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Y] = 0;
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Z] = 0;
accelGyroSettings->setData(accelGyroSettingsData);
// Calibration mag
RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData();
memento.revoCalibrationData = revoCalibrationData;
// Reset the transformation matrix to identity
for (int i = 0; i < RevoCalibration::MAG_TRANSFORM_R2C2; i++) {
revoCalibrationData.mag_transform[i] = 0;
}
revoCalibrationData.mag_transform[RevoCalibration::MAG_TRANSFORM_R0C0] = 1;
revoCalibrationData.mag_transform[RevoCalibration::MAG_TRANSFORM_R1C1] = 1;
revoCalibrationData.mag_transform[RevoCalibration::MAG_TRANSFORM_R2C2] = 1;
revoCalibrationData.mag_bias[RevoCalibration::MAG_BIAS_X] = 0;
revoCalibrationData.mag_bias[RevoCalibration::MAG_BIAS_Y] = 0;
revoCalibrationData.mag_bias[RevoCalibration::MAG_BIAS_Z] = 0;
// Disable adaptive mag nulling
revoCalibrationData.MagBiasNullingRate = 0;
revoCalibration->setData(revoCalibrationData);
// Calibration AuxMag
AuxMagSettings::DataFields auxMagSettingsData = auxMagSettings->getData();
memento.auxMagSettings = auxMagSettingsData;
// Reset the transformation matrix to identity
for (int i = 0; i < AuxMagSettings::MAG_TRANSFORM_R2C2; i++) {
auxMagSettingsData.mag_transform[i] = 0;
}
auxMagSettingsData.mag_transform[AuxMagSettings::MAG_TRANSFORM_R0C0] = 1;
auxMagSettingsData.mag_transform[AuxMagSettings::MAG_TRANSFORM_R1C1] = 1;
auxMagSettingsData.mag_transform[AuxMagSettings::MAG_TRANSFORM_R2C2] = 1;
auxMagSettingsData.mag_bias[AuxMagSettings::MAG_BIAS_X] = 0;
auxMagSettingsData.mag_bias[AuxMagSettings::MAG_BIAS_Y] = 0;
auxMagSettingsData.mag_bias[AuxMagSettings::MAG_BIAS_Z] = 0;
// Disable adaptive mag nulling
auxMagSettingsData.MagBiasNullingRate = 0;
auxMagSettings->setData(auxMagSettingsData);
QThread::usleep(100000);
mag_accum_x.clear();
mag_accum_y.clear();
mag_accum_z.clear();
mag_fit_x.clear();
mag_fit_y.clear();
mag_fit_z.clear();
// Need to get as many accel updates as possible
memento.accelStateMetadata = accelState->getMetadata();
if (calibrateAccel) {
UAVObject::Metadata mdata = accelState->getMetadata();
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC);
mdata.flightTelemetryUpdatePeriod = 100;
accelState->setMetadata(mdata);
}
// Need to get as many mag updates as possible
memento.magSensorMetadata = magSensor->getMetadata();
memento.auxMagSensorMetadata = auxMagSensor->getMetadata();
if (calibrateMag) {
UAVObject::Metadata mdata = magSensor->getMetadata();
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC);
mdata.flightTelemetryUpdatePeriod = 100;
magSensor->setMetadata(mdata);
mdata = auxMagSensor->getMetadata();
UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_PERIODIC);
mdata.flightTelemetryUpdatePeriod = 100;
auxMagSensor->setMetadata(mdata);
}
// reset dirty state to forget previous unsaved runs
m_dirty = false;
if (calibrateMag) {
currentSteps = &calibrationStepsMag;
} else {
currentSteps = &calibrationStepsAccelOnly;
}
position = 0;
// Show instructions and enable controls
progressChanged(0);
displayInstructions((*currentSteps)[0].instructions, WizardModel::Prompt);
showHelp((*currentSteps)[0].visualHelp);
savePositionEnabledChanged(true);
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:101,代码来源:sixpointcalibrationmodel.cpp
示例14: parseCommandLine
/**
* Parses Command Line Arguments (Argc,Argv)
* @param argc
* @param argv
*/
void
parseCommandLine (int argc,
char *argv[])
{
//Show help
if (pcl::console::find_switch (argc, argv, "-h"))
{
showHelp (argv[0]);
exit (0);
}
//Model & scene filenames
std::vector<int> filenames;
filenames = pcl::console::parse_file_extension_argument (argc, argv, ".pcd");
if (filenames.size () != 2)
{
std::cout << "Filenames missing.\n";
showHelp (argv[0]);
exit (-1);
}
model_filename_ = argv[filenames[0]];
scene_filename_ = argv[filenames[1]];
//Program behavior
if (pcl::console::find_switch (argc, argv, "-k"))
{
show_keypoints_ = true;
}
std::string used_algorithm;
if (pcl::console::parse_argument (argc, argv, "--algorithm", used_algorithm) != -1)
{
if (used_algorithm.compare ("Hough") == 0)
{
use_hough_ = true;
}
else if (used_algorithm.compare ("GC") == 0)
{
use_hough_ = false;
}
else
{
std::cout << "Wrong algorithm name.\n";
showHelp (argv[0]);
exit (-1);
}
}
//General parameters
pcl::console::parse_argument (argc, argv, "--model_ss", model_ss_);
pcl::console::parse_argument (argc, argv, "--scene_ss", scene_ss_);
pcl::console::parse_argument (argc, argv, "--rf_rad", rf_rad_);
pcl::console::parse_argument (argc, argv, "--descr_rad", descr_rad_);
pcl::console::parse_argument (argc, argv, "--cg_size", cg_size_);
pcl::console::parse_argument (argc, argv, "--cg_thresh", cg_thresh_);
pcl::console::parse_argument (argc, argv, "--icp_max_iter", icp_max_iter_);
pcl::console::parse_argument (argc, argv, "--icp_corr_distance", icp_corr_distance_);
pcl::console::parse_argument (argc, argv, "--hv_clutter_reg", hv_clutter_reg_);
pcl::console::parse_argument (argc, argv, "--hv_inlier_th", hv_inlier_th_);
pcl::console::parse_argument (argc, argv, "--hv_occlusion_th", hv_occlusion_th_);
pcl::console::parse_argument (argc, argv, "--hv_rad_clutter", hv_rad_clutter_);
pcl::console::parse_argument (argc, argv, "--hv_regularizer", hv_regularizer_);
pcl::console::parse_argument (argc, argv, "--hv_rad_normals", hv_rad_normals_);
pcl::console::parse_argument (argc, argv, "--hv_detect_clutter", hv_detect_clutter_);
}
开发者ID:yazdani,项目名称:iai_rescue_robosherlock,代码行数:71,代码来源:hypothezer.cpp
示例15: Folder
Browser::Browser()
{
string input, destination, newpath;
path = "/";
vector<string> params;
// pass buffer
manager.setBuffer(&buffer);
string command;
pwd = Folder(0, 0, "root");
// WELCOME
//printw("%s", "## Welcome in Rapidshare Manager \n");
//printw("%s", "rs#~/ ");
//refresh();
//move(linenum,6);
//cout << "## Welcome in Rapidshare Manager" << endl;
//cout << "rs#~/ ";
while(true) {
input = buffer.getCommand();
//getline(cin, input);
//printw("---- %s -----", input.c_str());
trim(input);
split(params, input, is_any_of(" "));
command = params[0];
if(command == "ls"){
manager.listFolder(pwd);
}
if(command == "help"){
showHelp();
}
if(command == "mv"){
params = processParams(input, command, 2);
mv(getCurrentPath(params[0]), getCurrentPath(params[1]));
}
if(command == "cd"){
params = processParams(input, "cd", 1);
if(params[0] == ".."){
if(!pwd.isRoot()){
pwd = manager.getFolder(pwd.parent);
path = pwd.path;
}else{
path = "/";
}
}else{
if(pwd.isRoot()){
path = pwd.path + params[0];
}else{
path = pwd.path + "/" + params[0];
}
if(manager.getFolder(path).notFound()) {
cout << "not found" << endl;
}else{
pwd = manager.getFolder(path);
}
}
}
if(command == "cp"){
params = processParams(input, "cp", 2);
if(params.size() == 2){
bool local = isLocal(params[0]);
string destination;
if(local){
destination = getCurrentPath(params[1]);
path = params[0];
}else{
path = getCurrentPath(params[0]);
destination = params[1];
}
copy(path, destination, local);
}
}
if(command == "pwd"){
cout << pwd.path << endl;
}
if(command == "play"){
params = processParams(input, command, 1);
/*if(params.size() == 1){
//.........这里部分代码省略.........
开发者ID:Pooky,项目名称:RapidshareShell,代码行数:101,代码来源:Browser.cpp
示例16: main
int
main (int argc,
char *argv[])
{
parseCommandLine (argc, argv);
pcl::PointCloud<PointType>::Ptr model (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr model_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene (new pcl::PointCloud<PointType> ());
pcl::PointCloud<PointType>::Ptr scene_keypoints (new pcl::PointCloud<PointType> ());
pcl::PointCloud<NormalType>::Ptr model_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<NormalType>::Ptr scene_normals (new pcl::PointCloud<NormalType> ());
pcl::PointCloud<DescriptorType>::Ptr model_descriptors (new pcl::PointCloud<DescriptorType> ());
pcl::PointCloud<DescriptorType>::Ptr scene_descriptors (new pcl::PointCloud<DescriptorType> ());
/**
* Load Clouds
*/
if (pcl::io::loadPCDFile (model_filename_, *model) < 0)
{
std::cout << "Error loading model cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
if (pcl::io::loadPCDFile (scene_filename_, *scene) < 0)
{
std::cout << "Error loading scene cloud." << std::endl;
showHelp (argv[0]);
return (-1);
}
/**
* Compute Normals
*/
pcl::NormalEstimationOMP<PointType, NormalType> norm_est;
norm_est.setKSearch (10);
norm_est.setInputCloud (model);
norm_est.compute (*model_normals);
norm_est.setInputCloud (scene);
norm_est.compute (*scene_normals);
/**
* Downsample Clouds to Extract keypoints
*/
pcl::UniformSampling<PointType> uniform_sampling;
uniform_sampling.setInputCloud (model);
uniform_sampling.setRadiusSearch (model_ss_);
uniform_sampling.filter (*model_keypoints);
std::cout << "Model total points: " << model->size () << "; Selected Keypoints: " << model_keypoints->size () << std::endl;
uniform_sampling.setInputCloud (scene);
uniform_sampling.setRadiusSearch (scene_ss_);
uniform_sampling.filter (*scene_keypoints);
std::cout << "Scene total points: " << scene->size () << "; Selected Keypoints: " << scene_keypoints->size () << std::endl;
/**
* Compute Descriptor for keypoints
*/
pcl::SHOTEstimationOMP<PointType, NormalType, DescriptorType> descr_est;
descr_est.setRadiusSearch (descr_rad_);
descr_est.setInputCloud (model_keypoints);
descr_est.setInputNormals (model_normals);
descr_est.setSearchSurface (model);
descr_est.compute (*model_descriptors);
descr_est.setInputCloud (scene_keypoints);
descr_est.setInputNormals (scene_normals);
descr_est.setSearchSurface (scene);
descr_est.compute (*scene_descriptors);
/**
* Find Model-Scene Correspondences with KdTree
*/
pcl::CorrespondencesPtr model_scene_corrs (new pcl::Correspondences ());
pcl::KdTreeFLANN<DescriptorType> match_search;
match_search.setInputCloud (model_descriptors);
std::vector<int> model_good_keypoints_indices;
std::vector<int> scene_good_keypoints_indices;
for (size_t i = 0; i < scene_descriptors->size (); ++i)
{
std::vector<int> neigh_indices (1);
std::vector<float> neigh_sqr_dists (1);
if (!pcl_isfinite (scene_descriptors->at (i).descriptor[0])) //skipping NaNs
{
continue;
}
int found_neighs = match_search.nearestKSearch (scene_descriptors->at (i), 1, neigh_indices, neigh_sqr_dists);
if (found_neighs == 1 && neigh_sqr_dists[0] < 0.25f)
{
pcl::Correspondence corr (neigh_indices[0], static_cast<int> (i), neigh_sqr_dists[0]);
model_scene_corrs->push_back (corr);
model_good_keypoints_indices.push_back (corr.index_query);
scene_good_keypoints_indices.push_back (corr.index_match);
}
}
pcl::PointCloud<
|
请发表评论