Add import of forces from excel
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,9 +10,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
internal class ForceCombinationFromFile : IForceCombinationFromFile
|
||||
public class ForceCombinationFromFile : IForceCombinationFromFile
|
||||
{
|
||||
private IForceFactoredCombination factoredCombination;
|
||||
IUpdateStrategy<IForceCombinationFromFile> updateStrategy;
|
||||
IUpdateStrategy<IFactoredCombinationProperty> propertyUpdateStrategy;
|
||||
IGetTupleFromFileLogic getTupleFromFileLogic;
|
||||
|
||||
private IForceFactoredList factoredCombination;
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public List<IForceFileProperty> ForceFiles { get; set; } = new();
|
||||
@@ -21,12 +27,25 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
ForceCombinationFromFile newItem = new();
|
||||
updateStrategy ??= new ForceCombinationFromFileUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
getTupleFromFileLogic ??= new GetTupleFromFileLogic() { TraceLogger = new ShiftTraceLogger()};
|
||||
factoredCombination = new ForceFactoredList();
|
||||
factoredCombination.ForceTuples.Clear();
|
||||
propertyUpdateStrategy ??= new FactoredCombinationPropertyUpdateStrategy();
|
||||
propertyUpdateStrategy.Update(factoredCombination.CombinationProperty, CombinationProperty);
|
||||
foreach (var file in ForceFiles)
|
||||
{
|
||||
getTupleFromFileLogic.ForceFileProperty = file;
|
||||
var tuples = getTupleFromFileLogic.GetTuples();
|
||||
factoredCombination.ForceTuples.AddRange(tuples);
|
||||
}
|
||||
return factoredCombination.GetCombinations();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user