Exemplo n.º 1
0
        public void TestExcelExport()
        {
            string excelFileName = Directory.GetCurrentDirectory() + @"\ExportTest.xlsx";

            City bern = new City("Bern", "Switzerland", 5000, 46.95, 7.44);
            City zuerich = new City("Zürich", "Switzerland", 100000, 32.876174, 13.187507);
            City aarau = new City("Aarau", "Switzerland", 10000, 35.876174, 12.187507);
            Link link1 = new Link(bern, aarau, 15, TransportModes.Ship);
            Link link2 = new Link(aarau, zuerich, 20, TransportModes.Ship);
            List<Link> links = new List<Link>();
            links.Add(link1);
            links.Add(link2);

            // TODO: Fix starting Excel on sever (not robust)
            ExcelExchange excel = new ExcelExchange();

            Console.WriteLine("Export Path is: {0}", excelFileName);

            excel.WriteToFile(excelFileName, bern, zuerich, links);

            // first verify that file exists
            Assert.IsTrue(File.Exists(excelFileName));

            // now verify the content of the file
            // TODO: Fix reading file on sever
            VerifyExcelContent(excelFileName);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var assembly = Assembly.GetExecutingAssembly().FullName;
            var version = assembly.Split(',')[1].Split('=')[1];
            Console.Out.WriteLine("Welcome to RoutePlanner (Version {0})", arg0: version);

            var wayPoint = new WayPoint("Windisch", 47.479319847061966, 8.212966918945312);
            Console.WriteLine("{0}: {1}/{2}", wayPoint.Name, wayPoint.Latitude, wayPoint.Longitude);
            Console.Out.WriteLine("--------------");
            Console.Out.WriteLine(wayPoint);

            RoutesFactory.Create(new Cities());

            string excelFileName = Directory.GetCurrentDirectory() + @"\ExportTest.xlsx";
            ExcelExchange excel = new ExcelExchange();
            Console.WriteLine("Export Path is: {0}", excelFileName);
            City bern = new City("Bern", "Switzerland", 5000, 46.95, 7.44);
            City zuerich = new City("Zürich", "Switzerland", 100000, 32.876174, 13.187507);
            City aarau = new City("Aarau", "Switzerland", 10000, 35.876174, 12.187507);
            Link link1 = new Link(bern, aarau, 15, TransportModes.Ship);
            Link link2 = new Link(aarau, zuerich, 20, TransportModes.Ship);
            List<Link> links = new List<Link>();
            links.Add(link1);
            links.Add(link2);
            excel.WriteToFile(excelFileName, bern, zuerich, links);

            /* Test Logging */
            var cities = new Cities();
            Routes routes = new RoutesFloydWarshall(cities);
            //cities.ReadCities("adsf");
            //routes.ReadRoutes("adsf");
        }
Exemplo n.º 3
0
        public void TestExcelExport()
        {
            var excelFileName = Directory.GetCurrentDirectory() + @"\ExportTest.xlsx";
            var bern = new City("Bern", "Switzerland", 5000, 46.95, 7.44);
            var zuerich = new City("Zürich", "Switzerland", 100000, 32.876174, 13.187507);
            var aarau = new City("Aarau", "Switzerland", 10000, 35.876174, 12.187507);
            var link1 = new Link(bern, aarau, 15, TransportModes.Ship);
            var link2 = new Link(aarau, zuerich, 20, TransportModes.Ship);
            var links = new List<Link>();
            links.Add(link1);
            links.Add(link2);

            var excel = new ExcelExchange();

            excel.WriteToFile(excelFileName, bern, zuerich, links);

            Assert.IsTrue(File.Exists(excelFileName), excelFileName);
        }
Exemplo n.º 4
0
        public void TestExcelExport()
        {
            var excelFileName = Directory.GetCurrentDirectory() + @"\ExportTest.xlsx";

            var bern = new City("Bern", "Switzerland", 5000, 46.95, 7.44);
            var zuerich = new City("Zürich", "Switzerland", 100000, 32.876174, 13.187507);
            var aarau = new City("Aarau", "Switzerland", 10000, 35.876174, 12.187507);
            var links = new Link[]
            {
                new Link(bern, aarau, 15, TransportMode.Ship),
                new Link(aarau, zuerich, 20, TransportMode.Ship)
            };

            var excel = new ExcelExchange();
            excel.WriteToFile(excelFileName, links);
            Assert.IsTrue(File.Exists(excelFileName), excelFileName);

            //should not show dialog boxes or fail, should silently overwrite the file
            excel.WriteToFile(excelFileName, links);
            Assert.IsTrue(File.Exists(excelFileName), excelFileName);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Version version = Assembly.GetEntryAssembly().GetName().Version;
            Console.WriteLine("Welcome to RoutePlanner ({0})", version);


            WayPoint wayPoint = new WayPoint("Windisch", 47.479319847061966, 8.212966918945312);
            Console.WriteLine(wayPoint.ToString());
            WayPoint wpBern = new WayPoint("Bern", 46.9472221, 7.451202500000022);
            WayPoint wpTripolis = new WayPoint("Tripolis", 59.86062519999999, 17.650885199999948);
            Console.WriteLine("Distanz Bern-Tripolis: {0}km", wpBern.Distance(wpTripolis));

            City cBern = new City("Bern", "Schweiz", 75000, 47.479319847061966, 8.212966918945312);
            City c0 = new City("Mumbai", "India", 12383146, 18.96, 72.82);

            string serializedCity = string.Empty;
            using (StringWriter outstream = new StringWriter())
            {
                SimpleObjectWriter writer = new SimpleObjectWriter(outstream);
                writer.Next(cBern);
                serializedCity = outstream.ToString();
            }
            Console.WriteLine(serializedCity);

            using(StringReader inStream = new StringReader(serializedCity)) {
                SimpleObjectReader reader = new SimpleObjectReader(inStream);
                object o = reader.Next();
            }
        

            WayPoint wp = c0.Location;
            Cities c = new Cities();
            c.ReadCities("citiesTestDataLab2.txt");
            c.FindNeighbours(wp,2000);
            c.ReadCities("citiesTestDataLab2.txt");

            var routes = new RoutesDijkstra(c);
            var reqWatch = new RouteRequestWatcher();
            routes.RouteRequestEvent += reqWatch.LogRouteRequests;
            routes.FindShortestRouteBetween("Mumbai", "India", TransportModes.Rail);
            routes.FindShortestRouteBetween("Mumbai", "India", TransportModes.Rail);
            routes.FindShortestRouteBetween("India", "Mumbai", TransportModes.Rail);

            Console.WriteLine("City found: {0}", c.FindCity("Mumbai").Name);

            c.ReadCities("citiesTestDataLab4.txt");
            Routes r = new RoutesDijkstra(c);
            r.RouteRequestEvent += reqWatch.LogRouteRequests;
            r.ReadRoutes("linksTestDataLab4.txt");
            List<Link> l = r.FindShortestRouteBetween("Zürich", "Winterthur", TransportModes.Rail);
            foreach (Link link in l)
            {
                Console.WriteLine("from {0} to {1} in {2}", link.FromCity.Name, link.ToCity.Name, link.Distance);
            }
            Console.ReadKey();

            City zurich = c.FindCity("Zürich");
            City winterthur = c.FindCity("Winterthur");
            ExcelExchange export = new ExcelExchange();
            export.WriteToFile("Test.xls", zurich, winterthur,l);
            
        }