예제 #1
0
        /// <summary>
        /// Adds a polygonal geocerca.
        /// </summary>
        /// <param name="points"></param>
        protected void AddPolygon(List <PointF> points)
        {
            monitor.ClearLayer(LayerAreasPoi);

            if (points == null || points.Count == 0)
            {
                return;
            }

            var poly = new Polygon("POLYGON", StyleFactory.GetPointFromColor(Color));

            for (var i = 0; i < points.Count; i++)
            {
                poly.AddPoint(new Point(i.ToString("#0"), points[i].X, points[i].Y));
            }

            monitor.AddGeometries(LayerAreasPoi, poly);

            if (Direccion == null)
            {
                var lat = points.Average(p => p.Y);
                var lon = points.Average(p => p.X);
                SetCenter(lat, lon);
            }
        }
예제 #2
0
        protected void AddCircle(int id, PointF point, int radio, string layer, Color color)
        {
            if (radio <= 0)
            {
                return;
            }

            var poly = new Point(id.ToString("#0"), point.X, point.Y, radio, StyleFactory.GetPointFromColor(color));

            monitor.AddGeometries(layer, poly);
            monitor.SetCenter(point.Y, point.X);
        }
예제 #3
0
        private void DrawPolygon(ReferenciaGeografica geocerca, Color color)
        {
            var poligono = new Polygon(string.Format("POLYGON_{0}", geocerca.Id), StyleFactory.GetPointFromColor(color));

            var points = geocerca.Poligono.ToPointFList();

            for (var i = 0; i < points.Count; i++)
            {
                poligono.AddPoint(new Point(string.Format("{0}_{1}", geocerca.Id, i), points[i].X, points[i].Y));
            }

            Monitor.AddGeometries(Layers.Geocercas, poligono);
        }
예제 #4
0
        /// <summary>
        /// Adds a circle shaped geocerca.
        /// </summary>
        /// <param name="point"></param>
        /// <param name="radio"></param>
        protected void AddCircle(PointF point, int radio)
        {
            monitor.ClearLayer(LayerAreasPoi);

            if (Radio <= 0)
            {
                return;
            }

            var poly = new Point("POLYGON", point.X, point.Y, radio, StyleFactory.GetPointFromColor(Color));

            monitor.AddGeometries(LayerAreasPoi, poly);
        }
예제 #5
0
        protected void AddPolygon(int id, List <PointF> points, string layer, Color color)
        {
            if (points == null || points.Count == 0)
            {
                return;
            }

            var poly = new Polygon(id.ToString("#0"), StyleFactory.GetPointFromColor(color));

            for (var i = 0; i < points.Count; i++)
            {
                poly.AddPoint(new Point(i.ToString("#0"), points[i].X, points[i].Y));
            }

            monitor.AddGeometries(layer, poly);
            monitor.SetCenter(points.Last().Y, points.Last().X);
        }
예제 #6
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);
        }
예제 #7
0
        private void DrawCircle(ReferenciaGeografica geocerca, Color color)
        {
            var point    = geocerca.Poligono.FirstPoint;
            var poligono = new Point(string.Format("POINT_{0}", geocerca.Id), point.X, point.Y, geocerca.Poligono.Radio, StyleFactory.GetPointFromColor(color));

            Monitor.AddGeometries(Layers.Geocercas, poligono);
        }
예제 #8
0
        protected List <Geometry> GeneratePuntos(ViajeDistribucion distribucion, Color color)
        {
            var geomList = new List <Geometry>();

            var entregas = distribucion.Detalles.Where(d => d.Linea == null);

            foreach (var entrega in entregas)
            {
                var punto = entrega.ReferenciaGeografica;
                if (punto != null)
                {
                    var radio = punto.Poligono != null && punto.Poligono.Radio > 0
                                    ? punto.Poligono.Radio : 100;
                    var geocerca = new Point("G:" + punto.Id, punto.Longitude, punto.Latitude, radio, StyleFactory.GetPointFromColor(color));
                    //var marker = MarkerFactory.CreateMarker("P:" + punto.Id, string.Empty, punto.Latitude, punto.Longitude, GetEntregaPopupContent(entrega.Id));

                    geomList.Add(geocerca);
                    //markerList.Add(marker);
                }
            }

            return(geomList);

            /*
             * if (markerList.Any())
             *  monitorPuntos.AddMarkers(LayerPuntos, markerList.ToArray());
             * if (geomList.Any())
             *  monitorPuntos.AddGeometries(LayerReferencias, geomList.ToArray());
             */
        }