示例#1
0
        public void UpdatePlot(PlotData plotData, AxisVariable oxVariable, AxisVariable oyVariable)
        {
            this.oxVar    = oxVariable;
            this.oyVar    = oyVariable;
            this.plotData = plotData;

            this.Invalidate();
        }
示例#2
0
        private void p2d_Plot2DChanged(Plot2D plot)
        {
            AxisVariable avX = UI.ConvertToAxisVariable(plot.PlotVariableX);
            AxisVariable avY = UI.ConvertToAxisVariable(plot.PlotVariableY);
            PlotData     pd  = this.ConvertToPlotData(plot);

            this.selectedP2DGraph.UpdatePlot(pd, avX, avY);
        }
示例#3
0
        private void iPlot_PlotChanged(AxisVariable ox, AxisVariable oy, PlotData data)
        {
            this.Graph.UpdatePlot(data, ox, oy);
            this.UpdateFamiliesList(data);
            this.UpdateRangesOnUI(ox, oy);

            this.comboBoxOxVariables.SelectedItem = ox;
            this.comboBoxOyVariables.SelectedItem = oy;
        }
示例#4
0
        public ViewPlot2DForm(ArrayList list, PlotGraphSize size)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            int d = 4;
            int x = d;
            int y = 4;
            int i = 0;

            this.hashtableGraphPlot = new Hashtable();
            IEnumerator en = list.GetEnumerator();

            while (en.MoveNext())
            {
                i++;
                Plot2D      p2d      = (Plot2D)en.Current;
                Plot2DGraph p2dGraph = new Plot2DGraph();
                this.AdjustGraphSize(p2dGraph, size);

                AxisVariable avX = UI.ConvertToAxisVariable(p2d.PlotVariableX);
                AxisVariable avY = UI.ConvertToAxisVariable(p2d.PlotVariableY);
                PlotData     pd  = this.ConvertToPlotData(p2d);
                p2dGraph.UpdatePlot(pd, avX, avY);

                x = i * d + (i - 1) * p2dGraph.Width;
                p2dGraph.Location = new Point(x, y);

                this.panelPlots.Controls.Add(p2dGraph);
                this.hashtableGraphPlot.Add(p2dGraph, p2d);

                p2dGraph.PlotSelected += new PlotSelectedEventHandler(p2dGraph_PlotSelected);
                p2d.Plot2DChanged     += new Plot2DChangedEventHandler(p2d_Plot2DChanged);
            }

            if (size == PlotGraphSize.Medium)
            {
                this.panelPlots.Height -= 135;
                this.Height            -= 150;
            }
            else if (size == PlotGraphSize.Small)
            {
                this.panelPlots.Height -= 208;
                this.Height            -= 222;
            }

            this.UnselectAllPlots();
            this.plot2DControl.CheckBoxDetails.CheckedChanged += new EventHandler(CheckBoxDetails_CheckedChanged);
        }
示例#5
0
        public void InitializePlotControl(IPlot iPlot)
        {
            this.iPlot = iPlot;
            ArrayList oxVars = iPlot.GetOxVariables();
            ArrayList oyVars = iPlot.GetOyVariables();

            this.comboBoxOxVariables.Items.Clear();
            this.comboBoxOyVariables.Items.Clear();

            // populate the ox variables
            IEnumerator e1 = oxVars.GetEnumerator();

            while (e1.MoveNext())
            {
                this.comboBoxOxVariables.Items.Add(e1.Current);
            }
            if (oxVars != null && oxVars.Count > 0)
            {
                this.comboBoxOxVariables.SelectedIndex = 0;
            }

            // populate the oy variables
            IEnumerator e2 = oyVars.GetEnumerator();

            while (e2.MoveNext())
            {
                this.comboBoxOyVariables.Items.Add(e2.Current);
            }
            if (oyVars != null && oyVars.Count > 0)
            {
                this.comboBoxOyVariables.SelectedIndex = 0;
            }

            PlotData plotData = iPlot.GetPlotData(this.OxVariable, this.OyVariable);

            // update the ranges
            this.UpdateRangesOnUI(this.OxVariable, this.OyVariable);

            // update the plot
            this.plotGraph.UpdatePlot(plotData, this.OxVariable, this.OyVariable);

            //
            this.UpdateFamiliesList(plotData);

            if (this.iPlot != null)
            {
                this.iPlot.PlotChanged += new PlotChangedEventHandler(iPlot_PlotChanged);
            }
        }
示例#6
0
        public void UpdatePlot(PlotData plotData, AxisVariable oxVariable, AxisVariable oyVariable)
        {
            this.oxVar    = oxVariable;
            this.oyVar    = oyVariable;
            this.plotData = plotData;

            this.oxLength = this.Width - PlotsConst.OX_LEFT_MARGIN - PlotsConst.OX_RIGHT_MARGIN;
            this.oyLength = this.Height - PlotsConst.OY_DOWN_MARGIN - PlotsConst.OY_UP_MARGIN - this.labelTitle.Height;
            this.origin   = new PointF(PlotsConst.OX_LEFT_MARGIN, oyLength + PlotsConst.OY_UP_MARGIN + this.labelTitle.Height);

            this.labelTitle.Text = "";
            if (this.PlotData != null)
            {
                this.labelTitle.Text = this.plotData.Name;
            }

            this.Invalidate();
        }
示例#7
0
        private PlotData ConvertToPlotData(Plot2D p2d)
        {
            PhysicalQuantity xPhysicalQuantity = p2d.PlotVariableX.Variable.Type;
            PhysicalQuantity yPhysicalQuantity = p2d.PlotVariableY.Variable.Type;

            if (p2d.CurveFamily.Name == null)
            {
                p2d.CurveFamily.Name = p2d.Name;
            }

            PlotData plotData = new PlotData();

            plotData.Name = p2d.Name;
            CurveFamilyF[] oldFamilies = new CurveFamilyF[1];
            oldFamilies[0] = p2d.CurveFamily;
            CurveFamily[] newFamilies = UI.ConvertCurveFamilies(oldFamilies, xPhysicalQuantity, yPhysicalQuantity);
            plotData.CurveFamilies = newFamilies;
            return(plotData);
        }
示例#8
0
 private void UpdateFamiliesList(PlotData plotData)
 {
     this.checkedListBoxFamilies.Items.Clear();
     if (plotData != null)
     {
         IList       list = plotData.CurveFamilies;
         IEnumerator e    = list.GetEnumerator();
         while (e.MoveNext())
         {
             CurveFamily family = (CurveFamily)e.Current;
             string      s      = family.Name;
             if (family.Unit != null && !family.Unit.Trim().Equals(""))
             {
                 s += " [" + family.Unit + "]";
             }
             this.checkedListBoxFamilies.Items.Add(s);
             int i = this.checkedListBoxFamilies.Items.IndexOf(s);
             this.checkedListBoxFamilies.SetItemChecked(i, family.IsShownOnPlot);
         }
     }
 }