/// <summary> /// 比较经纬度是否相同 /// </summary> private bool CompareSame(EGPSHistoryInfo origrnal, EGPSHistoryInfo current) { if (origrnal != null) { if ((origrnal.Latitude == current.Latitude) && (origrnal.Longitude == current.Longitude)) { return true; } } return false; }
private EGPSHistoryInfo ConvertInfo_Short(Guid vehicleCode, DataRow row, string[] arrColumnName) { if (row == null) { return null; } try { EGPSHistoryInfo info = new EGPSHistoryInfo(); info.GPSCode = System.Convert.ToString(row["GPSCode"]); info.Speed = System.Convert.ToInt32(row["Speed"]); info.Latitude = System.Convert.ToDecimal(row["Latitude"]); info.Longitude = System.Convert.ToDecimal(row["Longitude"]); info.ReportTime = System.DateTime.Parse(row["ReportTime"].ToString(), Culture); info.ACCState = System.Convert.ToInt32(row["ACCState"]); info.StarkMileage = System.Convert.ToDecimal(row["StarkMileage"]); info.OilBearing = System.Convert.ToDecimal(row["OilBearing"]); info.VehicleCode = vehicleCode; return info; } catch (Exception ex) { Logger.Error("ConvertInfo_Short" + ex.Message,ex); return null; } }
/// <summary> /// 当前点是否静止(ACC为0或者当前点和上一点的速度都为0,当前点和下一点的速度都为0) /// </summary> private bool CheckIsStop(EGPSHistoryInfo original, EGPSHistoryInfo current, IList<EGPSHistoryInfo> ltHistoryInfo_All, int index) { if (current.ACCState == 0) { return true; } 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; }
private EGPSHistoryInfo ConvertInfo(Guid vehicleCode, DataRow row, params string[] arrColumnName) { if (row == null) { return null; } try { if (arrColumnName.Length > 0) return ConvertInfo_Short(vehicleCode, row, arrColumnName); 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.GPSCode = System.Convert.ToString(row["GPSCode"]); info.IsGPSLocated = System.Convert.ToBoolean(row["IsGPSLocated"]); info.IsGPSOverFlow = System.Convert.ToInt32(row["IsGPSOverFlow"]); info.Latitude = System.Convert.ToDecimal(row["Latitude"]); info.Longitude = System.Convert.ToDecimal(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 = System.DateTime.Parse(row["ReceiveTime"].ToString(), Culture); info.ReportTime = System.DateTime.Parse(row["ReportTime"].ToString(), Culture); info.Speed = System.Convert.ToInt32(row["Speed"]); info.StarkMileage = System.Convert.ToDecimal(row["StarkMileage"]); info.AntennaState = System.Convert.ToInt32(row["AntennaState"]); info.VehicleCode = vehicleCode; return info; } catch (Exception ex) { Logger.Error("ConvertInfo" + ex.Message, ex); return null; } }
/// <summary> /// 返回运行的点的视图实体列表 /// </summary> private List<VGPSHistoryRunInfo> GetVGPSHistoryRunInfoList(List<LatLon> ltLatLon, EGPSHistoryInfo[] arrEGPSHistoryInfo, List<string> listStopTime) { //IMapService service = new PES.MapService.MapSearchService.MapService(); //string[] arrLatLonParameter = service.Encode(ltLatLon.ToArray()); //if ((arrLatLonParameter == null) || (arrLatLonParameter.Length == 0)) //{ // return null; //} List<VGPSHistoryRunInfo> ltHistoryInfo = new List<VGPSHistoryRunInfo>(); for (int i = 0; i < arrEGPSHistoryInfo.Length; i++) { VGPSHistoryRunInfo historyInfo = new VGPSHistoryRunInfo(); historyInfo.Longitude = arrEGPSHistoryInfo[i].Longitude; historyInfo.Latitude = arrEGPSHistoryInfo[i].Latitude; //historyInfo.EncodeLatLon = arrLatLonParameter[i]; historyInfo.ReportTime = arrEGPSHistoryInfo[i].ReportTime.ToString(); historyInfo.Speed = arrEGPSHistoryInfo[i].Speed.ToString() + "公里/小时"; historyInfo.Direction = arrEGPSHistoryInfo[i].Direction.ToString(); historyInfo.Mileage = (arrEGPSHistoryInfo[i].Mileage / 1000).ToString();//迁移前为decimal historyInfo.StopTime = listStopTime[i]; ltHistoryInfo.Add(historyInfo); } if (ltHistoryInfo.Count == 0) return null; return ltHistoryInfo; }