コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        void buildingImg_tap(FloorPoisDetails poi)
        {
            if (Mymap.Layers.Contains(floorPoisDetail))
            {
                Mymap.Layers.Remove(floorPoisDetail);
                floorPoisDetail.Clear();
            }
            var over = new MapOverlay { GeoCoordinate = poi.Coordinates };

            var control = new BuildingPois { txt_description = { Text = poi.Description } };
            over.Content = control;

            var poitap = new PoiTap
            {
                poiFloor = poi.poiFloor,
                poiId = poi.poiid,
                coordinate = poi.Coordinates
            };

            //set button data context
            control.btn_navigateHere.DataContext = poitap;
            control.btn_source.DataContext = poitap;
            control.btn_poiInfo.DataContext = poi;

            // set info visibility
            control.btn_poiInfo.Visibility = poi.Information.Length > 2 ? Visibility.Visible : Visibility.Collapsed;

            control.btn_navigateHere.Click += floorPoiNavHere_Tap;
            control.btn_source.Click += btn_source_Click;
            control.btn_poiInfo.Click += BtnPoiInfoOnClick;
            control.grid_details.Tap += building_pois_tap;
            over.PositionOrigin = new Point(0.5, 1.0);
            floorPoisDetail.Add(over);
            Mymap.Layers.Add(floorPoisDetail);
            Mymap.SetView(poi.Coordinates, 20, MapAnimationKind.Parabolic);
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private async void GetPoisByFloor(string build, string floor)
        {
            loading.Visibility = Visibility.Visible;
            loading.IsIndeterminate = true;
            poisByFloor_layer = new MapLayer();
            if (Mymap.Layers.Contains(poisByFloor_layer))
                Mymap.Layers.Remove(poisByFloor_layer);
            try
            {
                _y = await CustomPushpinWp8APIClient.GetPoisByFloor(build, floor);
                foreach (var obj in _y.pois)
                {
                    if (!obj.pois_type.Equals("None"))
                    {
                        var poi = new FloorPoisDetails
                        {
                            Coordinates =
                                new GeoCoordinate(double.Parse(obj.coordinates_lat, CultureInfo.InvariantCulture), double.Parse(obj.coordinates_lon, CultureInfo.InvariantCulture)),
                            Description = obj.name,
                            Information = obj.description,
                            poiid = obj.puid,
                            poiFloor = obj.floor_number
                        };
                        if (obj.is_building_entrance != null)
                            poi.Entrange = bool.Parse(obj.is_building_entrance);
                        else
                            poi.Entrange = false;

                        var imageFloorPois = new Image
                        {
                            Source = new BitmapImage(new Uri("/Assets/other_loc.png", UriKind.Relative)),
                            DataContext = poi
                        };
                        imageFloorPois.Tap += image_floor_pois_Tap;

                        poisbyflooroverlay = new MapOverlay
                        {
                            Content = imageFloorPois,
                            GeoCoordinate = poi.Coordinates,
                            PositionOrigin = new Point(0.5, 1.0)
                        };
                        poisByFloor_layer.Add(poisbyflooroverlay);
                    }
                }
                Mymap.Layers.Add(poisByFloor_layer);
            }
            catch
            {
                loading.Visibility = Visibility.Collapsed;
                loading.IsIndeterminate = false;
                downloading.Visibility = Visibility.Collapsed;
                MessageBox.Show("Can not load floor pois. Please check your connection and try again!");
            }
            loading.Visibility = Visibility.Collapsed;
            loading.IsIndeterminate = false;
            downloading.Visibility = Visibility.Collapsed;
        }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private void ViewPoisByBuilding()
        {
            if (Mymap.Layers.Contains(poisByFloor_layer))
                Mymap.Layers.Remove(poisByFloor_layer);
            poisByFloor_layer = new MapLayer();
            if (_poisByBuilding != null)
            {
                foreach (var obj1 in _poisByBuilding.pois)
                {
                    if (obj1.buid.Equals(_selectedBuild) && obj1.floor_number.Equals(_selectedFloor))
                    {
                        if (!obj1.pois_type.Equals("None"))
                        {
                            _selectedFloor = obj1.floor_number;

                            var poi = new FloorPoisDetails
                            {
                                Description = obj1.name,
                                Information = obj1.description,
                                poiid = obj1.puid,
                                poiFloor = obj1.floor_number
                            };
                            double lat = double.Parse(obj1.coordinates_lat, CultureInfo.InvariantCulture);
                            double lon = double.Parse(obj1.coordinates_lon, CultureInfo.InvariantCulture);
                            poi.Coordinates = new GeoCoordinate(lat, lon);
                            if (obj1.is_building_entrance != null)
                                poi.Entrange = bool.Parse(obj1.is_building_entrance);
                            else
                                poi.Entrange = false;

                            var imageFloorPois = new Image
                            {
                                Source = new BitmapImage(new Uri("/Assets/other_loc.png", UriKind.Relative)),
                                DataContext = poi
                            };
                            imageFloorPois.Tap += image_floor_pois_Tap;

                            poisbyflooroverlay = new MapOverlay
                            {
                                Content = imageFloorPois,
                                GeoCoordinate = poi.Coordinates,
                                PositionOrigin = new Point(0.5, 1.0)
                            };
                            poisByFloor_layer.Add(poisbyflooroverlay);
                        }
                    }
                }
            }
            Mymap.Layers.Add(poisByFloor_layer);
            downloading.Visibility = Visibility.Collapsed;
        }