コード例 #1
0
        public void UpdateMaps()
        {
            var tick  = Find.TickManager.TicksGame;
            var delay = _updateDelay;

            if (ShowLightMap)
            {
                if (_lightMap == null)
                {
                    _lightMap = new LightOverlay();
                }
                _lightMap.Update(tick, delay);
            }

            if (ShowPathMap)
            {
                if (_pathMap == null)
                {
                    _pathMap = new PathOverlay();
                }
                _pathMap.Update(tick, delay);
            }

            if (ShowBeautyMap)
            {
                if (_beautyMap == null)
                {
                    _beautyMap = new BeautyOverlay(_beautyMapUseAverage);
                }
                _beautyMap.Update(tick, delay);
            }
        }
コード例 #2
0
 public override void _Ready()
 {
     _map           = GetNode <Map>("Map");
     _pathOverlay   = GetNode <PathOverlay>("PathOverlay");
     _pathArrow     = GetNode <PathArrow>("PathArrow");
     _commandDialog = GetNode <VBoxContainer>("UI/CommandDialog");
     _fireButton    = GetNode <Button>("UI/CommandDialog/Fire");
     foreach (Unit unit in GetNode("PlayerUnits").GetChildren())
     {
         _playerUnits.Add(unit.Cell, unit);
     }
     foreach (Unit unit in GetNode("AIUnits").GetChildren())
     {
         _enemyUnits.Add(unit.Cell, unit);
     }
 }
コード例 #3
0
ファイル: DroidMapRenderer.cs プロジェクト: HiP-App/HiP-Forms
        /// <summary>
        /// Here the direct route in routedetails is calculated
        /// </summary>
        /// <param name="location"></param>
        private void DrawDetailsRoute(GeoLocation?location)
        {
            var myPath = new PathOverlay(Resource.Color.colorPrimaryDark, 7, new DefaultResourceProxyImpl(activity));

            if (location != null)
            {
                myPath.AddPoint(new GeoPoint(location.Value.Latitude, location.Value.Longitude));
            }

            if (osmMap.DetailsRoute != null && osmMap.DetailsRoute.Waypoints.Any())
            {
                foreach (var waypoint in osmMap.DetailsRoute.Waypoints)
                {
                    myPath.AddPoint(new GeoPoint(waypoint.Location.Latitude, waypoint.Location.Longitude));
                }
            }

            mapView.OverlayManager.Add(myPath);
            mapView.Invalidate();
        }
コード例 #4
0
        /// <summary>
        /// Paint simple road lines with blue color. PathOverlay is deprecated, but for drawing simple
        /// path is perfect.
        /// The new, not deprecated class Polylines is more complex and needs a road from RoadManager
        /// </summary>
        private void DrawPathOnMap()
        {
            PathOverlay myPath = new PathOverlay(Resources.GetColor(Resource.Color.colorPrimaryDark),
                                                 5, new DefaultResourceProxyImpl(this));

            if (currentUserLocation != null)
            {
                myPath.AddPoint(currentUserLocation);
            }

            if (route != null && route.Waypoints.Any())
            {
                foreach (Waypoint waypoint in route.Waypoints)
                {
                    myPath.AddPoint(new GeoPoint(waypoint.Location.Latitude, waypoint.Location.Longitude));
                }
            }

            map.Overlays.Add(myPath);
            map.Invalidate();
        }
コード例 #5
0
 public void ResetMaps()
 {
     _lightMap  = null;
     _pathMap   = null;
     _beautyMap = null;
 }
コード例 #6
0
        //private async Task<MvxGeoLocation> UpdateLocation()
        //{
        //   _cancellationTokenSource?.Cancel();
        //   _cancellationTokenSource = new CancellationTokenSource();
        //     var locationService = Mvx.Resolve<LocationService>();
        //   return await locationService.GetLocation(_cancellationTokenSource);
        //}
        public void OnClick(IDialogInterface dialog, int which)
        {
            for (int i = _mapView.Overlays.Count - 1; i >= 0; i--)
            {
                _mapView.Overlays.RemoveAt(i);
            }
            _mapView.Invalidate();
            switch (which)
            {
            case 0:
            {
                GeoPoint leftTopGeo     = new GeoPoint(-1.686000, 33.558542);
                GeoPoint rightBottomGeo = new GeoPoint(-11.409878, 42.633248);
                Bitmap   tanzania       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.tsetse_tanzania);
                Overlay  newOverlay     = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                _mapView.Overlays.Add(newOverlay);
            }
            break;

            case 1:
            {
                GeoPoint leftTopGeo     = new GeoPoint(39.301256, -20.008362);
                GeoPoint rightBottomGeo = new GeoPoint(-37.787103, 51.759213);
                Bitmap   tanzania       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.green_africa);
                Overlay  newOverlay     = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                _mapView.Overlays.Add(newOverlay);
            }
            break;

            case 2:
            {
                var      points    = _geoService.GetRivers(null, 0);
                GeoPoint lastPoint = null;
                foreach (GeoJsonObject geoJsonObject in points)
                {
                    PathOverlay newOverlay = new PathOverlay(Color.Blue, this);
                    foreach (List <double> coordinate in geoJsonObject.geometry.coordinates)
                    {
                        var point = new GeoPoint(coordinate[0], coordinate[1]);
                        newOverlay.AddPoint(point);
                        lastPoint = point;
                    }
                    _mapView.Overlays.Add(newOverlay);
                }
                _mapController.SetCenter(lastPoint);
            }
            break;

            case 3:
            {
                GeoPoint leftTopGeo     = new GeoPoint(39.301256, -20.008362);
                GeoPoint rightBottomGeo = new GeoPoint(-37.787103, 51.759213);
                Bitmap   tanzania       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.fire_africa);
                Overlay  newOverlay     = new BitmapOverlay(this, leftTopGeo, rightBottomGeo, tanzania);
                _mapView.Overlays.Add(newOverlay);
            }
            break;
            }


            //54.259213
        }