public void DrawLineV(PointD p0, PointD p1) { Point c0 = _vr.VToC(p0); Point c1 = _vr.VToC(p1); if (_vr.CInView(c0) && _vr.CInView(c1)) { _graphics.DrawLine(NarrowPen(), _vr.VToC(p0), _vr.VToC(p1)); } }
public Plotter2d(PictureBox plot, double xExtent, double yExtent, IPlotter plotter) { double xmin = -xExtent / 2.0; double xmax = xExtent / 2.0; double ymin = -yExtent / 2.0; double ymax = yExtent / 2.0; _plot = plot; _plotter = plotter; _origin = new PointD(0.0, 0.0); _vr = new ViewReckoner( _border, plot.Width - _border, plot.Height - _border, _border, xmin, xmax, ymin, ymax); _plot.BackColor = Color.White; _plot.Paint += new PaintEventHandler(OnPaint); // create the axis _axes = new Axes(); _axes.XAxis = new Axis(xmin, xmax, _origin.X, _noOfTicks); _axes.YAxis = new Axis(ymin, ymax, _origin.Y, _noOfTicks); // rubber band _plot.MouseDown += new MouseEventHandler(OnMouseDown); _plot.MouseUp += new MouseEventHandler(OnMouseUp); _plot.MouseMove += new MouseEventHandler(OnMouseMove); // create image planes _mainImage = new ImagePlane(_plot); _bandImage = new ImagePlane(_plot); _mapperImage = new ImagePlane(_plot); Point oc = _vr.VToC(_origin); //_mapper = new Grid(oc.X, oc.X + _vr.CXSize / 4, 4, oc.Y, oc.Y - _vr.CYSize / 4, 4); //_mapper = new Line(oc, new Point(oc.X + _vr.CXSize / 4, oc.Y - _vr.CYSize / 4)); Replot(); }