Пример #1
0
        private IObservable <Unit> Download(GeoCoordinate coordinate)
        {
            _trace.Info(TraceCategory, "downloading data for {0}", coordinate.ToString());
            return(_downloader.Download(coordinate).SelectMany(bytes =>
            {
                _trace.Info(TraceCategory, "downloaded {0} bytes", bytes.Length.ToString());
                _hgtData = CompressionUtils.Unzip(bytes).Single().Value;
                InitData((int)coordinate.Latitude, (int)coordinate.Longitude);
                // store data to disk
                var path = GetFilePath(_srtmLat, _srtmLon);
                _trace.Info(TraceCategory, "storing as {0}", path);
                using (var stream = _fileSystemService.WriteStream(path))
                    stream.Write(_hgtData, 0, _hgtData.Length);

                return Observable.Return <Unit>(Unit.Default);
            }));
        }