예제 #1
0
        private MapOverlay putOverlayOnMap(GeoCoordinate positionCoord, MapOverlay MyOverlay)
        {
            MyOverlay = new MapOverlay();
            // firstRun = 1;
            TakeUserPushPin takePushpin = new TakeUserPushPin();

            // DrawUserPushPin.DrawPushpin(positionCoord, MyOverlay);
            MyOverlay = takePushpin.DrawPushpin(positionCoord, MyOverlay);
            return MyOverlay;
            // Add the MapOverlay containing the pushpin to the MapLayer
        }
예제 #2
0
        // For a current position change, set it up on the map by drawing a push pin object and zooms in to it.
        // Also checks if a current position satisfies to the marked audio zones, by calling <checkCoordinates> function which makes all comparison (look in audioPlayer part)
        void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
        {
            Dispatcher.BeginInvoke(() =>
            {

                Latitude = args.Position.Coordinate.Latitude;
                Longitude = args.Position.Coordinate.Longitude;

                // Unfortunately, the Location API works with Windows.Devices.Geolocation.Geocoordinate objeccts
                // and the Maps controls use System.Device.Location.GeoCoordinate objects so we have to do a
                // conversion before we do anything with it on the map
                GeoCoordinate positionCoord = new GeoCoordinate()
                {
                    Altitude = args.Position.Coordinate.Altitude.HasValue ? args.Position.Coordinate.Altitude.Value : 0.0,
                    Course = args.Position.Coordinate.Heading.HasValue ? args.Position.Coordinate.Heading.Value : 0.0,
                    HorizontalAccuracy = args.Position.Coordinate.Accuracy,
                    Latitude = args.Position.Coordinate.Latitude,
                    Longitude = args.Position.Coordinate.Longitude,
                    Speed = args.Position.Coordinate.Speed.HasValue ? args.Position.Coordinate.Speed.Value : 0.0,
                    VerticalAccuracy = args.Position.Coordinate.AltitudeAccuracy.HasValue ? args.Position.Coordinate.AltitudeAccuracy.Value : 0.0
                };

                // Center the map on the new location
                this.Map.Center = positionCoord;

                this.Map.ZoomLevel = 19;

                if (MyOverlay != null)
                    this.PushpinMapLayer.Remove(MyOverlay);

                // firstRun = 1;

                MyOverlay = new MapOverlay();
                TakeUserPushPin takePushpin = new TakeUserPushPin();

                // DrawUserPushPin.DrawPushpin(positionCoord, MyOverlay);
                MyOverlay = takePushpin.DrawPushpin(positionCoord, MyOverlay);

                // Add the MapOverlay containing the pushpin to the MapLayer
                this.PushpinMapLayer.Add(MyOverlay);

                locationDrawPushpin(args);

                // this two lines produsing all the work related to
                // checking and identifying if any song should be played in this particular place
                LocationCheck locationCheck = new LocationCheck();

                firstFourBuildingsInfo = new string[4][]; // setting up an array to get information about current location

               firstFourBuildingsInfo =  locationCheck.startAnalysis(sender, args);
               if (firstFourBuildingsInfo != null)
               {
                   item_ONE_name.Text = firstFourBuildingsInfo[0][0];
                   item_ONE_dist.Text = firstFourBuildingsInfo[0][1];

                   item_TWO_name.Text = firstFourBuildingsInfo[1][0];
                   item_TWO_dist.Text = firstFourBuildingsInfo[1][1];

                   item_THREE_name.Text = firstFourBuildingsInfo[2][0];
                   item_THREE_dist.Text = firstFourBuildingsInfo[2][1];

                   item_FOUR_name.Text = firstFourBuildingsInfo[3][0];
                   item_FOUR_dist.Text = firstFourBuildingsInfo[3][1];
               }

                // Show progress indicator while map resolves to new position
                pi.IsVisible = true;
                pi.IsIndeterminate = true;
                pi.Text = "Resolving...";
                SystemTray.SetProgressIndicator(this, pi);
            });
        }