public void AddPolygon(View view) { if (null == hMap) { return; } if (null != mPolygon) { mPolygon.Remove(); } PolygonOptions polygonOptions = new PolygonOptions(); var rectangleLatLng = MapUtils.CreateRectangle(new LatLng(48.893478, 2.334595), 0.1, 0.1); foreach (LatLng item in rectangleLatLng) { polygonOptions.Add(item); } polygonOptions.InvokeFillColor(Color.Green).InvokeStrokeColor(Color.Black); mPolygon = hMap.AddPolygon(polygonOptions); hMap.SetOnPolygonClickListener(this); }
public void SetPoints(View v) { if (null != mPolygon) { string latitude = oneLatitude.Text.ToString().Trim(); string longtitude = oneLongtitude.Text.ToString().Trim(); if (CheckUtils.CheckIsEdit(latitude) || CheckUtils.CheckIsEdit(longtitude)) { Toast.MakeText(this, "Please make sure the latitude & longtitude is Edited", ToastLength.Short).Show(); } else { if (!CheckUtils.CheckIsRight(latitude) || !CheckUtils.CheckIsRight(longtitude)) { Toast.MakeText(this, "Please make sure the latitude & longtitude is right", ToastLength.Short).Show(); } else { mPolygon.Points = (MapUtils .CreateRectangle(new LatLng(System.Double.Parse(latitude), System.Double.Parse(longtitude)), 0.5, 0.5)); } } } }