Exemple #1
0
        private void adicionarRadar(RadarInfo radar)
        {
            RadarBLL radarBLL = new RadarBLL();
            string   radarId  = radar.Latitude.ToString() + "|" + radar.Longitude.ToString();

            if (!Radares.ContainsKey(radarId))
            {
                RadarPin ponto = new RadarPin()
                {
                    Id  = radar.Latitude.ToString() + "|" + radar.Longitude.ToString(),
                    Pin = new Pin()
                    {
                        Type     = PinType.Place,
                        Position = new Position(radar.Latitude, radar.Longitude),
                        Label    = radar.Velocidade.ToString() + "km/h"
                    },
                    Sentido    = radar.Direcao,
                    Velocidade = radar.Velocidade,
                    Imagem     = radarBLL.imagemRadar(radar.Velocidade),
                    Tipo       = radar.Tipo
                };
                Radares.Add(ponto.Id, ponto);
                if (AoDesenharRadar != null)
                {
                    AoDesenharRadar(this, ponto);
                }
            }
        }
Exemple #2
0
        MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
        {
            RadarBLL         radarBLL             = new RadarBLL();
            var              annotationIdentifier = "radarLocal";
            MKAnnotationView anView;

            if (annotation is MKUserLocation)
            {
                return(null);
            }
            anView = (MKAnnotationView)mapView.DequeueReusableAnnotation(annotationIdentifier);

            if (anView == null)
            {
                anView = new MKAnnotationView(annotation, annotationIdentifier);
            }

            switch (_radar.Tipo)
            {
            case RadarTipoEnum.RadarFixo:
                anView.Image = GetImage(radarBLL.imagemRadar(_radar.Velocidade));
                break;

            case RadarTipoEnum.SemaforoComRadar:
                anView.Image = GetImage("radar_40_semaforo.png");
                break;

            case RadarTipoEnum.SemaforoComCamera:
                anView.Image = GetImage("semaforo.png");
                break;

            case RadarTipoEnum.RadarMovel:
                anView.Image = GetImage("radar_movel.png");
                break;

            case RadarTipoEnum.PoliciaRodoviaria:
                anView.Image = GetImage("policiarodoviaria.png");
                break;

            case RadarTipoEnum.Lombada:
                anView.Image = GetImage("lombada.png");
                break;

            case RadarTipoEnum.Pedagio:
                anView.Image = GetImage("pedagio.png");
                break;
            }

            anView.CanShowCallout = true;
            return(anView);
        }