Пример #1
0
        private void OnMouseUp(object sender, MouseEventArgs e)
        {
            if (_band)
            {
                // clear the rubber band
                _bandImage.Clear();

                // re-calculate x axis
                int l = _mouseDownAt.X;
                int u = e.X;
                if (l > u)
                {
                    (l, u) = (u, l);
                }
                _axes.XAxis.Initialise(_vr.XCToV(l), _vr.XCToV(u), _origin.X, _noOfTicks);
                _vr.SetXExtent(new RangeD(_axes.XAxis.Min, _axes.XAxis.Max));

                // re-calculate y axis
                l = _mouseDownAt.Y;
                u = e.Y;
                if (l > u)
                {
                    (l, u) = (u, l);
                }
                _axes.YAxis.Initialise(_vr.YCToV(u), _vr.YCToV(l), _origin.Y, _noOfTicks);
                _vr.SetYExtent(new RangeD(_axes.YAxis.Min, _axes.YAxis.Max));

                // redraw
                Replot();
                _band = false;
            }
            else
            {
                if (_mapper != null && _mapper.Selected)
                {
                    _mapperImage.Clear();
                    PlotterGraphics pg = new PlotterGraphics(_vr, _mapperImage.Graphics);
                    _mapper.Deselect(pg);
                    DisplayImage();

                    if (_plotter != null)
                    {
                        _plotter.PlotPoints(_mapper.Values(_vr));
                    }
                }
            }
        }
Пример #2
0
        public override List <PointDO> Values(ViewReckoner vr)
        {
            const int n = 50;

            List <PointDO> values = new List <PointDO>();

            double x0 = vr.XCToV(_p0.X);
            double x1 = vr.XCToV(_p1.X);
            double y0 = vr.YCToV(_p0.Y);
            double y1 = vr.YCToV(_p1.Y);

            double xd = (x1 - x0) / (double)n;
            double yd = (y1 - y0) / (double)n;

            for (int i = 0; i <= n; ++i)
            {
                values.Add(new PointDO(x0 + (double)i * xd, y0 + (double)i * yd, _color));
            }

            return(values);
        }