Пример #1
0
        public ElevationFile(String filePath, DecimalGeoCoordinate location, TileResolution resolution)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException("filePath");
            }
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            Resolution = resolution;
            Location   = location;
            FilePath   = filePath;
        }
        /// <summary>
        /// Load a reference to an elevation file on disk.
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public ElevationFile LoadFile(String filePath)
        {
            if (filePath == null)
            {
                throw new ArgumentNullException("filePath");
            }
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(filePath);
            }

            TileResolution resolution = null;

            using (var fileStream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                long fileLength = fileStream.Length / 2;
                resolution = TileResolution.GetResolutionFromFileLength(fileLength);
            }

            var location = ParseGeoCoordinateFromFileName(filePath);

            return(new ElevationFile(filePath, location, resolution));
        }
Пример #3
0
 private void OnTileResolutionChanged(TileResolutionChanged message)
 {
     _tileResolution = message.TileResolution;
     CanExecuteChanged?.Invoke(this, EventArgs.Empty);
 }