using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Forces.Logics;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
namespace StructureHelperCommon.Models.Forces
{
///
public class ForceFactoredList : IForceFactoredList
{
readonly IUpdateStrategy updateStrategy = new ForceFactoredListUpdateStrategy();
private List result;
private IGetCombinationByFactoredTupleLogic getCombinationLogic = new GetCombinationByFactoredTupleLogic();
///
public Guid Id { get; }
///
public string Name { get; set; } = "New Factored Load";
public bool SetInGravityCenter { get; set; } = true;
///
public IPoint2D ForcePoint { get; set; } = new Point2D();
///
public List ForceTuples { get; } = new() { new ForceTuple()};
///
public IFactoredCombinationProperty CombinationProperty { get; set; }= new FactoredCombinationProperty(Guid.NewGuid());
public ForceFactoredList(Guid id)
{
Id = id;
}
public ForceFactoredList() : this (Guid.NewGuid()) { }
public object Clone()
{
var newItem = new ForceFactoredList();
updateStrategy.Update(newItem, this);
return newItem;
}
///
public List GetCombinations()
{
getCombinationLogic.CombinationProperty = CombinationProperty;
getCombinationLogic.ForceActionProperty = new ForceActionProperty()
{
SetInGravityCenter = SetInGravityCenter,
ForcePoint = ForcePoint
};
result = new();
ForceTuples.ForEach(x => GetCombinationByForceTuple(x));
return result;
}
private void GetCombinationByForceTuple(IForceTuple forceTuple)
{
getCombinationLogic.SourceForceTuple = forceTuple;
result.Add(getCombinationLogic.GetCombinationList());
}
}
}