예제 #1
0
 public LAZStreamReader(string path, LASHeader header, LASVLR lazEncodedVLR)
 {
     m_path          = path;
     m_header        = header;
     m_lazEncodedVLR = lazEncodedVLR;
     m_laz           = new LAZInterop(m_path, m_header.OffsetToPointData, m_lazEncodedVLR.Data);
 }
예제 #2
0
 public LAZStreamReader(string path, LASHeader header, LASVLR lazEncodedVLR)
 {
     m_path = path;
     m_header = header;
     m_lazEncodedVLR = lazEncodedVLR;
     m_laz = new LAZInterop(m_path, m_header.OffsetToPointData, m_lazEncodedVLR.Data);
 }
예제 #3
0
 public bool IsCompatible(LASHeader other)
 {
     return(
         m_quantization == other.m_quantization &&
         m_pointDataRecordFormat == other.m_pointDataRecordFormat &&
         m_pointDataRecordLength == other.m_pointDataRecordLength
         );
 }
예제 #4
0
파일: LASFile.cs 프로젝트: jdauie/cloudae
        public LASFile(string path, LASHeader header, LASVLR[] vlrs, LASEVLR[] evlrs)
            : base(path)
        {
            m_header = header;
            m_vlrs = vlrs;
            m_evlrs = evlrs;

            using (var stream = File.Create(FilePath))
            {
                using (var writer = new FlexibleBinaryWriter(stream))
                {
                    header.Serialize(writer);
                }

                //header.WriteVLRs(stream, vlrs);
            }

            m_extent = m_header.Extent;
        }
예제 #5
0
파일: LASFile.cs 프로젝트: PCLC7Z2/cloudae
        public LASFile(string path, LASHeader header, LASVLR[] vlrs, LASEVLR[] evlrs)
            : base(path)
        {
            m_header = header;
            m_vlrs   = vlrs;
            m_evlrs  = evlrs;

            using (var stream = File.Create(FilePath))
            {
                using (var writer = new FlexibleBinaryWriter(stream))
                {
                    header.Serialize(writer);
                }

                //header.WriteVLRs(stream, vlrs);
            }

            m_extent = m_header.Extent;
        }
예제 #6
0
파일: LASFile.cs 프로젝트: jdauie/cloudae
        public LASFile(string path)
            : base(path)
        {
            if (Exists)
            {
                try
                {
                    using (var stream = StreamManager.OpenReadStream(FilePath))
                    {
                        using (var reader = new FlexibleBinaryReader(stream))
                        {
                            m_header = reader.ReadLASHeader();
                        }

                        m_vlrs = m_header.ReadVLRs(stream);
                        m_evlrs = m_header.ReadEVLRs(stream);
                    }

                    m_extent = m_header.Extent;
                }
                catch { }
            }
        }
예제 #7
0
파일: LASFile.cs 프로젝트: PCLC7Z2/cloudae
        public static LASFile Create(string path, IPointCloudBinarySource source)
        {
            var pcbs = source as PointCloudSource;

            if (pcbs != null)
            {
                var lasFile = pcbs.FileHandler as LASFile;
                if (lasFile != null)
                {
                    var evlrs = (new List <LASEVLR>(lasFile.m_evlrs)
                    {
                        new LASEVLR(new LASRecordIdentifier("Jacere", 0), null),
                        new LASEVLR(new LASRecordIdentifier("Jacere", 1), null)
                    }).ToArray();

                    var header = new LASHeader(new [] { lasFile.Header }, lasFile.m_vlrs, evlrs);
                    return(new LASFile(path, header, lasFile.m_vlrs, evlrs));
                }
            }

            // this will require more work
            return(new LASFile(path));
        }
예제 #8
0
파일: LASFile.cs 프로젝트: PCLC7Z2/cloudae
        public LASFile(string path)
            : base(path)
        {
            if (Exists)
            {
                try
                {
                    using (var stream = StreamManager.OpenReadStream(FilePath))
                    {
                        using (var reader = new FlexibleBinaryReader(stream))
                        {
                            m_header = reader.ReadLASHeader();
                        }

                        m_vlrs  = m_header.ReadVLRs(stream);
                        m_evlrs = m_header.ReadEVLRs(stream);
                    }

                    m_extent = m_header.Extent;
                }
                catch { }
            }
        }
