Exemplo n.º 1
0
 private void mapViewPanel_Paint(object sender, PaintEventArgs e)
 {
     if (human != null)
     {
         int humanPathLength = human.path.Length;
         if (humanPathLength > 0)
         {
             HexSet humanHexSet = map.MapState.GetHexSet(human.hexSetIdx);
             for (int i = 0; i < humanPathLength; i++)
             {
                 HexaPos pos = human.path[i];
                 humanHexSet.hexSet.Add(map.GetHex(pos.X, pos.Y));
             }
         }
         else
         {
             if (map.MapState.GetHexSetNum() > 0)
             {
                 HexSet humanHexSet = map.MapState.GetHexSet(human.hexSetIdx);
                 humanHexSet.hexSet.Clear();
             }
         }
     }
     if (mapVisible == true)
     {
         if (mapDrawer != null)
         {
             mapDrawer.Draw(e.Graphics);
         }
     }
 }
Exemplo n.º 2
0
 private void mapViewPanel_Paint(object sender, PaintEventArgs e)
 {
     if (mapVisible == true)
     {
         if (mapDrawer != null)
         {
             mapDrawer.Draw(e.Graphics);
         }
     }
 }
Exemplo n.º 3
0
        private void VisibilityGraphForm_Paint(object sender, PaintEventArgs e)
        {
            //Draw the graphics/GUI
            foreach (Control c in this.Controls)
            {
                c.Refresh();
            }

            if (_graphDrawer != null)
            {
                _graphDrawer.Draw(e.Graphics);
            }
        }
Exemplo n.º 4
0
        private void SimTestForm_Paint(object sender, PaintEventArgs e)
        {
            if (_planMethod == PlanningForm.planMethod.UNKNOWN)
            {
                btnPlanStep.Enabled = false;
            }
            else
            {
                btnPlanStep.Enabled = true;
            }

            if (_mapDrawer != null)
            {
                _mapDrawer.Draw(e.Graphics);
            }

            //Draw the graphics/GUI
            foreach (Control c in this.Controls)
            {
                c.Refresh();
            }
        }
Exemplo n.º 5
0
        private void MapForm_Paint(object sender, PaintEventArgs e)
        {
            this.btnAnimation.Text        = "Show Search Space";
            this.btnHumanPath.Text        = "Generate Human Path";
            this.btnObstacle.Text         = "Edit Obstacles";
            this.btnRobotPath.Enabled     = false;
            this.btnHumanPath.Enabled     = true;
            this.btnAnimation.Enabled     = true;
            this.btnClearObstacle.Enabled = false;
            this.HCtrl.Enabled            = false;

            switch (_formState)
            {
            case FormState.IDLE:
            default:
                break;

            case FormState.EDIT_OBSTACLE:
                this.btnObstacle.Enabled      = true;
                this.btnObstacle.Text         = "Finish Editing Obstacles";
                this.btnClearObstacle.Enabled = true;
                this.btnHumanPath.Enabled     = false;
                this.btnAnimation.Enabled     = false;
                this.btnRobotPath.Enabled     = false;
                break;

            case FormState.ADD_HUMAN_INIT:
                this.btnRobotPath.Enabled = false;
                this.btnHumanPath.Text    = "Finish Human Path";
                this.btnAnimation.Enabled = false;

                break;

            case FormState.GENERATING_HUMANPATH:
                this.btnRobotPath.Enabled = false;
                this.btnHumanPath.Text    = "Finish Human Path";
                this.btnAnimation.Enabled = false;
                this.HCtrl.Enabled        = true;
                break;

            case FormState.HUMANPATH_GENERATED:
                this.btnRobotPath.Enabled = true;
                break;

            case FormState.SHOWING_SEARCHSPACE:
                this.btnAnimation.Text = "Quit";
                break;
            }

            //update textbox
            if (_human != null)
            {
                int humanPathLength = _human.path.Length;

                if (humanPathLength > 0)
                {
                    HexSet humanHexSet = _map.MapState.GetHexSet(_human.hexSetIdx);
                    this.tbHumanPath.Clear();
                    for (int i = 0; i < humanPathLength; i++)
                    {
                        HexaPos pos     = _human.path[i];
                        string  posInfo = i.ToString() + " : " + pos.X.ToString() + " , " + pos.Y.ToString() + "\n";
                        this.tbHumanPath.AppendText(posInfo);
                        humanHexSet.hexSet.Add(_map.GetHex(pos.X, pos.Y));
                    }
                }
                else
                {
                    this.tbHumanPath.Clear();
                    if (_map.MapState.GetHexSetNum() > 0)
                    {
                        HexSet humanHexSet = _map.MapState.GetHexSet(_human.hexSetIdx);
                        humanHexSet.hexSet.Clear();
                    }
                }
            }

            //Draw the graphics/GUI
            foreach (Control c in this.Controls)
            {
                c.Refresh();
            }

            if (_mapDrawer != null)
            {
                _mapDrawer.Draw(e.Graphics);
            }

            //Force the next Paint()
            //this.Invalidate();
        }