/// <summary> /// call Generate(m_act_val, m_zyklen, m_raster, m_screensize, m_formula, m_perspective) auf. /// </summary> protected void Start() { Generate(_actVal, _cycles, _screensize, _formula, _perspective); lock (_startCountLock) { _startCount--; } if (_startCount == 0) { if (_starter != null) { if (_abort) { if (_oldData != null) { _gData = _oldData; } if (_oldPictureData != null) { _pData = _oldPictureData; } } System.Diagnostics.Debug.WriteLine("Iter ends"); _start = false; _starter.ComputationEnds(); } } }
/// <summary> /// Set data of the last iteration with the same rendering parameters. /// </summary> public void SetOldData(DataTypes.GraphicData oldData, DataTypes.PictureData oldPictureData, int updateCount) { _oldData = oldData; _oldPictureData = oldPictureData; _updateCount = updateCount; }
/// <summary> /// Initialisation /// </summary> public Iterate(int width, int height, IAsyncComputationStarter starter, bool isRightView) { _starter = starter; _gData = new GraphicData(width, height); _pData = new PictureData(width, height); this._width = width; this._height = height; this._isRightView = isRightView; }
public Iterate(ParameterDict parameterDict, IAsyncComputationStarter starter, bool isRightView=false) { _parameterDict = parameterDict; _starter = starter; _width = parameterDict.GetWidth(); _height=parameterDict.GetHeight(); _gData = new GraphicData(_width, _height); _pData = new PictureData(_width, _height); this._isRightView = isRightView; }
/// <summary> /// Initialisation /// </summary> public Iterate(int width, int height) { _gData = new GraphicData(width, height); _pData = new PictureData(width, height); this._width = width; this._height = height; }
/// <summary> /// Create surface model. /// </summary> public void ComputeOneStep() { ImageCreationStarts(); if (_paras != null) { _paras.InComputing = true; } this.WindowState = FormWindowState.Normal; if (Scheduler.GrandScheduler.Exemplar.inComputeOneStep) { return; } try { Scheduler.GrandScheduler.Exemplar.inComputeOneStep = true; SetPictureBoxSize(); string tempParameterHash = GetParameterHashWithoutPictureArt(); _paras.Assign(); if (_oldParameterHashWithoutPictureArt == tempParameterHash) { // Update last render for better quality _currentUpdateStep++; DataTypes.GraphicData oldData = null; DataTypes.PictureData oldPictureData = null; if (_iterate != null && !_iterate.InAbort) { oldData = _iterate.GraphicInfo; oldPictureData = _iterate.PictureData; } _iterate = new Iterate(_width, _height, this, false); _updateCount++; _iterate.SetOldData(oldData, oldPictureData, _updateCount); if (!ParameterDict.Current.GetBool("View.Pipeline.UpdatePreview")) { _iterate._oneStepProgress = _inPreview; } else { _iterate._oneStepProgress = false; } if (_updateCount > ParameterDict.Current.GetDouble("View.UpdateSteps") + 1) { _iterate._oneStepProgress = true; } _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula == -2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } else { // Initiate new rendering { // Stop subrendering, if some formula parameters changed if (_currentUpdateStep > 0) { _currentUpdateStep = 0; if (_paras != null) { _paras.InComputing = false; } Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; _oldParameterHashWithoutPictureArt = ""; _updateCount = 1; } _oldParameterHashWithoutPictureArt = tempParameterHash; _paras.Assign(); _updateCount = 1; _iterate = new Iterate(_width, _height, this, false); _iterate._oneStepProgress = false; _iterate.StartAsync(_paras.Parameter, _paras.Cycles, _paras.ScreenSize, _paras.Formula == -2, !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection")); } } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); if (_paras != null) { _paras.InComputing = false; } Scheduler.GrandScheduler.Exemplar.inComputeOneStep = false; } }