Beispiel #1
0
        // detailed function (named arguments)
        public void AddVertLine(double y, int lineWidth = 1, Color?lineColor = null, Style.LineStyle lineStyle = Style.LineStyle.solid)
        {
            var style = new Style(plotObjects.Count());

            style.lineWidth = lineWidth;
            style.lineColor = lineColor.GetValueOrDefault(style.lineColor);
            style.lineStyle = lineStyle;
            AddAxisLine(y, true, style);
        }
Beispiel #2
0
        // detailed function (named arguments)
        public void AddSignal(double[] y, double sampleRateHz,
                              int lineWidth = 1, Color?lineColor = null, Style.LineStyle lineStyle = Style.LineStyle.solid)
        {
            var style = new Style(plotObjects.Count());

            style.lineWidth = lineWidth;
            style.lineColor = lineColor.GetValueOrDefault(style.lineColor);
            style.lineStyle = lineStyle;
            plotObjects.Add(new Plottables.Signal(y, sampleRateHz, style));
        }
Beispiel #3
0
        // detailed function (named arguments)
        public void AddScatter(double[] xs, double[] ys,
                               int markerSize = 3, Color?markerColor = null, Style.MarkerShape markerShape = Style.MarkerShape.circleFilled,
                               int lineWidth  = 1, Color?lineColor   = null, Style.LineStyle lineStyle     = Style.LineStyle.solid)
        {
            xs = xs ?? AscendingNumbers(ys.Length);
            var style = new Style(plotObjects.Count());

            style.markerSize  = markerSize;
            style.markerColor = markerColor.GetValueOrDefault(style.markerColor);
            style.markerShape = markerShape;
            style.lineWidth   = lineWidth;
            style.lineColor   = lineColor.GetValueOrDefault(style.lineColor);
            style.lineStyle   = Style.LineStyle.solid;
            AddScatter(xs, ys, style);
        }
Beispiel #4
0
        public ArrayList CreateMorphedShape(float ratio)
        {
            ArrayList morphedCommands = new ArrayList();
            int       targetIndex     = -1;
            EPoint    ptCurrent       = new EPoint();

            foreach (ShapeCommand.Base cmd in this.CommandList)
            {
                if (!(cmd is ShapeCommand.Style))
                {
                    targetIndex++;
                }

                ShapeCommand.Base cmdTo = (ShapeCommand.Base) this._morphCommandList[targetIndex];

                if (cmd is ShapeCommand.Move)
                {
                    EPoint pt1 = ((ShapeCommand.Move)cmd).Target;
                    EPoint pt2 = ((ShapeCommand.Move)cmdTo).Target;
                    ptCurrent = this.GetPointBetween(pt1, pt2, ratio);
                    morphedCommands.Add(new ShapeCommand.Move(ptCurrent));
                }
                else if ((cmd is ShapeCommand.Line) || (cmd is ShapeCommand.Curve))
                {
                    ShapeCommand.Draw  draw  = (ShapeCommand.Draw)cmd;
                    ShapeCommand.Curve curve = draw.GetAsCurve();

                    if ((cmdTo is ShapeCommand.Line) || (cmdTo is ShapeCommand.Curve))
                    {
                        draw = (ShapeCommand.Draw)cmdTo;
                        ShapeCommand.Curve curveTo = draw.GetAsCurve();

                        EPoint ptControl = this.GetPointBetween(curve.Control, curveTo.Control, ratio);
                        EPoint ptAnchor  = this.GetPointBetween(curve.Anchor, curveTo.Anchor, ratio);

                        morphedCommands.Add(new ShapeCommand.Curve(ptControl, ptAnchor));
                        ptCurrent += ptControl + ptAnchor;
                    }
                    else
                    {
                        ShapeCommand.Move move = (ShapeCommand.Move)cmdTo;

                        EPoint ptFrom = ptCurrent + curve.Control + curve.Anchor;
                        EPoint ptTo   = move.Target;

                        ptCurrent = this.GetPointBetween(ptFrom, ptTo, ratio);
                        morphedCommands.Add(new ShapeCommand.Move(ptCurrent.Copy()));
                    }
                }
                else if (cmd is ShapeCommand.LineStyle)
                {
                    ShapeCommand.LineStyle ls = (ShapeCommand.LineStyle)cmd;
                    if (ls.StyleId > 0)
                    {
                        Style.LineStyle style = (Style.LineStyle) this.LineStyles[ls.StyleId - 1];
                        style.MorphPosition = ratio;
                        morphedCommands.Add(ls);                         //.GetMorphed(ratio));
                    }
                }
                else if (cmd is ShapeCommand.FillStyle)
                {
                    ShapeCommand.FillStyle fs = (ShapeCommand.FillStyle)cmd;
                    if (fs.StyleId > 0)
                    {
                        Style.FillStyle style = (Style.FillStyle) this.FillStyles[fs.StyleId - 1];
                        style.MorphPosition = ratio;
                        morphedCommands.Add(fs);                         //.GetMorphed(ratio));
                    }
                }
            }
            return(morphedCommands);
        }