コード例 #1
0
 protected void PostParse(ParseElementCollection parent)
 {
     if (_startArc != null)
     {
         parent.AddArc(_startArc, _endArc);
     }
 }
コード例 #2
0
        void set_peak_names()
        {
            string header = FrmInputSingleLine.Show(this, this.Text, "Peak names", "Enter the peak names", "{DisplayName}");

            if (header != null)
            {
                ParseElementCollection hc = new ParseElementCollection(header);

                foreach (Peak p in this._core.Peaks)
                {
                    p.OverrideDisplayName = hc.ConvertToString(p, this._core);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Converts to string.
        /// </summary>
        /// <param name="propertyTarget">Elements {!xxx} will get the xxx property from this object, elements {xxx} will get the xxx value from QueryValue(xxx)</param>
        /// <returns>String</returns>
        public static string ConvertToString(this ParseElementCollection self, object propertyTarget, Core core)
        {
            var r = new StringBuilder();

            foreach (var x in self.Contents)
            {
                if (x.IsInBrackets)
                {
                    r.Append(Column.AsString(ColumnManager.QueryProperty(core, propertyTarget, x.Value), EListDisplayMode.Content));
                }
                else
                {
                    r.Append(x.Value);
                }
            }

            return(r.ToString());
        }
コード例 #4
0
        /// <summary>
        /// Creates the MChart.Plot object
        /// </summary>
        /// <param name="axes">Include axis text (i.e. not a preview)</param>
        /// <param name="toPlot">What will be plotted</param>
        /// <returns>New MChart.Plot object</returns>
        protected MCharting.Plot PrepareNewPlot(bool axes, Associational toPlot, IntensityMatrix sourceMatrix)
        {
            MCharting.Plot plot = new MCharting.Plot();

            PlotSetup setup = this._core.Options.GetPlotSetup(this._core, toPlot);

            if (this._mnuPlot != null)
            {
                if (toPlot != null)
                {
                    this._mnuPlot.Text  = toPlot.DisplayName;
                    this._mnuPlot.Image = UiControls.GetImage(toPlot.Icon, true);

                    if (ParseElementCollection.IsNullOrEmpty(setup.Information))
                    {
                        this._mnuCustomText.Text = "(Click here to configure text)";
                    }
                    else
                    {
                        this._mnuCustomText.Text = setup.Information.ConvertToString(toPlot, this._core);
                    }

                    this._mnuPlot.Visible       = true;
                    this._mnuCustomText.Visible = this._chkShowCustom.Checked;
                }
                else
                {
                    this._mnuPlot.Text          = "No selection";
                    this._mnuPlot.Image         = Resources.IconTransparent;
                    this._mnuPlot.Visible       = false;
                    this._mnuCustomText.Text    = "";
                    this._mnuCustomText.Visible = false;
                }
            }

            if (this._core.Options.NoAxes)
            {
                axes = false;
            }

            if (axes)
            {
                plot.Style.BackColour = this._core.Options.Colours.PlotBackground;

                if (!ParseElementCollection.IsNullOrEmpty(setup.AxisX))
                {
                    plot.XLabel = setup.AxisX.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.AxisY))
                {
                    plot.YLabel = setup.AxisY.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.Title))
                {
                    plot.Title = setup.Title.ConvertToString(toPlot, this._core);
                }

                if (!ParseElementCollection.IsNullOrEmpty(setup.SubTitle))
                {
                    plot.SubTitle = setup.SubTitle.ConvertToString(toPlot, this._core);
                }

                plot.Style.AutoTickX    = false;
                plot.Style.GridStyle    = new Pen(this._core.Options.Colours.MinorGrid, this._core.Options.LineWidth);
                plot.Style.TickStyle    = new Pen(this._core.Options.Colours.MajorGrid, this._core.Options.LineWidth);
                plot.Style.AxisText     = new SolidBrush(this._core.Options.Colours.AxisTitle);
                this.Chart.Style.Margin = new Padding(this._core.Options.Margin);
            }
            else
            {
                plot.Style.BackColour   = this._core.Options.Colours.PreviewBackground;
                plot.Style.AutoTickX    = false;
                plot.Style.AutoTickY    = false;
                plot.Style.GridStyle    = null;
                plot.Style.TickStyle    = null;
                plot.Style.AxisStyle    = null;
                this.Chart.Style.Margin = Padding.Empty;
            }

            plot.Style.XMin = setup.RangeXMin.GetValue();
            plot.Style.XMax = setup.RangeXMax.GetValue();
            plot.Style.YMin = setup.RangeYMin.GetValue();
            plot.Style.YMax = setup.RangeYMax.GetValue();

            // Min/max of IM
            if (sourceMatrix != null)
            {
                if (setup.RangeYMin.Mode == EAxisRange.General)
                {
                    if (setup.RangeYMax.Mode == EAxisRange.General)
                    {
                        var range = sourceMatrix.AllValues.Range();
                        plot.Style.YMin = range.Min;
                        plot.Style.YMax = range.Max;
                    }
                    else
                    {
                        plot.Style.YMin = sourceMatrix.AllValues.Min();
                    }
                }
                else if (setup.RangeYMax.Mode == EAxisRange.General)
                {
                    plot.Style.YMax = sourceMatrix.AllValues.Max();
                }
            }

            switch (setup.RangeXMin.Mode)
            {
            case EAxisRange.Fixed:
                plot.Style.XMin = setup.RangeXMin.Value;
                break;

            case EAxisRange.Automatic:
            case EAxisRange.General:
                plot.Style.XMin = null;
                break;
            }


            //plot.Style.XMin = setup.RangeXMin.Get( toPlot );
            //plot.Style.XMax = setup.RangeXMax.Get( toPlot );
            //plot.Style.YMin = setup.RangeYMin.Get( toPlot );
            //plot.Style.YMax = setup.RangeYMax.Get( toPlot );

            return(plot);
        }