Esempio n. 1
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            var polylineOptions = new PolylineOptions();

            polylineOptions.InvokeColor(0x702418ff);

            foreach (var position in routeCoordinates)
            {
                polylineOptions.Add(new LatLng(position.Latitude, position.Longitude));
            }

            NativeMap.AddPolyline(polylineOptions);

            foreach (Bus bus in BusList.busList)
            {
                if (bus.route == "blue")
                {
                    CircleOptions circleOptions = new CircleOptions();
                    circleOptions.InvokeCenter(new LatLng(bus.lat, bus.lng));
                    circleOptions.InvokeRadius(30);
                    circleOptions.InvokeFillColor(0X700000ff);
                    circleOptions.InvokeStrokeColor(0X70FFFFFF);
                    circleOptions.InvokeStrokeWidth(5);

                    NativeMap.AddCircle(circleOptions);
                }
            }
        }
        public void updateCircle()
        {
            CustomMap customMap = (CustomMap)this.Element;

            if (customMap != null)
            {
                if (customMap.UserPin != null)
                {
                    if (circle != null)
                    {
                        circle.Remove();
                        circle.Dispose();
                    }
                    //moy
                    CircleOptions circleOptions = new CircleOptions();
                    circleOptions.InvokeCenter(new LatLng(customMap.UserPin.Position.Latitude, customMap.UserPin.Position.Longitude));
                    circleOptions.InvokeRadius(customMap.getDistanceUserTarget());
                    circleOptions.InvokeFillColor(Android.Graphics.Color.Argb(0, 0, 0, 0));
                    circleOptions.InvokeStrokeColor(Android.Graphics.Color.Argb(240, 250, 250, 250));
                    circleOptions.InvokeStrokeWidth(5f);

                    circle = map.AddCircle(circleOptions);
                }
            }
        }
Esempio n. 3
0
        public void UpdateRegionMap()
        {
            try
            {
                if (selectedTrap != null)
                {
                    if (circle != null)
                    {
                        circle.Remove();
                    }

                    LatLng position = new LatLng(lastLocation.Latitude, lastLocation.Longitude);

                    int fillColor = int.Parse("80f15f4b", System.Globalization.NumberStyles.HexNumber);

                    CircleOptions circleOptions = new CircleOptions();

                    circleOptions.InvokeCenter(position);
                    //circleOptions.InvokeRadius(selectedTrap.Trap.Meters);
                    circleOptions.InvokeFillColor(fillColor);
                    circleOptions.InvokeStrokeWidth(3);

                    circle = googleMap.AddCircle(circleOptions);
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Esempio n. 4
0
        public void OnLocationChanged(Location location)
        {
            Location currentLocation = location;

            myLocation = location;
            if (currentLocation == null)
            {
                Console.WriteLine("Unable to determine your location. Try again in a short while.");
            }
            else
            {
                Console.WriteLine(string.Format("{0:f6},{1:f6}", currentLocation.Latitude, currentLocation.Longitude));
                myLocation = location;

                if (positionMarker != null)
                {
                    positionMarker.Remove();
                }
                var circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(location.Latitude, location.Longitude));
                circleOptions.InvokeRadius(20);
                circleOptions.InvokeFillColor(0X66FF0000);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                circleOptions.InvokeStrokeWidth(0);
                //positionMarker = mMap.AddCircle(circleOptions);
            }
        }
Esempio n. 5
0
        private void CircleDemo(HuaweiMap hMap)
        {
            hMap.Clear();

            Circle        circle1;
            LatLng        circle1LatLng  = new LatLng(41.01019, 28.974475);
            CircleOptions circle1Options = new CircleOptions();

            circle1Options.InvokeCenter(circle1LatLng);
            circle1Options.InvokeRadius(1600);
            circle1Options.InvokeStrokeWidth(5);
            circle1Options.InvokeStrokeColor(Color.Blue);
            circle1Options.InvokeFillColor(Color.Argb(60, 0, 0, 255));
            circle1Options.Clickable(true);
            circle1Options.InvokeZIndex(2);
            circle1 = hMap.AddCircle(circle1Options);

            Circle        circle2;
            LatLng        circle2LatLng  = new LatLng(41.01563, 29.052667);
            CircleOptions circle2Options = new CircleOptions();

            circle2Options.InvokeCenter(circle2LatLng);
            circle2Options.InvokeRadius(5000);
            circle2Options.InvokeStrokeWidth(10);
            circle2Options.InvokeStrokeColor(Color.OrangeRed);
            circle2Options.InvokeFillColor(Color.Argb(60, 255, 200, 0));
            circle2Options.Clickable(true);
            circle2Options.InvokeZIndex(1);
            circle2 = hMap.AddCircle(circle2Options);
        }
Esempio n. 6
0
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;

            if (!isCircle)
            {
                var polylineOptions = new PolylineOptions();
                polylineOptions.InvokeColor(0x66FF0000);

                foreach (var position in routeCoordinates)
                {
                    polylineOptions.Add(new LatLng(position.Latitude, position.Longitude));
                }

                map.AddPolyline(polylineOptions);
            }
            if (isCircle)
            {
                var circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
                circleOptions.InvokeRadius(circle.Radius);
                circleOptions.InvokeFillColor(0X00FFFFFF);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                circleOptions.InvokeStrokeWidth(3);
                map.AddCircle(circleOptions);
            }
        }
Esempio n. 7
0
        protected override MarkerOptions CreateMarker(Pin pin)
        {
            if (pin is CirclePin)
            {
                //create an overlay circle, and add to map
                var circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
                circleOptions.InvokeRadius(PublishedData.PinOverlayRadius);
                circleOptions.InvokeFillColor(0X66FF0000);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                circleOptions.InvokeStrokeWidth(0);
                Circle circle = NativeMap.AddCircle(circleOptions);
                (pin as CirclePin).Overlay = circle;
            }

            // marker,or pin.
            var marker = new MarkerOptions();

            marker.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
            marker.Anchor(0.5f, 0.5f);// set anchor to to middle of icon
            marker.SetTitle(pin.Label);
            marker.SetSnippet(pin.Address);
            Bitmap imageBitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.pin);
            Bitmap resizedIcon = Bitmap.CreateScaledBitmap(imageBitmap, 50, 50, false);

            marker.SetIcon(BitmapDescriptorFactory.FromBitmap(resizedIcon));

            return(marker);
        }