예제 #9
0
파일: LASHeader.cs 프로젝트: jdauie/cloudae
 public bool IsCompatible(LASHeader other)
 {
     return (
         m_quantization == other.m_quantization &&
         m_pointDataRecordFormat == other.m_pointDataRecordFormat &&
         m_pointDataRecordLength == other.m_pointDataRecordLength
     );
 }
예제 #10
0
파일: LASHeader.cs 프로젝트: jdauie/cloudae
        /// <summary>
        /// This will only work if point format, point length, offset, and scale are identical.
        /// </summary>
        public LASHeader(LASHeader[] headers, LASVLR[] vlrs, LASEVLR[] evlrs)
        {
            var header = headers[0];
            var extent = headers.Select(h => h.m_extent).Union3D();

            var points = (ulong)headers.Sum(h => (long)h.m_numberOfPointRecords);
            var pointsByReturn = new ulong[15];
            for (var i = 0; i < pointsByReturn.Length; i++)
            {
                pointsByReturn[i] = (ulong)headers.Sum(h => (long)h.m_numberOfPointsByReturn[i]);
            }

            uint legacyPoints = 0;
            uint[] legacyPointsByReturn;

            if (points > uint.MaxValue)
            {
                legacyPoints = 0;
                legacyPointsByReturn = new uint[5];
            }
            else
            {
                legacyPoints = (uint)points;
                legacyPointsByReturn = pointsByReturn.Take(5).Select(c => (uint)c).ToArray();
            }

            m_fileSourceID = header.m_fileSourceID;

            m_globalEncoding = header.m_globalEncoding;
            m_projectID = header.m_projectID;
            m_version = LASVersionInfo.Create(LASVersion.LAS_1_4);

            m_systemIdentifier = header.m_systemIdentifier;
            m_generatingSoftware = header.m_generatingSoftware;
            m_fileCreationDayOfYear = header.m_fileCreationDayOfYear;
            m_fileCreationYear = header.m_fileCreationYear;

            m_headerSize = c_minHeaderSize[LASVersion.LAS_1_4];
            m_offsetToPointData = m_headerSize + (uint)vlrs.Sum(vlr => vlr.Length);

            m_numberOfVariableLengthRecords = (uint)vlrs.Length;
            m_pointDataRecordFormat = header.m_pointDataRecordFormat;
            m_pointDataRecordLength = header.m_pointDataRecordLength;

            if (points > uint.MaxValue)
            {
                m_legacyNumberOfPointRecords = 0;
                m_legacyNumberOfPointsByReturn = new uint[5];
            }
            else
            {
                m_legacyNumberOfPointRecords = legacyPoints;
                m_legacyNumberOfPointsByReturn = legacyPointsByReturn;
            }

            m_quantization = header.m_quantization;
            m_extent = extent;

            m_startOfWaveformDataPacketRecord = 0;

            m_startOfFirstExtendedVariableLengthRecord = m_offsetToPointData + (points * m_pointDataRecordLength);
            m_numberOfExtendedVariableLengthRecords = (uint)evlrs.Length;
            m_numberOfPointRecords = points;

            m_numberOfPointsByReturn = pointsByReturn;
        }
예제 #11
0
파일: LASFile.cs 프로젝트: jdauie/cloudae
        public static LASFile Create(string path, IPointCloudBinarySource source)
        {
            var pcbs = source as PointCloudSource;
            if (pcbs != null)
            {
                var lasFile = pcbs.FileHandler as LASFile;
                if (lasFile != null)
                {
                    var evlrs = (new List<LASEVLR>(lasFile.m_evlrs)
                    {
                        new LASEVLR(new LASRecordIdentifier("Jacere", 0), null),
                        new LASEVLR(new LASRecordIdentifier("Jacere", 1), null)
                    }).ToArray();

                    var header = new LASHeader(new [] {lasFile.Header}, lasFile.m_vlrs, evlrs);
                    return new LASFile(path, header, lasFile.m_vlrs, evlrs);
                }
            }

            // this will require more work
            return new LASFile(path);
        }