示例#1
0
        private MapItemStorage CreateData()
        {
            MapItemStorage storage = new MapItemStorage();

            // Create the first triangle.
            storage.Items.Add(
                CreatePolygon(800, "Small triangle",
                              new GeoPoint[] {
                new GeoPoint(0, 0), new GeoPoint(0, 40),
                new GeoPoint(40, 0), new GeoPoint(0, 0)
            }
                              )
                );

            // Create the second triangle.
            storage.Items.Add(
                CreatePolygon(1800, "Large triangle",
                              new GeoPoint[] {
                new GeoPoint(0, 0), new GeoPoint(0, -60),
                new GeoPoint(-60, 0), new GeoPoint(0, 0)
            }
                              )
                );

            return(storage);
        }
示例#2
0
        private void InitMapControl()
        {
            VectorItemsLayer itemsLayer = new VectorItemsLayer();
            MapItemStorage   storage    = new MapItemStorage();
            List <MapItem>   stations   = Getstations();

            storage.Items.AddRange(stations);
            itemsLayer.Data = storage;
            map.Layers.Add(itemsLayer);
        }
示例#3
0
        private IMapDataAdapter CreateMapItemStorage(int distanceRadius)
        {
            MapItemStorage      mapStorage = new MapItemStorage();
            List <PhotoMapItem> items      = MapClasterizationHelper.Default.GetClasteredItems(MapControl, Files, distanceRadius);

            mapStorage.Items.BeginUpdate();
            try {
                mapStorage.Items.AddRange(items);
            } finally {
                mapStorage.Items.EndUpdate();
            }
            return(mapStorage);
        }
        void OnElevationCalculated(object sender, ElevationsCalculatedEventArgs e)
        {
            MapItemStorage storage = new MapItemStorage();

            foreach (ElevationInformation elevationInformation in e.Result.Locations)
            {
                storage.Items.Add(new MapCallout()
                {
                    Text     = string.Format("{0}\nElevation = {1} m", elevationInformation.Location, elevationInformation.Elevation),
                    Location = elevationInformation.Location
                });
            }
            vectorLayer.Data = storage;
        }
示例#5
0
        private MapItemStorage ObtenerRutas()
        {
            var storage = new MapItemStorage();
            var rutas = new List<RutaMapa>();

            for (var i = 0; i < TareasCumplimientodeEntregas.Count - 1; i++)
            {
                var r = new RutaMapa(TareasCumplimientodeEntregas[i], TareasCumplimientodeEntregas[i + 1]);
                rutas.Add(r);
            }

            storage.Items.AddRange(rutas.ToArray());
            return storage;
        }
示例#6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            mapControl.CenterPoint = new GeoPoint(37.54164, 126.84035);
            mapControl.ZoomLevel   = 13;
            VectorItemsLayer itemsLayer = new VectorItemsLayer();

            mapControl.Layers.Add(itemsLayer);
            MapItemStorage storage  = new MapItemStorage();
            List <MapItem> capitals = GetCapitals();

            storage.Items.AddRange(capitals);
            itemsLayer.Data = storage;
        }
示例#7
0
 internal void DestroyStorage()
 {
     if (Layer != null)
     {
         Layer.Data = null;
     }
     if (VisibleItemsStorage != null)
     {
         VisibleItemsStorage.Items.Clear();
         VisibleItemsStorage.Dispose();
         VisibleItemsStorage = null;
         FixMapBug(VisibleItems);
         VisibleItems.Clear();
     }
 }
        private MapDataAdapterBase CreateData()
        {
            MapItemStorage storage = new MapItemStorage();

            MapPie pie = new MapPie()
            {
                Location = new GeoPoint(50, 13), Size = 100
            };

            pie.Segments.Add(CreatePieSegment("A", 100, "color1"));
            pie.Segments.Add(CreatePieSegment("B", 50, "color2"));
            pie.Segments.Add(CreatePieSegment("C", 120, "color3"));
            storage.Items.Add(pie);

            return(storage);
        }
