Exemplo n.º 1
0
        public PinViewModel(MapViewModel mapView, MapPosition position, PinDisplayType type, bool showCircle)
        {
            X      = position.X;
            Y      = position.Y;
            Radius = position.Radius;
            Label  = position.Description;
            if (Label == null)
            {
                Label = "";
            }
            MapView     = mapView;
            MapPosition = position;
            _colourType = type;
            _showCircle = showCircle;

            this.PropertyChanged += (_, __) => RefreshPinOnMap();
            this.PropertyChanged += (_, __) => RefreshCircleOnMap();

            Pin = new ColouredPin()
            {
                Position = new Position(X, Y),
                Type     = PinType.Generic,
                Label    = Label
            };

            Circle = new Circle()
            {
                Center      = new Position(X, Y),
                Radius      = new Distance(Radius),
                StrokeWidth = 7
            };

            if (type != PinDisplayType.NOT_VISIBLE)
            {
                MapView.MapPage.AddPinToMap(Pin);
                PinOnMap = true;
            }
            else
            {
                PinOnMap = false;
            }

            if (_showCircle)
            {
                mapView.MapPage.AddMapElementToMap(Circle);
                CircleOnMap = true;
            }
            else
            {
                CircleOnMap = false;
            }

            RefreshPinOnMap();
            RefreshCircleOnMap();
        }
Exemplo n.º 2
0
        private float GetColourByDisplayType(PinDisplayType pinDisplayType)
        {
            switch (pinDisplayType)
            {
            case PinDisplayType.LOCKED: return(_lockedPinColour);

            case PinDisplayType.UNLOCKED: return(_unLockedPinColour);

            case PinDisplayType.NOT_STOP: return(_notStopPinColour);

            default: return(0);
            }
        }
Exemplo n.º 3
0
        public PinViewModel AddMapPosition(MapPosition mapPosition, PinDisplayType type, bool showCircle)
        {
            foreach (PinViewModel model in Pins)
            {
                if (model.MapPosition == mapPosition)
                {
                    model.ColourType = type;
                    model.ShowCircle = showCircle;
                    return(model);
                }
            }

            var pinViewModel = new PinViewModel(this, mapPosition, type, showCircle);

            Pins.Add(pinViewModel);
            return(pinViewModel);
        }