Example #1
0
        void MainForm_Click(object sender, MouseEventArgs e)
        {
            int xx = e.X;
            int yy = e.Y;

            switch (_stage)
            {
            case 0:
            {
                Console.WriteLine("[" + xx + "," + yy + "]");
                break;
            }

            case POINT:
            {
                Point_dt q = new Point_dt(xx, yy);
                Point_dt p = screen2world(q);
                _ajd.insertPoint(p);
                Refresh();
                break;
            }

            case FIND:
            {
                Point_dt q = new Point_dt(xx, yy);
                Point_dt p = screen2world(q);
                //_t1 = _ajd.find(p);
                _t1 = _ajd.FastFind(p);
                Refresh();
                break;
            }

            case SECTION1:
            {
                Point_dt q = new Point_dt(xx, yy);
                _p1 = screen2world(q);
                // _p1 = new Point_dt(99792.03,1073355.0,30.0);

                // _t1 = _ajd.find(_p1);
                _stage = SECTION2;
                break;
            }

            case SECTION2:
            {
                Point_dt q = new Point_dt(xx, yy);
                _p2 = screen2world(q);
                // _p2 = new Point_dt(149587.055,1040477.0,5.0);

                // _t2 = _ajd.find(_p2);
                _los = new Visibility(_ajd);
                _los.computeSection(_p1, _p2);
                Refresh();
                _stage = SECTION1;
                break;
            }

            case GUARD:
            {
                Point_dt q = new Point_dt(xx, yy);
                _p1 = screen2world(q);
                if (_guards == null)
                {
                    _guards = new List <Point_dt>();
                }
                _guards.Add(new Point_dt(_p1.x, _p1.y, GH));

                /*
                 * if(_p2!=null) { _los = new Visibility(_ajd);
                 * _los.computeSection(_p1,_p2); _visible =
                 * _los.isVisible(30,5); }
                 */
                Refresh();
                break;
            }

            case CLIENT:
            {
                Point_dt q = new Point_dt(xx, yy);
                _p2 = screen2world(q);
                if (_clients == null)
                {
                    _clients = new List <Point_dt>();
                }
                _clients.Add(new Point_dt(_p2.x, _p2.y, CH));

                /*
                 * if(_p1!=null) { _los = new Visibility(_ajd);
                 * _los.computeSection(_p1,_p2); _visible =
                 * _los.isVisible(30,5); }
                 */
                Refresh();
                break;
            }
            }
        }
Example #2
0
        void MainForm_Click(object sender, MouseEventArgs e)
        {
            int xx = e.X;
            int yy = e.Y;

            switch (_stage)
            {
                case 0:
                    {
                        Console.WriteLine("[" + xx + "," + yy + "]");
                        break;
                    }
                case POINT:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        Point_dt p = screen2world(q);
                        _ajd.insertPoint(p);
                        Refresh();
                        break;
                    }
                case FIND:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        Point_dt p = screen2world(q);
                        //_t1 = _ajd.find(p);
                        _t1 = _ajd.FastFind(p);
                        Refresh();
                        break;
                    }
                case SECTION1:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        _p1 = screen2world(q);
                        // _p1 = new Point_dt(99792.03,1073355.0,30.0);

                        // _t1 = _ajd.find(_p1);
                        _stage = SECTION2;
                        break;
                    }
                case SECTION2:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        _p2 = screen2world(q);
                        // _p2 = new Point_dt(149587.055,1040477.0,5.0);

                        // _t2 = _ajd.find(_p2);
                        _los = new Visibility(_ajd);
                        _los.computeSection(_p1, _p2);
                        Refresh();
                        _stage = SECTION1;
                        break;
                    }
                case GUARD:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        _p1 = screen2world(q);
                        if (_guards == null)
                            _guards = new List<Point_dt>();
                        _guards.Add(new Point_dt(_p1.x, _p1.y, GH));
                        /*
                         * if(_p2!=null) { _los = new Visibility(_ajd);
                         * _los.computeSection(_p1,_p2); _visible =
                         * _los.isVisible(30,5); }
                         */
                        Refresh();
                        break;
                    }
                case CLIENT:
                    {
                        Point_dt q = new Point_dt(xx, yy);
                        _p2 = screen2world(q);
                        if (_clients == null)
                            _clients = new List<Point_dt>();
                        _clients.Add(new Point_dt(_p2.x, _p2.y, CH));
                        /*
                         * if(_p1!=null) { _los = new Visibility(_ajd);
                         * _los.computeSection(_p1,_p2); _visible =
                         * _los.isVisible(30,5); }
                         */
                        Refresh();
                        break;
                    }
            }
        }