public void Parse(Parameters parameters) { switch (parameters.GetName()) { case "background": IRGBColor color = parameters.GetColor(1); this.BackGroundColor = new PixelColor { Ambient = color, Diffuse = new RGBColor(0.0f, 0.0f, 0.0f), Specular = new RGBColor(0.0f, 0.0f, 0.0f), Color = color }; break; case "level": this.MaxRecursionLevel = parameters.GetInt(1); break; case "antialiasing": this.AntiAliasing = parameters.GetBool(1); break; case "shading": this.Shading = ShadingFactory.Create(parameters.GetString(1)); break; } }
/* * GridDrawer constructer takes in various parameters then sets them to setup the GridDrawer. */ public GridDrawer(Graphics canvas, int Width, int Height, EShadingAlgorthims shadingEnum) { this.canvas = canvas; this.Width = Width; this.Height = Height; shadingFactory = new ShadingFactory(); //Creates an instance of ShadingFactory ShadingAlgorithm = shadingFactory.CreateNewShadeing(shadingEnum); //calls the CreateNewShadeing method of ShadingFactory to return the ShadingAlgorithm requested. }