Exemple #1
0
        public void Paint()
        {
            MapReader reader = new MapReader(@"test.svg");

            HighResolutionTime.Start();
            if (reader.Read())
            {
                map = reader.GetMap(new Dictionary <string, byte>());
            }
            Console.WriteLine("Чтение карты: " + HighResolutionTime.GetTime());
            BaseBmp = map.GetLayerMask(0);
            Graphics g = Graphics.FromImage(BaseBmp);

            foreach (var node in map._patensyGraph.Vertices)
            {
                g.FillRectangle(System.Drawing.Brushes.Red, node.SourceWP.X, node.SourceWP.Y, node.SourceWP.PointWidth, node.SourceWP.PointHeight);
                g.FillRectangle(System.Drawing.Brushes.Red, node.TargetWP.X, node.TargetWP.Y, node.TargetWP.PointWidth, node.TargetWP.PointHeight);
            }
            foreach (var edge in map._patensyGraph.Edges)
            {
                g.DrawLine(System.Drawing.Pens.Green, edge.Source.SourceWP.Center, edge.Target.SourceWP.Center);
            }

            Agents.Human.HumanManager mng = new Agents.Human.HumanManager();
            //agent = mng.GetInstance(map, null, new System.Windows.Media.Media3D.Size3D(0.5, 0.3, 2.0), 1.4, 1.0, 1.0);
            //agent.Initialize(new System.Drawing.Point(10, 3), new List<WayPoint> { new WayPoint(300, 10), new WayPoint(154, 550), new WayPoint(630, 130) });

            g.FillEllipse(System.Drawing.Brushes.Orange, 300, 10, 5, 5);
            g.FillEllipse(System.Drawing.Brushes.Orange, 154, 550, 5, 5);
            g.FillEllipse(System.Drawing.Brushes.Orange, 630, 130, 5, 5);

            SetMapImage(BaseBmp);

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(10);
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Start();
        }
        public void Paint()
        {
            MapReader reader = new MapReader(@"test.svg");
            HighResolutionTime.Start();
            if (reader.Read())
            {
                map = reader.GetMap(new Dictionary<string,byte>());
            }
            Console.WriteLine("Чтение карты: " + HighResolutionTime.GetTime());
            BaseBmp = map.GetLayerMask(0);
            Graphics g = Graphics.FromImage(BaseBmp);
            foreach (var node in map._patensyGraph.Vertices)
            {
                g.FillRectangle(System.Drawing.Brushes.Red, node.SourceWP.X, node.SourceWP.Y, node.SourceWP.PointWidth, node.SourceWP.PointHeight);
                g.FillRectangle(System.Drawing.Brushes.Red, node.TargetWP.X, node.TargetWP.Y, node.TargetWP.PointWidth, node.TargetWP.PointHeight);
            }
            foreach (var edge in map._patensyGraph.Edges)
            {
                g.DrawLine(System.Drawing.Pens.Green, edge.Source.SourceWP.Center, edge.Target.SourceWP.Center);
            }

            Agents.Human.HumanManager mng = new Agents.Human.HumanManager();
            //agent = mng.GetInstance(map, null, new System.Windows.Media.Media3D.Size3D(0.5, 0.3, 2.0), 1.4, 1.0, 1.0);
            //agent.Initialize(new System.Drawing.Point(10, 3), new List<WayPoint> { new WayPoint(300, 10), new WayPoint(154, 550), new WayPoint(630, 130) });

            g.FillEllipse(System.Drawing.Brushes.Orange, 300, 10, 5, 5);
            g.FillEllipse(System.Drawing.Brushes.Orange, 154, 550, 5, 5);
            g.FillEllipse(System.Drawing.Brushes.Orange, 630, 130, 5, 5);

            SetMapImage(BaseBmp);

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(10);
            timer.Tick+=new EventHandler(timer_Tick);
            timer.Start();
        }