[534] | 1 | // toiauxgpsproducer.cc
|
---|
| 2 | // Eric Aubourg CEA/DAPNIA/SPP octobre 1999
|
---|
| 3 |
|
---|
| 4 | #include "toiauxgpsproducer.h"
|
---|
| 5 | #include "archparam.h"
|
---|
| 6 | #include "archexc.h"
|
---|
| 7 | #include "requesthandler.h"
|
---|
| 8 |
|
---|
| 9 | #define latitude "latitude"
|
---|
| 10 | #define longitude "longitude"
|
---|
| 11 | #define altitude "altitude"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | TOIAuxGPSProducer::TOIAuxGPSProducer(AuxGPS* aux)
|
---|
| 15 | : auxGPS(aux)
|
---|
| 16 | {
|
---|
| 17 | possibleTOIs.insert(TOI(latitude, TOI::unspec, "auxGPS interp", "degrees")); // + = NORTH
|
---|
| 18 | possibleTOIs.insert(TOI(longitude, TOI::unspec, "auxGPS interp", "degrees")); // + = EAST
|
---|
| 19 | possibleTOIs.insert(TOI(altitude, TOI::unspec, "auxGPS interp", "meters"));
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | string TOIAuxGPSProducer::getName() {
|
---|
| 23 | return("TOIAuxGPSProducer 1.0");
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | long TOIAuxGPSProducer::firstSampleNum(TOI const& toi) {
|
---|
| 29 | CHKPROD
|
---|
| 30 | return -99999999;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | long TOIAuxGPSProducer::lastSampleNum(TOI const& toi) {
|
---|
| 34 | CHKPROD
|
---|
| 35 | return 99999999;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | bool TOIAuxGPSProducer::canGetValue(long sampleNum, TOI const& toi) {
|
---|
| 39 | CHKPROD
|
---|
| 40 | return auxGPS->canGetLocation(archParam.acq.SN2MJD(sampleNum));
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | bool TOIAuxGPSProducer::canGetValueLater(long /*sampleNum*/, TOI const& toi) {
|
---|
| 44 | CHKPROD
|
---|
| 45 | return false; // we can always get value NOW
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | bool TOIAuxGPSProducer::canGetPrevValue(long sampleNum, TOI const& toi) {
|
---|
| 49 | CHKPROD
|
---|
| 50 | return canGetValue(sampleNum-1, toi);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | bool TOIAuxGPSProducer::canGetNextValue(long sampleNum, TOI const& toi) {
|
---|
| 54 | CHKPROD
|
---|
| 55 | return canGetValue(sampleNum+1, toi);
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | double TOIAuxGPSProducer::getValue(long sampleNum, TOI const& toi) {
|
---|
| 59 | CHKPROD
|
---|
| 60 | double lat, lon, alt;
|
---|
| 61 | auxGPS->getLocation(archParam.acq.SN2MJD(sampleNum), lat, lon, alt);
|
---|
| 62 | if (toi.name == latitude) return lat;
|
---|
| 63 | if (toi.name == longitude) return lon;
|
---|
| 64 | if (toi.name == altitude) return alt;
|
---|
| 65 | throw ArchExc("TOIAuxGPSProducer inconsistence " + toi.name);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | double TOIAuxGPSProducer::getPrevValue(long& sampleNum, TOI const& toi) {
|
---|
| 69 | sampleNum--;
|
---|
| 70 | return getValue(sampleNum, toi);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | double TOIAuxGPSProducer::getNextValue(long& sampleNum, TOI const& toi) {
|
---|
| 74 | sampleNum++;
|
---|
| 75 | return getValue(sampleNum, toi);
|
---|
| 76 | }
|
---|
| 77 |
|
---|