Esempio n. 8
0
        private void HandleInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
        {
            // Draw a circle on the map
            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(Location_NewYork);
            circleOptions.InvokeRadius(100000.0);
            circleOptions.InvokeFillColor(Android.Graphics.Color.White);
            _map.AddCircle(circleOptions);

            // Draw a polygon (Wyoming) on the map
            PolygonOptions polygonOptions = new PolygonOptions();

            polygonOptions.Add(new LatLng[]
            {
                new LatLng(45.00, -111.00),
                new LatLng(45, -104),
                new LatLng(41, -104),
                new LatLng(41, -111)
            });

            polygonOptions.InvokeFillColor(Android.Graphics.Color.Purple);
            polygonOptions.InvokeStrokeWidth(2);
            _map.AddPolygon(polygonOptions);
        }
Esempio n. 9
0
        private void AddClusterItems(Location currentLocation)
        {
            var items = new List <ClusterItem>();

            // Add current location to the cluster list
            var currentMarker = new MarkerOptions();
            var me            = new LatLng(currentLocation.Latitude, currentLocation.Longitude);

            currentMarker.SetPosition(me);
            var meMarker = new CircleOptions();

            meMarker.InvokeCenter(me);
            meMarker.InvokeRadius(32);
            meMarker.InvokeStrokeWidth(0);
            meMarker.InvokeFillColor(ContextCompat.GetColor(BaseContext, Android.Resource.Color.HoloBlueLight));
            _googleMap.AddCircle(meMarker);
            items.Add(new ClusterItem(currentLocation.Latitude, currentLocation.Longitude));

            // Create a log. spiral of markers to test clustering
            for (int i = 0; i < 20; ++i)
            {
                var t = i * Math.PI * 0.33f;
                var r = 0.005 * Math.Exp(0.1 * t);
                var x = r * Math.Cos(t);
                var y = r * Math.Sin(t);
                items.Add(new ClusterItem(currentLocation.Latitude + x, currentLocation.Longitude + y));
            }
            _clusterManager.AddItems(items);
        }
