7 #include <stdair/basic/BasConst_General.hpp>
8 #include <stdair/bom/BomManager.hpp>
9 #include <stdair/bom/SegmentDate.hpp>
10 #include <stdair/bom/SegmentCabin.hpp>
11 #include <stdair/bom/LegDate.hpp>
24 stdair::SegmentDate* lOperatingSegmentDate_ptr =
25 ioSegmentDate.getOperatingSegmentDate ();
26 if (lOperatingSegmentDate_ptr != NULL) {
32 const stdair::LegDateList_T& lLegDateList =
33 stdair::BomManager::getList<stdair::LegDate> (ioSegmentDate);
34 stdair::LegDateList_T::const_iterator itFirstLeg = lLegDateList.begin();
35 const stdair::LegDate* lFirstLeg_ptr = *itFirstLeg;
36 assert (lFirstLeg_ptr != NULL);
37 stdair::LegDateList_T::const_reverse_iterator itLastLeg =
38 lLegDateList.rbegin();
39 const stdair::LegDate* lLastLeg_ptr = *itLastLeg;
40 assert (lLastLeg_ptr != NULL);
43 const stdair::Date_T& lBoardingDate = lFirstLeg_ptr->getBoardingDate();
44 ioSegmentDate.setBoardingDate (lBoardingDate);
46 const stdair::Duration_T& lBoardingTime = lFirstLeg_ptr->getBoardingTime();
47 ioSegmentDate.setBoardingTime (lBoardingTime);
49 const stdair::Date_T& lOffDate = lLastLeg_ptr->getOffDate();
50 ioSegmentDate.setOffDate (lOffDate);
52 const stdair::Duration_T& lOffTime = lLastLeg_ptr->getOffTime();
53 ioSegmentDate.setOffTime (lOffTime);
58 const stdair::SegmentCabinList_T& lSegmentCabinList =
59 stdair::BomManager::getList<stdair::SegmentCabin> (ioSegmentDate);
60 for (stdair::SegmentCabinList_T::const_iterator itSC =
61 lSegmentCabinList.begin(); itSC != lSegmentCabinList.end(); ++itSC) {
62 stdair::SegmentCabin* lSC_ptr = *itSC;
63 assert (lSC_ptr != NULL);
74 const stdair::LegDateList_T& lLegDateList =
75 stdair::BomManager::getList<stdair::LegDate> (ioSegmentDate);
77 stdair::LegDateList_T::const_iterator itLegDate = lLegDateList.begin();
78 const stdair::LegDate* lCurrentLegDate_ptr = *itLegDate;
79 assert (lCurrentLegDate_ptr != NULL);
82 stdair::Duration_T lElapsedTime = lCurrentLegDate_ptr->getElapsedTime();
88 for (
const stdair::LegDate* lPreviousLegDate_ptr = lCurrentLegDate_ptr;
89 itLegDate != lLegDateList.end();
90 ++itLegDate, lPreviousLegDate_ptr = lCurrentLegDate_ptr) {
91 lCurrentLegDate_ptr = *itLegDate;
95 assert (lCurrentLegDate_ptr->getBoardingPoint()
96 == lPreviousLegDate_ptr->getOffPoint());
97 const stdair::Duration_T& lStopOverTime =
98 lCurrentLegDate_ptr->getBoardingTime() - lPreviousLegDate_ptr->getOffTime();
99 lElapsedTime += lStopOverTime;
102 const stdair::Duration_T& currentElapsedTime =
103 lCurrentLegDate_ptr->getElapsedTime();
104 lElapsedTime += currentElapsedTime;
108 ioSegmentDate.setElapsedTime (lElapsedTime);
116 const stdair::Duration_T& lElapsedTime = ioSegmentDate.getElapsedTime();
117 const double lElapseInHours=
static_cast<const double>(lElapsedTime.hours());
118 const long int lDistance =
119 static_cast<const long int>(stdair::DEFAULT_FLIGHT_SPEED*lElapseInHours);
120 ioSegmentDate.setDistance (lDistance);