Example #1
0
        private void OnPinClicked(TKCustomMapPin pin)
        {
            var firstPosition = Pins.First().Position;
            var position      = pin.Position;

            // if the user tapped the first marker, we'll close the gap.
            // and prevent them from adding more points.
            _allowedToAddPoint = _allowedToAddPoint &&
                                 Pins.Count > 1 &&
                                 !(Math.Abs(position.Latitude - firstPosition.Latitude) <= 0 && Math.Abs(position.Longitude - firstPosition.Longitude) <= 0);

            if (!_allowedToAddPoint)
            {
                var polygon = new TKPolygon
                {
                    Color       = Color.FromHex("#7f000000"),
                    StrokeColor = Color.Black,
                    StrokeWidth = 2
                };
                foreach (var line in Polylines)
                {
                    polygon.Coordinates.AddRange(line.LineCoordinates);
                }
                Polylines.Clear();
                Polygons.Clear();
                Pins.Clear();
                Polygons.Add(polygon);
            }
        }
Example #2
0
        /// <summary>
        /// Gets the <see cref="GpioPin"/> with the specified Wiring Pi pin number.
        /// </summary>
        /// <value>
        /// The <see cref="GpioPin"/>.
        /// </value>
        /// <param name="pinNumber">The pin number.</param>
        /// <returns>A reference to the GPIO pin.</returns>
        public GpioPin this[WiringPiPin pinNumber]
        {
            get
            {
                if (pinNumber == WiringPiPin.Unknown)
                {
                    throw new InvalidOperationException("You can not get an unknown WiringPi pin.");
                }

                return(Pins.First(p => p.WiringPiPinNumber == pinNumber));
            }
        }