Esempio n. 1
0
 public GpdWriter(string filePath, string[] fields, double sliceHeight)
 {
     _header = new GpdHeader
     {
         Version  = GpdHeader.EVersion.V1,
         Slice    = (float)sliceHeight,
         Fields   = fields ?? new[] { "x", "y", "z", "intensity" },
         Format   = GpdHeader.EFormat.GPD,
         Size     = new[] { GpdHeader.ESize.Double, GpdHeader.ESize.Double, GpdHeader.ESize.Double, GpdHeader.ESize.Double },
         Type     = new[] { GpdHeader.EType.F, GpdHeader.EType.F, GpdHeader.EType.F, GpdHeader.EType.F },
         DataType = GpdHeader.EDataType.BINARY
     };
     try
     {
         Directory.CreateDirectory(Path.GetDirectoryName(filePath) !);
         var fileStream     = File.Open(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
         var bufferedStream = new BufferedStream(fileStream, 4096);
         _binaryWriter = new BinaryWriter(bufferedStream);
         PrependMetadataHeader();
         CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Esempio n. 2
0
        public GpdReader(string inputFile)
        {
            _fileInfo   = new FileInfo(inputFile);
            _fileStream = File.Open(inputFile, FileMode.Open);
            var bufferedStream = new BufferedStream(_fileStream);

            _binaryReader = new BinaryReader(bufferedStream);
            Header        = new GpdHeader(_fileStream);
            _fileStream.Seek(Header.HeaderBytes, SeekOrigin.Begin);
        }