示例#1
0
        private void CreateRoutes()
        {
            var cities = new List <City>()
            {
                new City()
                {
                    latitude = 34.87F, longitude = 137.06F, Title = "Nishio"
                },
                new City()
                {
                    latitude = 34.87F, longitude = 138.3F, Title = "Yaizu"
                },
                new City()
                {
                    latitude = 34.97F, longitude = 136.64F, Title = "Yokkaichi"
                },
                new City()
                {
                    latitude = 34.82F, longitude = 137.39F, Title = "Toyokawa"
                },
                new City()
                {
                    latitude = 35.6F, longitude = 139.7F, Title = "Tokyo"
                }
            };

            // Create points for each city.
            cities.ForEach(x =>
            {
                var point = CreateTarget(x);
                _cityLayer.Items.Add(point.Key);
                _cityLayer.Items.Add(point.Value);
            });

            // Create route from Toyokawa to Tokyo.
            var list = cities.OrderByDescending(x => x.longitude).ToList();

            for (int index = 1; index <= list.Count() - 1; index++)
            {
                var last    = list[index - 1];
                var current = list[index];

                var route = CreateRoute(last, current);
                _routeLayer.Items.Add(route);
            }

            // Zoom in items.
            var items = _cityLayer.Items.Cast <C1.Win.Map.VectorItem>().ToArray();

            _map.ZoomToItems(items);
        }
示例#2
0
        private void btnZoomArea_Click(object sender, EventArgs e)
        {
            if (_grid.SelectedRows.Count <= 0)
            {
                return;
            }
            if (_grid.SelectedRows.Count > 1 && _grid.Rows.Count > 1)
            {
                var list = _grid.SelectedRows.Cast <DataGridViewRow>()
                           .ToList()
                           .Select(x => x.DataBoundItem as DataRowView)
                           .Select(x => Convert.ToInt32(x["Number"]))
                           .ToList();

                var marks = _layer.Items.Where(x => list.Contains(Convert.ToInt32(x.Tag)));
                _map.ZoomToItems(marks);
            }
        }