Ejemplo n.º 1
0
        public void RouteMaker_CreateRoutePoint_CreatesRoute()
        {
            if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
            {
                throw new ThreadStateException("The current threads apartment state is not STA");
            }

            DataProvider data = Factories.GetRouteData();

            RouteMaker maker    = new RouteMaker();
            var        testData = maker.CreateRoute(data, 3);

            List <Microsoft.Maps.MapControl.WPF.MapPolyline> locations = new List <Microsoft.Maps.MapControl.WPF.MapPolyline>();

            MapPolyline arrow = new Microsoft.Maps.MapControl.WPF.MapPolyline();
            MapPolyline line  = new Microsoft.Maps.MapControl.WPF.MapPolyline();

            Setup(line);

            line.Locations = new LocationCollection();

            for (int i = 0; i < 3; i++)
            {
                var loc = data.Route.ElementAt(i);
                line.Locations.Add(new Location(loc));
            }

            arrow = GetArrow(data.Route.First(), data.Route.ElementAt(1));

            locations.Add(line);
            locations.Add(arrow);

            Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(0), testData.ElementAt(0)));
            Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(1), testData.ElementAt(1)));
        }
Ejemplo n.º 2
0
        private void SetupRoutes()
        {
            var roadStats      = RoadStatsProvider.GetAll();
            var transportStats = TransportStatsProvider.GetAll();
            var newRoutes      = new RouteMaker().CreateRoutes(roadStats, transportStats);

            foreach (var(Key, Value) in newRoutes)
            {
                RoadByFromTo[Key] = Value;
            }
        }
Ejemplo n.º 3
0
 // Use this for initialization
 void Awake()
 {
     roomFactory        = GetComponent <RoomFactory>();
     normalDistribution = GetComponent <NormalDistribution>();
     roomFinder         = GetComponent <RoomFinder>();
     routeMaker         = GetComponent <RouteMaker>();
     roomMoveChecker    = GetComponent <RoomMoveChecker>();
     corridorCreator    = GetComponent <CorridorCreator>();
     wallMaker          = GetComponent <WallMaker>();
     playerManager      = GetComponent <PlayerManager>();
     cameraBehavior     = Camera.main.GetComponent <CameraBehavior>();
     exitmaker          = GetComponent <ExitMaker>();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// This is the constructor for the MapTimedViewModel
        /// </summary>
        /// <param name="data">A DataProvider object to read the data from</param>
        public MapTimedViewModel(DataProvider data)
        {
            _data = data;

            maker         = new RouteMaker();
            _mapPolylines = new List <MapPolyline>();

            //set the api key read from the key file
            APIKey = new ApplicationIdCredentialsProvider(data.APIKey);

            MapZoomLevel = 12.6;

            if (_data.Route.Count > 0)
            {
                MapCenter = _data.Route.First();
            }
            else
            {
                MapCenter = new Location(48.236096, 14.188624);
            }

            slMaximum = _data.Route.Count() - 1;
            if (slMaximum < 1000)
            {
                slTickFrequency = 2;
            }
            if (slMaximum > 1000 && slMaximum < 10000)
            {
                slTickFrequency = 10;
            }
            if (slMaximum > 10000 && slMaximum < 1000000)
            {
                slTickFrequency = 500;
            }
            if (slMaximum > 1000000)
            {
                slTickFrequency = 2000;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This is the constructor for the MapRouteViewModel
        /// </summary>
        /// <param name="data">A DataProvider object to read the data from</param>
        public MapRouteViewModel(DataProvider data)
        {
            _data = data;

            _mapPolylines = new List <MapPolyline>();

            maker = new RouteMaker();

            MapZoomLevel = 12.6;

            if (_data.Route.Count > 0)
            {
                MapCenter = _data.Route.First();
            }
            else
            {
                MapCenter = new Location(48.236096, 14.188624);
            }

            //  set the api key read from the key file
            APIKey = new ApplicationIdCredentialsProvider(data.APIKey);
        }