Exemple #1
0
        //************************************************************************************************
        //       Public Methods
        //************************************************************************************************

        /// <summary>
        /// Creates a new FloorPlan object in m_Status, then uses that to create a new PathFinder object
        /// </summary>
        /// <param name="FloorPlanImage">an image of the floorplan</param>
        /// <param name="ppf">the scale of the image, in pixels per foot</param>
        public void CreateStatus(Image FloorPlanImage, double ppf)
        {
            m_pixelsperfoot = ppf;
            m_status        = new Status(FloorPlanImage, m_pixelsperfoot);

            m_pathfinder = new QGPathFinder(m_status.FloorPlan);
        }
Exemple #2
0
 public void buildGraphTest()
 {
     Image myimage = new Bitmap("../../testImage.jpg");
     FloorPlan floorPlan = new FloorPlan(myimage, 5); // TODO: Initialize to an appropriate value
     QGPathFinder target = new QGPathFinder(floorPlan); // TODO: Initialize to an appropriate value
     int expected = 6354; // TODO: Initialize to an appropriate value
     int actual;
     actual = target.buildGraph().VertexCount;
     Assert.AreEqual(expected, actual);
 }
Exemple #3
0
        /// <summary>
        ///get executing time for a path
        ///</summary>
        public Int64 getPathExecutingTime(FloorPlan floorPlan, int StartX, int StartY, int TargetX, int TargetY)
        {
            Int64 ExecutingTime = 0;

            floorPlan.setStartTile(StartX, StartY);
            floorPlan.setTargetTile(TargetX, TargetY);
            QGPathFinder target = new QGPathFinder(floorPlan);
            List<FloorTile> actual;

            DateTime StartTime = DateTime.Now;
            actual = target.getPath();
            DateTime EndTime = DateTime.Now;
            TimeSpan t= EndTime - StartTime;

            if (actual != null){
                ExecutingTime = (Int64) t.TotalMilliseconds;
            }

            return ExecutingTime;
        }
Exemple #4
0
        /// <summary>
        /// Creates a new FloorPlan object in m_Status, then uses that to create a new PathFinder object
        /// </summary>
        /// <param name="FloorPlanImage">an image of the floorplan</param>
        /// <param name="ppf">the scale of the image, in pixels per foot</param>
        public void CreateStatus(FloorPlan fp)
        {
            m_status = new Status(fp);

            m_pathfinder = new QGPathFinder(m_status.FloorPlan);
        }
Exemple #5
0
        public void getPathTest()
        {
            TextWriter tw = new StreamWriter("../../getPathResult.txt");

            Image myimage = new Bitmap("../../floorplan.bmp");
            FloorPlan floorPlan = new FloorPlan(myimage, 3); // TODO: Initialize to an appropriate value
            int StartX = 106;
            int StartY = 74;
            int TargetX = 107;
            int TargetY = 43;
            floorPlan.setStartTile(StartX, StartY);
            floorPlan.setTargetTile(TargetX, TargetY);

            String TargetString = TargetX + "_" + TargetY;

            QGPathFinder qgpf = new QGPathFinder(floorPlan);

            //show neighbors
            List<FloorTile> TargetNeighbors = floorPlan.getTargetTile().getNeighbours();
            String neighborString = "";
            for (int i = 0; i < TargetNeighbors.Count; i++)
            {
                neighborString = TargetNeighbors[i].Position.X + "_" + TargetNeighbors[i].Position.Y;

                //tw.WriteLine("Target Neighbors: " + neighborString + ": " + isContainEdge);
            }

            List<FloorTile> actual;
            actual = qgpf.getPath();

            tw.WriteLine(qgpf.GetMessages());
            tw.Close();

            visualizeFloorPlan(floorPlan, StartX, StartY, TargetX, TargetY);

            List<FloorTile> expected = new List<FloorTile>();
            FloorTile t1 = new FloorTile(0, 0, true, floorPlan);
            FloorTile t2 = new FloorTile(0, 1, true, floorPlan);
            FloorTile t3 = new FloorTile(0, 2, true, floorPlan);
            expected.Add(t1);
            expected.Add(t2);
            expected.Add(t3);
            //String actualString = actual[1].Position.X + "," + actual[1].Position.Y;
            //String expectedString = expected[1].Position.X + "," + expected[1].Position.Y;

            //Assert.AreEqual(expectedString, actualString);
        }
Exemple #6
0
        /// <summary>
        ///get executing time for a path
        ///</summary>
        public void visualizeFloorPlan(FloorPlan floorPlan, int StartX, int StartY, int TargetX, int TargetY)
        {
            floorPlan.setStartTile(StartX, StartY);
            floorPlan.setTargetTile(TargetX, TargetY);
            QGPathFinder target = new QGPathFinder(floorPlan);
            List<FloorTile> actual;

            actual = target.getPath();

            Form f = new WindowsFormsApplication1.Form1(floorPlan, actual);
            Application.Run(f);

            //f.Invoke();
            //f.Draw(floorPlan, actual);
        }
Exemple #7
0
 public void QGPathFinderConstructorTest()
 {
     Image myimage = new Bitmap("../../testImage.jpg");
     FloorPlan floorPlan = new FloorPlan(myimage, 5); // TODO: Initialize to an appropriate value
     QGPathFinder target = new QGPathFinder(floorPlan);
     Type actual = target.GetType();
     Type expected = typeof(QGPathFinder);
     Assert.AreEqual(expected, actual);
 }
Exemple #8
0
        /// <summary>
        /// Creates a new FloorPlan object in m_Status, then uses that to create a new PathFinder object
        /// </summary>
        /// <param name="FloorPlanImage">an image of the floorplan</param>
        /// <param name="ppf">the scale of the image, in pixels per foot</param>
        public void CreateStatus(FloorPlan fp)
        {
            m_status = new Status(fp);

            m_pathfinder = new QGPathFinder(m_status.FloorPlan);
        }
Exemple #9
0
        //************************************************************************************************
        //       Public Methods
        //************************************************************************************************
        /// <summary>
        /// Creates a new FloorPlan object in m_Status, then uses that to create a new PathFinder object
        /// </summary>
        /// <param name="FloorPlanImage">an image of the floorplan</param>
        /// <param name="ppf">the scale of the image, in pixels per foot</param>
        public void CreateStatus(Image FloorPlanImage, double ppf)
        {
            m_pixelsperfoot = ppf;
            m_status = new Status(FloorPlanImage, m_pixelsperfoot);

            m_pathfinder = new QGPathFinder(m_status.FloorPlan);
        }