/// <summary> /// Draw line from active location to active object, if it is a zone. /// </summary> void UpdateDistanceLine () { if (activeObject != null && activeObject is Zone) { if (activeObject is Zone && ((Zone)activeObject).State != PlayerZoneState.Inside) { if (distanceLine == null) { // Draw line PolylineOptions po = new PolylineOptions(); po.Points.Add (new LatLng (Main.GPS.Location.Latitude, Main.GPS.Location.Longitude)); po.Points.Add (new LatLng (((Zone)activeObject).ObjectLocation.Latitude, ((Zone)activeObject).ObjectLocation.Longitude)); //.ObjectLocation.Latitude, ((Zone)activeObject).ObjectLocation.Longitude)); po.InvokeColor(Color.Cyan); po.InvokeWidth(4); po.InvokeZIndex(2); distanceLine = _map.AddPolyline(po); } else { // Set new line points List<LatLng> points = new List<LatLng>(2); points.Add (new LatLng (Main.GPS.Location.Latitude, Main.GPS.Location.Longitude)); points.Add (new LatLng (((Zone)activeObject).ObjectLocation.Latitude, ((Zone)activeObject).ObjectLocation.Longitude)); //.ObjectLocation.Latitude, ((Zone)activeObject).ObjectLocation.Longitude)); distanceLine.Points = points; } } else { // Delete line if (distanceLine != null) { distanceLine.Remove (); distanceLine = null; } } } else { // Delete line if (distanceLine != null) { distanceLine.Remove (); distanceLine = null; } } }
private PolylineOptions CreatePolylineOptions(MapPolyline polyline) { var op = new PolylineOptions(); op.InvokeColor(polyline.Color.ToAndroid().ToArgb()); op.InvokeWidth((float)polyline.Width); op.InvokeZIndex(polyline.ZIndex); return op; }
private static PolylineOptions CloneOptions(PolylineOptions op) { var options = new PolylineOptions(); options.InvokeColor(op.Color); options.InvokeWidth(op.Width); options.InvokeZIndex(op.ZIndex); return options; }