Esempio n. 10
0
        private void SetupOverlays()
        {
            // render a circle on the map
            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(AtlantaCoords);
            circleOptions.InvokeRadius(8000.0);
            circleOptions.InvokeFillColor(Android.Graphics.Color.Orange);
            _map.AddCircle(circleOptions);

            // render a polygon on the map
            PolygonOptions polygonOptions = new PolygonOptions();

            polygonOptions.Add(new LatLng[]
            {
                new LatLng(25.25, -80.27),
                new LatLng(32.14, -64.97),
                new LatLng(18.23, -66.56)
            });

            polygonOptions.InvokeFillColor(Android.Graphics.Color.Yellow);
            polygonOptions.InvokeStrokeWidth(8);
            _map.AddPolygon(polygonOptions);

            // overlay images at physical size: _map.AddGroundOverlay
        }
        void AddCircles(IList circles)
        {
            var map = NativeMap;

            if (map == null)
            {
                return;
            }

            if (_circles == null)
            {
                _circles = new List <ACircle>();
            }

            _circles.AddRange(circles.Cast <Circle>().Select(circle =>
            {
                var opts = new CircleOptions();

                opts.InvokeCenter(new LatLng(circle.Center.Latitude, circle.Center.Longitude));
                opts.InvokeRadius(circle.Radius.Meters);
                opts.InvokeStrokeWidth(circle.StrokeWidth * _scaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps)
                opts.InvokeStrokeColor(circle.StrokeColor.ToAndroid());
                opts.InvokeFillColor(circle.FillColor.ToAndroid());
                //opts.Clickable(circle.IsClickable);

                var nativeCircle = map.AddCircle(opts);

                // associate pin with marker for later lookup in event handlers
                circle.Id = nativeCircle;
                return(nativeCircle);
            }));
        }
Esempio n. 12
0
        protected override MarkerOptions CreateMarker(Pin pin)
        {
            CustomPin customPin = (CustomPin)pin;

            var marker = new MarkerOptions();

            marker.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude));
            marker.SetAlpha(0);

            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(customPin.Position.Latitude, customPin.Position.Longitude));
            circleOptions.InvokeRadius(1000);
            circleOptions.InvokeStrokeWidth(0);

            switch (customPin.Status)
            {
            case StatusEnum.Diagnosed:
                circleOptions.InvokeFillColor(0X66FF0000);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                NativeMap.AddCircle(circleOptions);
                break;

            case StatusEnum.Healthy:
                break;

            case StatusEnum.Recovered:
                break;

            case StatusEnum.Symptomatic:
                circleOptions.InvokeFillColor(0X33FF4D26);
                circleOptions.InvokeStrokeColor(0X33FF4D26);
                NativeMap.AddCircle(circleOptions);
                break;

            default:
                break;
            }

/*            circleOptions.InvokeFillColor(0X66FF0000);
 *          circleOptions.InvokeStrokeColor(0X66FF0000);*/



            return(marker);
        }
Esempio n. 13
0
        private void DrawCircle()
        {
            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(30.679879, 104.064855));
            circleOptions.InvokeRadius(9000);
            circleOptions.InvokeStrokeColor(Color.Black);
            circleOptions.InvokeFillColor(Color.Transparent);
            circleOptions.InvokeStrokeWidth(3);
            aMap.AddCircle(circleOptions);
        }
        void map_MarkerDragEnd(object sender, GoogleMap.MarkerDragEndEventArgs e)
        {
            map.Clear();
            latLngMarker.Latitude  = e.Marker.Position.Latitude;
            latLngMarker.Longitude = e.Marker.Position.Longitude;

            distance = Location.CalculateDistance(latLngMarker.Latitude, latLngMarker.Longitude, latLngUser.Latitude, latLngUser.Longitude, DistanceUnits.Kilometers);

            if (distance <= 1)
            {
                marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen));
                circle.InvokeFillColor(Android.Graphics.Color.Green);
                marker.SetPosition(latLngMarker);
                circle.InvokeCenter(latLngMarker);
                map.AddMarker(marker);
                map.AddCircle(circle);
                async void SendMail()
                {
                    List <string> to      = new List <string>();
                    var           message = new EmailMessage
                    {
                        Subject = "Point",
                        Body    = "User coordinates - " + latLngUser.Latitude + " " + latLngUser.Longitude
                                  + "\n" + "Marker coordinates - " + marker.Position.Latitude + " " + marker.Position.Longitude,
                        To = to
                    };
                    await Email.ComposeAsync(message);
                }

                SendMail();
            }
            else
            {
                marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                circle.InvokeFillColor(0X66FF0000);
                marker.SetPosition(latLngMarker);
                circle.InvokeCenter(latLngMarker);
                map.AddMarker(marker);
                map.AddCircle(circle);
            }
        }
