Esempio n. 1
0
        /// <summary>
        /// Reads a .bt (Binary terrain) file.
        /// http://www.vterrain.org/Implementation/Formats/BT.html
        /// </summary>
        /// <param name="stream">
        /// The stream.
        /// </param>
        public void ReadTerrainFile(cITerrainElevation Data)
        {
            //var buffer = reader.ReadBytes(10);
            //var enc = new ASCIIEncoding();
            //var marker = enc.GetString(buffer);
            //if (!marker.StartsWith("binterr"))
            //{
            //    throw new FileFormatException("Invalid marker.");
            //}

            //var version = marker.Substring(7);


            this.Width  = Data.Width;
            this.Height = Data.Height;
            //short dataSize = reader.ReadInt16();
            //bool isFloatingPoint = reader.ReadInt16() == 1;
            //short horizontalUnits = reader.ReadInt16();
            //short utmZone = reader.ReadInt16();
            //short datum = reader.ReadInt16();
            this.Left   = 0;
            this.Right  = Data.Width;
            this.Bottom = Data.Height;
            this.Top    = 0;
            //short proj = reader.ReadInt16();
            //float scale = reader.ReadSingle();
            //var padding = reader.ReadBytes(190);

            //int index = 0;
            this.Data     = Data.Data; //new double[this.Width * this.Height];
            this.MinimumZ = Data.Minimum;
            this.MaximumZ = Data.Maximum;
            this.Scale    = Data.Scale;
        }
Esempio n. 2
0
        /// <summary>
        /// Loads the specified file.
        /// </summary>
        /// <param name="source">
        /// The file name.
        /// </param>
        public void Load(cITerrainElevation Data)
        {
            if (Data == null)
            {
                throw new ArgumentNullException("source");
            }

            this.ReadTerrainFile(Data);
        }