コード例 #1
0
        public void Form1_Load(object sender, EventArgs e)
        {
            drones    = new Drones[3];
            drones[0] = new Drones("Vulcan Black Widow", 500, 100, 5);
            drones[1] = new Drones("Vulcan Payload Development", 5000, 150, 5);
            drones[2] = new Drones("Vulcan Airlift", 1000, 150, 10);
            string[] drone = new string[3];
            for (int i = 0; i < 3; i++)
            {
                drone[i] = drones[i].name;
            }

            LoadData loader = new LoadData();
            string   filepath = @"e:\data source\addressbook.map"; //addressbook file path
            string   addressBook = null, routes = null;
            int      numLines = loader.fileDecrypt(filepath, ref addressBook);

            nodes = new Graph[(numLines - 1) * 4];

            object[] addresses = new string[numLines - 1];
            loader.loadNodes(addressBook, numLines, ref nodes);
            filepath = @"e:\data source\routes.map"; //routes file path
            loader.fileDecrypt(filepath, ref routes);
            loader.loadRoutes(routes, ref nodes);    //загрузка соседей в каждый нод

            for (int i = 0; i < numLines - 1; i++)
            {
                addresses[i] = nodes[i].street + " " + nodes[i].house;
            }
            comboBox2.Items.AddRange(addresses);
            comboBox1.Items.AddRange(drone);
            mapBrowser.Navigate("https://www.google.ru/maps/@55.0457912,82.9236788,16.91z");

            routing route = new routing();

            map  = new Graph[41, 41, 4];
            grid = new SquareGrid(41, 41, 4);
            route.MapMaker(ref map, nodes, 41, 41, 4, 55.041513, 82.916838);
        }
コード例 #2
0
        public static string[] DrawGrid(SquareGrid grid, AStarSearch astar, Location start, Location goal)
        {
            string[] output = new string[4];
            // Печать массива cameFrom
            for (int z = 0; z < 4; z++)
            {
                for (var y = 0; y < 41; y++)
                {
                    for (var x = 0; x < 41; x++)
                    {
                        Location id  = new Location(x, y, z);
                        Location ptr = id;
                        if (!astar.cameFrom.TryGetValue(id, out ptr))
                        {
                            ptr = id;
                        }
                        if (start.x == x && start.y == y && start.z == z) /*Console.Write("\u2191 ");*/ x {
                            ++; output[z] += "S";
                        }
                        if (goal.x == x && goal.y == y && goal.z == z) /*Console.Write("\u2191 ");*/ x {
                            ++; output[z] += "F";
                        }

                        if (grid.walls.Contains(id)) /*Console.Write("##");*/ output {