Esempio n. 15
0
        private void DrawBlueDot()
        {
            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(currentLocation.Latitude, currentLocation.Longitude));
            circleOptions.InvokeRadius(5);
            circleOptions.InvokeFillColor(Color.CadetBlue);
            circleOptions.InvokeStrokeColor(Color.White);
            circleOptions.InvokeStrokeWidth(2);
            circleOptions.InvokeZIndex(1);

            blueDot = _map.AddCircle(circleOptions);
        }
Esempio n. 16
0
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;

            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
            circleOptions.InvokeRadius(circle.Radius);
            circleOptions.InvokeFillColor(0X66FF0000);
            circleOptions.InvokeStrokeColor(0X66FF0000);
            circleOptions.InvokeStrokeWidth(0);
            map.AddCircle(circleOptions);
        }
Esempio n. 17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SearchJourney);

            #region setup map markers
            currentLocation = new MarkerOptions();
            currentLocation.SetTitle("Current Position");
            currentLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
            currentLocation.SetPosition(getCurrentPosition());
            currentLocation.Visible(false);

            fromLocation = new MarkerOptions();
            fromLocation.SetTitle("From Here");
            fromLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
            fromLocation.SetPosition(getCurrentPosition());
            fromLocation.Visible(false);

            toLocation = new MarkerOptions();
            toLocation.SetTitle("To Here");
            toLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen));
            toLocation.SetPosition(getCurrentPosition());
            toLocation.Visible(false);

            fromCircleOp = new CircleOptions();
            fromCircleOp.InvokeCenter(getCurrentPosition());
            fromCircleOp.InvokeRadius(1000);
            fromCircleOp.InvokeFillColor(0X66FF0000);
            fromCircleOp.InvokeStrokeColor(0X66FF0000);
            fromCircleOp.InvokeStrokeWidth(0);
            fromCircleOp.Visible(false);


            toCircleOp = new CircleOptions();
            toCircleOp.InvokeCenter(getCurrentPosition());
            toCircleOp.InvokeRadius(1000);
            toCircleOp.InvokeFillColor(Color.Green);
            toCircleOp.InvokeStrokeColor(Color.Green);
            toCircleOp.InvokeStrokeWidth(0);
            toCircleOp.Visible(false);
            #endregion

            // Create your application here
            InitMapFragment();
            SetupCurrentLocationButton();
            SetupSearchButton();
            SetupSetFromButton();
            SetupSetToButton();
            SetupForm();
        }
