Example #1
0
        /// <summary>
        /// Do all rendering associated with this <see cref="Line"/> to the specified
        /// <see cref="Graphics"/> device.  This method is normally only
        /// called by the Draw method of the parent <see cref="LineItem"/> object.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="ZedGraph.GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="curve">A <see cref="LineItem"/> representing this
        /// curve.</param>
        public void Draw( IGraphics g, GraphPane pane, CurveItem curve, float scaleFactor )
        {
            // If the line is being shown, draw it
            if ( this.IsVisible )
            {
                //How to handle fill vs nofill?
                //if ( isSelected )
                //	GraphPane.Default.SelectedLine.

                SmoothingMode sModeSave = g.SmoothingMode;
                if ( _isAntiAlias )
                    g.SmoothingMode = SmoothingMode.HighQuality;

                if ( curve is StickItem )
                {
                    DrawSticks(g, pane, curve, scaleFactor);
                }
                // we can't draw Smooth Filled Curves with SVG -- they require GDI paths which
                // the SVGNet library doesn't support, so only do this if we're using GdiGraphics
                // for output
                else if ( (this.IsSmooth || this.Fill.IsVisible) && g.GetType() == typeof(GdiGraphics) )
                {
                    DrawSmoothFilledCurve(g, pane, curve, scaleFactor);
                }
                else
                {
                    DrawCurve(g, pane, curve, scaleFactor, GetPoints(curve, pane));
                }

                g.SmoothingMode = sModeSave;
            }
        }