public bool LoadFromCsvFormat(string filename, string type, List <Coordonnees> coordList)
 {
     coordList.Clear();
     using (var reader = new StreamReader(filename)) {
         while (!reader.EndOfStream)
         {
             string   line   = reader.ReadLine();
             string[] values = line.Split(';');
             if (values.Length == 2)
             {
                 Coordonnees newCoord = new Coordonnees(Convert.ToDouble(values[0]), Convert.ToDouble(values[1]));
                 coordList.Add(newCoord);
             }
             else if (values.Length == 3)
             {
                 POI newPOI = new POI(Convert.ToDouble(values[0]), Convert.ToDouble(values[1]), values[2]);
                 coordList.Add(newPOI);
             }
         }
     }
     if (coordList.Count() > 0)
     {
         if (type == "POI")
         {
             return(coordList.Count() == 1);
         }
         else if (type == "Travel")
         {
             return(coordList.Count() > 1);
         }
         return(false);
     }
     return(true);
 }
Exemple #2
0
        public override bool IsPointClose(double latitude, double longitude, double precision)
        {
            if (ListeCoord != null)
            {
                POI    temp = new POI(latitude, longitude, "Comparer");
                double xMin = 100, xMax = -100, yMin = 100, yMax = -100;

                foreach (Coordonnees c in ListeCoord)
                {
                    xMin = 100; xMax = -100; yMin = 100; yMax = -100;
                    if (c.Longitude > xMax)
                    {
                        xMax = c.Longitude;
                    }
                    if (c.Longitude < xMin)
                    {
                        xMin = c.Longitude;
                    }
                    if (c.Latitude > yMax)
                    {
                        yMax = c.Latitude;
                    }
                    if (c.Latitude < yMin)
                    {
                        yMin = c.Latitude;
                    }

                    // si la distance qui sépare le point d’un des segments de celle-ci est inférieure à la précision
                    if (temp.IsPointClose(c.Latitude, c.Longitude, precision))                     // returns true when it shouldn't
                    {
                        return(true);
                    }
                }

                /* un point se trouve proche de la ligne si elle est proche d’un de ses points
                 * si notre point est compris entre les points min et max, il est proche
                 */
                return((xMin <= longitude && longitude <= xMax) && (yMin <= latitude && latitude <= yMax));
            }
            return(false);
        }
Exemple #3
0
 public Polyline(POI refPOI, string description, Color color, int largeur)
 {
     NextId();
     _listPOI = new List <POI>();
     Largeur  = largeur;
     AddPOI(refPOI);
     if (description != "Description")
     {
         Description = description;
     }
     else
     {
         Description = "Polyline";
     }
     if (color != null)
     {
         Colour = color;
     }
     else
     {
         Colour = Color.Red;
     }
 }
Exemple #4
0
 public void AddPOI(POI unPOI)
 {
     ListPOI.Add(unPOI);
     return;
 }
Exemple #5
0
 public Polyline(POI pPOI)
 {
     NextId();
     LPOI = new List <POI>();
     LPOI.Add(pPOI);
 }
Exemple #6
0
 public POI(POI poi) : this(poi.Latitude, poi.Longitude, poi.Description, poi.Fill)
 {
 }                                                                                      // Copy constructor
Exemple #7
0
 public POI(POI copie) : this(copie.Description, new Coordonnees(copie.Latitude, copie.Longitude))
 {
 }
Exemple #8
0
 public POI(POI copie) : this(copie.Description, new Coordonnees(copie.Latitude, copie.Longitude))
 {
     Debug.Log("[POI][Constructeur]copie");
 }