本文整理汇总了C++中QueryResult::get方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryResult::get方法的具体用法?C++ QueryResult::get怎么用?C++ QueryResult::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryResult
的用法示例。
在下文中一共展示了QueryResult::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nameToWorldCoords
/*
* static method to use a name server catalog ([email protected] or [email protected])
* to get the coordinates from the object name. If feedback is not NULL,
* status info is written to the given open file.
*
* On success, sets the position arg and returns 0, else 1.
*/
int AstroCatalog::nameToWorldCoords(
const char* objName,
WorldOrImageCoords& pos,
const char* nameServer,
FILE* feedback)
{
double ra, dec;
QueryResult result;
AstroCatalog* cat = AstroCatalog::open(nameServer);
if (cat == NULL)
return ERROR;
if (cat->getObject(objName, 0, NULL, result)) {
delete cat;
return ERROR;
}
if (result.get(0, cat->ra_col(), ra)
|| result.get(0, cat->dec_col(), dec)) {
delete cat;
return ERROR;
}
pos = WorldCoords(ra, dec, cat->equinox());
delete cat;
return 0;
}
示例2: pos
main()
{
// gcc doesn't need this, but SunCC does...
ios::sync_with_stdio();
// errors will be printed on stderr automatically
set_error_handler(print_error);
// open the GSC catalog
AstroCatalog* cat = AstroCatalog::open("test.table");
if (!cat) {
printf("LocalCatalog::open returned NULL\n");
exit(1);
}
// query the GSC for a list of objects at the given pos and radius
WorldCoords pos(3, 19, 48, 41, 30, 39);
AstroQuery q;
q.pos(pos);
q.radius(10);
q.maxRows(10);
cout << "Query GSC for objects at pos "
<< q.pos() << ", in radius "
<< q.radius1() << ".." << q.radius2()
<< ":"
<< endl;
QueryResult result;
int num_results = cat->query(q, "./tLocalCatalog.out", result);
if (num_results < 0) {
cout << "Query returned an error\n";
exit(1);
}
cout << "Query returns: "
<< num_results
<< " objects, out of "
<< q.maxRows()
<< " requested"
<< endl;
cout << "More objects ?: "
<< (cat->more() ? "YES" : "NO")
<< endl;
cout << "---Result List---"
<< endl;
int ncols = cat->numCols();
int i, j;
cout << "columns:\n";
for (i = 0; i < ncols; i++)
cout << cat->colName(i) << "\t";
cout << "\n\nresults:\n";
char* s;
for (i = 0; i < num_results; i++) {
// print the Id
if (result.get(i, 0, s) == 0)
cout << s << "\t";
else
cout << "ERROR\t";
// print the position in H:M:S+D:M:S
if (result.getPos(i, pos) == 0)
cout << pos.ra() << "\t" << pos.dec() << "\t";
else
cout << "ERROR\t";
// print the other columns
for (j = 3; j < ncols; j++) {
if (result.get(i, j, s) == 0)
cout << s << "\t";
else
cout << "ERROR\t";
}
cout << endl;
}
cout << "-----------------" << endl;
cout << "test searching by Id in a local catalog\n";
if (cat->getObject("GSC0286902884", 0, NULL, result) != 0) {
cout << "ERROR\n";
}
else {
cout << "OK\n" << result << endl;;
}
return 0;
}