示例#9
0
        private MapDataAdapterBase CreateData()
        {
            MapItemStorage storage = new MapItemStorage();
            Random         rnd     = new Random();

            for (int i = 0; i < 100; i++)
            {
                int sign   = rnd.Next(2) > 0 ? 1 : -1;
                int coordX = rnd.Next(60) * sign;
                sign = rnd.Next(2) > 0 ? 1 : -1;
                int coordY     = rnd.Next(110) * sign;
                int colorIndex = Math.Max(1, rnd.Next(4));
                storage.Items.Add(CreateBubbleItem(coordX, coordY, colorIndex));
            }

            return(storage);
        }
示例#10
0
        private void InitializeMiniMap()
        {
            MiniMapImageTilesLayer miniMapTiles = (MiniMapImageTilesLayer)MiniMap.Layers["ImageTilesLayer"];

            SetBingMapDataProviderKey(miniMapTiles.DataProvider as BingMapDataProvider);
            MiniMapVectorItemsLayer layer   = new MiniMapVectorItemsLayer();
            MapItemStorage          storage = new MapItemStorage();

            layer.Data = storage;
            foreach (PhotoMapItem item in ((MapItemStorage)((VectorItemsLayer)MapControl.Layers[2]).Data).Items)
            {
                storage.Items.Add(new MapDot()
                {
                    Location = item.Location, Size = 4, Fill = Color.Red
                });
            }
            MapControl.MiniMap.Layers.Add(layer);
        }
示例#11
0
        private void InitializeData()
        {
            Ellipse = new MapEllipse
            {
                Fill             = TransparentBrush,
                IsHitTestVisible = false,
                Stroke           = ColoredBrush,
                StrokeStyle      = new StrokeStyle()
                {
                    Thickness = 4
                }
            };
            var dot = new MapDot()
            {
                Fill             = CenterFillBrush,
                Stroke           = TransparentBrush,
                Size             = 20,
                IsHitTestVisible = false
            };

            CenterMarkers = new List <MapDot>();
            CenterMarkers.Add(dot);
            dot = new MapDot()
            {
                Fill        = TransparentBrush,
                Stroke      = CenterBorderBrush,
                Size        = 32,
                StrokeStyle = new StrokeStyle()
                {
                    Thickness = 5
                },
                IsHitTestVisible = false
            };
            CenterMarkers.Add(dot);
            var storage = new MapItemStorage();

            storage.Items.Add(Ellipse);
            foreach (var marker in CenterMarkers)
            {
                storage.Items.Add(marker);
            }
            this.Data = storage;
        }
示例#12
0
        private MapDataAdapterBase CreateData()
        {
            MapItemStorage storage = new MapItemStorage();

            // Create bubble charts and add them to the storage.
            storage.Items.Add(new MapBubble()
            {
                Argument = "A", Value = 100,
                Location = new GeoPoint(-50, -70), Size = 100
            });
            storage.Items.Add(new MapBubble()
            {
                Argument = "B", Value = 70,
                Location = new GeoPoint(-50, 0), Size = 70
            });
            storage.Items.Add(new MapBubble()
            {
                Argument = "C", Value = 120,
                Location = new GeoPoint(-50, 70), Size = 120
            });

            //Create a pie chart and add it to the storage.
            MapPie pie = new MapPie()
            {
                Location = new GeoPoint(30, 0), Size = 100
            };

            pie.Segments.Add(new PieSegment()
            {
                Argument = "A", Value = 100
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = "B", Value = 50
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = "C", Value = 120
            });
            storage.Items.Add(pie);

            return(storage);
        }
        void OnShapesLoaded(object sender, ShapesLoadedEventArgs e)
        {
            MapPolyline line = new MapPolyline()
            {
                StrokeStyle = new StrokeStyle()
                {
                    Thickness = 3
                }
            };

            line.Points.Assign(((ISupportCoordPoints)e.Shapes[0]).Points);
            MapItemStorage storage = new MapItemStorage();

            storage.Items.Add(line);
            PolylineData = storage;
            MapPolyline etalonLine = new MapPolyline();

            etalonLine.Points.Assign(((ISupportCoordPoints)e.Shapes[0]).Points);
            storage = new MapItemStorage();
            storage.Items.Add(etalonLine);
            EtalonData = storage;
        }
