private bool useStopNotStation;                                              // False if open from journey/departure window.
        private void SetMapScope(IEnumerable <StopsBasic.StopBasic> stops, bool zoomAtCurrentLoc = true, bool adaptiveZoom = false)
        {
            double lat, lon, distance;

            var loc = new Utilities.Position(double.NaN, double.NaN);

            try
            {
                loc = AsyncHelpers.RunSync(DataFeedClient.GeoWatcher.GetCurrentPosition);
            }
            catch
            {
                zoomAtCurrentLoc = false;
                PlatformDependentSettings.ShowMessage(Settings.Localization.PositioningNeeded);
            }

            if (!zoomAtCurrentLoc || double.IsNaN(loc.Latitude) || double.IsNaN(loc.Longitude))
            {
                lat      = stops.GetAverageLatitude();
                lon      = stops.GetAverageLongitude();
                distance = adaptiveZoom ? 10000 : 1000;
            }
            else
            {
                lat      = loc.Latitude;
                lon      = loc.Longitude;
                distance = 350;
            }

            map.MoveToRegion(MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(lat, lon), new Distance(distance)), false);
        }
示例#2
0
 public ChessModel ModelAt(Utilities.Position pos)
 {
     //the method passes through all models and check their position
     for (int i = 0; i < 32; i++)
     {
         if (models[i].Position() == pos && models[i].IsCaptured() == false) //avoid shadow-worrier bug
         {
             return(models[i]);
         }
     }
     return(null);
 }
示例#3
0
 public bool CheckerHasModel(Utilities.Position checkerPosition)
 {
     for (int i = 0; i < 32; i++)
     {
         if (models[i].Position() == checkerPosition)
         {
             if (models[i].IsCaptured() == false)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#4
0
 public Checker CheckerAt(Utilities.Position pos)
 {
     return(checkers[pos.x, pos.y, pos.z]);
 }