Refactoring: add some button icons
This commit is contained in:
@@ -30,7 +30,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
|
||||
public DesignForcePair() : this(Guid.NewGuid()) {}
|
||||
|
||||
public IForceCombinationList GetCombinations()
|
||||
public IForceCombinationList GetCombination()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -41,5 +41,10 @@ namespace StructureHelperCommon.Models.Forces
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
StructureHelperCommon/Models/Forces/ForceColumnProperty.cs
Normal file
25
StructureHelperCommon/Models/Forces/ForceColumnProperty.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceColumnProperty : IForceColumnProperty
|
||||
{
|
||||
public Guid Id { get; private set; }
|
||||
public string ColumnName { get; set; } = string.Empty;
|
||||
public int ColumnIndex { get; set; } = 0;
|
||||
public double ColumnFactor { get; set; } = 1d;
|
||||
public ForceColumnProperty(Guid id, string columnName)
|
||||
{
|
||||
Id = id;
|
||||
ColumnName = columnName;
|
||||
}
|
||||
public ForceColumnProperty(string columnName) : this(Guid.NewGuid(), columnName)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,52 +14,83 @@ namespace StructureHelperCommon.Models.Forces
|
||||
public class ForceCombinationByFactor : IForceCombinationByFactor
|
||||
{
|
||||
readonly IUpdateStrategy<IAction> updateStrategy = new ActionUpdateStrategy();
|
||||
private ForceCombinationList result;
|
||||
private List<LimitStates> limitStates;
|
||||
private List<CalcTerms> calcTerms;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
public bool SetInGravityCenter { get; set; }
|
||||
public string Name { get; set; } = "New Factored Load";
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D ForcePoint { get; set; }
|
||||
public LimitStates LimitState { get; set; } = LimitStates.SLS; //By default create characteristic value of forces
|
||||
/// <inheritdoc/>
|
||||
public IForceTuple FullSLSForces { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; //By defult use full value of load
|
||||
public bool SetInGravityCenter { get; set; } = true;
|
||||
/// <inheritdoc/>
|
||||
public double ULSFactor { get; set; }
|
||||
public IPoint2D ForcePoint { get; set; } = new Point2D();
|
||||
/// <inheritdoc/>
|
||||
public double LongTermFactor { get; set; }
|
||||
|
||||
public IForceTuple FullSLSForces { get; set; } = new ForceTuple();
|
||||
/// <inheritdoc/>
|
||||
public double ULSFactor { get; set; } = 1.2d;
|
||||
/// <inheritdoc/>
|
||||
public double LongTermFactor { get; set; } = 1d;
|
||||
|
||||
public ForceCombinationByFactor(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Factored Load";
|
||||
SetInGravityCenter = true;
|
||||
ForcePoint = new Point2D();
|
||||
FullSLSForces = new ForceTuple();
|
||||
LongTermFactor = 1d;
|
||||
ULSFactor = 1.2d;
|
||||
}
|
||||
public ForceCombinationByFactor() : this (Guid.NewGuid()) { }
|
||||
public IForceCombinationList GetCombinations()
|
||||
public IForceCombinationList GetCombination()
|
||||
{
|
||||
GetNewResult();
|
||||
ProcessResult();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void ProcessResult()
|
||||
{
|
||||
var result = new ForceCombinationList();
|
||||
result.SetInGravityCenter = this.SetInGravityCenter;
|
||||
result.ForcePoint = this.ForcePoint;
|
||||
result.DesignForces.Clear();
|
||||
var limitStates = new List<LimitStates>() { LimitStates.ULS, LimitStates.SLS };
|
||||
var calcTerms = new List<CalcTerms>() { CalcTerms.ShortTerm, CalcTerms.LongTerm };
|
||||
foreach (var limitState in limitStates)
|
||||
{
|
||||
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor;
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
|
||||
var designForceTuple = new DesignForceTuple() { LimitState = limitState, CalcTerm = calcTerm };
|
||||
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor) as ForceTuple;
|
||||
result.DesignForces.Add(designForceTuple);
|
||||
}
|
||||
ProcessLimitState(limitState);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void ProcessLimitState(LimitStates limitState)
|
||||
{
|
||||
var stateFactor = limitState is LimitStates.SLS ? 1d : ULSFactor;
|
||||
foreach (var calcTerm in calcTerms)
|
||||
{
|
||||
ProcessCalcTerm(limitState, stateFactor, calcTerm);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm)
|
||||
{
|
||||
var termFactor = calcTerm is CalcTerms.ShortTerm ? 1d : LongTermFactor;
|
||||
var designForceTuple = new DesignForceTuple()
|
||||
{
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm
|
||||
};
|
||||
designForceTuple.ForceTuple = ForceTupleService.MultiplyTuples(FullSLSForces, stateFactor * termFactor) as ForceTuple;
|
||||
result.DesignForces.Add(designForceTuple);
|
||||
}
|
||||
|
||||
private void GetNewResult()
|
||||
{
|
||||
result = new ForceCombinationList();
|
||||
result.SetInGravityCenter = SetInGravityCenter;
|
||||
result.ForcePoint = ForcePoint;
|
||||
result.DesignForces.Clear();
|
||||
limitStates = new List<LimitStates>()
|
||||
{
|
||||
LimitStates.ULS, LimitStates.SLS
|
||||
};
|
||||
calcTerms = new List<CalcTerms>()
|
||||
{
|
||||
CalcTerms.ShortTerm, CalcTerms.LongTerm
|
||||
};
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
@@ -68,5 +99,14 @@ namespace StructureHelperCommon.Models.Forces
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
var listResult = new List<IForceCombinationList>
|
||||
{
|
||||
GetCombination()
|
||||
};
|
||||
return listResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
internal class ForceCombinationFromFile : IForceCombinationFromFile
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public List<IForceFileProperty> ForceFiles { get; set; } = new();
|
||||
public bool SetInGravityCenter { get; set; } = true;
|
||||
public IPoint2D ForcePoint { get; set; } = new Point2D();
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IForceCombinationList GetCombination()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace StructureHelperCommon.Models.Forces
|
||||
return newItem;
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public IForceCombinationList GetCombinations()
|
||||
public IForceCombinationList GetCombination()
|
||||
{
|
||||
var result = Clone() as IForceCombinationList;
|
||||
result.DesignForces.Clear();
|
||||
@@ -84,5 +84,14 @@ namespace StructureHelperCommon.Models.Forces
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<IForceCombinationList> GetCombinations()
|
||||
{
|
||||
var listResult = new List<IForceCombinationList>
|
||||
{
|
||||
GetCombination()
|
||||
};
|
||||
return listResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
StructureHelperCommon/Models/Forces/ForceFileProperty.cs
Normal file
32
StructureHelperCommon/Models/Forces/ForceFileProperty.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceFileProperty : IForceFileProperty
|
||||
{
|
||||
public Guid Id { get; private set; }
|
||||
public LimitStates LimitState { get; set; } = LimitStates.ULS;
|
||||
public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm;
|
||||
public string FilePath { get; set; } = string.Empty;
|
||||
public int SkipRowBeforeHeaderCount { get; set; } = 2;
|
||||
public int SkipRowHeaderCount { get; set; } = 1;
|
||||
public double GlobalFactor { get; set; } = 1d;
|
||||
public IForceColumnProperty Mx { get; set; } = new ForceColumnProperty("N");
|
||||
public IForceColumnProperty My { get; set; } = new ForceColumnProperty("My");
|
||||
public IForceColumnProperty Nz { get; set; } = new ForceColumnProperty("Mz");
|
||||
|
||||
public ForceFileProperty(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
public ForceFileProperty() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ namespace StructureHelperCommon.Models.Forces
|
||||
/// Return combination of forces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IForceCombinationList GetCombinations();
|
||||
IForceCombinationList GetCombination();
|
||||
|
||||
List<IForceCombinationList> GetCombinations();
|
||||
}
|
||||
}
|
||||
|
||||
28
StructureHelperCommon/Models/Forces/IForceColumnProperty.cs
Normal file
28
StructureHelperCommon/Models/Forces/IForceColumnProperty.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Settingth for column reading from MSExcel file
|
||||
/// </summary>
|
||||
public interface IForceColumnProperty : ISaveable
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of column for searching
|
||||
/// </summary>
|
||||
string ColumnName { get; set; }
|
||||
/// <summary>
|
||||
/// Column index
|
||||
/// </summary>
|
||||
int ColumnIndex { get; set; }
|
||||
/// <summary>
|
||||
/// Factor for obtaining value from column
|
||||
/// </summary>
|
||||
double ColumnFactor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,6 +10,8 @@ namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public interface IForceCombinationByFactor : IForceAction
|
||||
{
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
IForceTuple FullSLSForces { get; set; }
|
||||
double ULSFactor { get; set; }
|
||||
double LongTermFactor { get; set; }
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
internal interface IForceCombinationFromFile : IForceAction
|
||||
{
|
||||
List<IForceFileProperty> ForceFiles { get; set; }
|
||||
}
|
||||
}
|
||||
27
StructureHelperCommon/Models/Forces/IForceFileProperty.cs
Normal file
27
StructureHelperCommon/Models/Forces/IForceFileProperty.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings for extracting force combination from MSExcel file
|
||||
/// </summary>
|
||||
public interface IForceFileProperty : ISaveable
|
||||
{
|
||||
LimitStates LimitState { get; set; }
|
||||
CalcTerms CalcTerm { get; set; }
|
||||
string FilePath { get; set; }
|
||||
int SkipRowBeforeHeaderCount { get; set; }
|
||||
int SkipRowHeaderCount { get; set; }
|
||||
double GlobalFactor { get; set; }
|
||||
IForceColumnProperty Mx { get; set; }
|
||||
IForceColumnProperty My { get; set; }
|
||||
IForceColumnProperty Nz { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy<IForceColumnProperty>
|
||||
{
|
||||
public void Update(IForceColumnProperty targetObject, IForceColumnProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.ColumnName = sourceObject.ColumnName;
|
||||
targetObject.ColumnIndex = sourceObject.ColumnIndex;
|
||||
targetObject.ColumnFactor = sourceObject.ColumnFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceCombinationFromFileUpdateStrategy : IUpdateStrategy<IForceCombinationFromFile>
|
||||
{
|
||||
private IUpdateStrategy<IForceAction> baseUpdateStrategy;
|
||||
private IUpdateStrategy<IForceFileProperty> fileUpdateStrategy;
|
||||
|
||||
public ForceCombinationFromFileUpdateStrategy(IUpdateStrategy<IForceAction> baseUpdateStrategy, IUpdateStrategy<IForceFileProperty> fileUpdateStrategy)
|
||||
{
|
||||
this.baseUpdateStrategy = baseUpdateStrategy;
|
||||
this.fileUpdateStrategy = fileUpdateStrategy;
|
||||
}
|
||||
|
||||
public ForceCombinationFromFileUpdateStrategy() : this (
|
||||
new ForceActionUpdateStrategy(),
|
||||
new ForceFilePropertyUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IUpdateStrategy<IForceCombinationFromFile>.Update(IForceCombinationFromFile targetObject, IForceCombinationFromFile sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
baseUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.ForceFiles.Clear();
|
||||
foreach (var file in sourceObject.ForceFiles)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
public class ForceFilePropertyUpdateStrategy : IUpdateStrategy<IForceFileProperty>
|
||||
{
|
||||
private IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy;
|
||||
|
||||
public ForceFilePropertyUpdateStrategy(IUpdateStrategy<IForceColumnProperty> columnUpdateStrategy)
|
||||
{
|
||||
this.columnUpdateStrategy = columnUpdateStrategy;
|
||||
}
|
||||
|
||||
public ForceFilePropertyUpdateStrategy() : this (new ForceColumnPropertyUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Update(IForceFileProperty targetObject, IForceFileProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||
targetObject.FilePath = sourceObject.FilePath;
|
||||
targetObject.GlobalFactor = sourceObject.GlobalFactor;
|
||||
targetObject.SkipRowBeforeHeaderCount = sourceObject.SkipRowBeforeHeaderCount;
|
||||
targetObject.SkipRowHeaderCount = sourceObject.SkipRowHeaderCount;
|
||||
columnUpdateStrategy.Update(targetObject.Mx, sourceObject.Mx);
|
||||
columnUpdateStrategy.Update(targetObject.My, sourceObject.My);
|
||||
columnUpdateStrategy.Update(targetObject.Nz, sourceObject.Nz);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user