示例#14
0
        private MapItemStorage ObtenerCamion()
        {
            if (TareasCumplimientodeEntregas.Count <= 1) return null;
            var storage = new MapItemStorage();
            var primeraTarea = TareasCumplimientodeEntregas[0];
            var segundaTarea = TareasCumplimientodeEntregas[1];

            var puntoPrimeraTarea = new GeoCoordinate(primeraTarea.Latitude, primeraTarea.Longitude);
            var puntoSegundaTarea = new GeoCoordinate(segundaTarea.Latitude, segundaTarea.Longitude);
            var distancia = puntoPrimeraTarea.GetDistanceTo(puntoSegundaTarea);

            Camion = new CamionMapa()
            {
                TareaActual = TareasCumplimientodeEntregas.FirstOrDefault(),
                DistanciaRecorrida = 0,
                Distancia = distancia,
                Location = TareasCumplimientodeEntregas.FirstOrDefault().Location
            };

            storage.Items.Add(Camion);
            return storage;
        }
示例#15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            MapItemStorage storage = new MapItemStorage();

            pie = new MapPie()
            {
                Location = new GeoPoint(51.507222, -0.1275),
                Size     = 100,
                Argument = "pie",
            };
            pie.Segments.Add(new PieSegment()
            {
                Argument = NextLetter(), Value = defaultValue
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = NextLetter(), Value = defaultValue
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = NextLetter(), Value = defaultValue
            });

            storage.Items.Add(pie);

            mapControl1.Layers.Add(new VectorItemsLayer()
            {
                Data      = storage,
                Colorizer = new KeyColorColorizer()
                {
                    ItemKeyProvider       = new ArgumentItemKeyProvider(),
                    PredefinedColorSchema = PredefinedColorSchema.Palette
                }
            });

            lbRotationDirection.DataSource = Enum.GetValues(typeof(RotationDirection));
            lbSegments.DataSource          = pie.Segments;
        }
示例#16
0
        private MapItemStorage LoadDataFromXML(string filePath)
        {
            MapItemStorage storage = new MapItemStorage();

            // Load an XML document from the specified file path.
            XDocument document = XDocument.Load(filePath);

            if (document != null)
            {
                foreach (XElement element in document.Element("Capitals").Elements())
                {
                    // Specify shapes attributes by loaded from an XML file values.
                    double latitude = Convert.ToDouble(element.Element("Latitude").Value,
                                                       CultureInfo.InvariantCulture
                                                       );
                    double longitude = Convert.ToDouble(element.Element("Longitude").Value,
                                                        CultureInfo.InvariantCulture
                                                        );
                    string name       = element.Element("Name").Value;
                    uint   population = Convert.ToUInt32(element.Element("Population").Value);

                    MapDot capital = new MapDot()
                    {
                        Location = new GeoPoint(latitude, longitude), Size = 20
                    };
                    capital.Attributes.Add(new MapItemAttribute()
                    {
                        Name = "CityName", Type = typeof(string), Value = name
                    });
                    capital.Attributes.Add(new MapItemAttribute()
                    {
                        Name = "Population", Type = typeof(uint), Value = population
                    });
                    storage.Items.Add(capital);
                }
            }
            return(storage);
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            MapItemStorage   storage = new MapItemStorage();
            VectorItemsLayer layer   = new VectorItemsLayer()
            {
                Data = storage
            };

            dot = new MapDot()
            {
                Size = 100
            };
            dot.TitleOptions.TextColor     = Color.Orange;
            dot.TitleOptions.TextGlowColor = Color.Black;
            dot.TitleOptions.Pattern       = "{Title}";

            dot.Attributes.Add(new MapItemAttribute()
            {
                Name = "Title", Value = "Hello,\nI am Dot."
            });
            storage.Items.Add(dot);

            mapControl1.Layers.Add(layer);
        }
        // Create a storage to provide data for the vector layer.
        private IMapDataAdapter CreateData()
        {
            MapItemStorage storage = new MapItemStorage();

            // Add Bubble charts with different values, sizes and
            // locations to the storage's Items collection.
            storage.Items.Add(new MapBubble()
            {
                Argument   = "A",
                Value      = 200,
                Location   = new GeoPoint(-45, -60),
                Size       = 20,
                Group      = 1,
                MarkerType = MarkerType.Diamond
            });
            storage.Items.Add(new MapBubble()
            {
                Argument   = "B",
                Value      = 400,
                Location   = new GeoPoint(-45, 0),
                Size       = 40,
                Group      = 2,
                MarkerType = MarkerType.Plus
            });
            storage.Items.Add(new MapBubble()
            {
                Argument   = "C",
                Value      = 800,
                Location   = new GeoPoint(-45, 60),
                Size       = 80,
                Group      = 1,
                MarkerType = MarkerType.Cross
            });

            return(storage);
        }
