Beispiel #1
0
        public Map(string filename, Competition parentCompetition)
            : base()
        {
            Bitmap image = new Bitmap(filename);
            GpsPoint topLeftPoint;
            GpsPoint bottomRightPoint;
            double topLeftLatitude;
            double topLeftLongitude;
            double bottomRightLatitude;
            double bottomRightLongitude;
            string[] coordinatesFromPath = filename.Remove(filename.LastIndexOf(".")).Substring(filename.LastIndexOf(@"\") + 1).Split("_".ToCharArray());
            foreach (string coordinate in coordinatesFromPath)
            {
                if (coordinate.Length != 6 || coordinate == null || coordinate == string.Empty)
                {
                    throw (new FormatException("Coordinates in image name not in correct format!"));
                }
            }
            topLeftLongitude = Convert.ToDouble(coordinatesFromPath[0]);
            topLeftLatitude = Convert.ToDouble(coordinatesFromPath[1]);
            bottomRightLongitude = Convert.ToDouble(coordinatesFromPath[2]);
            bottomRightLatitude = Convert.ToDouble(coordinatesFromPath[3]);
            topLeftPoint = new GpsPoint(topLeftLatitude, topLeftLongitude, GpsPointFormatImport.Swiss);
            bottomRightPoint = new GpsPoint(bottomRightLatitude, bottomRightLongitude, GpsPointFormatImport.Swiss);

            this.image = image;
            this.mapName = filename;
            this.topLeftPoint = topLeftPoint;
            this.bottomRightPoint = bottomRightPoint;
            this.parcoursCollection = new ParcoursCollection();
            this.parentCompetition = parentCompetition;
        }
Beispiel #2
0
 public void AddRange(ParcoursCollection itemCollection)
 {
     foreach (Parcours item in itemCollection)
     {
         items.Add(item);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Creates a Map Object. 
 /// 
 /// </summary>
 /// <param name="image">Bitmap Image of the Location, corresponding to the GPS-Points</param>
 /// <param name="topLeftPoint">GPS Point with the Coordinates of the upper Left Point on the Map Image</param>
 /// <param name="bottomRightPoint">GPS Point with the Coordinates of the lower Right Point on the Map Image</param>
 public Map(Bitmap image, GpsPoint topLeftPoint, GpsPoint bottomRightPoint, Competition parentCompetition)
 {
     this.Image = image;
     this.TopLeftPoint = topLeftPoint;
     this.BottomRightPoint = bottomRightPoint;
     this.parcoursCollection = new ParcoursCollection();
     this.parentCompetition = parentCompetition;
 }
Beispiel #4
0
 public Map()
     : base()
 {
     this.parcoursCollection = new ParcoursCollection();
 }