Exemplo n.º 1
0
        protected ChartPresenter(
            TView view,
            ChartPresenterContext chartPresenterContext,
            IChartTemplatingTask chartTemplatingTask,
            IIndividualPKAnalysisPresenter pkAnalysisPresenter,
            IChartTask chartTask,
            IObservedDataTask observedDataTask,
            IChartUpdater chartUpdater, bool useSimulationNameToCreateCurveName)
            : base(view, chartPresenterContext)
        {
            _chartTask        = chartTask;
            _observedDataTask = observedDataTask;
            _chartUpdater     = chartUpdater;
            _useSimulationNameToCreateCurveName = useSimulationNameToCreateCurveName;
            _view.SetChartView(chartPresenterContext.EditorAndDisplayPresenter.BaseView);
            _pkAnalysisPresenter = pkAnalysisPresenter;
            _view.SetPKAnalysisView(_pkAnalysisPresenter.View);
            AddSubPresenters(_pkAnalysisPresenter);
            _chartTemplatingTask = chartTemplatingTask;
            _repositoryCache     = new Cache <DataRepository, IndividualSimulation> {
                OnMissingKey = noDataForSimulation
            };

            ChartEditorPresenter.SetShowDataColumnInDataBrowserDefinition(IsColumnVisibleInDataBrowser);
            ChartDisplayPresenter.DragDrop   += OnDragDrop;
            ChartDisplayPresenter.DragOver   += OnDragOver;
            ChartDisplayPresenter.ExportToPDF = () => _chartTask.ExportToPDF(Chart);
            AddAllButtons();
            _chartDisplayMode           = ChartDisplayMode.Chart;
            _observedDataDragDropBinder = new ObservedDataDragDropBinder();
        }
Exemplo n.º 2
0
        public void InitializeRepositoriesWithOriginalData()
        {
            var newRepositories = _dataRepositoryCreator.CreateOriginalDataRepositories(_model).ToList();

            ChartEditorPresenter.AddDataRepositories(newRepositories);
            addNewRepositories(newRepositories);
        }
        protected override void Context()
        {
            _view = A.Fake <IChartEditorView>();
            _axisSettingsPresenter        = A.Fake <IAxisSettingsPresenter>();
            _chartSettingsPresenter       = A.Fake <IChartSettingsPresenter>();
            _chartExportSettingsPresenter = A.Fake <IChartExportSettingsPresenter>();
            _curveSettingsPresenter       = A.Fake <ICurveSettingsPresenter>();
            _dataBrowserPresenter         = A.Fake <IDataBrowserPresenter>();
            _chartTemplateMenuPresenter   = A.Fake <IChartTemplateMenuPresenter>();
            _chartUpdater     = A.Fake <IChartUpdater>();
            _eventPublisher   = A.Fake <IEventPublisher>();
            _dimensionFactory = A.Fake <IDimensionFactory>();
            sut = new ChartEditorPresenter(_view, _axisSettingsPresenter, _chartSettingsPresenter, _chartExportSettingsPresenter, _curveSettingsPresenter, _dataBrowserPresenter, _chartTemplateMenuPresenter, _chartUpdater, _eventPublisher, _dimensionFactory);

            sut.SetCurveNameDefinition(x => x.QuantityInfo.PathAsString);

            _chart = new CurveChart().WithAxes();
            sut.Edit(_chart);

            _baseGrid       = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs());
            _standardColumn = new DataColumn("Standard", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid)
            {
                DataInfo = new DataInfo(ColumnOrigins.Calculation),
            };

            A.CallTo(() => _dimensionFactory.MergedDimensionFor(_baseGrid)).Returns(_baseGrid.Dimension);
            A.CallTo(() => _dimensionFactory.MergedDimensionFor(_standardColumn)).Returns(_standardColumn.Dimension);
        }
Exemplo n.º 4
0
        private void addRepositoryToChart(DataRepository newRepository)
        {
            var dataRepositories = new[] { newRepository };

            ChartEditorPresenter.AddDataRepositories(dataRepositories);
            addNewRepositories(dataRepositories);
            addNewCurvesToChart(dataRepositories);
        }
        private void showSimulationColumn()
        {
            var simulationColumnSettings = Column(BrowserColumns.Simulation);

            simulationColumnSettings.Visible      = true;
            simulationColumnSettings.VisibleIndex = 0;
            ChartEditorPresenter.ApplyColumnSettings(simulationColumnSettings);
        }
