15 #include "utl/UTCDateTime.h"
19 #include "boost/lexical_cast.hpp"
21 using namespace RdAirplane;
24 using namespace RdAirplane::Util;
33 _airplane_(pAirplane),
34 _earliestEvent_(NULL),
63 vector<const TimeStamp*> timesForInterpolation;
64 vector<const UTMPoint*> coordForInterpolation;
65 for(Ads_bEventSet::iterator iter = ads_bEvents.begin(); iter != ads_bEvents.end(); ++iter) {
67 const UTMPoint& eventCoordinates =
event->getCoordinates(pAltitudeType);
68 const TimeStamp& time =
event->getCaptureTime();
69 if(!timesForInterpolation.empty() &&
71 iter == --ads_bEvents.end())) {
72 if(timesForInterpolation.size()>3) {
76 timesForInterpolation.clear();
77 coordForInterpolation.clear();
79 timesForInterpolation.push_back(&time);
80 coordForInterpolation.push_back(&eventCoordinates);
89 switch(pAltitudeType) {
98 throw runtime_error(
"Encountered an unknown altitude type.");
106 switch(pAltitudeType) {
116 throw runtime_error(
"Encountered an unknown altitude type.");
131 string year = boost::lexical_cast<
string>(time.GetYear());
133 sprintf(month_c,
"%02d", time.GetMonth());
135 sprintf(day_c,
"%02d", time.GetDay());
137 sprintf(hour_c,
"%02d", time.GetHour());
139 sprintf(minute_c,
"%02d", time.GetMinute());
140 string timeIdendifier = year+month_c+day_c+hour_c+minute_c;
151 if(event->ShouldBeFilteredOut()) {
156 switch(event->getAltitudeType()) {
168 throw runtime_error(
"Encountered an unknown altitude type.");
191 for(InterpolatorList::const_iterator iter = interpolators.begin(); iter!=interpolators.end(); ++iter) {
192 if((*iter)->isTimeInInterpolatedRange(pTime)) {
194 point =
new Point((*iter)->getCoordinates(pTime));
217 for(InterpolatorList::const_iterator iter = interpolators.begin(); iter!=interpolators.end(); ++iter) {
218 if((*iter)->isTimeInInterpolatedRange(pTime)) {
220 speed =
new Vector((*iter)->getDerivative(pTime));
240 info <<
"\t Flight Id: " <<
getId() << endl
243 info <<
"\t\t pressure altitude interpolated:" << endl;
245 for(InterpolatorList::const_iterator iter = interpolators.begin(); iter != interpolators.end(); ++iter) {
246 info <<
"\t\t\t" << (*iter)->getInformation() << endl;
248 info <<
"\t\t corrected pressure altitude interpolated:" << endl;
250 for(InterpolatorList::const_iterator iter = interpolators.begin(); iter != interpolators.end(); ++iter) {
251 info <<
"\t\t\t" << (*iter)->getInformation() << endl;
253 info <<
"\t\t GPS altitude interpolated:" << endl;
255 for(InterpolatorList::const_iterator iter = interpolators.begin(); iter != interpolators.end(); ++iter) {
256 info <<
"\t\t\t" << (*iter)->getInformation() << endl;
const Ads_bDataBase & getAdsBDataBase() const
InterpolatorList _interpolatorsGPSAltitude_
const Ads_bEvent * getEarliestAds_bEvent() const
utl::CoordinateSystemPtr getCoordinateSystem() const
Class to hold and convert a point in geodetic coordinates.
utl::Point * getPosition(const utl::TimeStamp &pTime, Ads_bEvent::AltitudeType pAltitudeType) const
Flight(Airplane *pAirplane)
InterpolatorList _interpolatorsGDASCorrectedPressureAltitude_
std::list< Interpolator3D * > InterpolatorList
void _interpolateAds_bEvents(Ads_bEvent::AltitudeType pAltitudeType)
const Ads_bEventSet & getAdsbEvents() const
const Airplane & getAirplane() const
Ads_bEventSet _ads_bEventsAll_
const Ads_bEvent * _latestEvent_
A TimeStamp holds GPS second and nanosecond for some event.
static const utl::TimeInterval & MaxAllowedTimeBetweenADS_BEventsForInterpolation()
utl::Vector * getSpeed(const utl::TimeStamp &pTime, Ads_bEvent::AltitudeType pAltitudeType) const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Ads_bEventSet _ads_bEventsPressureAltitude_
const std::string & getId() const
const AirplaneOffset * _offset_
const Ads_bEvent * _earliestEvent_
Ads_bEventSet & _getAdsbEvents(Ads_bEvent::AltitudeType pAltitudeType) const
Ads_bEventSet _ads_bEventsCorrectedPressureAltitude_
InterpolatorList _interpolatorsPressureAltitude_
const Ads_bEvent * getLatestAds_bEvent() const
A TimeInterval is used to represent time elapsed between two events.
const utl::TimeStamp & getCaptureTime() const
void deleteAllPointersInContainer(ContainerType &pContainer)
bool isTimeDuringFlight(const utl::TimeStamp &pTime) const
std::set< Ads_bEvent *, Ads_bEventComparator > Ads_bEventSet
const AirplaneOffset * getAirplaneOffset(const Airplane &pAirplane, const utl::TimeStamp &pTime) const
std::string getInfo() const
const std::string & getId() const
InterpolatorList _interpolatorsManuallyCorrectedPressureAltitude_
Ads_bEventSet _ads_bEventsGPSAltitude_
InterpolatorList & _getInterpolators(Ads_bEvent::AltitudeType pAltitudeType) const
Ads_bEvent * addAds_bEvent(const utl::TimeStamp &pCaptureTime, const utl::UTMPoint &pCoordinates, const std::string &pAds_bMessageAsHex)