protected virtual ExecutionResult Execute(NoiseRequest noiseRequest, WarpRequest warpRequest) { var tracktor = new Tracktor(); return(new ExecutionResult() { Noise = tracktor.Noise(noiseRequest), Wrap = tracktor.Warp(warpRequest) }); }
protected virtual void Generate() { var height = (int)SizeYNumericUpDown.Value; var width = (int)SizeXNumericUpDown.Value; var noiseRequest = new NoiseRequest(width, height, GetNoiseFractal(), GetWarpFractal()) { Is3D = Is3DCheckBox.Checked, IsInverted = IsInvertedCheckBox.Checked, Z = (float)ZNumericUpDown.Value }; var warpRequest = new WarpRequest(width, height, GetWarpFractal()) { Is3D = Is3DCheckBox.Checked, IsInverted = IsInvertedCheckBox.Checked, Z = (float)ZNumericUpDown.Value }; using (var window = new WorkerWindow() { Action = () => { return(Execute(noiseRequest, warpRequest)); } }) { window.ShowDialog(this); var result = window.Result; if (result == default) { return; } if (NoisePictureBox.Image != default) { var img = NoisePictureBox.Image; NoisePictureBox.Image = default; img.Dispose(); } if (WarpPictureBox.Image != default) { var img = WarpPictureBox.Image; WarpPictureBox.Image = default; img.Dispose(); } NoisePictureBox.Image = GenerateImage(width, height, result.Noise.Image); WarpPictureBox.Image = GenerateImage(width, height, result.Wrap.Image); MeanLabel.Text = "Mean: " + result.Noise.Statistics.Average.ToString(); MinLabel.Text = "Min: " + result.Noise.Statistics.Minimum.ToString(); MaxLabel.Text = "Max: " + result.Noise.Statistics.Maximum.ToString(); } }