/// <summary> /// Replaces the already visible zone or creates a new one. /// </summary> /// <param name="z">The z coordinate.</param> /// <param name="replace">The z coordinate.</param> void CreateZone (Zone z, Polygon replace = null) { IList<LatLng> points = new List<LatLng>(z.Points.Count); if (replace != null) { // Replace the points from the old polygon foreach (var zp in z.Points) { points.Add(new LatLng(zp.Latitude, zp.Longitude)); replace.Points = points; } } else { // Create a new polygon for zone PolygonOptions po = new PolygonOptions (); foreach (var zp in z.Points) { po.Points.Add (new LatLng (zp.Latitude, zp.Longitude)); } po.InvokeStrokeColor (Color.Argb (160, 255, 0, 0)); po.InvokeStrokeWidth (2); po.InvokeFillColor (Color.Argb (80, 255, 0, 0)); po.InvokeZIndex(1); // Add polygon to list of active zones zones.Add (z.ObjIndex, _map.AddPolygon (po)); } }