Exemplo n.º 6
0
 public void ClearChart()
 {
     using (_chartUpdater.UpdateTransaction(Chart))
     {
         ChartEditorPresenter.RemoveDataRepositories(_dataRepositories);
         _dataRepositories.Clear();
     }
 }
Exemplo n.º 7
0
        private void setDefaultEditorLayout()
        {
            ResetEditor();

            Column(AxisOptionsColumns.UnitName).Caption = PKSimConstants.UI.Unit;


            ConfigureEditor();
            ChartEditorPresenter.ApplyColumnSettings();
        }
Exemplo n.º 8
0
        private void bindCurveChartToEditor()
        {
            Chart = new CurveChart
            {
                OriginText = Captions.ChartFingerprintDataFrom("Test Chart Project", "Test Chart Simulation", DateTime.Now.ToIsoFormat()),
                Title      = "The Chart Title"
            };

            Chart.ChartSettings.BackColor = Color.White;
            ChartEditorPresenter.Edit(Chart);
        }
Exemplo n.º 9
0
        private void removeSimulation(IndividualSimulation simulation)
        {
            var repo = DataRepositoryFor(simulation);

            if (repo == null)
            {
                return;
            }
            _repositoryCache.Remove(repo);
            ChartEditorPresenter.RemoveDataRepositories(new [] { repo });
            Chart.RemoveSimulation(simulation);
        }
Exemplo n.º 10
0
 protected virtual void AddColorGroupedObservedData(IReadOnlyList <IReadOnlyList <DataRepository> > observedDataListGroupedByFolder)
 {
     using (_chartUpdater.UpdateTransaction(Chart))
     {
         foreach (var observesDataListInFolder in observedDataListGroupedByFolder)
         {
             AddDataRepositoriesToEditor(observesDataListInFolder);
             var columnsToAdd = observesDataListInFolder.SelectMany(x => x.ObservationColumns());
             ChartEditorPresenter.AddCurvesWithSameColorForColumn(columnsToAdd.ToList());
         }
     }
 }
Exemplo n.º 11
0
 public void ClearChart()
 {
     using (_chartUpdater.UpdateTransaction(Chart))
     {
         ChartEditorPresenter.RemoveDataRepositories(_dataRepositories);
         _dataRepositories.Each(repository =>
         {
             Chart.RemoveCurvesForDataRepository(repository);
         });
         _dataRepositories.Clear();
     }
 }
Exemplo n.º 12
0
 private void addColorGroupedObservedData(IReadOnlyList <IReadOnlyList <DataRepository> > observedData)
 {
     using (_chartUpdater.UpdateTransaction(Chart))
     {
         foreach (var observedDataNodesList in observedData)
         {
             AddDataRepositoriesToEditor(observedDataNodesList);
             var columnsToAdd = observedDataNodesList.SelectMany(x => x.ObservationColumns());
             ChartEditorPresenter.AddCurvesWithSameColorForColumn(columnsToAdd.ToList());
         }
     }
 }
Exemplo n.º 13
0
        public override void AddObservedData(DataRepository observedData, bool asResultOfDragAndDrop)
        {
            AddDataRepositoryToEditor(observedData);

            //make curve visibles
            if (!asResultOfDragAndDrop)
            {
                return;
            }

            observedData.Where(c => c.DataInfo.Origin == ColumnOrigins.Observation)
            .Each(c => ChartEditorPresenter.AddCurveForColumn(c.Id));
        }
Exemplo n.º 14
0
 private void configureChartEditorPresenter(IDataColumnToPathElementsMapper dataColumnToPathColumnValuesMapper)
 {
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.RepositoryName).GroupIndex      = 0;
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.DimensionName).GroupIndex       = 1;
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.Simulation).GroupIndex          = -1;
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.TopContainer).Caption           = "TopC";
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.Container).Caption              = "Container";
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.BottomCompartment).VisibleIndex = 2;
     ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.Molecule).SortColumnName        = BrowserColumns.OrderIndex.ToString();
     ChartEditorPresenter.SetDisplayQuantityPathDefinition(setQuantityPathDefinitions(_model, dataColumnToPathColumnValuesMapper));
     ChartEditorPresenter.SetShowDataColumnInDataBrowserDefinition(showDataColumnInDataBrowserDefinition);
     ChartEditorPresenter.ApplyAllColumnSettings();
 }
