コード例 #1
0
        public void AddMarkers()
        {
            var points = Points.Get();

            if (points == null || points.Count == 0)
            {
                Monitor.ClearLayer(LayerMarkers);
                return;
            }
            var inicio  = points.First();
            var fin     = points.Last();
            var markIni = new Marker("inicio", ResolveUrl("~/images/salida.png"), inicio.Y, inicio.X, DrawingFactory.GetSize(32, 32), DrawingFactory.GetOffset(-16, -32));
            var markFin = new Marker("fin", ResolveUrl("~/images/llegada.png"), fin.Y, fin.X, DrawingFactory.GetSize(32, 32), DrawingFactory.GetOffset(-16, -32));

            Monitor.AddMarkers(LayerMarkers, markIni, markFin);
        }
コード例 #2
0
        private void GetMessages()
        {
            var messages = lbMessages.SelectedStringValues;

            if (MessagesIds.Count == 0 && messages.Count == 0)
            {
                return;
            }

            var empresa   = DAOFactory.EmpresaDAO.FindById(ddlDistrito.Selected);
            var maxMonths = empresa != null && empresa.Id > 0 ? empresa.MesesConsultaPosiciones : 3;
            var events    = DAOFactory.LogMensajeDAO.GetByMobilesAndTypes(ddlMovil.SelectedValues, GetSelectedMessagesCodes(messages), InitialDate, FinalDate, maxMonths);

            for (var i = 0; i < events.Count(); i++)
            {
                var el = events.ElementAt(i);

                if (!el.HasValidLatitudes())
                {
                    continue;
                }

                var messageIconUrl = el.GetIconUrl();
                var iconUrl        = string.IsNullOrEmpty(messageIconUrl) ? Images.DefaultMessage : string.Concat(IconDir, messageIconUrl);

                Monitor.AddMarkers(Layers.Mensajes, new Marker(i.ToString("#0"), iconUrl, el.Latitud, el.Longitud,
                                                               string.Format("javascript:gMSP({0})", el.Id), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12)));

                //if (el.HasDuration()) AddMessageWithElapsedTime(el);
            }

            SetMessagesCenterIndex(events);
        }
コード例 #3
0
        /// <summary>
        /// Displays the last position reported by the givenn mobile or device.
        /// </summary>
        /// <param name="lastPosition"></param>
        private void DisplayPosition(MobilePosition lastPosition)
        {
            var id        = lastPosition.IdPosicion.ToString();
            var latitude  = lastPosition.Latitud;
            var longitude = lastPosition.Longitud;

            var popup = string.Format("javascript:gPP('{0}','{1}','{2}','{3}','{4}','{5}')", lastPosition.EsquinaCercana, lastPosition.Interno, lastPosition.Responsable,
                                      lastPosition.Dispositivo, string.Concat(lastPosition.Fecha.Value.ToShortDateString(), "", lastPosition.Fecha.Value.TimeOfDay.ToString()), lastPosition.Velocidad);

            var marker = new Marker(id, CurrentPositionImgUrl, latitude, longitude, popup, DrawingFactory.GetSize(21, 25), DrawingFactory.GetOffset(-10.5, -25));

            Monitor.AddMarkers(_posicion, marker);

            Monitor.SetCenter(latitude, longitude);

            Monitor.SetDefaultCenter(latitude, longitude);

            Monitor.TriggerEvent(id, _posicion, PopupEvent);
        }
コード例 #4
0
        private void GetReferenciasGeograficas()
        {
            var pois = !PoisTypesIds.Contains(0)
                       ? DAOFactory.ReferenciaGeograficaDAO.GetList(new[] { Distrito }, new[] { Location }, PoisTypesIds).Where(x => x.Vigencia == null || x.Vigencia.Vigente(InitialDate, FinalDate)).ToList()
                       : new List <ReferenciaGeografica>();

            if (pois.Count == 0 && lstTicket.SelectedValue != "")
            {
                var value = lstTicket.SelectedValue.Contains("T-") || lstTicket.SelectedValue.Contains("V-")
                            ? Convert.ToInt32((string)lstTicket.SelectedValue.Split('-')[1])
                            : Convert.ToInt32((string)lstTicket.SelectedValue);

                if (value > 0 && lstTicket.SelectedValue.Contains("T-"))
                {
                    var ticket = DAOFactory.TicketDAO.FindById(value);

                    pois.Add(ticket.Linea.ReferenciaGeografica);
                    pois.Add(ticket.PuntoEntrega.ReferenciaGeografica);
                }

                if (value > 0 && lstTicket.SelectedValue.Contains("V-"))
                {
                    var viaje = DAOFactory.ViajeDistribucionDAO.FindById(value);

                    pois.Add(viaje.Linea.ReferenciaGeografica);
                    pois.AddRange(viaje.Detalles.Select(detalle => detalle.ReferenciaGeografica));
                }
            }

            foreach (var punto in pois)
            {
                if (punto.Poligono != null)
                {
                    DrawGeocerca(punto);
                }

                if (punto.Direccion != null)
                {
                    Monitor.AddMarkers(Layers.PuntosDeInteres, new Marker(punto.Id.ToString("#0"), GetPoiIcon(punto), punto.Direccion.Latitud, punto.Direccion.Longitud,
                                                                          string.Format("javascript:gPOIP('{0}')", punto.Descripcion), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12)));
                }
            }
        }
コード例 #5
0
        private void GetReferenciasGeograficas()
        {
            var pois = !PoisTypesIds.Contains(0)
                       ? DAOFactory.ReferenciaGeograficaDAO.GetList(new[] { Distrito }, new[] { Location }, PoisTypesIds).Where(x => x.Vigencia == null || x.Vigencia.Vigente(InitialDate, FinalDate)).ToList()
                       : new List <ReferenciaGeografica>();

            foreach (var punto in pois)
            {
                if (punto.Poligono != null)
                {
                    DrawGeocerca(punto);
                }

                if (punto.Direccion != null)
                {
                    Monitor.AddMarkers(Layers.PuntosDeInteres, new Marker(punto.Id.ToString("#0"), GetPoiIcon(punto), punto.Direccion.Latitud, punto.Direccion.Longitud,
                                                                          string.Format("javascript:gPOIP('{0}')", punto.Descripcion), DrawingFactory.GetSize(24, 24), DrawingFactory.GetOffset(-12, -12)));
                }
            }
        }