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);
		}
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;

            if (circle == null)
            {
                circle = new CustomCircle
                {
                    Position = new Position {Longitude = 37.79752, Latitude = -122.40183 },
                    Radius =  3000D
                };
            }

            var circleOptions = new CircleOptions();
            circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude));
            circleOptions.InvokeRadius(circle.Radius);
            circleOptions.InvokeFillColor(0X66B0171F);
            circleOptions.InvokeStrokeColor(0X66FF0000);
            circleOptions.InvokeStrokeWidth(0);
            map.AddCircle(circleOptions);
        }
 private void HandleInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
 {
     CircleOptions circleOptions = new CircleOptions();
     circleOptions.InvokeCenter(InMaui);
     circleOptions.InvokeRadius(100.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);
		}
        /// <summary>
        /// Adds a circle to the map
        /// </summary>
        /// <param name="circle">The circle to add</param>
        private void AddCircle(TKCircle circle)
        {
            circle.PropertyChanged += CirclePropertyChanged;

            var circleOptions = new CircleOptions();

            circleOptions.InvokeRadius(circle.Radius);
            circleOptions.InvokeCenter(circle.Center.ToLatLng());

            if (circle.Color != Color.Default)
            {
                circleOptions.InvokeFillColor(circle.Color.ToAndroid().ToArgb());
            }
            if (circle.StrokeColor != Color.Default)
            {
                circleOptions.InvokeStrokeColor(circle.StrokeColor.ToAndroid().ToArgb());
            }
            circleOptions.InvokeStrokeWidth(circle.StrokeWidth);
            this._circles.Add(circle, this._googleMap.AddCircle(circleOptions));
        }
Exemplo n.º 6
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);
			Inicializa_MapFragment ();
			//Definimos las ciudades en las cuales pondremos nuestros marcadores en el mapa
			MisCiudades.Add ( new Ciudad_Marca ("MÉXICO D.F.","En su forma abreviada México, D. F., es la capital y sede de los poderes federales de los Estados Unidos Mexicanos.",new LatLng (19.430334, -99.13599),"p1"));
			MisCiudades.Add ( new Ciudad_Marca ("LEÓN","Es una ciudad mexicana localizada  en el Estado de Guanajuato,México, en la región del Bajío.",new LatLng ( 21.12806,-101.689163),"p2"));
			MisCiudades.Add ( new Ciudad_Marca ("LAGOS DE MORENO"," Es un municipio y la ciudad más grande y poblada de la Región denominada Los Altos de Jalisco, ubicados en el estado mexicano de Jalisco.",new LatLng ( 21.36453,-101.939076),"p3"));
			MisCiudades.Add ( new Ciudad_Marca ("GUADALAJARA","es una ciudad mexicana, capital del estado de Jalisco, así como principal localidad del área urbana denominada Zona Metropolitana de Guadalajara.",new LatLng ( 20.663626,-103.343754),"p4"));

			CargamosMarcadores ();

			Button btnLinea = FindViewById<Button> (Resource.Id.btnLinea);
			Button btnCirculo = FindViewById<Button> (Resource.Id.btnCirculo);
			Button btnPoligono = FindViewById<Button> (Resource.Id.btnPoligono);
			txtPosicion=(TextView) FindViewById (Resource.Id.txtPosicion);



			btnLinea.Click += delegate {
				PolylineOptions rectOptions = new PolylineOptions();
				if (mMap != null)
				{
					foreach (Ciudad_Marca ciudad in MisCiudades) 
					{
						rectOptions.Add (ciudad.Ubicacion );
					}

					rectOptions.InvokeColor(Color.Red.ToArgb());
					rectOptions.InvokeWidth(25);
					rectOptions.Geodesic(true) ;

					mMap.AddPolyline(rectOptions);
				}
			};

			btnCirculo.Click += delegate {
				if (mMap != null)
				{
					foreach (Ciudad_Marca ciudad in MisCiudades) 
					{
						CircleOptions circleOptions = new CircleOptions();
						circleOptions.InvokeCenter(ciudad.Ubicacion);
						circleOptions.InvokeRadius(10000);

						circleOptions.InvokeStrokeWidth(10);
						circleOptions.InvokeStrokeColor(Color.Blue.ToArgb() );

						Color micolorfill=Color.FromArgb(150,149,153,225);
						circleOptions.InvokeFillColor(micolorfill.ToArgb() );

						mMap.AddCircle(circleOptions);

					}
				}

			};

			btnPoligono.Click += delegate {
				if (mMap != null) {
					PolygonOptions Poligono = new PolygonOptions ();
					foreach (Ciudad_Marca ciudad in MisCiudades) {
						Poligono.Add (ciudad.Ubicacion);
					}

					Poligono.InvokeStrokeWidth(10);
					Poligono.InvokeStrokeColor(Color.Green.ToArgb ());

					Color micolorfill=Color.FromArgb(150,0,255,51);
					Poligono.InvokeFillColor(micolorfill.ToArgb() );

					mMap.AddPolygon (Poligono);
				}
			};


		}
        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;
            }));
        }
