예제 #1
0
        /// <summary>
        /// 更新位置
        /// </summary>
        void UpdateLocation()
        {
            if (_location == null)
            {
                return;                     //不更新无效位置
            }
            if (!ShowAllPoint && !OptimizationDisplayLoction(_lastLocation, _location))
            {
                return;
            }
            _lastLocation = _location;

            Dispatcher.BeginInvoke(() =>
            {
                if (_isShow)
                {
                    MapLayer.SetPosition(this, _location);
                    MapLayer.SetPosition(_borderName, _location);
                    if (IsActive && _borderName.Visibility == Visibility.Collapsed)
                    {
                        _borderName.Visibility = Visibility.Visible;
                    }
                }

                if (_mapCarInfo != null && _mapCarInfo.Visibility == Visibility.Visible)
                {
                    MapLayer.SetPosition(_mapCarInfo, _location);
                }

                if (_isActive)   //激活状态地图中心跟踪移动
                {
                    if (ActiveCarAlwaysInMap /*&& !CarIsInView()*/)
                    {
                        _mapLayer.ParentMap.Center = _location;
                    }
                }
            });

            LocationChanged(this, _location);
        }