Change convert strategies to save xls imported forces

This commit is contained in:
Evgeny Redikultsev
2025-01-20 16:19:14 +05:00
parent f508399846
commit 50b173c805
80 changed files with 1684 additions and 617 deletions

View File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <inheritdoc/>
public class ColumnProperty : IColumnProperty
public class ColumnFileProperty : IColumnFileProperty
{
/// <inheritdoc/>
public Guid Id { get; private set; }
@@ -20,19 +20,19 @@ namespace StructureHelperCommon.Models.Forces
/// <inheritdoc/>
public double Factor { get; set; } = 1d;
public ColumnProperty(Guid id, string columnName)
public ColumnFileProperty(Guid id, string name)
{
Id = id;
Name = columnName;
Name = name;
}
public ColumnProperty(string columnName) : this(Guid.NewGuid(), columnName)
public ColumnFileProperty(string columnName) : this(Guid.NewGuid(), columnName)
{
}
public object Clone()
{
var cloneLogic = new ColumnPropertyCloningStrategy();
var cloneLogic = new ColumnFilePropertyCloningStrategy();
return cloneLogic.GetClone(this);
}
}

View File

@@ -23,7 +23,7 @@ namespace StructureHelperCommon.Models.Forces
/// <inheritdoc/>
public double GlobalFactor { get; set; } = 1d;
/// <inheritdoc/>
public List<IColumnProperty> ColumnProperties { get; } = new();
public List<IColumnFileProperty> ColumnProperties { get; } = new();
public ColumnedFileProperty(Guid id)
{

View File

@@ -7,11 +7,27 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
/// <inheritdoc/>
public class FactoredCombinationProperty : IFactoredCombinationProperty
{
/// <inheritdoc/>
public Guid Id { get; }
/// <inheritdoc/>
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
/// <inheritdoc/>
public LimitStates LimitState { get; set; } = LimitStates.SLS;
/// <inheritdoc/>
public double LongTermFactor { get; set; } = 1d;
/// <inheritdoc/>
public double ULSFactor { get; set; } = 1.2d;
public FactoredCombinationProperty(Guid id)
{
Id = id;
}
public FactoredCombinationProperty() : this(Guid.NewGuid())
{
}
}
}

View File

@@ -18,7 +18,7 @@ namespace StructureHelperCommon.Models.Forces
if (propertyType == FilePropertyType.Forces)
{
ColumnedFileProperty fileProperty = new();
List<IColumnProperty> columnProperties = GetForceColumns();
List<IColumnFileProperty> columnProperties = GetForceColumns();
fileProperty.ColumnProperties.AddRange(columnProperties);
return fileProperty;
}
@@ -28,12 +28,12 @@ namespace StructureHelperCommon.Models.Forces
}
}
private static List<IColumnProperty> GetForceColumns()
private static List<IColumnFileProperty> GetForceColumns()
{
List<IColumnProperty> columnProperties = new();
columnProperties.Add(new ColumnProperty("Nz") { SearchingName = "N", Index = 6 });
columnProperties.Add(new ColumnProperty("Mx") { SearchingName = "My", Index = 8 });
columnProperties.Add(new ColumnProperty("My") { SearchingName = "Mz", Index = 10 });
List<IColumnFileProperty> columnProperties = new();
columnProperties.Add(new ColumnFileProperty("Nz") { SearchingName = "N", Index = 6 });
columnProperties.Add(new ColumnFileProperty("Mx") { SearchingName = "My", Index = 8 });
columnProperties.Add(new ColumnFileProperty("My") { SearchingName = "Mz", Index = 10 });
return columnProperties;
}
}

View File

