/// <summary> /// Конструктор /// </summary> /// <param name="vector">Вектор</param> /// <param name="procSpeed">Обработанная скорость</param> /// <param name="procDist">Обработанное расстояние</param> /// <param name="procHeading">Обработанное направление</param> public ProccessedTrackVectorItem(TrackVectorItem vector, double procSpeed, double procDist, double procHeading) { stLat = vector.Start.Latitude; stLon = vector.Start.Longitude; enLat = vector.Finish.Latitude; enLon = vector.Finish.Longitude; stDate = vector.Start.Date; enDate = vector.Finish.Date; origSpeed = vector.Speed; origHeading = vector.Heading; lapse = vector.Duration; origDist = vector.Distance; this.procDist = procDist; this.procSpeed = procSpeed; this.procHeading = procHeading; }
/// <summary> /// обработать таблицу с обработанным треком /// </summary> /// <param name="dataTable">Таблица</param> /// <returns>Обработанный трек</returns> private ProccessedTrack ParseProccessedDataTable(DataTable dataTable) { bool isVector = dataTable.Columns.Count > 7; ProccessedTrack pTrack = new ProccessedTrack(dataTable.TableName.Replace('_', ' ').Replace("$", ""), isVector); DataRow[] dataRows = dataTable.Select(); if (isVector) { foreach (DataRow row in dataRows) { double stlat = (double)row[1]; double stlon = (double)row[2]; DateTime stdate = (DateTime)row[3]; double enlat = (double)row[4]; double enlon = (double)row[5]; DateTime endate = (DateTime)row[6]; TimeSpan lapse = endate - stdate; double oSpeed = (double)row[8]; double pSpeed = (double)row[9]; double oDist = (double)row[10]; double pDist = (double)row[11]; double oHead = (double)row[12]; double pHead = (double)row[13]; TrackItem stItem = new TrackItem(stlat, stlon, stdate); TrackItem enItem = new TrackItem(enlat, enlon, endate); TrackVectorItem vItem = new TrackVectorItem(stItem, enItem); ProccessedTrackVectorItem pVector = new ProccessedTrackVectorItem(vItem, pSpeed, pDist, pHead); pTrack.AddProccedTrackVectorItem(pVector); } } else { foreach (DataRow row in dataRows) { double lat = (double)row[1]; double lon = (double)row[2]; DateTime date = (DateTime)row[3]; double plat = (double)row[4]; double plon = (double)row[5]; double dist = (double)row[6]; TrackItem item = new TrackItem(lat, lon, date); ProccessedTrackItem pItem = new ProccessedTrackItem(item, plat, plon); pTrack.AddProccessedTrackItem(pItem); } } return pTrack; }