8 #define DEBUG_READCSV false    11     : m_xMin(
std::numeric_limits<double>::max())
    13     , m_yMin(
std::numeric_limits<double>::max())
    29     for (uint i = 0; i < 
m_points.size(); ++i) {
    40     QString stringConverted;
    45         cout << 
"Le fichier " << filename.toStdString() << 
" va être lu." << endl;
    46     ifstream file(filename.toStdString().c_str()); 
    47     vector<int> correspondance(7); 
    56     for (uint i = 0; i < correspondance.size(); ++i) {
    57         correspondance[i] = -1;
    65         stringConverted = QString::fromStdString(value);
    68         QStringList text = stringConverted.split(
",");
    73         for (
int i = 0; i < text.size(); ++i) {
    75                 cout << 
"Colonne " << text[i].toStdString() << endl;
    76             if (text[i].contains(QString::fromStdString(
"X"), Qt::CaseInsensitive) && (!(text[i].contains(QString::fromStdString(
"max"), Qt::CaseInsensitive)))) {
    77                 correspondance[0] = i;
    79                     cout << 
"X DETECTED at colonne : " << i << endl;
    80             } 
else if ((text[i].contains(QString::fromStdString(
"Y"), Qt::CaseInsensitive)) && (!(text[i].contains(QString::fromStdString(
"Type"), Qt::CaseInsensitive)))) {
    81                 correspondance[1] = i;
    83                     cout << 
"Y DETECTED at colonne : " << i << endl;
    84             } 
else if (text[i].contains(QString::fromStdString(
"Lati"), Qt::CaseInsensitive)) {
    85                 correspondance[2] = i;
    87                     cout << 
"LATITUDE DETECTED at colonne : " << i << endl;
    88             } 
else if (text[i].contains(QString::fromStdString(
"Longi"), Qt::CaseInsensitive)) {
    89                 correspondance[3] = i;
    91                     cout << 
"LONGITUDE DETECTED at colonne : " << i << endl;
    92             } 
else if (text[i].contains(QString::fromStdString(
"Alti"), Qt::CaseInsensitive)) {
    93                 correspondance[4] = i;
    95                     cout << 
"ALTITUDE DETECTED at colonne : " << i << endl;
    96             } 
else if (text[i].contains(QString::fromStdString(
"Date"), Qt::CaseInsensitive)) {
    97                 correspondance[5] = i;
    99                     cout << 
"DATE DETECTED at colonne : " << i << endl;
   100             } 
else if ((text[i].contains(QString::fromStdString(
"Time"), Qt::CaseInsensitive)) || (text[i].contains(QString::fromStdString(
"Heure"), Qt::CaseInsensitive))) {
   101                 correspondance[6] = i;
   103                     cout << 
"Time DETECTED at colonne : " << i << endl;
   106                     cout << 
"Colonne " << text[i].toStdString() << 
" non reconnue" << endl;
   113         cout << 
"BEGIN CORRESPONDANCE" << endl;
   114     for (uint i = 0; i < correspondance.size(); ++i) {
   116             cout << correspondance[i] << endl;
   119         cout << 
"END CORRESPONDANCE" << endl;
   123     float latitude(0), longitude(0), altitude(0);
   124     QDateTime ts(QDateTime::currentDateTime());
   125     while (file.good()) {
   132         ts = QDateTime::currentDateTime();
   133         vector<QString> specificDate(2);
   135         getline(file, value);
   136         stringConverted = QString::fromStdString(value);
   138         if (stringConverted.length() != 0) 
   141                 cout << 
"Read new point" << endl;
   142             QStringList text = stringConverted.split(
",");
   143             for (
int i = 0; i < text.size(); ++i) {
   144                 if (i == correspondance[0]) {
   147                     x = text[i].toDouble();
   150                         cout << 
" X : " << x << 
" ";
   151                 } 
else if (i == correspondance[1]) {
   154                     y = text[i].toDouble();
   157                         cout << 
" Y : " << y << 
" ";
   158                 } 
else if (i == correspondance[2]) {
   161                     latitude = text[i].toFloat();
   164                         cout << 
" Latitude : " << latitude << 
" ";
   165                 } 
else if (i == correspondance[3]) {
   168                     longitude = text[i].toFloat();
   171                         cout << 
" Longitude : " << longitude << 
" ";
   172                 } 
else if (i == correspondance[4]) {
   175                     altitude = text[i].toFloat();
   178                         cout << 
" Altitude : " << altitude << 
" ";
   179                 } 
else if (i == correspondance[5]) {
   182                     specificDate[0] = text[i];
   184                         cout << 
" Date : " << specificDate[0].toStdString();
   186                 } 
else if (i == correspondance[6]) {
   189                     specificDate[1] = text[i];
   191                         cout << 
" Time : " << specificDate[1].toStdString();
   194             if ((specificDate[0].size() == 19) && (specificDate[1].size() == 0))
   195                 ts = QDateTime::fromString(specificDate[0], 
"yyyy-MM-dd hh:mm:ss");
   196             else if ((specificDate[0].size() == 11) && (specificDate[1].size() == 0))
   197                 ts = QDateTime::fromString(specificDate[0], 
"yyyy-MM-dd");
   198             else if ((specificDate[0].size() == 0) && (specificDate[1].size() == 8))
   199                 ts = QDateTime::fromString(specificDate[1], 
"hh:mm:ss");
   200             else if ((specificDate[0].size() == 10) && (specificDate[1].size() == 8)) {
   201                 ts = QDateTime(QDate::fromString(specificDate[0], 
"yyyy/MM/dd"), QTime::fromString(specificDate[1], 
"hh:mm:ss"));
   202             } 
else if ((specificDate[0].size() == 11) && (specificDate[1].size() == 8)) {
   206                 QLocale locale(QLocale::English, QLocale::UnitedStates);
   207                 ts = locale.toDateTime((specificDate[0] + specificDate[1]), 
"dd'-'MMM'-'yyyyhh':'mm':'ss");
   211                 cout << 
"timestamp : " << ts.toString(
"yyyy-MM-dd hh:mm:ss").toStdString();
   214             addPoint(x, y, altitude, ts.toTime_t());
   217                 cout << 
"Ligne ignorée" << endl;
   223         cout << 
"Le fichier de traces GPS " << filename.toStdString() << 
" a été lu." << endl;
   233     int initialNumberOfPoints(
m_points.size());
   234     emit 
signalMessage(QString(
"---\nTemporal filter initilizer ... ") + QString::number(initialNumberOfPoints) + QString(
" initial points") + QString(
"\nTemporal filter will delete each successive point withing interval of ") + QString::number(interval) + QString(
" seconds"));
   237     bool firstElement(
true);
   238     for (vector<PointGPS*>::iterator b = 
m_points.begin(); b != 
m_points.end();) {
   241             firstElement = 
false;
   244             if ((*b)->timeStamp() - pointPrecedent->
timeStamp() <= interval) {
   253     int endNumberOfPoints(
m_points.size());
   254     double reduction(((
double)(initialNumberOfPoints - endNumberOfPoints) * 100) / initialNumberOfPoints);
   255     emit 
signalMessage(QString(
"Temporal filter ended ... ") + QString::number(endNumberOfPoints) + QString(
" points left ") + QString(
" ( ") + QString::number(reduction, 
'g', 4) + QString(
" % of reduction)"));
   260     int initialNumberOfPoints(
m_points.size());
   261     emit 
signalMessage(QString(
"---\nSpatial filter initilizer ... ") + QString::number(initialNumberOfPoints) + QString(
" initial points") + QString(
"\nSpatial filter will delete each successive point withing interval of ") + QString::number(interval) + QString(
" meters"));
   263     for (uint i = 0; i < 
m_points.size(); i++) { 
   271     int endNumberOfPoints(
m_points.size());
   272     double reduction(((
double)(initialNumberOfPoints - endNumberOfPoints) * 100) / initialNumberOfPoints);
   273     emit 
signalMessage(QString(
"Spatial filter ended ... ") + QString::number(endNumberOfPoints) + QString(
" points left ") + QString(
" ( ") + QString::number(reduction, 
'g', 4) + QString(
" % of reduction)"));
   307     cout << 
"\n\t\t min (x,y) (" << 
m_xMin << 
", " << 
m_yMin << 
")";
   308     cout << 
"\n\t\t max (x,y) (" << 
m_xMax << 
", " << 
m_yMax << 
")" << endl;
   313     std::stringstream ss;
   316     ss << 
"\n\t\t min (x,y) (" << 
m_xMin << 
", " << 
m_yMin << 
")";
   317     ss << 
"\n\t\t max (x,y) (" << 
m_xMax << 
", " << 
m_yMax << 
")\n";
 
void temporalFilter(uint interval)
This is a temporal filter, which deletes points depending on a time value. 
 
void readFromCSV(QString filename)
Reads a csv file and inserts each point in m_points vector. 
 
std::vector< PointGPS * > getPoints()
getPoints Get the m_points vector 
 
void updateBox(double x, double y)
Update the enclosing box of the track. 
 
#define DISTANCE_THRESHOLD
 
void outputInfos()
Print some informations to user in console. 
 
Track()
Track's Constructor. 
 
void spaceFilter(double interval)
This is a space filter, which deletes points depending on a distance interval. 
 
void addPoint(double x, double y, float altitude, unsigned int timeStamp)
Creates a new point and inserts it in m_points. 
 
unsigned int timeStamp() const 
 
void applyThresholdToBox()
Apply a threshold to bounding box once the data file has been read. 
 
void delPointGPS(int occurrence)
Deletes a occurence. 
 
void signalMessage(QString)
 
std::string infos()
Return a string containing information about the content of this object. 
 
std::vector< PointGPS * > m_points
m_points Vector where points of the Track are saved 
 
std::string m_trackFullName