示例#19
0
        public void MapBubble(double latitude, double longitude)
        {
            MapItemStorage itemStorage = new MapItemStorage();

            itemStorage.Items.Add
            (
                new MapBubble()
            {
                Argument   = "A",
                Value      = 100,
                Location   = new GeoPoint(latitude, longitude),
                Size       = 100,
                Group      = 1,
                MarkerType = MarkerType.Circle
            }
            );

            KeyColorColorizer keyColorColorizer = new KeyColorColorizer();

            keyColorColorizer.ItemKeyProvider = new ArgumentItemKeyProvider();
            keyColorColorizer.Colors.Add(Color.FromArgb(75, Color.Red));
            keyColorColorizer.Keys.Add(new ColorizerKeyItem()
            {
                Key = "A", Name = "Category A"
            });

            VectorItemsLayer vectorItemsLayer = new VectorItemsLayer();

            vectorItemsLayer.Data      = itemStorage;
            vectorItemsLayer.Colorizer = keyColorColorizer;
            this.BingMap.Layers.Add(vectorItemsLayer);

/*            ColorListLegend colorListLegend = new ColorListLegend();
 *          colorListLegend.Layer = vectorItemsLayer;
 *          this.mapControl.Legends.Add(colorListLegend);*/
        }
        // Create a storage to provide data for the vector layer.
        private IMapDataAdapter CreateData()
        {
            MapItemStorage storage = new MapItemStorage();

            // Create a pie with several segments.
            MapPie pie = new MapPie();

            pie.Size = 200;
            pie.Segments.Add(new PieSegment()
            {
                Argument = "A", Value = 100
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = "B", Value = 50
            });
            pie.Segments.Add(new PieSegment()
            {
                Argument = "C", Value = 120
            });
            storage.Items.Add(pie);

            return(storage);
        }
示例#21
0
        private bool CriminalEventsToBingMap(out string result)
        {
            double longtitude;
            double latitude;

            result = string.Empty;

            try
            {
                if ((criminalEvents == null) || (criminalEvents.Count == 0))
                {
                    result = "אין אירועים להצגה";

                    return(false);
                }

                LocationService locationService = new LocationService(locationServiceInformation.LocationServiceUrl,
                                                                      locationServiceInformation.BingKey,
                                                                      locationServiceInformation.Country,
                                                                      locationServiceInformation.City);

                VectorItemsLayer vectorItemsLayer = new VectorItemsLayer();
                MapItemStorage   mapItemStorage   = new MapItemStorage();

                MapPushpin mapPushpin;

                foreach (CriminalEvent criminalEvent in criminalEvents)
                {
                    string houseNumber = (criminalEvent.HouseNumber != 0) ? criminalEvent.HouseNumber.ToString() : string.Empty;
                    string address     = $"{criminalEvent.Street} {houseNumber}";
                    address = address.Trim();

                    if (string.IsNullOrEmpty(address))
                    {
                        continue;
                    }

                    if (!locationService.AddressToLongtitudeLatitude($"{address}", out longtitude, out latitude, out result))
                    {
                        OnAudit($"לא נמצא מיקום ל: {address}", AuditSeverity.Warning);

                        continue;
                    }

                    mapPushpin = new MapPushpin()
                    {
                        Location = new GeoPoint(longtitude, latitude), Image = Properties.Resources.PushPin, ToolTipPattern = CriminalEventToolTip(criminalEvent)
                    };
                    mapItemStorage.Items.Add(mapPushpin);
                }

                vectorItemsLayer.Data = mapItemStorage;

                bingMap.Layers.Add(vectorItemsLayer);

                return(true);
            }
            catch (Exception e)
            {
                result = e.Message;

                return(false);
            }
        }
