Ejemplo n.º 1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Image = ((System.Windows.Controls.Image)(target));
                return;

            case 2:
                this.BttnSavePlot = ((System.Windows.Controls.Button)(target));

            #line 17 "..\..\Plots.xaml"
                this.BttnSavePlot.Click += new System.Windows.RoutedEventHandler(this.savePlotButtonClick);

            #line default
            #line hidden
                return;

            case 3:
                this.TabLayout = ((System.Windows.Controls.TabControl)(target));
                return;

            case 4:
                this.plotone = ((IronPlot.Plot2D)(target));
                return;

            case 5:
                this.plottwo = ((IronPlot.Plot2D)(target));
                return;

            case 6:
                this.plotthree = ((IronPlot.Plot2D)(target));
                return;

            case 7:
                this.plotfour = ((IronPlot.Plot2D)(target));
                return;

            case 8:
                this.plotfive = ((IronPlot.Plot2D)(target));
                return;

            case 9:
                this.plotsix = ((IronPlot.Plot2D)(target));
                return;

            case 10:
                this.plotseven = ((IronPlot.Plot2D)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Image = ((System.Windows.Controls.Image)(target));
                return;

            case 2:
                this.TabLayout = ((System.Windows.Controls.TabControl)(target));
                return;

            case 3:
                this.plotone = ((IronPlot.Plot2D)(target));
                return;

            case 4:
                this.plottwo = ((IronPlot.Plot2D)(target));
                return;

            case 5:
                this.plotthree = ((IronPlot.Plot2D)(target));
                return;

            case 6:
                this.plotfour = ((IronPlot.Plot2D)(target));
                return;

            case 7:
                this.plotfive = ((IronPlot.Plot2D)(target));
                return;

            case 8:
                this.plotsix = ((IronPlot.Plot2D)(target));
                return;

            case 9:
                this.plotseven = ((IronPlot.Plot2D)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Convenience method. Line plot of one or more lines or false colour image
        /// </summary>
        /// <param name="parameters">
        /// <para>Supports multiple lines with PyLab-like line properties, e.g. Plot2D(x1, y1, "-or", x2, y2, "--sb")</para>
        /// <para>plot2d(array) returns line plot if array is a vector (x values are craeted in this case)</para>
        /// <para>If array is a vector, line properties can be added: plot2d(array, "-or")</para>
        /// <para>plot2d(array) returns a false colour plot if array is a matrix</para>
        /// <para>plot2d(x, y, matrix) returns a false colour plot matrix using min and max values of x and y vectors to define false colour plot area</para>
        /// </param>
        /// <returns></returns>
        public static List <Plot2DCurve> Plot2D(params object[] parameters)
        {
            List <Plot2DCurve> curves = new List <Plot2DCurve>();
            Plot2D             plot2D = null;
            int paramIndex            = 0; // current parameter

            if (parameters.Length > 0 && parameters[0].GetType() == typeof(Plot2D))
            {
                plot2D = (Plot2D)parameters[0];
                paramIndex++;
            }
            else
            {
                plot2D = new Plot2D();
            }
            // x and y will contain lists of x and y vectors to be plotted
            List <double[]> x = new List <double[]>();
            List <double[]> y = new List <double[]>();

            double[]      createdX      = null;
            List <string> lineProperty  = new List <string>();
            int           lastLineIndex = paramIndex; // index of the end of the last line specification

            while (paramIndex < parameters.Length)
            {
                // Get the next two parameters, or up to the next string entry (line property)
                while ((paramIndex < (lastLineIndex + 2)) && (paramIndex < parameters.Length) && (parameters[paramIndex].GetType() != Type.GetType("System.String")))
                {
                    paramIndex++;
                }
                if ((paramIndex - lastLineIndex) == 2) // 2 vectors and possibly a line property
                {
                    x.Add(Array(parameters[lastLineIndex + 0]));
                    y.Add(Array(parameters[lastLineIndex + 1]));
                    if ((paramIndex < parameters.Length) && parameters[paramIndex].GetType() == Type.GetType("System.String"))
                    {
                        lineProperty.Add((string)(parameters[paramIndex]));
                    }
                    else
                    {
                        lineProperty.Add("");
                        paramIndex--;
                    }
                }
                else if ((paramIndex - lastLineIndex) == 1) // 1 vector and possibly a line property
                {
                    y.Add(Array(parameters[lastLineIndex + 0]));
                    if (createdX != null)
                    {
                        x.Add(createdX);
                    }
                    else
                    {
                        createdX = MathHelper.Counter(y[y.Count - 1].Length).SumWith(-1.0);
                        x.Add(createdX);
                    }
                    if ((paramIndex < parameters.Length) && parameters[paramIndex].GetType() == Type.GetType("System.String"))
                    {
                        lineProperty.Add((string)(parameters[paramIndex]));
                    }
                    else
                    {
                        lineProperty.Add("");
                    }
                }
                else
                {
                    throw new ArgumentException("Incorrect syntax");
                }
                paramIndex++; lastLineIndex = paramIndex;
            }
            for (int i = 0; i < x.Count; ++i)
            {
                curves.Add(plot2D.AddLine(x[i], y[i], lineProperty[i]));
            }
            return(curves);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Convenience method. Line plot of one or more lines or false colour image
 /// </summary>
 /// <param name="parameters">
 /// <para>Supports multiple lines with PyLab-like line properties, e.g. Plot2D(x1, y1, "-or", x2, y2, "--sb")</para>
 /// <para>plot2d(array) returns line plot if array is a vector (x values are craeted in this case)</para>
 /// <para>If array is a vector, line properties can be added: plot2d(array, "-or")</para>
 /// <para>plot2d(array) returns a false colour plot if array is a matrix</para>
 /// <para>plot2d(x, y, matrix) returns a false colour plot matrix using min and max values of x and y vectors to define false colour plot area</para>
 /// </param>
 /// <returns></returns>
 public static List<Plot2DCurve> Plot2D(params object[] parameters)
 {
     List<Plot2DCurve> curves = new List<Plot2DCurve>();
     Plot2D plot2D = null;
     int paramIndex = 0; // current parameter
     if (parameters.Length > 0 && parameters[0].GetType() == typeof(Plot2D))
     {
         plot2D = (Plot2D)parameters[0];
         paramIndex++;
     }
     else plot2D = new Plot2D();
     // x and y will contain lists of x and y vectors to be plotted
     List<double[]> x = new List<double[]>();
     List<double[]> y = new List<double[]>();
     double[] createdX = null;
     List<string> lineProperty = new List<string>();
     int lastLineIndex = paramIndex; // index of the end of the last line specification
     while (paramIndex < parameters.Length)
     {
         // Get the next two parameters, or up to the next string entry (line property) 
         while ((paramIndex < (lastLineIndex + 2)) && (paramIndex < parameters.Length) && (parameters[paramIndex].GetType() != Type.GetType("System.String")))
         {
             paramIndex++;
         }
         if ((paramIndex - lastLineIndex) == 2) // 2 vectors and possibly a line property
         {
             x.Add(Array(parameters[lastLineIndex + 0]));
             y.Add(Array(parameters[lastLineIndex + 1]));
             if ((paramIndex < parameters.Length) && parameters[paramIndex].GetType() == Type.GetType("System.String"))
             {
                 lineProperty.Add((string)(parameters[paramIndex]));
             }
             else
             {
                 lineProperty.Add("");
                 paramIndex--;
             }
         }
         else if ((paramIndex - lastLineIndex) == 1) // 1 vector and possibly a line property
         {
             y.Add(Array(parameters[lastLineIndex + 0]));
             if (createdX != null) x.Add(createdX);
             else
             {
                 createdX = MathHelper.Counter(y[y.Count - 1].Length).SumWith(-1.0);
                 x.Add(createdX);
             }
             if ((paramIndex < parameters.Length) && parameters[paramIndex].GetType() == Type.GetType("System.String"))
             {
                 lineProperty.Add((string)(parameters[paramIndex]));
             }
             else lineProperty.Add("");
         }
         else
         {
             throw new ArgumentException("Incorrect syntax");
         }
         paramIndex++; lastLineIndex = paramIndex;
     }
     for (int i = 0; i < x.Count; ++i)
     {
         curves.Add(plot2D.AddLine(x[i], y[i], lineProperty[i]));
     }
     return curves;
 }
Ejemplo n.º 5
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Image = ((System.Windows.Controls.Image)(target));
     return;
     case 2:
     this.BttnSavePlot = ((System.Windows.Controls.Button)(target));
     
     #line 17 "..\..\Plots.xaml"
     this.BttnSavePlot.Click += new System.Windows.RoutedEventHandler(this.savePlotButtonClick);
     
     #line default
     #line hidden
     return;
     case 3:
     this.TabLayout = ((System.Windows.Controls.TabControl)(target));
     return;
     case 4:
     this.plotone = ((IronPlot.Plot2D)(target));
     return;
     case 5:
     this.plottwo = ((IronPlot.Plot2D)(target));
     return;
     case 6:
     this.plotthree = ((IronPlot.Plot2D)(target));
     return;
     case 7:
     this.plotfour = ((IronPlot.Plot2D)(target));
     return;
     case 8:
     this.plotfive = ((IronPlot.Plot2D)(target));
     return;
     case 9:
     this.plotsix = ((IronPlot.Plot2D)(target));
     return;
     case 10:
     this.plotseven = ((IronPlot.Plot2D)(target));
     return;
     }
     this._contentLoaded = true;
 }