@@ -17,13 +17,24 @@ namespace StructureHelperCommon.Models.Forces
IGetTuplesFromFileLogic getTupleFromFileLogic;
private IForceFactoredList factoredCombination;
public Guid Id { get; set; }
public Guid Id { get; }
public ForceCombinationFromFile(Guid id)
{
Id = id;
}
public ForceCombinationFromFile() : this(Guid.NewGuid())
{
}
public string Name { get; set; } = string.Empty;
public List<IColumnedFileProperty> ForceFiles { get; set; } = new();
public bool SetInGravityCenter { get; set; } = true;
public IPoint2D ForcePoint { get; set; } = new Point2D();
public IFactoredCombinationProperty CombinationProperty { get; } = new FactoredCombinationProperty();
public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty();
public object Clone()
{

View File

@@ -23,7 +23,7 @@ namespace StructureHelperCommon.Models.Forces
/// <inheritdoc/>
public List<IForceTuple> ForceTuples { get; } = new() { new ForceTuple()};
/// <inheritdoc/>
public IFactoredCombinationProperty CombinationProperty { get; } = new FactoredCombinationProperty();
public IFactoredCombinationProperty CombinationProperty { get; set; }= new FactoredCombinationProperty();
public ForceFactoredList(Guid id)

View File

@@ -10,7 +10,7 @@ namespace StructureHelperCommon.Models.Forces
/// <summary>
/// Settingth for column reading from MSExcel file
/// </summary>
public interface IColumnProperty : ISaveable, ICloneable
public interface IColumnFileProperty : ISaveable, ICloneable
{
/// <summary>
/// Name of column

View File

@@ -28,6 +28,6 @@ namespace StructureHelperCommon.Models.Forces
/// <summary>
/// Collection of column's properties which will be imported
/// </summary>
List<IColumnProperty> ColumnProperties { get; }
List<IColumnFileProperty> ColumnProperties { get; }
}
}

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +11,7 @@ namespace StructureHelperCommon.Models.Forces
/// <summary>
/// Properties of factored combination of forces
/// </summary>
public interface IFactoredCombinationProperty
public interface IFactoredCombinationProperty : ISaveable
{
/// <summary>
/// Term of calculation for assigned combination

View File

@@ -10,6 +10,6 @@ namespace StructureHelperCommon.Models.Forces
/// <summary>
/// Properties of factored combination of forces
/// </summary>
IFactoredCombinationProperty CombinationProperty { get; }
IFactoredCombinationProperty CombinationProperty { get; set; }
}
}

View File

@@ -8,28 +8,28 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ColumnPropertyCloningStrategy : ICloneStrategy<IColumnProperty>
public class ColumnFilePropertyCloningStrategy : ICloneStrategy<IColumnFileProperty>
{
private IUpdateStrategy<IColumnProperty> updateStrategy;
private IUpdateStrategy<IColumnFileProperty> updateStrategy;
public ColumnPropertyCloningStrategy(IUpdateStrategy<IColumnProperty> updateStrategy)
public ColumnFilePropertyCloningStrategy(IUpdateStrategy<IColumnFileProperty> updateStrategy)
{
this.updateStrategy = updateStrategy;
}
public ColumnPropertyCloningStrategy()
public ColumnFilePropertyCloningStrategy()
{
}
public IColumnProperty GetClone(IColumnProperty sourceObject)
public IColumnFileProperty GetClone(IColumnFileProperty sourceObject)
{
CheckObject.IsNull(sourceObject);
if (updateStrategy is null)
{
updateStrategy = new ColumnPropertyUpdateStrategy();
updateStrategy = new ColumnFilePropertyUpdateStrategy();
}
ColumnProperty newItem = new(sourceObject.Name);
ColumnFileProperty newItem = new(sourceObject.Name);
updateStrategy.Update(newItem, sourceObject);
return newItem;
}

View File

@@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces
{
public class ColumnPropertyUpdateStrategy : IUpdateStrategy<IColumnProperty>
public class ColumnFilePropertyUpdateStrategy : IUpdateStrategy<IColumnFileProperty>
{
public void Update(IColumnProperty targetObject, IColumnProperty sourceObject)
public void Update(IColumnFileProperty targetObject, IColumnFileProperty sourceObject)
{
CheckObject.IsNull(targetObject);
CheckObject.IsNull(sourceObject);

View File

@@ -31,7 +31,7 @@ namespace StructureHelperCommon.Models.Forces
targetObject.ColumnProperties.Clear();
foreach (var item in sourceObject.ColumnProperties)
{
IColumnProperty clone = (IColumnProperty)item.Clone();
IColumnFileProperty clone = (IColumnFileProperty)item.Clone();
targetObject.ColumnProperties.Add(clone);
}
}