diff --git a/App.xaml b/App.xaml
index c984ac3..92ce395 100644
--- a/App.xaml
+++ b/App.xaml
@@ -11,6 +11,10 @@
+
+
+
+
diff --git a/Documentation/2021-06-14 10-46-38.JPG b/Documentation/2021-06-14 10-46-38.JPG
new file mode 100644
index 0000000..31a0451
Binary files /dev/null and b/Documentation/2021-06-14 10-46-38.JPG differ
diff --git a/Infrastructure/UI/Resources/ButtonStyles.xaml b/Infrastructure/UI/Resources/ButtonStyles.xaml
new file mode 100644
index 0000000..c3744c2
--- /dev/null
+++ b/Infrastructure/UI/Resources/ButtonStyles.xaml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Infrastructure/UI/Resources/CommonEnums.xaml b/Infrastructure/UI/Resources/CommonEnums.xaml
new file mode 100644
index 0000000..e6a976a
--- /dev/null
+++ b/Infrastructure/UI/Resources/CommonEnums.xaml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Infrastructure/UI/Resources/DataGridStyles.xaml b/Infrastructure/UI/Resources/DataGridStyles.xaml
new file mode 100644
index 0000000..e5fe7dd
--- /dev/null
+++ b/Infrastructure/UI/Resources/DataGridStyles.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Infrastructure/UI/Resources/DataGridTemplates.xaml b/Infrastructure/UI/Resources/DataGridTemplates.xaml
new file mode 100644
index 0000000..8c9d75f
--- /dev/null
+++ b/Infrastructure/UI/Resources/DataGridTemplates.xaml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StructureHelper.csproj b/StructureHelper.csproj
index 7d5e8e6..6934552 100644
--- a/StructureHelper.csproj
+++ b/StructureHelper.csproj
@@ -178,6 +178,15 @@
App.xaml
Code
+
+ InterpolateTuplesView.xaml
+
+
+ PartialFactorsView.xaml
+
+
+ SafetyFactorsView.xaml
+
CalculationPropertyView.xaml
@@ -232,14 +241,27 @@
PrimitivePropertiesView.xaml
+
+ SelectPrimitivesView.xaml
+
RectangleBeamView.xaml
+
+
+
+
+
+
+
+
+
+
@@ -273,10 +295,26 @@
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -305,6 +343,18 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -361,6 +411,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -395,6 +449,8 @@
false
-
+
+
+
\ No newline at end of file
diff --git a/StructureHelperCommon/Infrastructures/Enums/StressStates.cs b/StructureHelperCommon/Infrastructures/Enums/StressStates.cs
new file mode 100644
index 0000000..e02d0a6
--- /dev/null
+++ b/StructureHelperCommon/Infrastructures/Enums/StressStates.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Infrastructures.Enums
+{
+ public enum StressStates
+ {
+ Tension,
+ Compression
+ }
+}
diff --git a/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
index 907bd90..1b5ba2a 100644
--- a/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
+++ b/StructureHelperCommon/Infrastructures/Strings/ErrorString.cs
@@ -19,5 +19,6 @@ namespace StructureHelperCommon.Infrastructures.Strings
public static string FileCantBeDeleted => "#0008: File can't be deleted";
public static string FileCantBeSaved => "#0009: File can't be saved";
public static string VisualPropertyIsNotRight => "#0010: VisualPropertyIsNotRight";
+ public static string FactorMustBeGraterThanZero => "#0011: Partial factor must not be less than zero";
}
}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs b/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs
new file mode 100644
index 0000000..b4c2f35
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/Factories/ConcreteFactorsFactory.cs
@@ -0,0 +1,112 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public enum FactorType
+ {
+ LongTermFactor,
+ BleedingFactor,
+ PlainConcreteFactor
+ }
+
+ public static class ConcreteFactorsFactory
+ {
+ public static IMaterialSafetyFactor GetFactor(FactorType factorType)
+ {
+ if (factorType == FactorType.LongTermFactor) { return LongTerm(); }
+ else if (factorType == FactorType.BleedingFactor) { return Bleeding(); }
+ else if (factorType == FactorType.PlainConcreteFactor) { return PlainConcrete(); }
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
+ }
+
+ private static IMaterialSafetyFactor LongTerm()
+ {
+ IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor()
+ {
+ Name = "Gamma_b1",
+ Description = "Coefficient for considering long term calculations",
+ };
+ IMaterialPartialFactor partialFactor;
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Tension,
+ CalcTerm = CalcTerms.LongTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.9d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Compression,
+ CalcTerm = CalcTerms.LongTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.9d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ return safetyFactor;
+ }
+
+ private static IMaterialSafetyFactor Bleeding()
+ {
+ IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor()
+ {
+ Name = "Gamma_b3",
+ Description = "Coefficient for considering bleeding in vertical placement conditionals",
+ };
+ IMaterialPartialFactor partialFactor;
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Compression,
+ CalcTerm = CalcTerms.ShortTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.85d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Compression,
+ CalcTerm = CalcTerms.LongTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.85d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ return safetyFactor;
+ }
+
+ private static IMaterialSafetyFactor PlainConcrete()
+ {
+ IMaterialSafetyFactor safetyFactor = new MaterialSafetyFactor()
+ {
+ Name = "Gamma_b2",
+ Description = "Coefficient for plain concrete structures",
+ };
+ IMaterialPartialFactor partialFactor;
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Compression,
+ CalcTerm = CalcTerms.ShortTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.9d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ partialFactor = new MaterialPartialFactor
+ {
+ StressState = StressStates.Compression,
+ CalcTerm = CalcTerms.LongTerm,
+ LimitState = LimitStates.ULS,
+ FactorValue = 0.9d
+ };
+ safetyFactor.PartialFactors.Add(partialFactor);
+ return safetyFactor;
+ }
+
+
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs
new file mode 100644
index 0000000..51aeffa
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/IMaterialPartialFactor.cs
@@ -0,0 +1,16 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public interface IMaterialPartialFactor : IPartialFactor
+ {
+ StressStates StressState { get; set; }
+ CalcTerms CalcTerm { get; set; }
+ LimitStates LimitState { get; set; }
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs
new file mode 100644
index 0000000..4542fa2
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/IMaterialSafetyFactor.cs
@@ -0,0 +1,18 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public interface IMaterialSafetyFactor : ICloneable
+ {
+ string Name { get; set; }
+ bool Take { get; set; }
+ string Description { get; set; }
+ List PartialFactors { get; }
+ double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates);
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs
new file mode 100644
index 0000000..6aaf89c
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/IPartialFactor.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public interface IPartialFactor : ICloneable
+ {
+ double FactorValue {get;set;}
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs
new file mode 100644
index 0000000..8e90e1f
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/MaterialPartialFactor.cs
@@ -0,0 +1,52 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public class MaterialPartialFactor : IMaterialPartialFactor
+ {
+ private double factorValue;
+
+ public StressStates StressState { get; set; }
+ public CalcTerms CalcTerm { get; set; }
+ public LimitStates LimitState { get; set; }
+ public double FactorValue
+ {
+ get => factorValue;
+ set
+ {
+ if (value < 0 )
+ {
+ throw new StructureHelperException(ErrorStrings.FactorMustBeGraterThanZero);
+ }
+ factorValue = value;
+ }
+ }
+
+ public MaterialPartialFactor()
+ {
+ StressState = StressStates.Compression;
+ LimitState = LimitStates.ULS;
+ CalcTerm = CalcTerms.LongTerm;
+ FactorValue = 1d;
+ }
+
+ public object Clone()
+ {
+ var newItem = new MaterialPartialFactor()
+ {
+ StressState = StressState,
+ CalcTerm = CalcTerm,
+ LimitState = LimitState,
+ FactorValue = FactorValue,
+ };
+ return newItem;
+ }
+ }
+}
diff --git a/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs b/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs
new file mode 100644
index 0000000..c49d904
--- /dev/null
+++ b/StructureHelperCommon/Models/Materials/Libraries/MaterialSafetyFactor.cs
@@ -0,0 +1,46 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperCommon.Models.Materials.Libraries
+{
+ public class MaterialSafetyFactor : IMaterialSafetyFactor
+ {
+ public string Name {get; set; }
+ public bool Take { get; set; }
+ public string Description { get; set; }
+ public List PartialFactors { get; }
+
+ public MaterialSafetyFactor()
+ {
+ Take = true;
+ Name = "New factor";
+ Description = "Material safety factor for ...";
+ PartialFactors = new List();
+ }
+
+ public double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates)
+ {
+ double result = 1d;
+ var coefficients = PartialFactors.Where(x => (x.StressState == stressState & x.CalcTerm == calcTerm & x.LimitState == limitStates));
+ foreach (var item in coefficients) { result *= item.FactorValue;}
+ return result;
+ }
+
+ public object Clone()
+ {
+ var newItem = new MaterialSafetyFactor();
+ newItem.Take = Take;
+ newItem.Name = Name;
+ newItem.Description = Description;
+ foreach (var item in PartialFactors)
+ {
+ newItem.PartialFactors.Add(item.Clone() as IMaterialPartialFactor);
+ }
+ return newItem;
+ }
+ }
+}
diff --git a/StructureHelperCommon/Services/Forces/TupleService.cs b/StructureHelperCommon/Services/Forces/TupleService.cs
index 00f69a6..3f76628 100644
--- a/StructureHelperCommon/Services/Forces/TupleService.cs
+++ b/StructureHelperCommon/Services/Forces/TupleService.cs
@@ -1,4 +1,6 @@
-using StructureHelperCommon.Models.Forces;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Forces;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
@@ -18,8 +20,9 @@ namespace StructureHelperCommon.Services.Forces
return newTuple;
}
- public static IForceTuple InterpolateTuples(IForceTuple startTuple, IForceTuple endTuple, double coefficient)
+ public static IForceTuple InterpolateTuples(IForceTuple endTuple, IForceTuple startTuple = null, double coefficient = 0.5d)
{
+ if (startTuple == null) startTuple = new ForceTuple();
double dMx, dMy, dNz;
dMx = endTuple.Mx - startTuple.Mx;
dMy = endTuple.My - startTuple.My;
@@ -32,20 +35,17 @@ namespace StructureHelperCommon.Services.Forces
};
}
- public static IForceTuple InterpolateTuples(IForceTuple endTuple, double coefficient)
- {
- IForceTuple startTuple = new ForceTuple();
- return InterpolateTuples(startTuple, endTuple, coefficient);
- }
- public static List InterpolateDesignTuple(IDesignForceTuple endTuple, int stepCount)
+ public static List InterpolateDesignTuple(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce = null, int stepCount = 10)
{
+ if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
+ if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
var tuples =new List();
double step = 1d / stepCount;
for (int i = 0; i <= stepCount; i++)
{
- var currentTuple = InterpolateTuples(endTuple.ForceTuple, i * step);
- var currentDesignTuple = new DesignForceTuple() { LimitState = endTuple.LimitState, CalcTerm = endTuple.CalcTerm, ForceTuple = currentTuple };
+ var currentTuple = InterpolateTuples(finishDesignForce.ForceTuple, startDesignForce.ForceTuple, i * step);
+ var currentDesignTuple = new DesignForceTuple() { LimitState = finishDesignForce.LimitState, CalcTerm = finishDesignForce.CalcTerm, ForceTuple = currentTuple };
tuples.Add(currentDesignTuple);
}
return tuples;
diff --git a/StructureHelperCommon/StructureHelperCommon.csproj b/StructureHelperCommon/StructureHelperCommon.csproj
index 33f49bc..e1bcd1c 100644
--- a/StructureHelperCommon/StructureHelperCommon.csproj
+++ b/StructureHelperCommon/StructureHelperCommon.csproj
@@ -49,6 +49,7 @@
+
@@ -68,11 +69,17 @@
+
+
+
+
+
+
diff --git a/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs b/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs
index 251bae5..1d6a5d3 100644
--- a/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/ConcreteLibMaterial.cs
@@ -9,12 +9,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using StructureHelperCommon.Infrastructures.Settings;
namespace StructureHelperLogics.Models.Materials
{
public class ConcreteLibMaterial : IConcreteLibMaterial
{
public ILibMaterialEntity MaterialEntity { get; set; }
+ public List SafetyFactors { get; }
public bool TensionForULS { get ; set; }
public bool TensionForSLS { get; set; }
@@ -22,6 +24,8 @@ namespace StructureHelperLogics.Models.Materials
public ConcreteLibMaterial()
{
+ SafetyFactors = new List();
+ SafetyFactors.AddRange(PartialCoefficientFactory.GetDefaultConcreteSafetyFactors(ProgramSetting.CodeType));
optionLogic = new MaterialOptionLogic(new LCMB.ConcreteOptions());
}
@@ -33,6 +37,15 @@ namespace StructureHelperLogics.Models.Materials
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
+ double compressionVal = 1d;
+ double tensionVal = 1d;
+ foreach (var item in SafetyFactors.Where(x => x.Take == true))
+ {
+ compressionVal *= item.GetFactor(StressStates.Compression, calcTerm, limitState);
+ tensionVal *= item.GetFactor(StressStates.Tension, calcTerm, limitState);
+ }
+ materialOptions.ExternalFactor.Compressive = compressionVal;
+ materialOptions.ExternalFactor.Tensile = tensionVal;
LCMB.IMaterialBuilder builder = new LCMB.ConcreteBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
return director.BuildMaterial();
diff --git a/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs b/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs
new file mode 100644
index 0000000..175d93d
--- /dev/null
+++ b/StructureHelperLogics/Models/Materials/Factories/PartialCoefficientFactory.cs
@@ -0,0 +1,44 @@
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelperLogics.Models.Materials
+{
+ public static class PartialCoefficientFactory
+ {
+ public static List GetDefaultConcreteSafetyFactors(CodeTypes codeType)
+ {
+ if (codeType == CodeTypes.SP63_13330_2018) return GetConcreteFactorsSP63_2018();
+ else if (codeType == CodeTypes.EuroCode_2_1990) return GetConcreteFactorsEC2_1990();
+ else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + ": " + codeType);
+ }
+
+ private static List GetConcreteFactorsEC2_1990()
+ {
+ List factors = new List();
+ return factors;
+ }
+
+ private static List GetConcreteFactorsSP63_2018()
+ {
+ List factors = new List();
+ IMaterialSafetyFactor coefficient;
+ coefficient = ConcreteFactorsFactory.GetFactor(FactorType.LongTermFactor);
+ coefficient.Take = true;
+ factors.Add(coefficient);
+ coefficient = ConcreteFactorsFactory.GetFactor(FactorType.PlainConcreteFactor);
+ coefficient.Take = false;
+ factors.Add(coefficient);
+ coefficient = ConcreteFactorsFactory.GetFactor(FactorType.BleedingFactor);
+ coefficient.Take = false;
+ factors.Add(coefficient);
+ return factors;
+ }
+ }
+}
diff --git a/StructureHelperLogics/Models/Materials/ILibMaterial.cs b/StructureHelperLogics/Models/Materials/ILibMaterial.cs
index 5a881ee..b162bce 100644
--- a/StructureHelperLogics/Models/Materials/ILibMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/ILibMaterial.cs
@@ -10,5 +10,6 @@ namespace StructureHelperLogics.Models.Materials
public interface ILibMaterial : IHelperMaterial
{
ILibMaterialEntity MaterialEntity { get; set; }
+ List SafetyFactors { get; }
}
}
diff --git a/StructureHelperLogics/Models/Materials/LibMaterial.cs b/StructureHelperLogics/Models/Materials/LibMaterial.cs
index cbec179..87302dc 100644
--- a/StructureHelperLogics/Models/Materials/LibMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/LibMaterial.cs
@@ -2,6 +2,7 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Materials.Libraries;
+using System.Collections.Generic;
using LCM = LoaderCalculator.Data.Materials;
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
@@ -18,7 +19,10 @@ namespace StructureHelperLogics.Models.Materials
private CalcTerms calcTerm;
public string Name { get; set; }
public double MainStrength { get; set; }
- public ILibMaterialEntity MaterialEntity { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
+
+ public ILibMaterialEntity MaterialEntity { get; set; }
+
+ public List SafetyFactors { get; }
public LibMaterial(MaterialTypes materialType, CodeTypes codeType, string name, double mainStrength)
{
diff --git a/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs b/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs
index d3ff225..94f86fc 100644
--- a/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs
+++ b/StructureHelperLogics/Models/Materials/ReinforcementLibMaterial.cs
@@ -13,11 +13,13 @@ namespace StructureHelperLogics.Models.Materials
public class ReinforcementLibMaterial : IReinforcementLibMaterial
{
public ILibMaterialEntity MaterialEntity { get; set; }
+ public List SafetyFactors { get; }
private IMaterialOptionLogic optionLogic;
public ReinforcementLibMaterial()
{
+ SafetyFactors = new List();
optionLogic = new MaterialOptionLogic(new LCMB.ReinforcementOptions());
}
@@ -29,6 +31,15 @@ namespace StructureHelperLogics.Models.Materials
public LCM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
{
var materialOptions = optionLogic.SetMaterialOptions(MaterialEntity, limitState, calcTerm);
+ double compressionVal = 1d;
+ double tensionVal = 1d;
+ foreach (var item in SafetyFactors.Where(x => x.Take == true))
+ {
+ compressionVal *= item.GetFactor(StressStates.Compression, calcTerm, limitState);
+ tensionVal *= item.GetFactor(StressStates.Tension, calcTerm, limitState);
+ }
+ materialOptions.ExternalFactor.Compressive = compressionVal;
+ materialOptions.ExternalFactor.Tensile = tensionVal;
LCMB.IMaterialBuilder builder = new LCMB.ReinforcementBuilder(materialOptions);
LCMB.IBuilderDirector director = new LCMB.BuilderDirector(builder);
return director.BuildMaterial();
diff --git a/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs b/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs
index cd76681..f957c0e 100644
--- a/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs
+++ b/StructureHelperLogics/Models/Templates/CrossSections/RCs/MaterialLogic.cs
@@ -1,5 +1,6 @@
using StructureHelper.Models.Materials;
using StructureHelperCommon.Infrastructures.Settings;
+using StructureHelperCommon.Models.Materials.Libraries;
using StructureHelperLogics.Models.Materials;
using System;
using System.Collections.Generic;
diff --git a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
index 87abf07..53b663b 100644
--- a/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
+++ b/StructureHelperLogics/NdmCalculations/Primitives/RectanglePrimitive.cs
@@ -39,6 +39,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
NdmMaxSize = 0.01d;
NdmMinDivision = 10;
VisualProperty = new VisualProperty();
+ VisualProperty.Opacity = 0.8;
}
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
diff --git a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
index 4584d1c..7688fc6 100644
--- a/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
+++ b/StructureHelperLogics/Services/NdmCalculations/InterpolateService.cs
@@ -12,13 +12,13 @@ namespace StructureHelperLogics.Services.NdmCalculations
{
public static class InterpolateService
{
- public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple sourceTuple, int stepCount)
+ public static IForceCalculator InterpolateForceCalculator(IForceCalculator source, IDesignForceTuple finishDesignForce,IDesignForceTuple startDesignForce, int stepCount)
{
IForceCalculator calculator = new ForceCalculator();
calculator.LimitStatesList.Clear();
- calculator.LimitStatesList.Add(sourceTuple.LimitState);
+ calculator.LimitStatesList.Add(finishDesignForce.LimitState);
calculator.CalcTermsList.Clear();
- calculator.CalcTermsList.Add(sourceTuple.CalcTerm);
+ calculator.CalcTermsList.Add(finishDesignForce.CalcTerm);
calculator.IterationAccuracy = source.IterationAccuracy;
calculator.MaxIterationCount = source.MaxIterationCount;
calculator.Primitives.AddRange(source.Primitives);
@@ -29,7 +29,7 @@ namespace StructureHelperLogics.Services.NdmCalculations
SetInGravityCenter = false
};
combination.DesignForces.Clear();
- combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(sourceTuple, stepCount));
+ combination.DesignForces.AddRange(TupleService.InterpolateDesignTuple(finishDesignForce, startDesignForce, stepCount));
combination.ForcePoint.X = 0;
combination.ForcePoint.Y = 0;
calculator.ForceCombinationLists.Add(combination);
diff --git a/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs
new file mode 100644
index 0000000..07c92a1
--- /dev/null
+++ b/StructureHelperTests/FunctionalTests/Ndms/Calculators/ForceCalculatorTests/RCSectionsTest.cs
@@ -0,0 +1,53 @@
+using LoaderCalculator.Tests.Infrastructures.Logics;
+using NUnit.Framework;
+using StructureHelperLogics.Models.Templates.CrossSections.RCs;
+using StructureHelperLogics.Models.Templates.RCs;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+
+namespace StructureHelperTests.FunctionalTests.Ndms.Calculators.ForceCalculatorTests
+{
+ public class RCSectionsTest
+ {
+ [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, -0.00062544561815463693d, -0.0029292919541166911d, 0.00035383082501577246d)]
+ [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 3, 2, -0.00046762265275279838d, -0.0025101896869558888d, 0.00027185795017719519d)]
+ [TestCase(0.5d, 0.5d, 0.025d, 0.025d, 3, 3, -0.00080914991212906239d, -0.00080914991212906184d, 0.00011900072665826425d)]
+ public void Run_SouldPass(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, double expectedKx, double expectedKy, double expectedEpsZ)
+ {
+ //Arrange
+ var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount};
+ var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
+ var calculator = newSection.SectionRepository.CalculatorsList[0];
+ //Act
+ calculator.Run();
+ var result = calculator.Result as IForcesResults;
+ //Assert
+ Assert.IsNotNull(result);
+ Assert.IsTrue(result.IsValid);
+ var strainMatrix = result.ForcesResultList[0].LoaderResults.StrainMatrix;
+ var kx = strainMatrix.Kx;
+ var ky = strainMatrix.Ky;
+ var epsz = strainMatrix.EpsZ;
+ Assert.AreEqual(expectedKx, kx, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKx));
+ Assert.AreEqual(expectedKy, ky, ExpectedProcessor.GetAccuracyForExpectedValue(expectedKy));
+ Assert.AreEqual(expectedEpsZ, epsz, ExpectedProcessor.GetAccuracyForExpectedValue(expectedEpsZ));
+ }
+
+ [TestCase(0.4d, 0.6d, 0.012d, 0.025d, 2, 2, true, true)]
+ [TestCase(1d, 0.2d, 0.012d, 0.012d, 5, 2, true, false)]
+ [TestCase(1d, 0.2d, 0.012d, 0.025d, 5, 2, true, true)]
+ public void Run_SouldPass_Result_IsNotValid(double width, double height, double topDiametr, double bottomDiametr, int widthCount, int heightCount, bool calcResult, bool firstForceResult)
+ {
+ //Arrange
+ var template = new RectangleBeamTemplate(width, height) { TopDiameter = topDiametr, BottomDiameter = bottomDiametr, WidthCount = widthCount, HeightCount = heightCount };
+ var newSection = new SectionTemplate(new RectGeometryLogic(template)).GetCrossSection();
+ var calculator = newSection.SectionRepository.CalculatorsList[0];
+ //Act
+ calculator.Run();
+ var result = calculator.Result as IForcesResults;
+ //Assert
+ Assert.IsNotNull(result);
+ Assert.True(calcResult == result.IsValid);
+ Assert.True(firstForceResult == result.ForcesResultList[0].IsValid);
+ }
+ }
+}
diff --git a/StructureHelperTests/StructureHelperTests.csproj b/StructureHelperTests/StructureHelperTests.csproj
index ab35ac9..3c234b3 100644
--- a/StructureHelperTests/StructureHelperTests.csproj
+++ b/StructureHelperTests/StructureHelperTests.csproj
@@ -42,6 +42,7 @@
+
diff --git a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
index 9b056eb..a614d8d 100644
--- a/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
+++ b/StructureHelperTests/ViewModelTests/NdmPrimitiveTests.cs
@@ -21,7 +21,7 @@ namespace StructureHelperTests.ViewModelTests
public class NdmPrimitiveTests
{
[Test]
- public void Run_ShouldPass()
+ public void Rectangle_Run_ShouldPass()
{
//Arrange
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
@@ -32,5 +32,18 @@ namespace StructureHelperTests.ViewModelTests
//Assert
Assert.NotNull(vm);
}
+
+ [Test]
+ public void Point_Run_ShouldPass()
+ {
+ //Arrange
+ var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Concrete40, CodeTypes.SP63_13330_2018);
+ var primitive = new PointPrimitive(material);
+ var primitiveBase = new PointViewPrimitive(primitive);
+ //Act
+ var vm = new PrimitivePropertiesViewModel(primitiveBase, new CrossSectionRepository());
+ //Assert
+ Assert.NotNull(vm);
+ }
}
}
diff --git a/Windows/Forces/ForceCombinationView.xaml b/Windows/Forces/ForceCombinationView.xaml
index 7d0b300..9a0081c 100644
--- a/Windows/Forces/ForceCombinationView.xaml
+++ b/Windows/Forces/ForceCombinationView.xaml
@@ -7,43 +7,58 @@
xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces"
d:DataContext="{d:DesignInstance vm:ForceCombinationViewModel}"
mc:Ignorable="d"
- Title="Force Combination" Height="250" Width="450" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
+ Title="Force Combination" Height="250" Width="550" MinHeight="300" MinWidth="450" MaxWidth="500" WindowStartupLocation="CenterScreen">
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Windows/Forces/InterpolateTuplesView.xaml b/Windows/Forces/InterpolateTuplesView.xaml
new file mode 100644
index 0000000..97e31ef
--- /dev/null
+++ b/Windows/Forces/InterpolateTuplesView.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/Forces/InterpolateTuplesView.xaml.cs b/Windows/Forces/InterpolateTuplesView.xaml.cs
new file mode 100644
index 0000000..f11652b
--- /dev/null
+++ b/Windows/Forces/InterpolateTuplesView.xaml.cs
@@ -0,0 +1,37 @@
+using StructureHelper.Windows.ViewModels.Forces;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.Forces
+{
+ ///
+ /// Логика взаимодействия для InterpolateTuplesView.xaml
+ ///
+ public partial class InterpolateTuplesView : Window
+ {
+ public InterpolateTuplesView(InterpolateTuplesViewModel viewModel)
+ {
+ InitializeComponent();
+ DataContext = viewModel;
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = true;
+ Close();
+ }
+ }
+}
diff --git a/Windows/MainWindow/MainViewModel.cs b/Windows/MainWindow/MainViewModel.cs
index c0a16cc..f3b0d70 100644
--- a/Windows/MainWindow/MainViewModel.cs
+++ b/Windows/MainWindow/MainViewModel.cs
@@ -11,6 +11,7 @@ using StructureHelper.Windows.MainWindow.Materials;
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
using StructureHelper.Windows.ViewModels.Calculations.CalculationProperies;
using StructureHelper.Windows.ViewModels.Calculations.CalculationResult;
+using StructureHelper.Windows.ViewModels.Forces;
using StructureHelper.Windows.ViewModels.NdmCrossSections;
using StructureHelperCommon.Infrastructures.Strings;
using StructureHelperCommon.Models.Forces;
@@ -45,7 +46,7 @@ namespace StructureHelper.Windows.MainWindow
private readonly ICalculatorsViewModelLogic calculatorsLogic;
public ICalculatorsViewModelLogic CalculatorsLogic { get => calculatorsLogic;}
- public IForceCombinationViewModelLogic CombinationsLogic { get => combinationsLogic; }
+ public ActionsViewModel CombinationsLogic { get => combinationsLogic; }
public IPrimitiveViewModelLogic PrimitiveLogic => primitiveLogic;
private MainModel Model { get; }
@@ -171,14 +172,14 @@ namespace StructureHelper.Windows.MainWindow
private double delta = 0.0005;
private double axisLineThickness;
private double gridLineThickness;
- private IForceCombinationViewModelLogic combinationsLogic;
+ private ActionsViewModel combinationsLogic;
private IPrimitiveViewModelLogic primitiveLogic;
public MainViewModel(MainModel model)
{
Model = model;
section = model.Section;
- combinationsLogic = new ForceCombinationViewModelLogic(repository);
+ combinationsLogic = new ActionsViewModel(repository);
calculatorsLogic = new CalculatorsViewModelLogic(repository);
CanvasWidth = 2d * scale;
CanvasHeight = 1.5d * scale;
diff --git a/Windows/MainWindow/Materials/HeadMaterialsView.xaml b/Windows/MainWindow/Materials/HeadMaterialsView.xaml
index a463d06..3f55bc6 100644
--- a/Windows/MainWindow/Materials/HeadMaterialsView.xaml
+++ b/Windows/MainWindow/Materials/HeadMaterialsView.xaml
@@ -9,28 +9,40 @@
mc:Ignorable="d"
Title="Materials" Height="350" Width="680" MinHeight="350" MinWidth="680" WindowStartupLocation="CenterScreen">
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
diff --git a/Windows/MainWindow/Materials/PartialFactorsView.xaml b/Windows/MainWindow/Materials/PartialFactorsView.xaml
new file mode 100644
index 0000000..427ed66
--- /dev/null
+++ b/Windows/MainWindow/Materials/PartialFactorsView.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/MainWindow/Materials/PartialFactorsView.xaml.cs b/Windows/MainWindow/Materials/PartialFactorsView.xaml.cs
new file mode 100644
index 0000000..c836628
--- /dev/null
+++ b/Windows/MainWindow/Materials/PartialFactorsView.xaml.cs
@@ -0,0 +1,31 @@
+using StructureHelper.Windows.ViewModels.Materials;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.MainWindow.Materials
+{
+ ///
+ /// Логика взаимодействия для PartialFactorsView.xaml
+ ///
+ public partial class PartialFactorsView : Window
+ {
+ public PartialFactorsView(List factors)
+ {
+ InitializeComponent();
+ var vm = new PartialFactorsViewModel(factors);
+ this.DataContext = vm;
+ }
+ }
+}
diff --git a/Windows/MainWindow/Materials/SafetyFactorsView.xaml b/Windows/MainWindow/Materials/SafetyFactorsView.xaml
new file mode 100644
index 0000000..49ef141
--- /dev/null
+++ b/Windows/MainWindow/Materials/SafetyFactorsView.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/MainWindow/Materials/SafetyFactorsView.xaml.cs b/Windows/MainWindow/Materials/SafetyFactorsView.xaml.cs
new file mode 100644
index 0000000..435156f
--- /dev/null
+++ b/Windows/MainWindow/Materials/SafetyFactorsView.xaml.cs
@@ -0,0 +1,31 @@
+using StructureHelper.Windows.ViewModels.Materials;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.AddMaterialWindow
+{
+ ///
+ /// Логика взаимодействия для SafetyFactorsView.xaml
+ ///
+ public partial class SafetyFactorsView : Window
+ {
+ public SafetyFactorsView(List safetyFactors)
+ {
+ InitializeComponent();
+ var vm = new SafetyFactorsViewModel(safetyFactors);
+ this.DataContext = vm;
+ }
+ }
+}
diff --git a/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml b/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml
new file mode 100644
index 0000000..bb0e453
--- /dev/null
+++ b/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml.cs b/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml.cs
new file mode 100644
index 0000000..022b98d
--- /dev/null
+++ b/Windows/PrimitivePropertiesWindow/SelectPrimitivesView.xaml.cs
@@ -0,0 +1,35 @@
+using StructureHelper.Windows.ViewModels.PrimitiveProperties;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace StructureHelper.Windows.PrimitivePropertiesWindow
+{
+ ///
+ /// Логика взаимодействия для SelectPrimitivesView.xaml
+ ///
+ public partial class SelectPrimitivesView : Window
+ {
+ public SelectPrimitivesView(SelectPrimitivesViewModel vm)
+ {
+ InitializeComponent();
+ DataContext = vm;
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ this.Close();
+ }
+ }
+}
diff --git a/Windows/ViewModels/CRUDViewModelBase.cs b/Windows/ViewModels/CRUDViewModelBase.cs
new file mode 100644
index 0000000..055c9a8
--- /dev/null
+++ b/Windows/ViewModels/CRUDViewModelBase.cs
@@ -0,0 +1,126 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Documents;
+
+namespace StructureHelper.Windows.ViewModels
+{
+ public abstract class CRUDViewModelBase : ViewModelBase, ICRUDViewModel where TItem : class
+ {
+
+ private RelayCommand addCommand;
+ private RelayCommand deleteCommand;
+ private RelayCommand copyCommand;
+ private RelayCommand editCommand;
+
+ public List Collection { get; set; }
+
+ public TItem NewItem { get; set; }
+ public TItem SelectedItem { get; set; }
+
+ public ObservableCollection Items { get; private set; }
+
+ public RelayCommand Add
+ {
+ get
+ {
+ return addCommand ??
+ (
+ addCommand = new RelayCommand(o =>
+ {
+ AddMethod(o);
+ }
+ ));
+ }
+ }
+ public virtual void AddMethod(object parameter)
+ {
+ Collection.Add(NewItem);
+ Items.Add(NewItem);
+ }
+ public RelayCommand Delete
+ {
+ get
+ {
+ return deleteCommand ??
+ (
+ deleteCommand = new RelayCommand(o =>
+ {
+ DeleteMethod();
+ }, o => SelectedItem != null
+ ));
+ }
+ }
+ public virtual void DeleteMethod()
+ {
+ Collection.Remove(SelectedItem);
+ Items.Remove(SelectedItem);
+ }
+ public RelayCommand Edit
+ {
+ get
+ {
+ return editCommand ??
+ (editCommand = new RelayCommand(o=>
+ {
+ EditMethod(o);
+ }, o => SelectedItem != null
+ ));
+ }
+ }
+
+ public virtual void EditMethod(object parameter)
+ {
+ Items.Clear();
+ foreach (var item in Collection)
+ {
+ Items.Add(item);
+ }
+ OnPropertyChanged(nameof(Items));
+ }
+
+ public RelayCommand Copy
+ {
+ get
+ {
+ return copyCommand ??
+ (copyCommand = new RelayCommand (o=>
+ {
+ CopyMethod();
+ }, o => SelectedItem != null
+ ));
+ }
+ }
+ public virtual void CopyMethod()
+ {
+ if (SelectedItem is ICloneable)
+ {
+ NewItem = (SelectedItem as ICloneable).Clone() as TItem;
+ }
+ Collection.Add(NewItem);
+ Items.Add(NewItem);
+ }
+ public void AddItems(IEnumerable items)
+ {
+ foreach (var item in items)
+ {
+ Items.Add(item);
+ }
+ }
+ public CRUDViewModelBase()
+ {
+ Items = new ObservableCollection();
+ }
+
+ public CRUDViewModelBase(List collection)
+ {
+ Collection = collection;
+ Items = new ObservableCollection(collection);
+ }
+ }
+}
diff --git a/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs b/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
index 61042cc..f7c4174 100644
--- a/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
+++ b/Windows/ViewModels/Calculations/Calculators/ForcesResultsViewModel.cs
@@ -7,8 +7,13 @@ using StructureHelper.Services.Reports;
using StructureHelper.Services.Reports.CalculationReports;
using StructureHelper.Services.ResultViewers;
using StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews;
+using StructureHelper.Windows.Forces;
+using StructureHelper.Windows.PrimitivePropertiesWindow;
+using StructureHelper.Windows.ViewModels.Forces;
+using StructureHelper.Windows.ViewModels.PrimitiveProperties;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Forces;
using StructureHelperLogics.NdmCalculations.Analyses;
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
using StructureHelperLogics.NdmCalculations.Primitives;
@@ -30,6 +35,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private IForceCalculator forceCalculator;
private IForcesResults forcesResults;
private IEnumerable ndmPrimitives;
+ private IEnumerable selectedNdmPrimitives;
private IEnumerable ndms;
private IReport isoFieldReport;
@@ -50,8 +56,15 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
return showIsoFieldCommand ??
(showIsoFieldCommand = new RelayCommand(o =>
{
- GetNdms();
- ShowIsoField();
+ var vm = new SelectPrimitivesViewModel(ndmPrimitives);
+ var wnd = new SelectPrimitivesView(vm);
+ wnd.ShowDialog();
+ if (wnd.DialogResult == true)
+ {
+ selectedNdmPrimitives = vm.Items.CollectionItems.Where(x => x.IsSelected == true).Select(x => x.Item.GetNdmPrimitive());
+ GetNdms();
+ ShowIsoField();
+ }
}, o => (SelectedResult != null) && SelectedResult.IsValid));
}
}
@@ -73,7 +86,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "csv |*.csv";
- saveFileDialog.Title = "Save an Image File";
+ saveFileDialog.Title = "Save an csv File";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
var filename = saveFileDialog.FileName;
@@ -119,8 +132,16 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
private void Interpolate()
{
- int stepCount = 100;
- var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, SelectedResult.DesignForceTuple, stepCount);
+ IDesignForceTuple startDesignTuple, finishDesignTuple;
+ finishDesignTuple = SelectedResult.DesignForceTuple.Clone() as IDesignForceTuple;
+ var viewModel = new InterpolateTuplesViewModel(finishDesignTuple, null, 100);
+ var wndTuples = new InterpolateTuplesView(viewModel);
+ wndTuples.ShowDialog();
+ if (wndTuples.DialogResult != true) return;
+ startDesignTuple = viewModel.StartDesignForce;
+ finishDesignTuple = viewModel.FinishDesignForce;
+ int stepCount = viewModel.StepCount;
+ var calculator = InterpolateService.InterpolateForceCalculator(forceCalculator, finishDesignTuple, startDesignTuple, stepCount);
calculator.Run();
var result = calculator.Result;
if (result is null || result.IsValid == false)
@@ -154,7 +175,7 @@ namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
{
var limitState = SelectedResult.DesignForceTuple.LimitState;
var calcTerm = SelectedResult.DesignForceTuple.CalcTerm;
- ndms = NdmPrimitivesService.GetNdms(ndmPrimitives, limitState, calcTerm);
+ ndms = NdmPrimitivesService.GetNdms(selectedNdmPrimitives, limitState, calcTerm);
}
}
}
diff --git a/Windows/ViewModels/Forces/ActionsViewModel.cs b/Windows/ViewModels/Forces/ActionsViewModel.cs
new file mode 100644
index 0000000..bc3f1db
--- /dev/null
+++ b/Windows/ViewModels/Forces/ActionsViewModel.cs
@@ -0,0 +1,60 @@
+using StructureHelper.Windows.Forces;
+using StructureHelperCommon.Models.Forces;
+using StructureHelperLogics.Models.CrossSections;
+using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public class ActionsViewModel : CRUDViewModelBase
+ {
+ ICrossSectionRepository repository;
+
+ public override void AddMethod(object parameter)
+ {
+ NewItem = new ForceCombinationList() { Name = "New Force Combination" };
+ base.AddMethod(parameter);
+ }
+
+ public override void DeleteMethod()
+ {
+ var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialogResult == DialogResult.Yes)
+ {
+ var calcRepository = repository.CalculatorsList;
+ foreach (var item in calcRepository)
+ {
+ if (item is IForceCalculator)
+ {
+ var forceCalculator = item as IForceCalculator;
+ var containSelected = forceCalculator.ForceCombinationLists.Contains(SelectedItem);
+ if (containSelected)
+ {
+ var dialogResultCalc = MessageBox.Show($"Action is contained in calculator {item.Name}", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialogResultCalc == DialogResult.OK) { forceCalculator.ForceCombinationLists.Remove(SelectedItem); }
+ else return;
+ }
+ }
+ }
+ base.DeleteMethod();
+ }
+ }
+
+ public override void EditMethod(object parameter)
+ {
+ var wnd = new ForceCombinationView(SelectedItem);
+ wnd.ShowDialog();
+ base.EditMethod(parameter);
+ }
+
+ public ActionsViewModel(ICrossSectionRepository repository) : base (repository.ForceCombinationLists)
+ {
+ this.repository = repository;
+ }
+ }
+}
diff --git a/Windows/ViewModels/Forces/ForceCombinationViewModel.cs b/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
index 18b2726..94bf3f5 100644
--- a/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
+++ b/Windows/ViewModels/Forces/ForceCombinationViewModel.cs
@@ -12,7 +12,9 @@ namespace StructureHelper.Windows.ViewModels.Forces
{
IForceCombinationList combinationList;
- public IDesignForceTuple SelectedTuple { get; set; }
+ //public IDesignForceTuple SelectedTuple { get; set; }
+ public ForceTuplesViewModel DesignForces { get;}
+
public string Name
{
get => combinationList.Name;
@@ -55,11 +57,12 @@ namespace StructureHelper.Windows.ViewModels.Forces
}
}
- public IEnumerable ForceTuples { get => combinationList.DesignForces; }
+ //public IEnumerable ForceTuples { get => combinationList.DesignForces; }
public ForceCombinationViewModel(IForceCombinationList combinationList)
{
this.combinationList = combinationList;
+ DesignForces = new ForceTuplesViewModel(this.combinationList.DesignForces);
}
}
}
diff --git a/Windows/ViewModels/Forces/ForceTuplesViewModel.cs b/Windows/ViewModels/Forces/ForceTuplesViewModel.cs
new file mode 100644
index 0000000..b8e5130
--- /dev/null
+++ b/Windows/ViewModels/Forces/ForceTuplesViewModel.cs
@@ -0,0 +1,25 @@
+using StructureHelper.Properties;
+using StructureHelperCommon.Infrastructures.Enums;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public class ForceTuplesViewModel : CRUDViewModelBase
+ {
+ public override void AddMethod(object parameter)
+ {
+ NewItem = new DesignForceTuple() { LimitState=LimitStates.ULS, CalcTerm=CalcTerms.ShortTerm};
+ base.AddMethod(parameter);
+ }
+
+ public ForceTuplesViewModel(List collection) : base(collection)
+ {
+
+ }
+ }
+}
diff --git a/Windows/ViewModels/Forces/InterpolateTuplesViewModel.cs b/Windows/ViewModels/Forces/InterpolateTuplesViewModel.cs
new file mode 100644
index 0000000..0448093
--- /dev/null
+++ b/Windows/ViewModels/Forces/InterpolateTuplesViewModel.cs
@@ -0,0 +1,40 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Forces
+{
+ public class InterpolateTuplesViewModel : OkCancelViewModelBase
+ {
+ public IDesignForceTuple StartDesignForce { get; }
+ public IDesignForceTuple FinishDesignForce { get; }
+ public int StepCount { get; set; }
+
+ public InterpolateTuplesViewModel(IDesignForceTuple finishDesignForce, IDesignForceTuple startDesignForce=null, int stepCount = 100)
+ {
+ if (startDesignForce !=null)
+ {
+ if (startDesignForce.LimitState != finishDesignForce.LimitState) throw new StructureHelperException(ErrorStrings.LimitStatesIsNotValid);
+ if (startDesignForce.CalcTerm != finishDesignForce.CalcTerm) throw new StructureHelperException(ErrorStrings.LoadTermIsNotValid);
+ StartDesignForce = startDesignForce;
+ }
+ else
+ {
+ StartDesignForce = new DesignForceTuple()
+ {
+ CalcTerm = finishDesignForce.CalcTerm,
+ LimitState = finishDesignForce.LimitState,
+ ForceTuple = new ForceTuple() { Mx = 0, My = 0, Nz = 0 },
+ };
+ }
+ FinishDesignForce = finishDesignForce;
+ StepCount = stepCount;
+ }
+ }
+}
diff --git a/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs b/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
index 7aadc4c..3e7ee20 100644
--- a/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
+++ b/Windows/ViewModels/Materials/HeadMaterialsViewModel.cs
@@ -1,6 +1,7 @@
using StructureHelper.Infrastructure;
using StructureHelper.Models.Materials;
using StructureHelper.Services.Primitives;
+using StructureHelper.Windows.AddMaterialWindow;
using StructureHelper.Windows.MainWindow;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Settings;
@@ -56,6 +57,29 @@ namespace StructureHelper.Windows.ViewModels.Materials
public ICommand DeleteMaterialCommand { get; set; }
public ICommand EditHeadMaterial;
+ private RelayCommand showSafetyfactors;
+
+ public RelayCommand ShowSafetyFactors
+ {
+ get
+ {
+ return showSafetyfactors ??
+ (
+ showSafetyfactors = new RelayCommand(o =>
+ {
+ if (selectedMaterial.HelperMaterial is ILibMaterial)
+ {
+ var material = selectedMaterial.HelperMaterial as ILibMaterial;
+ var wnd = new SafetyFactorsView(material.SafetyFactors);
+ wnd.ShowDialog();
+ OnPropertyChanged(nameof(Items));
+ }
+ }, o=> SelectedLibMaterial != null
+ ));
+ }
+ }
+
+
private ICommand addElasticMaterialCommand;
public ObservableCollection HeadMaterials { get; private set; }
@@ -74,6 +98,19 @@ namespace StructureHelper.Windows.ViewModels.Materials
}
}
+ public ObservableCollection Items
+ {
+ get
+ {
+ if (selectedMaterial.HelperMaterial is ILibMaterial)
+ {
+ var material = selectedMaterial.HelperMaterial as ILibMaterial;
+ return new ObservableCollection(material.SafetyFactors);
+ }
+ else return null;
+ }
+ }
+
public string SelectedName
{
get => selectedMaterial.Name;
diff --git a/Windows/ViewModels/Materials/ISafetyFactorViewModel.cs b/Windows/ViewModels/Materials/ISafetyFactorViewModel.cs
new file mode 100644
index 0000000..1e731a4
--- /dev/null
+++ b/Windows/ViewModels/Materials/ISafetyFactorViewModel.cs
@@ -0,0 +1,15 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Materials
+{
+ internal interface ISafetyFactorViewModel : ICRUDViewModel
+ {
+ RelayCommand ShowPartialFactors { get; }
+ }
+}
diff --git a/Windows/ViewModels/Materials/PartialFactorsViewModel.cs b/Windows/ViewModels/Materials/PartialFactorsViewModel.cs
new file mode 100644
index 0000000..439ff06
--- /dev/null
+++ b/Windows/ViewModels/Materials/PartialFactorsViewModel.cs
@@ -0,0 +1,22 @@
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Materials
+{
+ internal class PartialFactorsViewModel : CRUDViewModelBase
+ {
+ public override void AddMethod(object parameter)
+ {
+ NewItem = new MaterialPartialFactor();
+ base.AddMethod(parameter);
+ }
+
+ public PartialFactorsViewModel(List safetyFactors) : base(safetyFactors)
+ {
+ }
+ }
+}
diff --git a/Windows/ViewModels/Materials/SafetyFactorsViewModel.cs b/Windows/ViewModels/Materials/SafetyFactorsViewModel.cs
new file mode 100644
index 0000000..fa6eabd
--- /dev/null
+++ b/Windows/ViewModels/Materials/SafetyFactorsViewModel.cs
@@ -0,0 +1,41 @@
+using StructureHelper.Infrastructure;
+using StructureHelper.Windows.MainWindow.Materials;
+using StructureHelperCommon.Models.Materials.Libraries;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels.Materials
+{
+ internal class SafetyFactorsViewModel : CRUDViewModelBase
+ {
+ private RelayCommand showPartialCommand;
+
+ public RelayCommand ShowPartialFactors
+ {
+ get
+ {
+ return showPartialCommand ??
+ (showPartialCommand = new RelayCommand(o =>
+ {
+ var wnd = new PartialFactorsView(SelectedItem.PartialFactors);
+ wnd.ShowDialog();
+ }, o => SelectedItem != null
+ ));
+ }
+ }
+
+ public override void AddMethod(object parameter)
+ {
+ NewItem = new MaterialSafetyFactor();
+ base.AddMethod(parameter);
+ }
+
+ public SafetyFactorsViewModel(List safetyFactors) : base(safetyFactors)
+ {
+ }
+ }
+}
diff --git a/Windows/ViewModels/OkCancelViewModelBase.cs b/Windows/ViewModels/OkCancelViewModelBase.cs
new file mode 100644
index 0000000..f74c65e
--- /dev/null
+++ b/Windows/ViewModels/OkCancelViewModelBase.cs
@@ -0,0 +1,17 @@
+using StructureHelper.Infrastructure;
+using StructureHelperCommon.Infrastructures.Exceptions;
+using StructureHelperCommon.Infrastructures.Strings;
+using StructureHelperCommon.Models.Forces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StructureHelper.Windows.ViewModels
+{
+ public abstract class OkCancelViewModelBase : ViewModelBase
+ {
+
+ }
+}
diff --git a/Windows/ViewModels/PrimitiveProperties/SelectPrimitivesViewModel.cs b/Windows/ViewModels/PrimitiveProperties/SelectPrimitivesViewModel.cs
new file mode 100644
index 0000000..3206647
--- /dev/null
+++ b/Windows/ViewModels/PrimitiveProperties/SelectPrimitivesViewModel.cs
@@ -0,0 +1,23 @@
+using StructureHelper.Infrastructure.UI.DataContexts;
+using StructureHelperLogics.NdmCalculations.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace StructureHelper.Windows.ViewModels.PrimitiveProperties
+{
+ public class SelectPrimitivesViewModel
+ {
+ public SelectItemsViewModel Items { get; }
+
+ public SelectPrimitivesViewModel(IEnumerable primitives)
+ {
+ var primitiveViews = PrimitiveOperations.ConvertNdmPrimitivesToPrimitiveBase(primitives);
+ Items = new SelectItemsViewModel(primitiveViews);
+ Items.ItemDataDemplate = Application.Current.Resources["ColoredItemTemplate"] as DataTemplate;
+ }
+ }
+}
diff --git a/Windows/ViewModels/SelectItemsViewModel.cs b/Windows/ViewModels/SelectItemsViewModel.cs
new file mode 100644
index 0000000..540029d
--- /dev/null
+++ b/Windows/ViewModels/SelectItemsViewModel.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace StructureHelper.Windows.ViewModels
+{
+ public class SelectItemsViewModel
+ where TItem : class
+ {
+ public class CollectionItem
+ {
+ public bool IsSelected { get; set; }
+ public TItem Item { get; set; }
+ }
+
+ public DataTemplate ItemDataDemplate { get; set; }
+
+ public ObservableCollection CollectionItems { get; }
+
+ public SelectItemsViewModel(IEnumerable items)
+ {
+ CollectionItems = new ObservableCollection();
+ foreach (var item in items)
+ {
+ CollectionItems.Add(new CollectionItem() { IsSelected = true, Item = item });
+ }
+ }
+ }
+}