コード例 #1
0
        protected void AddMarker(EntidadPadre entidad, string style)
        {
            if (entidad != null)
            {
                var icono = IconDir;
                if (entidad.ReferenciaGeografica != null && entidad.ReferenciaGeografica.Icono != null)
                {
                    icono += entidad.ReferenciaGeografica.Icono.PathIcono;
                }

                var desc             = entidad.Descripcion;
                var refGeo           = entidad.ReferenciaGeografica;
                var vehiculoAsociado = DAOFactory.CocheDAO.FindMobileByDevice(entidad.Dispositivo.Id);
                var ultimaPosicion   = vehiculoAsociado != null?DAOFactory.LogPosicionDAO.GetLastVehiclesPositions(new List <Coche> {
                    vehiculoAsociado
                })[vehiculoAsociado.Id] : null;

                var latitud  = ultimaPosicion != null ? ultimaPosicion.Latitud : refGeo != null ? refGeo.Latitude : 0;
                var longitud = ultimaPosicion != null ? ultimaPosicion.Longitud : refGeo != null ? refGeo.Longitude : 0;
                var marker   = MarkerFactory.CreateLabeledMarker(entidad.Id.ToString("#0"), icono, latitud, longitud, desc, style, GetMovilPopupContent(entidad));

                if (refGeo != null && refGeo.Icono != null)
                {
                    marker.Size   = DrawingFactory.GetSize(refGeo.Icono.Width, refGeo.Icono.Height);
                    marker.Offset = DrawingFactory.GetOffset(refGeo.Icono.OffsetX, refGeo.Icono.OffsetY);
                }

                Monitor.AddMarkers(LayerEntidades, marker);
            }
        }
コード例 #2
0
        private void AddFlags(IList <List <RoutePosition> > routes)
        {
            var start = routes[0][0];
            var end   = routes[routes.Count - 1][routes[routes.Count - 1].Count - 1];

            var size   = DrawingFactory.GetSize(40, 40);
            var offset = DrawingFactory.GetOffset(-20, -32);

            Monitor.AddMarkers(Layers.Eventos, new Marker(start.Date.ToDisplayDateTime().ToString(), Images.Start, start.Latitude, start.Longitude,
                                                          string.Format("javascript:gFP('{0}')", string.Concat(start.Date.ToDisplayDateTime().ToShortDateString(), " ", start.Date.ToDisplayDateTime().TimeOfDay.ToString())), size, offset),
                               new Marker(end.Date.ToDisplayDateTime().ToString(), Images.End, end.Latitude, end.Longitude, string.Format("javascript:gFP('{0}')",
                                                                                                                                          string.Concat(end.Date.ToDisplayDateTime().ToShortDateString(), " ", end.Date.ToDisplayDateTime().TimeOfDay.ToString())), size, offset));
        }
コード例 #3
0
        private static string GetMarkerOffset(RouteEvent routeEvent)
        {
            if (routeEvent.MaximumSpeed == 0)
            {
                return(DrawingFactory.GetOffset(-12, -12));
            }

            const int desplazamiento = 10;
            var       angulo         = (-(routeEvent.Direction - 90) * 2 * Math.PI) / 360;
            var       dx             = Math.Cos(angulo) * desplazamiento;
            var       dy             = Math.Sin(angulo) * desplazamiento;

            return(DrawingFactory.GetOffset(-12 + dx, -12 - dy));
        }
コード例 #4
0
ファイル: Consola.aspx.cs プロジェクト: jesumarquez/lt
        protected void btMapa_Command(object sender, CommandEventArgs e)
        {
            var pos    = e.CommandArgument.ToString().Split(',');
            var lat    = Convert.ToDouble(pos[0], CultureInfo.InvariantCulture);
            var lon    = Convert.ToDouble(pos[1], CultureInfo.InvariantCulture);
            var icn    = string.Concat(ImagesDir, "salida.png");
            var size   = DrawingFactory.GetSize(40, 40);
            var offset = DrawingFactory.GetOffset(-20, -32);
            var marker = new Marker("0", icn, lat, lon, size, offset);

            Monitor1.AddMarkers("Posicion", marker);
            Monitor1.SetCenter(lat, lon, 12);
            modalMapa.Show();
            ScriptManager.RegisterStartupScript(this, typeof(string), "hidemap", string.Format("$get('{0}').style.visibility = '';", divMapa.ClientID), true);
        }
