예제 #1
0
파일: MainForm.cs 프로젝트: adiel2012/jdt
 public MainForm(Delaunay_Triangulation aj)
 {
     this.Text = "ajDelaunay GUI tester";
     this.Size = new Size(550, 550);
     _stage = 0;
     _ajd = aj;
     _dx_f = new Point_dt(5, this.Width - 5);
     _dy_f = new Point_dt(5, this.Height - 5);
     _dx_map = new Point_dt(aj.maxBoundingBox().x, aj.minBoundingBox().x);
     _dy_map = new Point_dt(aj.maxBoundingBox().y, aj.minBoundingBox().y);
     _clients = null;
     _guards = null;
     //addWindowListener(new WindowAdapter() {
     //    public void windowClosing(WindowEvent e) {
     //        System.exit(0);
     //    }
     //});
 }
예제 #2
0
파일: MainForm.cs 프로젝트: adiel2012/jdt
        // *** private methodes - random points obs ****
        // ********** Private methodes (open,save...) ********
        private void openTextFile()
        {
            _stage = 0;
            OpenFileDialog d = new OpenFileDialog();
            DialogResult dr = d.ShowDialog();
            if (dr != DialogResult.OK)
                return;

            string fi = d.FileName;
            _clients = null;
            _guards = null;

            if (!string.IsNullOrEmpty(fi)) // the user actualy choose a file.
            {
                try
                {
                    _ajd = new Delaunay_Triangulation(fi);
                    _dx_map = new Point_dt(_ajd.minBoundingBox().x, _ajd.maxBoundingBox().x);
                    _dy_map = new Point_dt(_ajd.minBoundingBox().y, _ajd.maxBoundingBox().y);

                    Refresh();
                }
                catch (Exception e)  // in case something went wrong.
                {
                    Console.WriteLine("** Error while reading text file **");
                    Console.WriteLine(e);
                }
            }
        }