From c3c36ab0c93f3539c9aebbf3bf77018517c087e2 Mon Sep 17 00:00:00 2001
From: remi cresson <remi.cresson@teledetection.fr>
Date: Mon, 5 Feb 2018 16:33:59 +0000
Subject: [PATCH] ADD: new method IsInRange (startmonth, startday, nbofdays)

---
 include/otbDates.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/otbDates.h b/include/otbDates.h
index cf32621..edb5834 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++)
     {
-- 
GitLab