public void Dispose(ref Gps.Decoder_Gps_Data gpsDataHeader) { CO_IA.Data.Gps.GpsOrbit gpsOrbit = new CO_IA.Data.Gps.GpsOrbit { PlateNumber = this.gpsIdentificationNumber, ActivityId = this._activityId }; gpsOrbit.RunTime = gpsDataHeader.BTC_Time; gpsOrbit.LocationState = gpsDataHeader.LocationState.ToString(); gpsOrbit.Latitude = gpsDataHeader.Latitude; gpsOrbit.Longitude = gpsDataHeader.Longitude; gpsOrbit.LatitudeHemisphere = gpsDataHeader.LatitudeHemisphere.ToString(); gpsOrbit.LongitudeHemisphere = gpsDataHeader.LongitudeHemisphere.ToString(); gpsOrbit.Height = gpsDataHeader.Height; gpsOrbit.Speed = gpsDataHeader.Speed; gpsOrbit.UsingStartNum = gpsDataHeader.UsingStartNum; lock (syncObj) { this.queueOrbit.Enqueue(gpsOrbit); } foreach (var receiver in listGpsOrbitReceiver) { receiver.SyncContext.Post(state => { receiver.Receive(gpsOrbit); }, null); } }
/// <summary> /// 过滤GPS点 /// </summary> /// <param name="gpsInfo"></param> /// <returns></returns> public bool Filter(GpsOrbit gpsInfo) { bool Re = false; if (gpsInfo == null) { return(false); } if (havePoints.Count == 0) { Re = true; } else { double dis = GetDistance(gpsInfo.Longitude, gpsInfo.Latitude, havePoints[havePoints.Count - 1].Longitude, havePoints[havePoints.Count - 1].Latitude); if (dis >= Para.Displacement) { Re = true; } else { if (dis > Para.DisplacementReferToAzimuth && havePoints.Count > 2) { //判断方位角 double a1 = GetAzimuthAngle(gpsInfo.Longitude, gpsInfo.Latitude, havePoints[havePoints.Count - 1].Longitude, havePoints[havePoints.Count - 1].Latitude); double a2 = GetAzimuthAngle(gpsInfo.Longitude, gpsInfo.Latitude, havePoints[havePoints.Count - 2].Longitude, havePoints[havePoints.Count - 2].Latitude); if (Math.Abs(a2 - a1) > Para.RefAzimuth) { return(true); } } } } if (Re) { havePoints.Add(gpsInfo); if (havePoints.Count > 3) { havePoints.RemoveAt(0); } } return(Re); }