public IEnumerable<ISOSpatialRow> Read(string dataPath, string fileName, TIM tim)
{
if (tim == null)
yield break;
if (!File.Exists(Path.Combine(dataPath, fileName)))
yield break;
using (var binaryReader = new System.IO.BinaryReader(File.Open(Path.Combine(dataPath, fileName), FileMode.Open)))
{
while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
{
var ptn = tim.Items.FirstOrDefault(x => x.GetType() == typeof (PTN)) as PTN;
var record = new ISOSpatialRow { TimeStart = GetStartTime(tim, binaryReader) };
if (ptn != null)
{
record.NorthPosition = ReadInt32(ptn.A, ptn.ASpecified, binaryReader).GetValueOrDefault(0);
record.EastPosition = ReadInt32(ptn.B, ptn.BSpecified, binaryReader).GetValueOrDefault(0);
record.Elevation = ReadInt32(ptn.C, ptn.CSpecified, binaryReader);
record.PositionStatus = ReadByte(ptn.D, ptn.DSpecified, binaryReader);
record.PDOP = ReadShort(ptn.E, ptn.ESpecified, binaryReader);
record.HDOP = ReadShort(ptn.F, ptn.FSpecified, binaryReader);
record.NumberOfSatellites = ReadByte(ptn.G, ptn.GSpecified, binaryReader);
SetGpsUtcDateTime(ptn, record, binaryReader);
}
SetSpatialValues(tim, record, binaryReader);
yield return record;
}
}
}