public static EGPSHistoryInfo ConvertInfo(DataRow row) { if (row == null) { return null; } EGPSHistoryInfo info = new EGPSHistoryInfo(); info.ACCState = System.Convert.ToInt32(row["ACCState"]); info.Direction = System.Convert.ToInt32(row["Direction"]); info.DoorStatus = System.Convert.ToInt32(row["DoorStatus"]); info.IsGPSLocated = System.Convert.ToBoolean(row["IsGPSLocated"]); info.IsGPSOverFlow = System.Convert.ToInt32(row["IsGPSOverFlow"]); info.Latitude = System.Convert.ToDouble(row["Latitude"]); info.Longitude = System.Convert.ToDouble(row["Longitude"]); info.Mileage = System.Convert.ToDecimal(row["Mileage"]); info.OilBearing = System.Convert.ToDecimal(row["OilBearing"]); info.OilState = System.Convert.ToInt32(row["OilState"]); info.PowerState = System.Convert.ToInt32(row["PowerState"]); info.ReceiveTime = DateTimeConvertHelper.Parse(row["ReceiveTime"].ToString()); info.ReportTime = DateTimeConvertHelper.Parse(row["ReportTime"].ToString()); info.Speed = System.Convert.ToInt32(row["Speed"]); info.StarkMileage = System.Convert.ToDecimal(row["StarkMileage"]); info.AntennaState = System.Convert.ToInt32(row["AntennaState"]); info.VehicleCode = new Guid(row["VehicleCode"].ToString()); return info; }
/// <summary> /// 比较经纬度是否相同 /// </summary> private bool CompareSame(EGPSHistoryInfo current, IList<EGPSHistoryInfo> ltHistoryInfo_All, int i) { if (i == 0) return false; EGPSHistoryInfo origrnal = ltHistoryInfo_All[i - 1]; if ((origrnal.Latitude == current.Latitude) && (origrnal.Longitude == current.Longitude)) { return true; } return false; }
private VGPSHistoryRunInfo ConvertToVGPSHistoryRunInfo(decimal currentMileage, EGPSHistoryInfo current, bool IsNotSurtStop, bool IsStop, TimeSpan stopTime, string stopTimeBegin, string stopTimeEnd) { VGPSHistoryRunInfo historyInfo = new VGPSHistoryRunInfo(); current.Mileage = currentMileage; historyInfo.Longitude = current.Longitude; historyInfo.Latitude = current.Latitude; //historyInfo.EncodeLatLon = arrLatLonParameter[i]; historyInfo.ReportTime = current.ReportTime.ToString("yyyy-MM-dd HH:mm"); historyInfo.Speed = current.Speed.ToString() + "公里/小时"; historyInfo.Direction = current.Direction.ToString(); historyInfo.Mileage = current.Mileage / 1000; historyInfo.StarkMileage = current.StarkMileage; historyInfo.IsNotSureStop = IsNotSurtStop; historyInfo.IsStop = IsStop; historyInfo.StopTime = (stopTime.Days * 24 * 60 + stopTime.Hours * 60 + stopTime.Minutes) + "分钟"; historyInfo.StopTimeBegin = stopTimeBegin; historyInfo.StopTimeEnd = stopTimeEnd; return historyInfo; }
//是否停车 private bool CheckIsStop(EGPSHistoryInfo current, IList<EGPSHistoryInfo> ltHistoryInfo_All, int index) { if (index > 0) { if ((ltHistoryInfo_All[index - 1].Speed == 0m) && (current.Speed == 0m)) { return true; } } if (index < ltHistoryInfo_All.Count - 1) { if ((ltHistoryInfo_All[index + 1].Speed == 0m) && (current.Speed == 0m)) { return true; } } return false; }