public override void updatePreview(InParamsExt inParams, ViewParams viewParams, OptionParams optionParams) { if (preview == null) { preview = new PreviewModel(this, inParams, optionParams); } preview.update(inParams, null); preview.updateOut(viewParams); preview.stats.start(); updatePreviewObservers(); preview.stats.storeDrawviewTime(); }
public void updateModelThreadFunction(object modelRunParams0) { ModelRunParams modelRunParams = (ModelRunParams)modelRunParams0; // first check if model needs creating bool create = true; if (model != null) { switch (modelRunParams.inParams.model) { case ModelType.CCD: create = (model.GetType() != typeof(CCDModel)); break; case ModelType.Probabilistic: create = (model.GetType() != typeof(ProbModel)); break; case ModelType.Transport: create = (model.GetType() != typeof(TransModel)); break; } } if (create) { switch (modelRunParams.inParams.model) { case ModelType.CCD: model = new CCDModel(this, modelRunParams.inParams, preview.outParams, modelRunParams.optionParams); break; case ModelType.Probabilistic: model = new ProbModel(this, modelRunParams.inParams, preview.outParams, modelRunParams.optionParams); break; case ModelType.Transport: model = new TransModel(this, modelRunParams.inParams, preview.outParams, modelRunParams.optionParams); break; default: model = new PreviewModel(this, modelRunParams.inParams, modelRunParams.optionParams); break; } // if model just created; model needs to be updated too modelRunParams.updateModelReq = true; } if (modelRunParams.updateModelReq || modelRunParams.updateOutReq) { // clear previous output if (modelRunParams.viewType == ViewType.Out) { model.clearOut(); } else if (modelRunParams.viewType == ViewType.Time) { model.clearTimeOut(); } updateModelObservers(); } if (modelRunParams.updateModelReq) { preview.update(modelRunParams.inParams, null); preview.updateOut(modelRunParams.viewParams); model.update(modelRunParams.inParams, preview.previewParams); // if model updated, out must be updated too modelRunParams.updateOutReq = true; } if (modelRunParams.updateOutReq) { if (modelRunParams.viewType == ViewType.Out) { model.updateOut(modelRunParams.viewParams); } else if (modelRunParams.viewType == ViewType.Time) { model.updateTimeOut(modelRunParams.viewParams); } model.stats.start(); updateModelObservers(); model.stats.storeDrawviewTime(); } Util.gcCollect(); }