Exemplo n.º 15
0
        private void configureChartEditorEvents()
        {
            ChartEditorPresenter.ColumnSettingsFor(BrowserColumns.Origin).Visible = true;

            ChartEditorPresenter.SetCurveNameDefinition(Helper.NameDefinition);
            ChartEditorPresenter.ColumnSettingsFor(CurveOptionsColumns.InterpolationMode).Visible = false;

            ChartEditorPresenter.ColumnSettingsFor(AxisOptionsColumns.NumberMode).Caption      = "Number Representation";
            ChartEditorPresenter.ColumnSettingsFor(AxisOptionsColumns.NumberMode).VisibleIndex = 1;

            ChartDisplayPresenter.Edit(Chart);

            ChartDisplayPresenter.DragOver += onChartDisplayDragOver;

            ReloadMenus();
        }
Exemplo n.º 16
0
        protected virtual void AddObservedData(IReadOnlyList <DataRepository> observedData, bool asResultOfDragAndDrop)
        {
            AddDataRepositoriesToEditor(observedData);

            //make curve visible
            if (!asResultOfDragAndDrop)
            {
                return;
            }

            using (_chartUpdater.UpdateTransaction(Chart))
            {
                var columnsToAdd = observedData.SelectMany(x => x.ObservationColumns());
                columnsToAdd.Each(c => ChartEditorPresenter.AddCurveForColumn(c));
            }
        }
Exemplo n.º 17
0
        protected virtual void UpdateAnalysisBasedOn(IndividualSimulation simulation, DataRepository dataRepository)
        {
            if (_repositoryCache.Contains(dataRepository))
            {
                ChartEditorPresenter.RemoveUnusedColumns();
                AddDataRepositoriesToEditor(new [] { dataRepository });
                ChartDisplayPresenter.Refresh();

                //after refresh, some data might not be available anymore=>in that case init chart from template
                InitializeFromTemplateIfRequired();

                RefreshPKAnalysisIfVisible();
            }
            else
            {
                _repositoryCache[dataRepository] = simulation;
                AddDataRepositoriesToEditor(new[] { dataRepository });
            }
        }
Exemplo n.º 18
0
        protected virtual void UpdateAnalysisBasedOn(IndividualSimulation simulation, DataRepository dataRepository)
        {
            BindChartToEditors();

            if (_repositoryCache.Contains(dataRepository))
            {
                ChartEditorPresenter.RefreshDataRepository(dataRepository);
                ChartDisplayPresenter.Refresh();

                //after refresh, some data might not be available anymore=>in that case init chart from template
                InitializeFromTemplateIfRequired();

                RefreshPKAnalysisIfVisible();
            }
            else
            {
                _repositoryCache[dataRepository] = simulation;
                ChartEditorPresenter.AddDataRepository(dataRepository);

                //has to be done here since colums are added dynamically!?!?
                ChartEditorPresenter.ApplyColumnSettings();
            }
        }
Exemplo n.º 19
0
        protected override void Context()
        {
            base.Context();
            _firstObservedData1 = _observedData1.ObservationColumns().First();
            _firstObservedData2 = _observedData2.ObservationColumns().First();

            _simulationResult1 = DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("SimulationResult1");
            _simulationResult2 = DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("SimulationResult2");
            _outputColumn1     = _simulationResult1.AllButBaseGrid().First();

            A.CallTo(() => _outputMapping1.FullOutputPath).Returns(_outputColumn1.QuantityInfo.PathAsString);
            A.CallTo(() => _outputMapping2.FullOutputPath).Returns(_outputColumn1.QuantityInfo.PathAsString);
            _optimizationRunResult.AddResult(_simulationResult1);
            _optimizationRunResult.AddResult(_simulationResult2);
            _optimizationRunResult2.AddResult(DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("SimulationResult3"));
            _optimizationRunResult2.AddResult(DomainHelperForSpecs.IndividualSimulationDataRepositoryFor("SimulationResult4"));

            _parameterIdentification.Configuration.RunMode = new MultipleParameterIdentificationRunMode();

            _allAddedDataRepositories = new List <DataRepository>();;
            A.CallTo(() => ChartEditorPresenter.AddDataRepositories(A <IEnumerable <DataRepository> > ._))
            .Invokes(x => _allAddedDataRepositories.AddRange(x.GetArgument <IEnumerable <DataRepository> >(0)));
        }
Exemplo n.º 20
0
 public void should_create_one_repository_for_each_output_containing_the_value_of_the_residuals_and_for_the_marker()
 {
     A.CallTo(() => ChartEditorPresenter.AddDataRepositories(A <IEnumerable <DataRepository> > ._)).MustHaveHappened();
 }
 protected virtual void ClearChartAndDataRepositories()
 {
     Chart.Clear();
     ChartEditorPresenter.RemoveAllDataRepositories();
 }