public DummyMoleculeContainerDTO MapFrom(IObjectBase objectBase)
        {
            var dto = Map <DummyMoleculeContainerDTO>(objectBase);

            dto.Id = ShortGuid.NewGuid();
            dto.MoleculePropertiesContainer = _objectBaseToDTOObjectBaseMapper.MapFrom(_moleculePropertiesContainer);
            return(dto);
        }
示例#2
0
        public void Init(IMoBiProject project, IContainer container)
        {
            _molecules = project.MoleculeBlockCollection.SelectMany(bb => bb.All()).Distinct(new NameComparer <IMoleculeBuilder>()).OrderBy(x => x.Name).ToList();
            _reactions = project.ReactionBlockCollection.SelectMany(bb => bb.All()).Distinct(new NameComparer <IReactionBuilder>()).OrderBy(x => x.Name).ToList();
            var list = project.SpatialStructureCollection.Select(CreateSpatialStuctureDTOFrom).Cast <IObjectBaseDTO>().ToList();

            list.Add(_objectBaseDTOMapper.MapFrom(container));
            list.AddRange(globalReactionParameters());
            _view.BindTo(list);
        }
示例#3
0
        private void addChildrenFromNeigborhood(List <IObjectBaseDTO> children, INeighborhoodBuilder neighborhood)
        {
            if (neighborhood == null)
            {
                return;
            }

            var firstContainer  = neighborhood.FirstNeighbor;
            var secondContainer = neighborhood.SecondNeighbor;

            if (firstContainer == null || secondContainer == null)
            {
                return;
            }

            if (!Equals(firstContainer.ParentContainer, secondContainer.ParentContainer))
            {
                firstContainer  = firstContainer.ParentContainer;
                secondContainer = secondContainer.ParentContainer;
            }

            children.Add(_objectBaseDTOMapper.MapFrom(firstContainer));
            children.Add(_objectBaseDTOMapper.MapFrom(secondContainer));
        }
示例#4
0
        public bool Edit(IFormula formula, IBuildingBlock buildingBlock, IParameter parameter)
        {
            var editSubPresenter = _formulaPresenterCache.PresenterFor(formula);

            editSubPresenter.BuildingBlock = buildingBlock;
            _subPresenterManager.Add(editSubPresenter);
            _subPresenterManager.InitializeWith(this);
            editSubPresenter.Edit(formula);
            _view.AddFormulaView(editSubPresenter.BaseView);
            var dto          = _objectBaseMapper.MapFrom(formula);
            var formulaCache = buildingBlock.FormulaCache;

            dto.AddUsedNames(formulaCache.Select(f => f.Name));
            _view.BindTo(dto);
            _referencePresenter.Init(parameter, Enumerable.Empty <IObjectBase>(), parameter);
            _view.Display();
            formula.Name = dto.Name;
            return(!_view.Canceled);
        }
 public ITreeNode MapFrom(IObjectBase objectBase)
 {
     return(MapFrom(_mapper.MapFrom(objectBase)));
 }