コード例 #5
0
        protected void AddMarker(EntregaDistribucion item, string imageUrl)
        {
            if (item.ReferenciaGeografica == null)
            {
                return;
            }
            var id       = item.Id.ToString("0");
            var latitud  = item.ReferenciaGeografica.Latitude;
            var longitud = item.ReferenciaGeografica.Longitude;
            var label    = item.Programado.ToString("HH:mm");
            var marker   = MarkerFactory.CreateLabeledMarker("m" + id, imageUrl, latitud, longitud, label);

            marker.Size   = DrawingFactory.GetSize(20, 20);
            marker.Offset = DrawingFactory.GetOffset(-10, -10);
            Monitor1.AddMarkers(LayerEntregas, marker);
        }
コード例 #6
0
ファイル: EditGeoRef.ascx.cs プロジェクト: jesumarquez/lt
        private void AddMarker()
        {
            monitor.ClearLayer(LayerPoi);
            var dir = DireccionSearch1.Selected;

            if (dir == null)
            {
                return;
            }

            var marker = new Marker("1", IconPath, dir.Latitud, dir.Longitud,
                                    DrawingFactory.GetSize(IconWidth, IconHeight),
                                    DrawingFactory.GetOffset(IconOffsetX, IconOffsetY));

            monitor.AddMarkers(LayerPoi, marker);
            SetCenter(dir.Latitud, dir.Longitud);
            monitor.ZoomTo(11);
        }
コード例 #7
0
        private void AddReferenciaGeografica(string layerPoi, string layerArea, ReferenciaGeografica dom, string popupContent)
        {
            if (dom.Poligono != null)
            {
                var center = dom.Poligono.FirstPoint;
                var col    = StyleFactory.GetPointFromColor(dom.Color.Color);
                var id     = dom.Id + "_GEO";

                if (dom.Poligono.Radio > 0)
                {
                    Monitor.AddGeometries(layerArea, new Point(id, center.X, center.Y, dom.Poligono.Radio, col));
                }
                else
                {
                    var points = dom.Poligono.ToPointFList();
                    var poly   = new Polygon(id, col);
                    for (var i = 0; i < points.Count; i++)
                    {
                        poly.AddPoint(new Point(id + "_" + i, points[i].X, points[i].Y));
                    }

                    Monitor.AddGeometries(layerArea, poly);
                }
            }

            if (dom.Direccion == null)
            {
                return;
            }

            var icono  = dom.Icono != null ? IconDir + dom.Icono.PathIcono : string.Empty;
            var marker = new Marker(dom.Id.ToString("#0"),
                                    icono,
                                    dom.Direccion.Latitud,
                                    dom.Direccion.Longitud,
                                    popupContent,
                                    DrawingFactory.GetSize(dom.Icono != null ? dom.Icono.Width : 0, dom.Icono != null ? dom.Icono.Height : 0), DrawingFactory.GetOffset(dom.Icono != null ? dom.Icono.OffsetX : 0, dom.Icono != null ? dom.Icono.OffsetY : 0));

            Monitor.AddMarkers(layerPoi, marker);
        }
コード例 #8
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);
        }
コード例 #9
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)));
                }
            }
        }
コード例 #10
0
        private void GetCenter(IEnumerable <List <RoutePosition> > routes)
        {
            var centerPosition = PosCenterIndex;

            if (centerPosition == null)
            {
                return;
            }

            foreach (var position in routes.SelectMany(route => route.Where(position => position.Id.Equals(centerPosition.Value))))
            {
                Monitor.AddMarkers(Layers.Eventos, new Marker(position.Date.ToDisplayDateTime().ToString(), Images.CurrentPosition, position.Latitude, position.Longitude,
                                                              string.Format("javascript:gCP('{0}', '{1}', '{2}')", GeocoderHelper.GetDescripcionEsquinaMasCercana(position.Latitude, position.Longitude),
                                                                            position.Date.ToDisplayDateTime(), position.Speed),
                                                              DrawingFactory.GetSize(21, 25), DrawingFactory.GetOffset(-10.5, -25)));

                _x = position.Latitude;
                _y = position.Longitude;

                Monitor.TriggerEvent(position.Date.ToDisplayDateTime().ToString(), Layers.Eventos, PopupEvent);
            }
        }
コード例 #11
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);
        }
コード例 #12
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);
        }
コード例 #13
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)));
                }
            }
        }