SetOldData() публичный Метод

Set data of the last iteration with the same rendering parameters.
public SetOldData ( DataTypes oldData, DataTypes oldPictureData, int updateCount ) : void
oldData DataTypes
oldPictureData DataTypes
updateCount int
Результат void
Пример #1
0
 /// <summary>
 /// Start Computing. Is called while rendering an animation. 
 /// </summary>
 public void Run(int updateSteps)
 {
     _currentProgress = 0;
     _master.Progress(_currentProgress);
     System.Diagnostics.Debug.WriteLine("PaintJob.Run " + updateSteps.ToString());
     _parameters = ParameterDict.Current.Clone();
     _updateSteps = updateSteps;
     _currentProgressd = 100.0 / (double)(_updateSteps);
     for (int i = 0; i < _updateSteps; i++)
     {
         if (_abort)
             return;
         _iterate = new Iterate(_parameters, this, false);
         if (_lastIterate != null)
         {
             _iterate.SetOldData(_lastIterate.GraphicInfo,_lastIterate.PictureData,i);
         }
         if (_abort)
             return;
         _iterate.StartAsync();
         _iterate.Wait();
         if (_abort)
             return;
         _lastIterate = _iterate;
         _currentProgress += _currentProgressd;
         _master.Progress(_currentProgress);
     }
     Renderer renderer = PictureArtFactory.Create(_iterate.PictureData, _iterate.LastUsedFormulas);
     renderer.Paint(_graphics);
     if (_abort)
         return;
     _master.Progress(0);
 }
Пример #2
0
        /// <summary>
        /// Neuzeichnen.
        /// </summary>
        protected override void StartDrawing()
        {
            ResultImageView.PublicForm.Stop();
            _forceRedraw = false;

            if (btnPreview.Width < 1 && btnPreview.Height < 1)
            {
                ResultImageView.PublicForm.CurrentUpdateStep = 0;
                return;
            }
            lock (_inDrawingMutex)
                _inDrawing = true;
            System.Diagnostics.Debug.WriteLine("_inDrawing = true (1)");
            if (_iterate != null)
            {
                if (_iterate.Running)
                {
                    _iterate.Abort();
                }
            }

            lock (_smallPreviewCurrentDrawStepMutex)
            {
                try {
                    //btnPreview.Enabled = false;
                } catch (InvalidOperationException ex)
                {
                    lock (_inDrawingMutex)
                        _inDrawing = false;
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                    return;
                }
                if (_smallPreviewCurrentDrawStep == 0 || _smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2 || _smallPreviewCurrentDrawStep == 4)
                {
                    _iterate = new Iterate(btnPreview.Width / 2, btnPreview.Height / 2, this, false);
                    _smallPreviewCurrentDrawStep = 2;
                }

                else if (_smallPreviewCurrentDrawStep == 3)
                {
                    _iterate = new Iterate(btnPreview.Width, btnPreview.Height, this, false);
                    _iterate.SetOldData(null, null, 2);
                    _smallPreviewCurrentDrawStep = 4;
                }
                else
                {
                    if (_iterate != null)
                    {
                        if (_iterate.Running)
                        {
                            _iterate.Abort();
                        }
                    }
                    _iterate = null;
                    lock (_inDrawingMutex)
                        _inDrawing = false;
                    _smallPreviewCurrentDrawStep = 1;
                }
            }
            if (_iterate != null)
            {
                _iterate._oneStepProgress = false;
                AssignParameters();
                _iterate.StartAsync(_parameter,
                                    ParameterDict.Current.GetInt("Formula.Static.Cycles"),
                                    1,
                                    ParameterDict.Current.GetBool("Formula.Static.Julia"),
                                    !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection"));
            }
        }
Пример #3
0
 /// <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;
     }
 }
Пример #4
0
        /// <summary>
        /// Neuzeichnen.
        /// </summary>
        protected override void StartDrawing()
        {
            ResultImageView.PublicForm.Stop();
            _forceRedraw = false;
               
            if (btnPreview.Width < 1 && btnPreview.Height < 1)
            {
                ResultImageView.PublicForm.CurrentUpdateStep = 0;
                return;
            }
            lock (_inDrawingMutex)
                _inDrawing = true;
            System.Diagnostics.Debug.WriteLine("_inDrawing = true (1)");
            if (_iterate != null)
            {
                if(_iterate.Running)
                  _iterate.Abort();
            }

            lock (_smallPreviewCurrentDrawStepMutex)
            {
                try { 
                btnPreview.Enabled = false;
                } catch(InvalidOperationException ex)
                {
                    lock (_inDrawingMutex)
                        _inDrawing = false;
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                    return;
                }
                if (_smallPreviewCurrentDrawStep == 0 || _smallPreviewCurrentDrawStep == 1 || _smallPreviewCurrentDrawStep == 2 || _smallPreviewCurrentDrawStep == 4)
                {
                    _iterate = new Iterate(btnPreview.Width / 2, btnPreview.Height / 2, this, false);
                    _smallPreviewCurrentDrawStep = 2;
                }

                else if (_smallPreviewCurrentDrawStep == 3)
                {
                    _iterate = new Iterate(btnPreview.Width, btnPreview.Height, this, false);
                    _iterate.SetOldData(null, null, 2);
                    _smallPreviewCurrentDrawStep = 4;
                }
                else
                {
                    if (_iterate != null)
                        if (_iterate.Running)
                            _iterate.Abort();
                    _iterate = null;
                    lock (_inDrawingMutex)
                        _inDrawing = false;
                    _smallPreviewCurrentDrawStep = 1;
                }

            }
            if (_iterate != null)
            {
                _iterate._oneStepProgress = false;
                AssignParameters();
                _iterate.StartAsync(_parameter,
                        ParameterDict.Current.GetInt("Formula.Static.Cycles"),
                        1,
                        ParameterDict.Current.GetBool("Formula.Static.Julia"),
                        !ParameterDict.Current.GetBool("Transformation.Camera.IsometricProjection"));
            }
        }
Пример #5
0
 /// <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;
     }
 }