Changeset 14676
- Timestamp:
- 11/21/12 15:32:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/drivectrl.cc
r14669 r14676 701 701 Source() : ra(0), dec(0), offset(0) 702 702 { 703 angle[0] = angle[1] = 0; 703 angle[0] = -90; 704 angle[1] = 90; 704 705 } 705 706 … … 1402 1403 } 1403 1404 1405 bool AddSource(const string &name, const Source &src) 1406 { 1407 const auto it = fSources.find(name); 1408 if (it!=fSources.end()) 1409 T::Warn("Source '"+name+"' already in list... overwriting."); 1410 1411 fSources[name] = src; 1412 return it==fSources.end(); 1413 } 1414 1404 1415 void ReadDatabase(bool print=true) 1405 1416 { … … 1410 1421 1411 1422 const mysqlpp::StoreQueryResult res = 1412 db.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store();1423 db.query("SELECT fSourceName, fRightAscension, fDeclination, fWobbleOffset, fWobbleAngle0, fWobbleAngle1 FROM source").store(); 1413 1424 1414 1425 fSources.clear(); 1415 1426 for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++) 1416 1427 { 1428 const string name = (*v)[0].c_str(); 1429 1417 1430 Source src; 1418 1431 src.ra = (*v)[1]; 1419 1432 src.dec = (*v)[2]; 1420 const string name = (*v)[0].c_str(); 1421 1422 // FIXME: Check double names 1423 fSources[name] = src; 1424 1425 if (print) 1426 { 1427 ostringstream msg; 1428 msg << " " << name << setprecision(8) << ": Ra=" << src.ra << "h Dec=" << src.dec << "deg"; 1429 T::Message(msg); 1430 } 1433 src.offset = (*v)[3]; 1434 src.angle[0] = (*v)[4]; 1435 src.angle[1] = (*v)[5]; 1436 AddSource(name, src); 1437 1438 if (!print) 1439 continue; 1440 1441 ostringstream msg; 1442 msg << " " << name << setprecision(8) << ": Ra=" << src.ra << "h Dec=" << src.dec << "deg"; 1443 msg << " Wobble=[" << src.offset << "," << src.angle[0] << "," << src.angle[1] << "]"; 1444 T::Message(msg); 1431 1445 } 1432 1446 #else … … 1449 1463 1450 1464 string name; 1451 double ra=0;1452 double dec=0;1453 1465 1454 1466 int i=0; 1467 1468 Source src; 1455 1469 1456 1470 string buffer; … … 1462 1476 { 1463 1477 case 0: name = buffer; break; 1464 case 1: ra = ConnectionDrive::ReadAngle(is); break; 1465 case 2: dec = ConnectionDrive::ReadAngle(is); break; 1478 case 1: src.ra = ConnectionDrive::ReadAngle(is); break; 1479 case 2: src.dec = ConnectionDrive::ReadAngle(is); break; 1480 case 3: is >> src.offset; break; 1481 case 4: is >> src.angle[0]; break; 1482 case 5: is >> src.angle[1]; break; 1466 1483 } 1467 1484 … … 1470 1487 } 1471 1488 1472 if (i==3 )1489 if (i==3 || i==6) 1473 1490 { 1474 Source src; 1475 src.ra = ra; 1476 src.dec = dec; 1477 1478 // FIXME: Check double names 1479 fSources[name] = src; 1491 AddSource(name, src); 1492 continue; 1480 1493 } 1494 1495 T::Warn("Resource 'source' not correctly formatted: '"+*it+"'"); 1481 1496 } 1482 1497
Note:
See TracChangeset
for help on using the changeset viewer.