Esempio n. 1
0
        void addBuildingsToMap(string notBuid)
        {

            if (_worldbuildings == null)
                return;

            if (buildingsLayer != null)
                buildingsLayer.Clear();
            else
                buildingsLayer = new MapLayer();


            if (Mymap.Layers.Contains(buildingsLayer))
                Mymap.Layers.Remove(buildingsLayer);

            foreach (var building in _worldbuildings.buildings)
            {
                if (building.buid.Equals(notBuid))
                    continue;
                var lat = Double.Parse(building.coordinates_lat, CultureInfo.InvariantCulture);
                var lon = Double.Parse(building.coordinates_lon, CultureInfo.InvariantCulture);
                var poi = new BuildingPoi { Coordinate = new GeoCoordinate(lat, lon), Buid = building.buid };
                var imagePoiLocation = new Image
                {
                    Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
                    DataContext = poi
                };

                buildingsOverlay = new MapOverlay();

                imagePoiLocation.Tap += loadClickedBuilding;
                buildingsOverlay.Content = imagePoiLocation;
                buildingsOverlay.PositionOrigin = new Point(0.5, 0.5);
                buildingsOverlay.GeoCoordinate = new GeoCoordinate(lat, lon);
                buildingsLayer.Add(buildingsOverlay);
            }

            Mymap.Layers.Add(buildingsLayer);
        }
Esempio n. 2
0
        private MapOverlay CreateClusteredItemPushpin(ClusteredPoint clusterInfo)
        {
            MapOverlay newo = new MapOverlay();
            var poi = new BuildingPoi { Coordinate = clusterInfo.Location, Buid = "adf" };
            var imagePoiLocation = new Image
            {
                Source = new BitmapImage(new Uri("/Assets/location.png", UriKind.Relative)),
                DataContext = poi
            };

            imagePoiLocation.Tap += loadClickedBuilding;
            newo.Content = imagePoiLocation;
            newo.PositionOrigin = new Point(0.5, 0.5);
            newo.GeoCoordinate = clusterInfo.Location;

            Ellipse el = new Ellipse();
            el.Width = 50;
            el.Height = 50;
            el.Fill = new SolidColorBrush(Colors.Red);
            el.Stroke = new SolidColorBrush(Colors.Black);
            el.HorizontalAlignment = HorizontalAlignment.Center;
            el.VerticalAlignment = VerticalAlignment.Center;

            var grid = new Grid();
            grid.Children.Add(el);
            grid.Children.Add(new TextBlock { Text = clusterInfo.ItemIndices.Count.ToString(), HorizontalAlignment=HorizontalAlignment.Center, VerticalAlignment=VerticalAlignment.Center });
            newo.Content = grid;

            return newo;
        }
Esempio n. 3
0
        private MapOverlay CreateItemPushpin(object item, ClusteredPoint clusterInfo)
        {
            MapOverlay newo = new MapOverlay();

            var obj = (ItemLocation)item;

            var bpoi = (BuildingPoi)obj.Item;
            var poi = new BuildingPoi { Coordinate = bpoi.Coordinate, Buid = bpoi.Buid};
            var imagePoiLocation = new Image
            {
                Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
                DataContext = poi
            };

            imagePoiLocation.Tap += loadClickedBuilding;
            newo.Content = imagePoiLocation;
            newo.PositionOrigin = new Point(0.5, 0.5);
            newo.GeoCoordinate = bpoi.Coordinate;

            return newo;
        }
Esempio n. 4
0
        private Task GenerateMockData(int numEntities)
        {
            layer.Items.Clear();

            return Task.Run(async () =>
            {
                mockData = new ItemLocationCollection();

                GeoCoordinate loc;
                foreach (var building in _worldbuildings.buildings)
                {
                    var lat = Double.Parse(building.coordinates_lat, CultureInfo.InvariantCulture);
                    var lon = Double.Parse(building.coordinates_lon, CultureInfo.InvariantCulture);
                    var poi = new BuildingPoi { Coordinate = new GeoCoordinate(lat, lon), Buid = building.buid };
                   
                    loc = new GeoCoordinate(lat, lon);
                    mockData.Add(poi, loc);
                }

               
                Dispatcher.BeginInvoke(() =>
               {
                   //Add mock data to layer 
                   layer.Items.AddRange(mockData);
               });
            });
        }