Example #1
0
        /// <summary>
        /// Creates a copy of the Function2DItem.
        /// </summary>
        public override Item Clone()
        {
            Function2DItem f = new Function2DItem();

            f.CopyFrom(this);
            return(f);
        }
Example #2
0
        /// <summary>
        /// Copies from another Function2D.
        /// </summary>
        public override void CopyFrom(Item src)
        {
            base.CopyFrom(src);
            Function2DItem f = (Function2DItem)src;

            Gradient = f.Gradient.Clone();
            Source   = f.Source;
            Compiler.Compile(this);
        }
Example #3
0
        /// <summary>
        /// Draws a z-<see cref="Scale">Scale</see> for a <see cref="Plot2D">2D Plot</see>.
        /// </summary>
        /// <param name="g">The <see cref="Graphics"/> to paint to</param>
        /// <param name="Model">The <see cref="PlotModel"/> of the Plot</param>
        /// <param name="v">The orientation of the scale</param>
        /// <param name="draw">If false, the scale is not drawn only is extensions are measured</param>
        /// <param name="r">The rectangle where the z-gradient is drawn inside</param>
        /// <param name="norms">The extensions of the painting</param>
        public static void DrawZScale(Graphics g, PlotModel Model, ref PointF[] v, bool draw, Rectangle r, ref Norms norms)
        {
            Function2DItem f = Model.GetPaintableItem() as Function2DItem;

            if (Model.z.scale && f != null)
            {
                Model.z.oppositeRaster = Model.z.oppositeLine = false;
                Model.z.scaleOutside   = Model.z.rasterOutside = false;
                if (draw)
                {
                    GradientPainter.FillRectangle(g, f.Gradient, r, GradientPainter.Direction.Up);
                    Pen pen = new Pen(Model.ScaleColor, Model.ScaleLineWidth);
                    g.DrawRectangle(pen, r);
                }
                SizeF size = g.MeasureString("0.5", Model.ScaleFont);
                float s0   = Math.Max(1, size.Height);
                v[0] = new PointF(r.X + r.Width, r.Y + r.Height);
                v[1] = new PointF(r.X + r.Width, r.Y);
                v[2] = new PointF(r.X + r.Width + s0, r.Y + r.Height);

                DrawScale(g, v, Model, Model.z, draw, ref norms);
            }
        }
Example #4
0
 /// <summary>
 /// A constructor setting the model and item of the painter.
 /// </summary>
 public Function2DPainter2D(PlotModel m, Item x) : base(m, x)
 {
     F = (Function2DItem)x;
 }