/// <summary> /// Creates the path from parameter dummy. /// </summary> /// <param name="objectBaseDTO">The dummy parameter dto.</param> /// <param name="shouldCreateAbsolutePaths">if set to <c>true</c> creates absolute paths otherwise creates reltive paths.</param> /// <param name="refObject"> /// The reference object the user chosen (may the concrete object that uses the reference or a /// existing parent of it). /// </param> /// <param name="editedObject"></param> /// <returns> The path that could be uses in the model to reference the object</returns> public virtual ReferenceDTO CreatePathFromParameterDummy(IObjectBaseDTO objectBaseDTO, bool shouldCreateAbsolutePaths, IEntity refObject, IUsingFormula editedObject) { if (IsMoleculeReference(objectBaseDTO)) { return(createMoleculeReference()); } var dtoDummyParameter = (DummyParameterDTO)objectBaseDTO; var parameterToUse = _context.Get <IParameter>(dtoDummyParameter.ParameterToUse.Id); ReferenceDTO dtoReference; if (parameterToUse.IsAtMolecule()) { dtoReference = new ReferenceDTO(); IObjectPath tmpPath; //global molecule parameters we always reference absolute if (shouldCreateAbsolutePaths || !parameterToUse.BuildMode.Equals(ParameterBuildMode.Local)) { tmpPath = _objectPathFactory.CreateAbsoluteObjectPath(dtoDummyParameter.Parent); } else { if (refObject != dtoDummyParameter.Parent) { tmpPath = _objectPathFactory.CreateRelativeObjectPath(refObject, dtoDummyParameter.Parent); } else { tmpPath = new ObjectPath(); } tmpPath = AdjustReferences(parameterToUse, tmpPath); } dtoReference.Path = _objectPathFactory.CreateFormulaUsablePathFrom(tmpPath) .WithAlias(_aliasCreator.CreateAliasFrom(parameterToUse.Name)) .WithDimension(parameterToUse.Dimension); dtoReference.Path.Add(parameterToUse.Name); } else { dtoReference = CreatePathsFromEntity(parameterToUse, shouldCreateAbsolutePaths, refObject, editedObject); } dtoReference.Path.Replace(Constants.MOLECULE_PROPERTIES, dtoDummyParameter.ModelParentName); dtoReference.BuildMode = parameterToUse.BuildMode; return(dtoReference); }
public IObjectPath GetSelection() { var selection = getSelected <IEntity>(); return(_objectPathFactory.CreateRelativeObjectPath(_refObject, selection)); }