Esempio 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();
        }
Esempio n. 2
0
        public void getPathTest()
        {
            Image myimage = new Bitmap("../../testImage.jpg"); // TODO: Initialize to an appropriate value
            //FloorPlan fp = new FloorPlan(myimage); // TODO: Initialize to an appropriate value
            Status status = new Status(myimage, 2.0); // TODO: Initialize to an appropriate value
            QGPathFinder target = new QGPathFinder(status, null); // TODO: Initialize to an appropriate value

            List<FloorTile> expected = null; // TODO: Initialize to an appropriate value
            List<FloorTile> actual;
            actual = target.getPath();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 3
0
        private void SetScale(double scaleLength)
        {
            m_fpState = fpState.IMAGE;
            using (ScaleForm sf = new ScaleForm(scaleLength, scaleLength / m_pixelsperfoot, this))
            {
                sf.ShowDialog();
                m_pixelsperfoot = sf.m_scale;
                m_status = new Status(m_floorPlanImage, m_pixelsperfoot);
                m_pathfinder = new QGPathFinder(m_status, this);
                m_ratioX = (double)(m_status.floorPlan.getXTileNum()) / (double)(floorPlanPanel.Width);
                m_ratioY = (double)m_status.floorPlan.getYTileNum() / (double)floorPlanPanel.Height;
                m_fpState = fpState.SETDEST;
            }
            if (t_DrawScaleTimer != null)
            {
                t_DrawScaleTimer.Dispose();
            }

            m_fpState = fpState.SETDEST;
            DrawFloor();
        }