Esempio n. 18
0
            public override IJavaObject AddBindingMapOverlay(IBindingMapOverlay overlay)
            {
                CircleOptions circleOptions = null;

                if (overlay is ExampleBindingOverlay mOverlay)
                {
                    circleOptions = new CircleOptions()
                                    .InvokeCenter(mOverlay.Location.ToLatLng())
                                    .InvokeRadius(mOverlay.Radius)
                                    .InvokeStrokeWidth(0)
                                    .Clickable(true);

                    switch (mOverlay.Id)
                    {
                    case 1:
                        circleOptions.InvokeFillColor(Context.GetColor(Android.Resource.Color.HoloBlueLight));
                        break;

                    case 2:
                        circleOptions.InvokeFillColor(Context.GetColor(Android.Resource.Color.HoloRedLight));
                        break;

                    case 3:
                        circleOptions.InvokeFillColor(Context.GetColor(Android.Resource.Color.HoloGreenLight));
                        break;

                    case 4:
                        circleOptions.InvokeFillColor(Context.GetColor(Android.Resource.Color.HoloOrangeLight));
                        break;

                    case 5:
                        circleOptions.InvokeFillColor(Context.GetColor(Android.Resource.Color.HoloPurple));
                        break;
                    }
                }

                return(circleOptions);
            }
        protected override void OnMapReady(Android.Gms.Maps.GoogleMap map)
        {
            base.OnMapReady(map);

            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
            circleOptions.InvokeRadius(circle.Radius);
            circleOptions.InvokeFillColor(0X66FF0000);
            circleOptions.InvokeStrokeColor(0X66FF0000);
            circleOptions.InvokeStrokeWidth(0);

            NativeMap.AddCircle(circleOptions);
        }
        private void AddClusterItems(GoogleMap map, HelperHomeModel h)
        {
            var items = new List <MyItem>();

            // Add current location to the cluster list
            var currentMarker = new MarkerOptions();
            var me            = new LatLng(h.Latitude, h.Longitude);

            currentMarker.SetPosition(me);
            var meMarker = new CircleOptions();

            meMarker.InvokeCenter(me);
            meMarker.InvokeRadius(32);
            meMarker.InvokeStrokeWidth(10);
            meMarker.InvokeFillColor(ContextCompat.GetColor(Context, Android.Resource.Color.HoloRedLight));
            map.AddCircle(meMarker);
            items.Add(new MyItem(h.Latitude, h.Longitude));

            // Create a log. spiral of markers to test clustering
            for (int i = 1; i < customMap.helperList.Count; i++)
            {
                var hi = customMap.helperList.ElementAt(i);
                var t  = i * Math.Pi * 0.33f;
                var r  = 0.005 * Math.Exp(0.1 * t);
                var x  = r * Math.Cos(t);
                var y  = r * Math.Sin(t);
                items.Add(new MyItem(hi.Latitude + x, hi.Longitude + y));
            }
            mClusterManager.AddItems(items);
            /*****************************************************************/

            // Set some lat/lng coordinates to start with.

            /*double lat = 51.5145160;
             * double lng = -0.1270060;
             *
             * // Add ten cluster items in close proximity, for purposes of this example.
             * for (int i = 1; i < customMap.helperList.Count; i++)
             * {
             *
             *  var h = customMap.helperList.ElementAt(i);
             *  double offset = i / 60d;
             *  lat = h.Latitude + offset;
             *  lng = h.Longitude + offset;
             *  MyItem offsetItem = new MyItem(lat, lng);
             *  mClusterManager.AddItem(offsetItem);
             *
             * }*/
        }
Esempio n. 21
0
        /// <summary>
        /// Adds a bubble that reflects the expiry range of a helicopter carrying organ
        /// </summary>
        /// <param name="heliPin"></param>
        private void addOrganRange(CustomPin heliPin)
        {
            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(heliPin.Position.Latitude, heliPin.Position.Longitude));

            // TODO adjust to organ countdown
            circleOptions.InvokeRadius(40000);

            circleOptions.InvokeFillColor(0X660000FF);
            circleOptions.InvokeStrokeColor(0X660000FF);
            circleOptions.InvokeStrokeWidth(0);

            highlightedOrganRange = new Tuple <CustomPin, Circle>(heliPin, NativeMap.AddCircle(circleOptions));
        }
Esempio n. 22
0
        public void CreateCircle(Circle circle)
        {
            if (circle == null)
            {
                return;
            }
            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
            circleOptions.InvokeRadius(circle.Radius);
            circleOptions.InvokeFillColor(0X00FFFFFF);
            circleOptions.InvokeStrokeColor(0X66FF0000);
            circleOptions.InvokeStrokeWidth(3);
            map.AddCircle(circleOptions);
        }
Esempio n. 23
0
		protected virtual CircleOptions CreateCircleOptions(Circle circle)
		{
			var opts = new CircleOptions()
				.InvokeCenter(new LatLng(circle.Center.Latitude, circle.Center.Longitude))
				.InvokeRadius(circle.Radius.Meters)
				.InvokeStrokeWidth(circle.StrokeWidth);

			if (!circle.StrokeColor.IsDefault)
				opts.InvokeStrokeColor(circle.StrokeColor.ToAndroid());

			if (!circle.FillColor.IsDefault)
				opts.InvokeFillColor(circle.FillColor.ToAndroid());

			return opts;
		}
