示例#1
0
文件: MainForm.cs 项目: Arnyev/GK
        public MainForm()
        {
            InitializeComponent();

            pictureBox.MouseDoubleClick += (s, e) => CurrentPolygon.AddPoint(new Point(e.X, e.Y));
            pictureBox.MouseClick       += PictureBox1_MouseClick;

            KeyDown              += Form1_KeyDown;
            KeyUp                += Form1_KeyUp;
            Resize               += Form1_Resize;
            KeyPreview            = true;
            pictureBox.MouseMove += Form1_MouseMove;

            _currentMousePoint = new Point(-1, -1);

            _mainBitmap      = new DirectBitmap(pictureBox.Width, pictureBox.Height);
            pictureBox.Image = _mainBitmap.Bitmap;

            _polygons             = new IPolygonData[PolygonCount];
            _polygons[0]          = new PolygonData(MinimumDistance);
            _polygons[1]          = new PolygonData(MinimumDistance);
            _pointColorCalculator = new PointColorCalculator();

            _polygons[0].AddPoint(new Point(100, 600));
            _polygons[0].AddPoint(new Point(600, 200));
            _polygons[0].AddPoint(new Point(1500, 100));
            _polygons[0].AddPoint(new Point(1000, 1000));
            _polygons[0].AddPoint(new Point(100, 800));


            _polygons[1].AddPoint(new Point(0, 0));
            _polygons[1].AddPoint(new Point(1000, 300));
            _polygons[1].AddPoint(new Point(700, 400));

            _polygons[1].AddPoint(new Point(0, 300));


            _formDrawer = new FormDrawer(MinimumDistance, new PolygonFiller(_pointColorCalculator),
                                         new WeilerAthertonCalculator());

            SetLeftPanelEvents();
            SetTimerRedraw();
            InitColorCalculatorAndControlsState();
        }
示例#2
0
 public PolygonFiller(IPointColorCalculator pointColorCalculator)
 {
     _pointColorCalculator = pointColorCalculator;
 }