Exemplo n.º 8
0
        private void HandleMarkerClick(object sender, GoogleMap.MarkerClickEventArgs e)
        {
            ClearMapOverlays ();
            Marker marker = e.Marker;
            int index = int.Parse (marker.Title);
            extendedMap.pin_Clicked (index );

            Android.Graphics.Color clrb = new Android.Graphics.Color (12,92,169,130);
            Android.Graphics.Color clrr = new Android.Graphics.Color (204,27,39,130);
            PolygonOptions polygonOptions = new PolygonOptions();
            switch (index)
            {
            case 0:
                CircleOptions circleOptions = new CircleOptions ();
                circleOptions.InvokeCenter (new LatLng (extendedMap.pinDatas [index].lat, extendedMap.pinDatas [index].lng));
                circleOptions.InvokeRadius (2000);

                circleOptions.InvokeFillColor (clrb.ToArgb ());
                circleOptions.InvokeStrokeColor (clrr.ToArgb ());

                circle = map.AddCircle (circleOptions);

                break;
            case 1:
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat-0.01, extendedMap.pinDatas[index].lng+0.01));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat+0.01, extendedMap.pinDatas[index].lng+0.01));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat+0.01, extendedMap.pinDatas[index].lng-0.01));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat-0.01, extendedMap.pinDatas[index].lng-0.01));
                polygonOptions.InvokeFillColor (clrb.ToArgb());
                polygonOptions.InvokeStrokeColor (clrr.ToArgb());
                polygon = map.AddPolygon(polygonOptions);
                break;
            case 2:
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat-0.01, extendedMap.pinDatas[index].lng+0.01));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat+0.01, extendedMap.pinDatas[index].lng+0.01));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat+0.005, extendedMap.pinDatas[index].lng));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat+0.02, extendedMap.pinDatas[index].lng-0.02));
                polygonOptions.Add(new LatLng(extendedMap.pinDatas[index].lat-0.01, extendedMap.pinDatas[index].lng-0.01));
                polygonOptions.InvokeFillColor (clrb.ToArgb());
                polygonOptions.InvokeStrokeColor (clrr.ToArgb());
                polygon = map.AddPolygon(polygonOptions);
                break;
                default:
                CircleOptions circleOptions2 = new CircleOptions ();
                circleOptions2.InvokeCenter (new LatLng (extendedMap.pinDatas [index].lat, extendedMap.pinDatas [index].lng));
                circleOptions2.InvokeRadius (2000);

                circleOptions2.InvokeFillColor (clrb.ToArgb ());
                circleOptions2.InvokeStrokeColor (clrr.ToArgb ());

                circle = map.AddCircle (circleOptions2);

                break;
            }
        }