Esempio n. 24
0
        public void DrawCircle(GoogleMap gMap)
        {
            Circle circle;

            var CircleMaker = new CircleOptions();
            var latlong     = new LatLng(13.0291, 80.2083);                                //Location

            CircleMaker.InvokeCenter(latlong);                                             //
            CircleMaker.InvokeRadius(1000);                                                //Radius in Circle
            CircleMaker.InvokeStrokeWidth(4);
            CircleMaker.InvokeStrokeColor(Android.Graphics.Color.ParseColor("#e6d9534f")); //Circle Color
            CircleMaker.InvokeFillColor(Color.Argb(034, 209, 72, 54));
            CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlong, 15);          //Map Zoom Level

            circle = GMap.AddCircle(CircleMaker);                                          //Gmap Add Circle
        }
Esempio n. 25
0
        void updateMap()
        {
            _map.Clear();
            MarkerOptions marker1 = new MarkerOptions();

            marker1.SetPosition(newLocation);
            _map.AddMarker(marker1);

            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(newLocation);
            circleOptions.InvokeRadius(radius);
            circleOptions.InvokeFillColor(Convert.ToInt32("0x3000ffff", 16));
            circleOptions.InvokeStrokeColor(Convert.ToInt32("0x3000ffff", 16));
            _circle = _map.AddCircle(circleOptions);
        }
Esempio n. 26
0
        /// <summary>
        /// Minulí pozice zůstávají na mapě
        /// </summary>
        private void DrawDebugPosition()
        {
            if (debugPositionCircle != null)
            {
                debugPositionCircle.Dispose();
            }
            debugPositionCircle = new CircleOptions();
            debugPositionCircle.InvokeCenter(new LatLng(customMap.DebugPosition.Latitude, customMap.DebugPosition.Longitude));
            debugPositionCircle.InvokeRadius(50);
            debugPositionCircle.InvokeFillColor(0X66FF0000);
            debugPositionCircle.InvokeStrokeColor(0X66FF0000);
            debugPositionCircle.InvokeStrokeWidth(0);


            NativeMap.AddCircle(debugPositionCircle);
        }
        /// <summary>
        /// When the user stops.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">User's position</param>
        private void Model_UserStopped(object sender, PositionArgs e)
        {
            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(e.LocationData.Latitude, e.LocationData.Longitude));
            circleOptions.InvokeRadius(14);
            circleOptions.InvokeFillColor(Color.Rgb(213, 52, 58));
            circleOptions.InvokeStrokeColor(Color.Black);
            circleOptions.InvokeStrokeWidth(1);
            circleOptions.InvokeZIndex(10);

            RunOnUiThread(() =>
            {
                _map.AddCircle(circleOptions);
                _speedTextView.Text = "0";
            });
        }
        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName.Equals("VisibleRegion") && !isDrawn)
            {
                var circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
                circleOptions.InvokeRadius(circle.Radius);
                circleOptions.InvokeFillColor(0X66FF0000);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                circleOptions.InvokeStrokeWidth(0);

                NativeMap.AddCircle(circleOptions);
                isDrawn = true;
            }
        }
        private void UpdateCircles()
        {
            circles?.ForEach(x => x.Remove());

            circles = new List <Circle>();

            customPins?.ForEach(x => {
                var circleOptions = new CircleOptions();
                circleOptions.InvokeCenter(new LatLng(x.Position.Latitude, x.Position.Longitude));
                circleOptions.InvokeRadius(x.Radius);
                circleOptions.InvokeFillColor(0X66FF0000);
                circleOptions.InvokeStrokeColor(0X66FF0000);
                circleOptions.InvokeStrokeWidth(0);

                circles.Add(NativeMap.AddCircle(circleOptions));
            });
        }
Esempio n. 30
0
        protected override NativeCircle CreateNativeItem(Circle outerItem)
        {
            var opts = new CircleOptions();

            opts.InvokeCenter(new LatLng(outerItem.Center.Latitude, outerItem.Center.Longitude));
            opts.InvokeRadius(outerItem.Radius.Meters);
            opts.InvokeStrokeWidth(outerItem.StrokeWidth * this.ScaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps)
            opts.InvokeStrokeColor(outerItem.StrokeColor.ToAndroid());
            opts.InvokeFillColor(outerItem.FillColor.ToAndroid());
            opts.Clickable(outerItem.IsClickable);

            var nativeCircle = NativeMap.AddCircle(opts);

            // associate pin with marker for later lookup in event handlers
            outerItem.NativeObject = nativeCircle;
            return(nativeCircle);
        }