public List <SoundingData> ExtractSoundings() { DataRecord dr = VectorPtrs[0].Vector.DataRecord; var sg3d = dr.Fields.GetFieldByTag("SG3D"); var bytes = sg3d.Bytes; var length = bytes.Length - 1; int currentIndex = 0; var soundingDatas = new List <SoundingData>(); //to stop at DataField.UnitTerminator while reading coordinates is a bug: "31" can occur like any other byte to encode the XCOO or YCOO coordinates //e.g. it is the first byte of latitude 34.6188063 (31+26880+10616832+335544320) //while (currentIndex < length && bytes[currentIndex] != DataField.UnitTerminator) //this is a bug: unit terminator causes premature termination while (currentIndex < length) { var soundingData = new SoundingData(); for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.Y += tempVal; } soundingData.Y /= baseFile.coordinateMultiplicationFactor; for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.X += tempVal; } soundingData.X /= baseFile.coordinateMultiplicationFactor; for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.depth += tempVal; } soundingData.depth /= baseFile.soundingMultiplicationFactor; soundingDatas.Add(soundingData); } return(soundingDatas); }
public List <SoundingData> ExtractSoundings() { DataRecord dr = VectorPtrs[0].Vector.DataRecord; var sg3d = dr.Fields.GetFieldByTag("SG3D"); var bytes = sg3d.Bytes; var length = bytes.Count() - 1; int currentIndex = 0; var soundingDatas = new List <SoundingData>(); while (currentIndex < length && bytes[currentIndex] != DataField.UnitTerminator) { var soundingData = new SoundingData(); for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.Y += tempVal; } soundingData.Y /= baseFile.coordinateMultiplicationFactor; for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.X += tempVal; } soundingData.X /= baseFile.coordinateMultiplicationFactor; for (int i = 0; i < 4; i++) { int tempVal = bytes[currentIndex++]; for (int j = 0; j < i; j++) { tempVal = tempVal << 8; } soundingData.depth += tempVal; } soundingData.depth /= baseFile.soundingMultiplicationFactor; soundingDatas.Add(soundingData); } return(soundingDatas); }