Exemplo n.º 1
0
        private void PlotFunction(Function3DParameters functionParameters)
        {
            if (nugenCCalcComponent1.FunctionParameters == null)
            {
                MessageBox.Show(this,
                                "Please, select some function", "MathX Demo 3D", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                nugenCCalcComponent1.FunctionParameters = functionParameters;
                object area = c1Chart.GetType().InvokeMember("ChartArea", BindingFlags.GetProperty,
                                                             null, c1Chart, null);

                object size = area.GetType().InvokeMember("Size", BindingFlags.GetProperty,
                                                          null, area, null);

                if (nugenCCalcComponent1.FunctionParameters is Explicit3DParameters)
                {
                    ((Explicit3DParameters)nugenCCalcComponent1.FunctionParameters).AreaSize = (Size)size;
                }
                //

                nugenCCalcComponent1.Plot();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Error: " + ex.Message, "Math X Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Plot with new source and new destination chart
        /// </summary>
        /// <example>
        ///     <code lang="CS" description="The following example plot given function on given chart">
        /// NugenCCalcComponent3D nugenCCalcComponent1 = new NugenCCalcComponent3D();
        /// nugenCCalcComponent1.Plot(c1Chart3D, new Explicit3DParameters("x*x+y"));
        /// </code>
        /// </example>
        public void Plot(object chartControl, Function3DParameters functionParameters)
        {
            if (DesignMode)
            {
                return;
            }

            OnBeforePlot();
            if (chartControl == null)
            {
                throw new ArgumentNullException("Chart control is null");
            }


            if (functionParameters == null)
            {
                throw new ArgumentNullException("functionParameters");
            }

            if (functionParameters.Code == "")
            {
                throw new ArgumentNullException("Source Code");
            }

            IChartAdapter3D adapter = null;

            if (chartControl != _chartControl)
            {
                adapter = (IChartAdapter3D)GetChartAdapter(chartControl);
                adapter.SetChartControl(chartControl);
            }
            else
            {
                adapter = (IChartAdapter3D)_currentAdapter;
            }

            if (adapter == null)
            {
                throw new Exception("Chart not supported");
            }


            Function function = functionParameters.Function;

            if (function is Explicit3DFunction)
            {
                PlotExplicit3DFunction(adapter, (Explicit3DParameters)functionParameters);
            }

            if (function is Implicit3DFunction)
            {
                PlotImplicit3DFunction(adapter, (Implicit3DParameters)functionParameters);
            }

            if (function is Parameter3DFunction)
            {
                PlotParametric3DFunction(adapter, (Parametric3DParameters)functionParameters);
            }

            if (function is ParametricSurface)
            {
                PlotParametricSurface(adapter, (ParametricSurfaceParameters)functionParameters);
            }

            OnAfterPlot();
        }
Exemplo n.º 3
0
		/// <summary>
		/// Plot with new source and new destination chart
		/// </summary>
		/// <example>
		/// 	<code lang="CS" description="The following example plot given function on given chart">
		/// NugenCCalcComponent3D nugenCCalcComponent1 = new NugenCCalcComponent3D();  
		/// nugenCCalcComponent1.Plot(c1Chart3D, new Explicit3DParameters("x*x+y"));
		/// </code>
		/// </example>
		public void Plot(object chartControl, Function3DParameters functionParameters)
		{
			if (DesignMode)
				return;

			OnBeforePlot();
			if (chartControl == null)
				throw new ArgumentNullException("Chart control is null");


			if (functionParameters == null)
				throw new ArgumentNullException("functionParameters");

			if (functionParameters.Code == "")
			{
				throw new ArgumentNullException("Source Code");
			}

			IChartAdapter3D adapter = null;
			if (chartControl != _chartControl)
			{
				adapter = (IChartAdapter3D)GetChartAdapter(chartControl);
				adapter.SetChartControl(chartControl);
			}
			else
				adapter = (IChartAdapter3D)_currentAdapter;

			if (adapter == null)
				throw new Exception("Chart not supported");


			Function function = functionParameters.Function;
			
			if (function is Explicit3DFunction)
			{
				PlotExplicit3DFunction(adapter, (Explicit3DParameters)functionParameters);
			}

			if (function is Implicit3DFunction)
			{
				PlotImplicit3DFunction(adapter, (Implicit3DParameters)functionParameters);
			}

			if (function is Parameter3DFunction)
			{
				PlotParametric3DFunction(adapter, (Parametric3DParameters)functionParameters);
			}

			if (function is ParametricSurface)
			{
				PlotParametricSurface(adapter, (ParametricSurfaceParameters)functionParameters);
			}

			OnAfterPlot();
		}
Exemplo n.º 4
0
		private void PlotFunction(Function3DParameters functionParameters)
		{
			if (nugenCCalcComponent1.FunctionParameters == null)
			{
				MessageBox.Show(this,
					"Please, select some function", "MathX Demo 3D", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}
	
			try
			{
				nugenCCalcComponent1.FunctionParameters = functionParameters;
				object area = c1Chart.GetType().InvokeMember("ChartArea", BindingFlags.GetProperty,
					null, c1Chart, null);

				object size = area.GetType().InvokeMember("Size", BindingFlags.GetProperty,
					null, area, null);
				
				if (nugenCCalcComponent1.FunctionParameters is Explicit3DParameters)
				{
					((Explicit3DParameters)nugenCCalcComponent1.FunctionParameters).AreaSize = (Size)size;
				}
				//

				nugenCCalcComponent1.Plot();
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, "Error: " + ex.Message, "Math X Demo", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}