Exemple #1
0
        /// <summary>
        /// returns the map image at index _currentTurn
        /// </summary>
        public Image getTurnMap(int height, int width)
        {
            Image     image    = null;
            TrackPath turnPath = new TrackPath();

            turnPath.Round   = false;
            turnPath.Weight  = 10;
            turnPath.MapType = _path.MapType;
            string mapSize = width.ToString() + "x" + height.ToString() + "&";

            if (_turns != null && _turns.Count > _currentTurn)
            {
                for (int i = _turns[_currentTurn].Locs[0].GpxLocation.Index;
                     i <= _turns[_currentTurn].Locs[2].GpxLocation.Index; i++)
                {
                    turnPath.Locations.Add(_path.Locations[i]);
                }
            }
            turnPath.GeocodeLocations = turnPath.Locations;
            // download web image
            if (turnPath != null && turnPath.Locations.Count > 0)
            {
                //incedentally, getting the path string sorts the locations
                string turnPathUrl = turnPath.getPathUrlString();
                if (_turnImages[_currentTurn] == null)
                {
                    image = _web.downloadImage(_baseMapUrl + mapSize
                                               + turnPathUrl + "&sensor=false");
                    if (image == null)
                    {
                        _status = _web.Status;
                    }
                    else
                    {
                        image = new Bitmap(image);
                        _turnImages[_currentTurn] = image;
                    }
                }
                else
                {
                    image = _turnImages[_currentTurn];
                }
                if (image != null)
                {
                    drawOnTurnMap(ref image, turnPath);
                }
            }
            return(image);
        }
Exemple #2
0
        /// <summary>
        /// returns the image of the ride map
        /// </summary>
        public Image getRideMap(bool downloadNew, int height, int width)
        {
            Image mapImage = null;

            _mapSize = width.ToString() + "x" + height.ToString() + "&";
            // download web image
            if (_path != null && _path.Locations.Count > 0 && width != 0 && height != 0)
            {
                if (downloadNew)
                {
                    _mapImage = _web.downloadImage(_baseMapUrl + _mapSize
                                                   + _path.getPathUrlString() + "&sensor=false");
                    if (_mapImage == null)
                    {
                        _status = _web.Status;
                    }
                    else
                    {
                        _mapImage = new Bitmap(_mapImage);
                        _rideMapFid.processImage((Bitmap)_mapImage);
                        if (_rideMapFid.MapLocated)
                        {
                            _rideMapFid.setCorrespondence(_path.UpperLeft, _path.LowerRight);
                        }
                    }
                }
                if (_mapImage != null)
                {
                    mapImage = new Bitmap(_mapImage);
                    drawnOnRideMap(ref mapImage, _path);
                }
            }
            else
            {
                mapImage = _web.downloadImage(_baseMapUrl + _mapSize + "&sensor=false");
                if (_mapImage == null)
                {
                    _status = _web.Status;
                }
            }
            _drawnOnMapImage = mapImage;
            return(mapImage);
        }
 /// <summary>
 /// returns the map image at index _currentTurn
 /// </summary>
 public Image getTurnMap(int height, int width)
 {
     Image image = null;
     TrackPath turnPath = new TrackPath();
     turnPath.Round = false;
     turnPath.Weight = 10;
     turnPath.MapType = _path.MapType;
     string mapSize = width.ToString() + "x" + height.ToString() + "&";
     if (_turns != null && _turns.Count > _currentTurn) {
         for (int i = _turns[_currentTurn].Locs[0].GpxLocation.Index;
             i <= _turns[_currentTurn].Locs[2].GpxLocation.Index; i++)
             turnPath.Locations.Add(_path.Locations[i]);
     }
     turnPath.GeocodeLocations = turnPath.Locations;
     // download web image
     if (turnPath != null && turnPath.Locations.Count > 0) {
         //incedentally, getting the path string sorts the locations
         string turnPathUrl = turnPath.getPathUrlString();
         if (_turnImages[_currentTurn] == null) {
             image = _web.downloadImage(_baseMapUrl + mapSize
                 + turnPathUrl + "&sensor=false");
             if (image == null) _status = _web.Status;
             else {
                 image = new Bitmap(image);
                 _turnImages[_currentTurn] = image;
             }
         } else {
             image = _turnImages[_currentTurn];
         }
         if (image != null)
             drawOnTurnMap(ref image, turnPath);
     }
     return image;
 }