Add ForceCombinationPropertyUserControl
This commit is contained in:
@@ -1,25 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces.Logics;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class ForceCombinationByFactorFromDTOConvertStrategy : ConvertStrategy<ForceCombinationByFactor, ForceCombinationByFactorDTO>
|
||||
public class ForceCombinationByFactorFromDTOConvertStrategy : ConvertStrategy<ForceFactoredList, ForceCombinationByFactorDTO>
|
||||
{
|
||||
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
||||
private IUpdateStrategy<IForceCombinationByFactor> updateStrategy;
|
||||
private IUpdateStrategy<IForceFactoredList> updateStrategy;
|
||||
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
|
||||
private IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy;
|
||||
|
||||
public ForceCombinationByFactorFromDTOConvertStrategy(
|
||||
IUpdateStrategy<IForceAction> baseUpdateStrategy,
|
||||
IUpdateStrategy<IForceCombinationByFactor> updateStrategy,
|
||||
IUpdateStrategy<IForceFactoredList> updateStrategy,
|
||||
IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy,
|
||||
IConvertStrategy<ForceTuple, ForceTupleDTO> forceTupleConvertStrategy)
|
||||
{
|
||||
@@ -31,17 +28,17 @@ namespace DataAccess.DTOs
|
||||
|
||||
public ForceCombinationByFactorFromDTOConvertStrategy() : this(
|
||||
new ForceActionBaseUpdateStrategy(),
|
||||
new ForceCombinationByFactorUpdateStrategy(),
|
||||
new ForceFactoredListUpdateStrategy(),
|
||||
new Point2DFromDTOConvertStrategy(),
|
||||
new ForceTupleFromDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override ForceCombinationByFactor GetNewItem(ForceCombinationByFactorDTO source)
|
||||
public override ForceFactoredList GetNewItem(ForceCombinationByFactorDTO source)
|
||||
{
|
||||
TraceLogger.AddMessage($"Force combination by factor name = {source.Name} is starting");
|
||||
ForceCombinationByFactor newItem = new(source.Id);
|
||||
ForceFactoredList newItem = new(source.Id);
|
||||
baseUpdateStrategy.Update(newItem, source);
|
||||
updateStrategy.Update(newItem, source);
|
||||
pointConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
@@ -49,7 +46,13 @@ namespace DataAccess.DTOs
|
||||
newItem.ForcePoint = pointConvertStrategy.Convert((Point2DDTO)source.ForcePoint);
|
||||
forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
forceTupleConvertStrategy.TraceLogger = TraceLogger;
|
||||
newItem.FullSLSForces = forceTupleConvertStrategy.Convert((ForceTupleDTO)source.FullSLSForces);
|
||||
CheckObject.IsNull(newItem.ForceTuples, nameof(newItem.ForceTuples));
|
||||
newItem.ForceTuples.Clear();
|
||||
foreach (var item in source.ForceTuples)
|
||||
{
|
||||
var newTuple = forceTupleConvertStrategy.Convert((ForceTupleDTO)item);
|
||||
newItem.ForceTuples.Add(newTuple);
|
||||
}
|
||||
TraceLogger.AddMessage($"Force combination by factor name = {newItem.Name} has been finished");
|
||||
return newItem;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user