public Location GetLoLa(double ALo, double ALa, int AX = 0, int AY = 0) { if (_geoType != GeoType.WGS84) { if (_geoType == GeoType.GCJ02) { GeoLatLng gcj02 = GPSTool.wgs84togcj02(ALo, ALa); return(new Location(gcj02.latitude, gcj02.longitude)); } else if (_geoType == GeoType.BD09) { //GeoLatLng gcj02 = GPSTool.wgs84togcj02(ALo, ALa); //GeoLatLng bd09 = GPSTool.gcj02tobd09(gcj02.longitude, gcj02.latitude); GeoLatLng bd09 = GPSTool.bd09togcj02(ALo, ALa); return(new Location(bd09.latitude, bd09.longitude)); } else { return(new Location(ALa, ALo)); } //return new Location(ALa + AY / 1000000.0, ALo + AX / 1000000.0); } else { return(new Location(ALa, ALo)); } }
/// <summary> /// 更新方向 /// </summary> void UpdateHeading() { if (!_isShow) { return; } if (_car.LastGpsData == null || _car.LastGpsData.LOCATE != 1 || !GPSTool.CheckLaLo(_car.LastGpsData.LATITUDE, _car.LastGpsData.LONGITUDE)) { return; } Dispatcher.BeginInvoke(() => { RotateTransform rt = RenderTransform as RotateTransform; if (rt == null) { rt = new RotateTransform(); rt.CenterX = Width / 2.0; rt.CenterY = Height / 2.0; } if (CarType != CarType.OilWell) { if (_car.LastGpsData != null) { rt.Angle = _car.LastGpsData.HEADING; } } RenderTransform = rt; }); }
public override Uri GetUri(int x, int y, int zoomLevel) { GPSTool.GoogleToBaiDuTile(ref x, ref y, zoomLevel); string nx = x + ""; nx = Regex.Replace(nx, "-", "M"); string ny = y + ""; ny = Regex.Replace(ny, "-", "M"); string url = string.Format(UriFormat, x % 9, nx, ny, zoomLevel); return(new Uri(url)); }
private void CalLocation() { NEWTRACK gps = _car?.LastGpsData; //异常 经纬度过滤 if (gps == null) { return; } if (gps.LOCATE != 1 || !GPSTool.CheckLaLo(gps.LATITUDE, gps.LONGITUDE)) { return; } if (_mapLayer?.MapAdjust == null) { return; } _location = _mapLayer.MapAdjust.GetLoLa(gps.LONGITUDE, gps.LATITUDE, gps.OFFSETX, gps.OFFSETY); }
/// <summary> /// 历史回放模式 /// </summary> //public bool HistoryMode { get; set; } bool RefreshState(NEWTRACK gps, string fieldName = null, bool noWeb = false) { if (gps == null) { return(false); } CarStatus.RefreshStatus(gps.STATUS, gps.STOPTIME); //车辆状态 OnPropertyChanged(nameof(CarStatus), true); AlarmStatus.RefreshAlarmStatus(gps.ALARM); OnPropertyChanged(nameof(AlarmStatus), true); if (gps.IsRealTime || _isCopy || (!gps.IsRealTime && !_isCopy)) { //在线或者历史回放状态刷新 if (!_isCopy && (CarStatus.offline == true || !gps.IsRealTime)) { //车辆下线 CarState = CarState.OffLine; } else { //在线状态下 if (AlarmStatus.HasAlarm) { //报警状态 CarState = CarState.Alarm; if (!_isCopy) { OnHaveNewAlarm(AlarmType.Normal); //新的报警 } } else if (gps.LOCATE != 1) //不定位 { CarState = CarState.NoGps; } else if (gps.SPEED >= 3) //行驶中 { CarState = CarState.Run; } else { //速度小于3km/h 认定为停车(可去除部分漂移) CarState = CarState.Stop; } } } else { //不在线状态判断 CarState = CarState.OffLine; } if (noWeb) { return(true); } if (!gps.IsRealTime) { return(true); } if (CarStatus.blindarea_status) { return(true); } if (!NEWTRACK.IsWebPosition) { return(true); } if (!IsInView) { return(true); } if (!GPSTool.CheckLaLo(gps.LATITUDE, gps.LONGITUDE)) { return(true); } GeoLatLng geo = GPSTool.wgs84togcj02(gps.LONGITUDE, gps.LATITUDE); geo.longitude = Math.Round(geo.longitude, 6); geo.latitude = Math.Round(geo.latitude, 6); Common_liby.InvokeMethodOnMainThread(() => { HtmlPage.Window.Invoke("GetWebPosition", geo.longitude, geo.latitude, MAC); }); return(false); }