diff --git a/include/otbDates.h b/include/otbDates.h index cf3262179586406d6cd357e023f192cb741825fb..edb58340266cb7d018b02b0d72f3bcca8069896a 100644 --- a/include/otbDates.h +++ b/include/otbDates.h @@ -60,7 +60,10 @@ public: ~SingleDate (){} - bool IsInRange(const int& startMonth,const int& startDay,const int& endMonth, const int& endDay) const + /* + * Return true if the date is in the time range given by (startmonth; startday; endmonth, endday) + */ + bool IsInRange(const int& startMonth, const int& startDay, const int& endMonth, const int& endDay) const { if (startMonth < month && month < endMonth) { @@ -80,6 +83,16 @@ public: } } + /* + * Return true if the date is in the time range given by (startmonth; startday; nbOfDays) + */ + bool IsInRange(const int& startMonth, const int& startDay, const int& nbOfDays) const + { + SingleDate startDate(year, startMonth, startDay); + + return startDate.julianday <= julianday && julianday <= startDate.julianday + nbOfDays; + } + int day; int month; int year; @@ -93,7 +106,7 @@ typedef std::vector<SingleDate> DatesType; * Input string must be in the form of "YYYYMMDD ....." */ DatesType GetDatesFromStringVector(std::vector<std::string> & list, bool check_order = true){ -std::cout << "GetDatesFromStringVector" << std::endl; + DatesType dates; for (unsigned int i = 0 ; i < list.size() ; i++) {