示例#22
0
        protected override void UpdateMap()
        {
            var map = MapContext.Map;

            var layer = new VectorItemsLayer()
            {
                AllowEditItems     = false,
                EnableHighlighting = false,
                EnableSelection    = false
            };

            if (!string.IsNullOrWhiteSpace(Name))
            {
                layer.Name = Name;
            }

            if (ItemImageIndex.HasValue)
            {
                layer.ItemImageIndex = ItemImageIndex.Value;
            }

            var fillColor = Utils.ColorFromString(FillColor);

            if (fillColor != Color.Empty)
            {
                layer.ItemStyle.Fill = fillColor;
            }

            var font = Utils.StringToFont(Font, out Color textColor);

            if (font != null)
            {
                layer.ItemStyle.Font = font;
            }
            if (textColor != Color.Empty)
            {
                layer.ItemStyle.TextColor = textColor;
            }

            var strokeColor = Utils.ColorFromString(StrokeColor);

            if (strokeColor != Color.Empty)
            {
                layer.ItemStyle.Stroke = strokeColor;
            }
            if (StrokeWidth.HasValue)
            {
                layer.ItemStyle.StrokeWidth = StrokeWidth.Value;
            }

            var textGlowColor = Utils.ColorFromString(TextGlowColor);

            if (textGlowColor != Color.Empty)
            {
                layer.ItemStyle.TextGlowColor = textGlowColor;
            }

            var adapter = new MapItemStorage();

            layer.Data = adapter;

            map.Layers.Add(layer);

            MapContext.CurrentLayer = layer;
        }
        public SCMap AddLayerVectorItems(LayerVectorItemsOptions options = null)
        {
            options ??= new LayerVectorItemsOptions();

            var map = Map;

            var layer = new VectorItemsLayer()
            {
                AllowEditItems     = false,
                EnableHighlighting = false,
                EnableSelection    = false
            };

            if (!string.IsNullOrWhiteSpace(options.Name))
            {
                layer.Name = options.Name;
            }

            if (options.ItemImageIndex.HasValue)
            {
                layer.ItemImageIndex = options.ItemImageIndex.Value;
            }

            var fillColor = Utils.ColorFromString(options.FillColor);

            if (fillColor != Color.Empty)
            {
                layer.ItemStyle.Fill = fillColor;
            }

            var font = Utils.StringToFont(options.Font, out Color textColor);

            if (font != null)
            {
                layer.ItemStyle.Font = font;
            }
            if (textColor != Color.Empty)
            {
                layer.ItemStyle.TextColor = textColor;
            }

            var strokeColor = Utils.ColorFromString(options.StrokeColor);

            if (strokeColor != Color.Empty)
            {
                layer.ItemStyle.Stroke = strokeColor;
            }
            if (options.StrokeWidth.HasValue)
            {
                layer.ItemStyle.StrokeWidth = options.StrokeWidth.Value;
            }

            var textGlowColor = Utils.ColorFromString(options.TextGlowColor);

            if (textGlowColor != Color.Empty)
            {
                layer.ItemStyle.TextGlowColor = textGlowColor;
            }

            var adapter = new MapItemStorage();

            layer.Data = adapter;

            map.Layers.Add(layer);
            CurrentLayer = layer;

            return(this);
        }