public static IList <EquationTypes> GetAvailableEquationTypesForFractalType(FractalTypes fractalTypeIn) { List <EquationTypes> aEquationTypesList = new List <EquationTypes>(); switch (fractalTypeIn) { case FractalTypes.NewtonFractal: aEquationTypesList.Add(EquationTypes.z3Minus1); aEquationTypesList.Add(EquationTypes.z3Minus2zPlus2); aEquationTypesList.Add(EquationTypes.z3Minusz); break; case FractalTypes.MandelbrotFractal: aEquationTypesList.Add(EquationTypes.z2); break; case FractalTypes.KochSnowflake: break; case FractalTypes.PythagorasTree: break; default: throw new FractalObserverException("Unknown fractal type!"); } return(aEquationTypesList); }
public IFractal CreateFractal(FractalTypes fractalTypeIn, EquationTypes equationTypeIn) { IEquation aEquation = null; if (equationTypeIn != EquationTypes.None) { aEquation = myEquationFactory.CreateEquation(equationTypeIn); } switch (fractalTypeIn) { case FractalTypes.NewtonFractal: return(new NewtonFractal(aEquation)); case FractalTypes.MandelbrotFractal: return(new MandelbrotSet(aEquation)); case FractalTypes.KochSnowflake: return(new KochSnowflake()); case FractalTypes.PythagorasTree: return(new PythagorasTree()); default: throw new FractalObserverException("Unknown fractal type!"); } }
/// <summary> /// Sets the fractal type parameter to the type selected in the combo box. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Data associated with the event.</param> public void OnFractalTypeSelected(object sender, SelectionChangedEventArgs e) { App.Window.Context.FractalType = FractalTypes.ByName(((ComboBox)sender).SelectedItem.ToString()); (bool, bool)boxEnableSetting = (false, false); switch (App.Window.Context.FractalType) { case FractalType.JuliaSet: case FractalType.BurningShipJuliaSet: boxEnableSetting = (true, false); break; case FractalType.PhoenixSet: boxEnableSetting = (true, true); break; } this.Find <TextBox>("JuliaConstant").IsEnabled = boxEnableSetting.Item1; this.Find <TextBox>("PhoenixConstant").IsEnabled = boxEnableSetting.Item2; var iterationLimitBox = this.Find <TextBox>("IterationLimit"); iterationLimitBox.Text = "100"; OnPositiveIntInput(iterationLimitBox, null); var scaleBox = this.Find <TextBox>("Scale"); scaleBox.Text = "200"; OnLongInput(scaleBox, null); var midpointBox = this.Find <TextBox>("Midpoint"); midpointBox.Text = "0"; OnComplexInput(midpointBox, null); }
public IFractal CreateFractal(FractalTypes fractalTypeIn) { switch (fractalTypeIn) { case FractalTypes.NewtonFractal: throw new FractalObserverException("When creating current fractal type equation type must be set in parameter!"); case FractalTypes.MandelbrotFractal: throw new FractalObserverException("When creating current fractal type equation type must be set in parameter!"); case FractalTypes.KochSnowflake: return(new KochSnowflake()); case FractalTypes.PythagorasTree: return(new PythagorasTree()); default: throw new FractalObserverException("Unknown fractal type!"); } }