Exemplo n.º 1
0
        public QGPathFinder(Status status, MainForm parent)
        {
            m_parent = parent;
            m_status = status;

            graph = new AdjacencyGraph<string, Edge<string>>(true);
            edgeCost = new Dictionary<Edge<string>, double>(graph.EdgeCount);
            this.fp = m_status.floorPlan;
            if (this.m_status.position != null)
            {
                startPoint = this.m_status.position.location.X + "_" + this.m_status.position.location.Y;
                m_parent.PostMessage("start: " + startPoint);
            }
            else
            {
                startPoint = "4_4";
            }
            if (this.m_status.endPoint!= null)
            {
                targetPoint = this.m_status.endPoint.X + "_" + this.m_status.endPoint.Y;
                m_parent.PostMessage("end: " + targetPoint);
            }
            else
            {
                targetPoint = "4_6";
            }

            buildGraph();
        }
Exemplo n.º 2
0
 public Status(Image floorPlan, double scale)
 {
     m_FloorPlan = new FloorPlan(floorPlan, scale);
     m_Moves = new List<FloorTile>();
     m_Images = new Stack<Image>(IMG_CAP);
     m_Moves = new List<FloorTile>();
     m_Position = new Position(new Point(0, 0), 0);
 }
Exemplo n.º 3
0
        public static FloorTile getTileByIndex(FloorPlan fp, string index)
        {
            string[] outPoint1 = Regex.Split(index, "_");

            return fp.getTile(
                System.Convert.ToInt32(outPoint1[0]),
                System.Convert.ToInt32(outPoint1[1]));
        }
Exemplo n.º 4
0
 public void getYTileNumTest()
 {
     Image myimage = new Bitmap("../../testImage.jpg"); // TODO: Initialize to an appropriate value
     FloorPlan target = new FloorPlan(myimage); // TODO: Initialize to an appropriate value
     int expected = 89; // TODO: Initialize to an appropriate value
     int actual;
     actual = target.getYTileNum();
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 5
0
        public void ConnectTest()
        {
            Image myimage = new Bitmap("../../testImage.jpg"); // TODO: Initialize to an appropriate value
            FloorPlan target = new FloorPlan(myimage); // TODO: Initialize to an appropriate value
            //Dictionary<FloorTile, List<FloorTile>> expected = new Dictionary<FloorTile,List<FloorTile>>(); // TODO: Initialize to an appropriate value
               // Dictionary<FloorTile, List<FloorTile>> actual;

               // actual =
            target.Connect();
            Assert.AreEqual(0, 0);
        }
Exemplo n.º 6
0
 public FloorTile(int x, int y, bool walkable,FloorPlan floorPlan)
 {
     m_location.X = x;
     m_location.Y = y;
     m_walkable = walkable;
     m_endPoint = false;
     m_floorPlan = floorPlan;
     m_neighbours = new List<FloorTile>();
     m_start = false;
     m_target = false;
 }