diff --git a/DataAccess/DTOs/Converters/ForceActionToDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/ForceActionToDTOConvertStrategy.cs index f535e98..be2b13c 100644 --- a/DataAccess/DTOs/Converters/ForceActionToDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/ForceActionToDTOConvertStrategy.cs @@ -8,11 +8,11 @@ namespace DataAccess.DTOs.Converters { public class ForceActionToDTOConvertStrategy : ConvertStrategy { - private IConvertStrategy forceCombinationByFactorConvertStrategy; + private IConvertStrategy forceCombinationByFactorConvertStrategy; private IConvertStrategy forceCombinationListConvertStrategy; public ForceActionToDTOConvertStrategy( - IConvertStrategy forceCombinationByFactorConvertStrategy, + IConvertStrategy forceCombinationByFactorConvertStrategy, IConvertStrategy forceCombinationListConvertStrategy) { this.forceCombinationByFactorConvertStrategy = forceCombinationByFactorConvertStrategy; @@ -28,7 +28,7 @@ namespace DataAccess.DTOs.Converters public override IForceAction GetNewItem(IForceAction source) { - if (source is IForceCombinationByFactor forceCombinationByFactor) + if (source is IForceFactoredList forceCombinationByFactor) { return GetForceCombinationByFactor(forceCombinationByFactor); } @@ -54,11 +54,11 @@ namespace DataAccess.DTOs.Converters return forceCombination; } - private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceCombinationByFactor forceCombinationByFactor) + private ForceCombinationByFactorDTO GetForceCombinationByFactor(IForceFactoredList forceCombinationByFactor) { forceCombinationByFactorConvertStrategy.ReferenceDictionary = ReferenceDictionary; forceCombinationByFactorConvertStrategy.TraceLogger = TraceLogger; - var convertLogic = new DictionaryConvertStrategy(this, forceCombinationByFactorConvertStrategy); + var convertLogic = new DictionaryConvertStrategy(this, forceCombinationByFactorConvertStrategy); var forceCombination = convertLogic.Convert(forceCombinationByFactor); return forceCombination; } diff --git a/DataAccess/DTOs/Converters/ForceActionsFromDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/ForceActionsFromDTOConvertStrategy.cs index b7a7b98..4c7812b 100644 --- a/DataAccess/DTOs/Converters/ForceActionsFromDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/ForceActionsFromDTOConvertStrategy.cs @@ -13,18 +13,22 @@ namespace DataAccess.DTOs public class ForceActionsFromDTOConvertStrategy : ConvertStrategy { private IConvertStrategy listConvertStrategy; - private IConvertStrategy factorConvertStrategy; + private IConvertStrategy factorConvertStrategy_v1_0; + private IConvertStrategy factorConvertStrategy; public ForceActionsFromDTOConvertStrategy( IConvertStrategy listConvertStrategy, - IConvertStrategy factorConvertStrategy) + IConvertStrategy factorConvertStrategy_v1_0, + IConvertStrategy factorConvertStrategy) { this.listConvertStrategy = listConvertStrategy; + this.factorConvertStrategy_v1_0 = factorConvertStrategy_v1_0; this.factorConvertStrategy = factorConvertStrategy; } public ForceActionsFromDTOConvertStrategy() : this ( new ForceCombinationListFromDTOConvertStrategy(), + new ForceCombinationByFactorV1_0FromDTOConvertStrategy(), new ForceCombinationByFactorFromDTOConvertStrategy()) { @@ -32,6 +36,10 @@ namespace DataAccess.DTOs public override IForceAction GetNewItem(IForceAction source) { + if (source is ForceCombinationByFactorV1_0DTO combination_v1_0) + { + return Obsolete_GetForceCombination_V1_0(combination_v1_0); + } if (source is ForceCombinationByFactorDTO combination) { return GetForceCombination(combination); @@ -45,15 +53,25 @@ namespace DataAccess.DTOs throw new StructureHelperException(errorString); } + private ForceFactoredList Obsolete_GetForceCombination_V1_0(ForceCombinationByFactorV1_0DTO source) + { + TraceLogger?.AddMessage("Force action is combination by factors version 1.0 (obsolete)", TraceLogStatuses.Warning); + factorConvertStrategy_v1_0.ReferenceDictionary = ReferenceDictionary; + factorConvertStrategy_v1_0.TraceLogger = TraceLogger; + ForceFactoredList newItem = factorConvertStrategy_v1_0.Convert(source); + return newItem; + } + private IForceAction GetForceCombination(ForceCombinationByFactorDTO source) { TraceLogger?.AddMessage("Force action is combination by factors"); factorConvertStrategy.ReferenceDictionary = ReferenceDictionary; factorConvertStrategy.TraceLogger = TraceLogger; - ForceCombinationByFactor newItem = factorConvertStrategy.Convert(source); + ForceFactoredList newItem = factorConvertStrategy.Convert(source); return newItem; } + private IForceAction GetForceList(ForceCombinationListDTO forceList) { TraceLogger?.AddMessage("Force action is combination by list"); diff --git a/DataAccess/DTOs/Converters/ForceCombinationByFactorFromDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/ForceCombinationByFactorFromDTOConvertStrategy.cs index 166718e..73a56fc 100644 --- a/DataAccess/DTOs/Converters/ForceCombinationByFactorFromDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/ForceCombinationByFactorFromDTOConvertStrategy.cs @@ -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 + public class ForceCombinationByFactorFromDTOConvertStrategy : ConvertStrategy { private IUpdateStrategy baseUpdateStrategy; - private IUpdateStrategy updateStrategy; + private IUpdateStrategy updateStrategy; private IConvertStrategy pointConvertStrategy; private IConvertStrategy forceTupleConvertStrategy; public ForceCombinationByFactorFromDTOConvertStrategy( IUpdateStrategy baseUpdateStrategy, - IUpdateStrategy updateStrategy, + IUpdateStrategy updateStrategy, IConvertStrategy pointConvertStrategy, IConvertStrategy 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; } diff --git a/DataAccess/DTOs/Converters/ForceCombinationByFactorToDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/ForceCombinationByFactorToDTOConvertStrategy.cs index 3a16a43..f3c8c04 100644 --- a/DataAccess/DTOs/Converters/ForceCombinationByFactorToDTOConvertStrategy.cs +++ b/DataAccess/DTOs/Converters/ForceCombinationByFactorToDTOConvertStrategy.cs @@ -12,15 +12,15 @@ using System.Threading.Tasks; namespace DataAccess.DTOs.Converters { - public class ForceCombinationByFactorToDTOConvertStrategy : IConvertStrategy + public class ForceCombinationByFactorToDTOConvertStrategy : IConvertStrategy { - private IUpdateStrategy updateStrategy; + private IUpdateStrategy updateStrategy; private IConvertStrategy pointUpdateStrategy; private IConvertStrategy forceTupleConvertStrategy; private IUpdateStrategy baseUpdateStrategy; - public ForceCombinationByFactorToDTOConvertStrategy(IUpdateStrategy updateStrategy, + public ForceCombinationByFactorToDTOConvertStrategy(IUpdateStrategy updateStrategy, IConvertStrategy pointUpdateStrategy, IConvertStrategy convertStrategy, IUpdateStrategy baseUpdateStrategy) @@ -32,7 +32,7 @@ namespace DataAccess.DTOs.Converters } public ForceCombinationByFactorToDTOConvertStrategy() : this ( - new ForceCombinationByFactorUpdateStrategy(), + new ForceFactoredListUpdateStrategy(), new Point2DToDTOConvertStrategy(), new ForceTupleToDTOConvertStrategy(), new ForceActionBaseUpdateStrategy()) @@ -43,7 +43,7 @@ namespace DataAccess.DTOs.Converters public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; } public IShiftTraceLogger TraceLogger { get; set; } - public ForceCombinationByFactorDTO Convert(IForceCombinationByFactor source) + public ForceCombinationByFactorDTO Convert(IForceFactoredList source) { Check(); try @@ -61,7 +61,7 @@ namespace DataAccess.DTOs.Converters } - private ForceCombinationByFactorDTO GetNewForceTuple(IForceCombinationByFactor source) + private ForceCombinationByFactorDTO GetNewForceTuple(IForceFactoredList source) { ForceCombinationByFactorDTO newItem = new() { Id = source.Id }; baseUpdateStrategy.Update(newItem, source); @@ -71,18 +71,23 @@ namespace DataAccess.DTOs.Converters return newItem; } - private void GetNewFullSLSForces(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem) + private void GetNewFullSLSForces(IForceFactoredList source, ForceCombinationByFactorDTO newItem) { - if (source.FullSLSForces is not null) + if (source.ForceTuples[0] is not null) { forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary; forceTupleConvertStrategy.TraceLogger = TraceLogger; var convertForceTupleLogic = new DictionaryConvertStrategy(this, forceTupleConvertStrategy); - newItem.FullSLSForces = convertForceTupleLogic.Convert(source.FullSLSForces); + newItem.ForceTuples.Clear(); + foreach (var item in source.ForceTuples) + { + var forceTuple = convertForceTupleLogic.Convert(item); + newItem.ForceTuples.Add(forceTuple); + } } } - private void GetNewForcePoint(IForceCombinationByFactor source, ForceCombinationByFactorDTO newItem) + private void GetNewForcePoint(IForceFactoredList source, ForceCombinationByFactorDTO newItem) { if (source.ForcePoint is not null) { @@ -95,7 +100,7 @@ namespace DataAccess.DTOs.Converters private void Check() { - var checkLogic = new CheckConvertLogic(this); + var checkLogic = new CheckConvertLogic(this); checkLogic.Check(); } } diff --git a/DataAccess/DTOs/Converters/Obsolete/ForceCombinationByFactorV1_0FromDTOConvertStrategy.cs b/DataAccess/DTOs/Converters/Obsolete/ForceCombinationByFactorV1_0FromDTOConvertStrategy.cs new file mode 100644 index 0000000..891804d --- /dev/null +++ b/DataAccess/DTOs/Converters/Obsolete/ForceCombinationByFactorV1_0FromDTOConvertStrategy.cs @@ -0,0 +1,60 @@ +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; + +namespace DataAccess.DTOs +{ + public class ForceCombinationByFactorV1_0FromDTOConvertStrategy : ConvertStrategy + { + private IUpdateStrategy baseUpdateStrategy; + private IUpdateStrategy updateStrategy; + private IConvertStrategy pointConvertStrategy; + private IConvertStrategy forceTupleConvertStrategy; + + public ForceCombinationByFactorV1_0FromDTOConvertStrategy( + IUpdateStrategy baseUpdateStrategy, + IUpdateStrategy updateStrategy, + IConvertStrategy pointConvertStrategy, + IConvertStrategy forceTupleConvertStrategy) + { + this.baseUpdateStrategy = baseUpdateStrategy; + this.updateStrategy = updateStrategy; + this.pointConvertStrategy = pointConvertStrategy; + this.forceTupleConvertStrategy = forceTupleConvertStrategy; + } + + public ForceCombinationByFactorV1_0FromDTOConvertStrategy() : this( + new ForceActionBaseUpdateStrategy(), + new ForceFactoredListUpdateStrategy(), + new Point2DFromDTOConvertStrategy(), + new ForceTupleFromDTOConvertStrategy()) + { + + } + + public override ForceFactoredList GetNewItem(ForceCombinationByFactorV1_0DTO source) + { + TraceLogger.AddMessage($"Force combination by factor name = {source.Name} is starting"); + ForceFactoredList newItem = new(source.Id); + baseUpdateStrategy.Update(newItem, source); + updateStrategy.Update(newItem, source); + pointConvertStrategy.ReferenceDictionary = ReferenceDictionary; + pointConvertStrategy.TraceLogger = TraceLogger; + newItem.ForcePoint = pointConvertStrategy.Convert((Point2DDTO)source.ForcePoint); + forceTupleConvertStrategy.ReferenceDictionary = ReferenceDictionary; + forceTupleConvertStrategy.TraceLogger = TraceLogger; + var forceTuple = forceTupleConvertStrategy.Convert((ForceTupleDTO)source.ForceTuple); + newItem.ForceTuples[0] = forceTuple; + TraceLogger.AddMessage($"Force combination by factor name = {source.Name} was successfully converted from version 1.0", TraceLogStatuses.Warning); + TraceLogger.AddMessage($"Force combination by factor name = {newItem.Name} has been finished"); + return newItem; + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/ForceCombinationByFactorDTO.cs b/DataAccess/DTOs/DTOEntities/ForceCombinationByFactorDTO.cs index 35e2889..c2a56cf 100644 --- a/DataAccess/DTOs/DTOEntities/ForceCombinationByFactorDTO.cs +++ b/DataAccess/DTOs/DTOEntities/ForceCombinationByFactorDTO.cs @@ -10,26 +10,21 @@ using System.Threading.Tasks; namespace DataAccess.DTOs { - public class ForceCombinationByFactorDTO : IForceCombinationByFactor + public class ForceCombinationByFactorDTO : IForceFactoredList { [JsonProperty("Id")] public Guid Id { get; set; } [JsonProperty("Name")] public string Name { get; set; } - [JsonProperty("LimitState")] - public LimitStates LimitState { get; set; } = LimitStates.SLS; - [JsonProperty("CalcTerm")] - public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; - [JsonProperty("FullSLSForces")] - public IForceTuple FullSLSForces { get; set; } = new ForceTupleDTO(); - [JsonProperty("ULSFactor")] - public double ULSFactor { get; set; } - [JsonProperty("LongTermFactor")] - public double LongTermFactor { get; set; } + [JsonProperty("ForceTuples")] + public List ForceTuples { get; } = new(); [JsonProperty("SetInGravityCenter")] public bool SetInGravityCenter { get; set; } [JsonProperty("ForcePoint")] public IPoint2D ForcePoint { get; set; } = new Point2DDTO(); + [JsonProperty("CombinationProperty")] + public IFactoredCombinationProperty CombinationProperty { get; } = new ForceFactoredCombinationPropertyDTO(); + public object Clone() { diff --git a/DataAccess/DTOs/DTOEntities/ForceFactoredCombinationPropertyDTO.cs b/DataAccess/DTOs/DTOEntities/ForceFactoredCombinationPropertyDTO.cs new file mode 100644 index 0000000..772e5e5 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/ForceFactoredCombinationPropertyDTO.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; + +namespace DataAccess.DTOs +{ + public class ForceFactoredCombinationPropertyDTO : IFactoredCombinationProperty + { + [JsonProperty("CalctTerm")] + public CalcTerms CalcTerm { get; set; } + [JsonProperty("LimitState")] + public LimitStates LimitState { get; set; } + [JsonProperty("LongTermFactor")] + public double LongTermFactor { get; set; } + [JsonProperty("ULSFactor")] + public double ULSFactor { get; set; } + } +} diff --git a/DataAccess/DTOs/DTOEntities/Obsolete/ForceCombinationByFactorV1_0DTO.cs b/DataAccess/DTOs/DTOEntities/Obsolete/ForceCombinationByFactorV1_0DTO.cs new file mode 100644 index 0000000..b6af6d1 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/Obsolete/ForceCombinationByFactorV1_0DTO.cs @@ -0,0 +1,59 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Shapes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataAccess.DTOs +{ + public class ForceCombinationByFactorV1_0DTO : IForceFactoredList + { + [JsonProperty("Id")] + public Guid Id { get; set; } + [JsonProperty("Name")] + public string Name { get; set; } + [JsonProperty("LimitState")] + public LimitStates LimitState { get; set; } = LimitStates.SLS; + [JsonProperty("CalcTerm")] + public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; + [JsonProperty("FullSLSForces")] + public IForceTuple ForceTuple { get; set; } = new ForceTupleDTO(); + [JsonProperty("ULSFactor")] + public double ULSFactor { get; set; } + [JsonProperty("LongTermFactor")] + public double LongTermFactor { get; set; } + [JsonProperty("SetInGravityCenter")] + public bool SetInGravityCenter { get; set; } + [JsonProperty("ForcePoint")] + public IPoint2D ForcePoint { get; set; } = new Point2DDTO(); + [JsonIgnore] + public IFactoredCombinationProperty CombinationProperty => new FactoredCombinationProperty() + { + CalcTerm = CalcTerm, + LimitState = LimitState, + LongTermFactor = LongTermFactor, + ULSFactor = ULSFactor, + }; + [JsonIgnore] + public List ForceTuples => new() { ForceTuple}; + + public object Clone() + { + throw new NotImplementedException(); + } + + public IForceCombinationList GetCombination() + { + throw new NotImplementedException(); + } + + public List GetCombinations() + { + throw new NotImplementedException(); + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/TypeBinderListFactory.cs b/DataAccess/DTOs/DTOEntities/TypeBinderListFactory.cs index 6b1e819..40c4c52 100644 --- a/DataAccess/DTOs/DTOEntities/TypeBinderListFactory.cs +++ b/DataAccess/DTOs/DTOEntities/TypeBinderListFactory.cs @@ -54,8 +54,10 @@ namespace DataAccess.DTOs { (typeof(FileVersionDTO), "FileVersion") }, { (typeof(ForceCalculatorDTO), "ForceCalculator") }, { (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") }, - { (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") }, + { (typeof(ForceCombinationByFactorV1_0DTO), "ForceCombinationByFactor") }, + { (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor_v1_1") }, { (typeof(ForceCombinationListDTO), "ForceCombinationList") }, + { (typeof(ForceFactoredCombinationPropertyDTO), "ForceFactoredCombinationProperty") }, { (typeof(ForceTupleDTO), "ForceTuple") }, { (typeof(FRMaterialDTO), "FRMaterial") }, { (typeof(HeadMaterialDTO), "HeadMaterial") }, @@ -67,6 +69,7 @@ namespace DataAccess.DTOs { (typeof(List), "ListOfIDateVersion") }, { (typeof(List), "ListOfIDesignForceTuple") }, { (typeof(List), "ListOfIForceAction") }, + { (typeof(List), "ListOfIForceTuple") }, { (typeof(List), "ListOfIHeadMaterial") }, { (typeof(List), "ListOfLimitState") }, { (typeof(List), "ListOfMaterialSafetyFactor") }, diff --git a/StructureHelper/Documentation/PreviousFileVersions/V1_0.shpj b/StructureHelper/Documentation/PreviousFileVersions/V1_0.shpj new file mode 100644 index 0000000..d78fec2 --- /dev/null +++ b/StructureHelper/Documentation/PreviousFileVersions/V1_0.shpj @@ -0,0 +1,776 @@ +{ + "$id": "1", + "$type": "RootObject", + "FileVersion": { + "Id": "5d599b0f-7368-44a1-9547-51979be1b14b", + "VersionNumber": 1, + "SubVersionNumber": 0 + }, + "Project": { + "Id": "55dedceb-cac1-43bc-9f8f-1294758c4e63", + "VisualAnalyses": { + "$id": "2", + "$type": "ListOfIVisualAnalysis", + "$values": [ + { + "$id": "3", + "$type": "VisualAnalysis", + "Id": "67c5b5ef-0c5c-4f74-b41c-b06598be4302", + "Analysis": { + "$id": "4", + "$type": "CrossSectionNdmAnalysis", + "Id": "df11a5a3-30a7-4b72-a651-1774c96de3e8", + "Name": "New NDM Analysis", + "Tags": "#New group", + "VersionProcessor": { + "$id": "5", + "$type": "VersionProcessor", + "Id": "179efcec-101b-4601-b324-68eae7836b13", + "Versions": { + "$type": "ListOfIDateVersion", + "$values": [ + { + "$id": "6", + "$type": "DateVersion", + "Id": "c43f9544-c11b-413e-abf0-14fa1785fddd", + "DateTime": "2025-01-08T14:30:06.8371783+05:00", + "Comment": "", + "AnalysisVersion": { + "$id": "7", + "$type": "CrossSection", + "Id": "c5ac3299-d964-4858-afef-795c4a58e93c", + "SectionRepository": { + "$id": "8", + "$type": "CrossSectionRepository", + "Id": "2fda8944-a3b1-43b9-9015-d64697c2fc15", + "HeadMaterials": { + "$type": "ListOfIHeadMaterial", + "$values": [ + { + "$id": "9", + "$type": "HeadMaterial", + "Id": "f740fc6d-7322-4587-8663-f64716078eae", + "Name": "Concrete", + "Color": "#FFF0F8FF", + "HelperMaterial": { + "$id": "10", + "$type": "ConcreteLibMaterial", + "Id": "cb977fd6-9c21-4cbf-b1e8-a0fdcb8c4ad0", + "RelativeHumidity": 0.55, + "MinAge": 0.0, + "MaxAge": 2207520000.0, + "MaterialEntityId": "32614a91-fc85-4690-aa82-af45e00f7638", + "SafetyFactors": { + "$id": "11", + "$type": "ListOfMaterialSafetyFactor", + "$values": [ + { + "$id": "12", + "$type": "MaterialSafetyFactor", + "Id": "2a053f6d-3478-47d7-9a7a-949e6d9bfe1a", + "Name": "Gamma_b1", + "Take": true, + "Description": "Coefficient for considering long term calculations", + "PartialFactors": { + "$type": "ListOfMaterialPartialFactor", + "$values": [ + { + "$id": "13", + "$type": "MaterialPartialFactor", + "Id": "6505cfd7-ad2b-429d-a400-ad261261d83b", + "FactorValue": 0.9, + "StressState": 0, + "CalcTerm": 2, + "LimitState": 1 + }, + { + "$id": "14", + "$type": "MaterialPartialFactor", + "Id": "0304878c-5f67-44f1-86ff-ad214585f3b0", + "FactorValue": 0.9, + "StressState": 1, + "CalcTerm": 2, + "LimitState": 1 + } + ] + } + }, + { + "$id": "15", + "$type": "MaterialSafetyFactor", + "Id": "a5e0ea95-8178-496f-8023-ed0b4346a8e8", + "Name": "Gamma_b2", + "Take": false, + "Description": "Coefficient for plain concrete structures", + "PartialFactors": { + "$type": "ListOfMaterialPartialFactor", + "$values": [ + { + "$id": "16", + "$type": "MaterialPartialFactor", + "Id": "2c2f4f48-962e-4b29-9277-c59f6bc6c968", + "FactorValue": 0.9, + "StressState": 1, + "CalcTerm": 1, + "LimitState": 1 + }, + { + "$id": "17", + "$type": "MaterialPartialFactor", + "Id": "6997f48c-abda-46ca-8868-cbac83a6abbe", + "FactorValue": 0.9, + "StressState": 1, + "CalcTerm": 2, + "LimitState": 1 + } + ] + } + }, + { + "$id": "18", + "$type": "MaterialSafetyFactor", + "Id": "59f8971a-6e49-491a-8a19-5c2bf780e8d3", + "Name": "Gamma_b3", + "Take": false, + "Description": "Coefficient for considering bleeding in vertical placement conditionals", + "PartialFactors": { + "$type": "ListOfMaterialPartialFactor", + "$values": [ + { + "$id": "19", + "$type": "MaterialPartialFactor", + "Id": "2bfb1551-f804-4409-a69b-9e2124c9ca2b", + "FactorValue": 0.85, + "StressState": 1, + "CalcTerm": 1, + "LimitState": 1 + }, + { + "$id": "20", + "$type": "MaterialPartialFactor", + "Id": "24e1c5e3-31c1-46ad-af00-4abc8cc049ce", + "FactorValue": 0.85, + "StressState": 1, + "CalcTerm": 2, + "LimitState": 1 + } + ] + } + } + ] + }, + "TensionForULS": false, + "TensionForSLS": true, + "MaterialLogicId": "b97e8168-76a1-4e24-ae98-9aa38edd1e9a" + } + }, + { + "$id": "21", + "$type": "HeadMaterial", + "Id": "72a82a62-990b-470f-8c55-e36b90c42b63", + "Name": "Reinforcement", + "Color": "#FFFF0000", + "HelperMaterial": { + "$id": "22", + "$type": "ReinforcementLibMaterial", + "Id": "2766510a-6d11-4e74-ac2e-5af3302b05c1", + "MaterialEntityId": "ea422282-3465-433c-9b93-c5bbfba5a904", + "SafetyFactors": { + "$id": "23", + "$type": "ListOfMaterialSafetyFactor", + "$values": [] + }, + "MaterialLogicId": "54c4fe40-8f82-4995-8930-81e65e97edb9" + } + } + ] + }, + "ForceActions": { + "$type": "ListOfIForceAction", + "$values": [ + { + "$id": "24", + "$type": "ForceCombinationList", + "Id": "4d843776-aeaa-4362-85cb-9f47182c48c2", + "Name": "New Force Action", + "SetInGravityCenter": true, + "ForcePoint": { + "$id": "25", + "$type": "Point2D", + "Id": "ad1c1c5a-13cd-4c9e-8c33-02fc15728a1e", + "X": 0.0, + "Y": 0.0 + }, + "DesignForces": { + "$id": "26", + "$type": "ListOfIDesignForceTuple", + "$values": [ + { + "$id": "27", + "$type": "DesignForceTuple", + "Id": "18d6576d-55a3-46c2-93a0-3b84de3d8b14", + "LimitState": 1, + "CalcTerm": 1, + "ForceTuple": { + "$id": "28", + "$type": "ForceTuple", + "Id": "f67ef70f-89a6-4c74-9dab-34c8427d687f", + "Mx": -50000.0, + "My": -50000.0, + "Nz": -100000.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + { + "$id": "29", + "$type": "DesignForceTuple", + "Id": "babf37e3-4744-400e-8eef-8282c721f77a", + "LimitState": 1, + "CalcTerm": 2, + "ForceTuple": { + "$id": "30", + "$type": "ForceTuple", + "Id": "a6d7ee69-04a0-43ba-a1bb-b4726c55b327", + "Mx": -50000.0, + "My": -50000.0, + "Nz": -100000.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + { + "$id": "31", + "$type": "DesignForceTuple", + "Id": "a7e30dab-fb80-47f2-8740-e1deaf935ea6", + "LimitState": 2, + "CalcTerm": 1, + "ForceTuple": { + "$id": "32", + "$type": "ForceTuple", + "Id": "ec91dfb2-4dd1-43a4-9c55-557b6b0d2036", + "Mx": -50000.0, + "My": -50000.0, + "Nz": -100000.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + { + "$id": "33", + "$type": "DesignForceTuple", + "Id": "1dc63aa5-9c2e-4fa6-9e8a-901cb89de1af", + "LimitState": 2, + "CalcTerm": 2, + "ForceTuple": { + "$id": "34", + "$type": "ForceTuple", + "Id": "35651c76-0a86-486f-a682-3218fb98110a", + "Mx": -50000.0, + "My": -50000.0, + "Nz": -100000.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + } + ] + } + }, + { + "$id": "35", + "$type": "ForceCombinationByFactor", + "Id": "52cc2928-64d8-4b7f-a046-a77f7e974486", + "Name": "New Factored Load", + "LimitState": 2, + "CalcTerm": 1, + "FullSLSForces": { + "$id": "36", + "$type": "ForceTuple", + "Id": "81e5560b-805b-4e76-96e6-2870d7564c05", + "Mx": -100000.0, + "My": -50000.0, + "Nz": -100000.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "ULSFactor": 1.2, + "LongTermFactor": 1.0, + "SetInGravityCenter": true, + "ForcePoint": { + "$id": "37", + "$type": "Point2D", + "Id": "45052383-5ad3-45f6-9fa1-e86f3484d858", + "X": 0.0, + "Y": 0.0 + } + } + ] + }, + "Primitives": { + "$type": "ListOfINdmPrimitive", + "$values": [ + { + "$id": "38", + "$type": "RectangleNdmPrimitive", + "Id": "b245bcbe-5a40-4fcd-b908-9154324b320d", + "Name": "Concrete block", + "RectangleShape": { + "$id": "39", + "$type": "RectangleShape", + "Id": "9b918d84-5e11-43ef-ae86-82bd17def45f", + "Width": 0.4, + "Height": 0.6 + }, + "NdmElement": { + "$id": "40", + "$type": "NdmElement", + "Id": "4e625e44-3453-439e-b0bd-caaa29e297c0", + "HeadMaterial": { + "$ref": "9" + }, + "Triangulate": true, + "UsersPrestrain": { + "$id": "41", + "$type": "ForceTuple", + "Id": "fa39b8c3-9abb-44c0-82cf-7429fe9dcb11", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "AutoPrestrain": { + "$id": "42", + "$type": "ForceTuple", + "Id": "16e76225-dacd-41d6-ac21-ecdb7b3b129c", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + "VisualProperty": { + "$id": "43", + "$type": "VisualProperty", + "Id": "edd6ef74-e24f-4ef6-8db0-5a73a97e5e02", + "IsVisible": true, + "Color": "#FF03AEDC", + "SetMaterialColor": true, + "ZIndex": 0, + "Opacity": 0.8 + }, + "Center": { + "$id": "44", + "$type": "Point2D", + "Id": "8561a168-bec4-4d1d-8d9b-cfbb21d0f4e9", + "X": 0.0, + "Y": 0.0 + }, + "DivisionSize": { + "$id": "45", + "$type": "DivisionSize", + "Id": "9a630741-220d-4612-972d-9f9d8aec148c", + "NdmMaxSize": 0.01, + "NdmMinDivision": 10, + "ClearUnderlying": false + }, + "RotationAngle": 0.0 + }, + { + "$id": "46", + "$type": "RebarNdmPrimitive", + "Id": "093cd50c-fb8b-46f8-80a0-f4a1ea361066", + "Name": "Left bottom rebar", + "NdmElement": { + "$id": "47", + "$type": "NdmElement", + "Id": "aadfefb3-a5db-441b-9e39-36b4c02c502e", + "HeadMaterial": { + "$ref": "21" + }, + "Triangulate": true, + "UsersPrestrain": { + "$id": "48", + "$type": "ForceTuple", + "Id": "6149e2b1-dba1-428a-b380-cff0ed1f9396", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "AutoPrestrain": { + "$id": "49", + "$type": "ForceTuple", + "Id": "a568e17b-05d4-48eb-b421-0dabf90e80e4", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + "VisualProperty": { + "$id": "50", + "$type": "VisualProperty", + "Id": "5ba35c9f-b54c-4f41-ba3a-4e3ce8997c8a", + "IsVisible": true, + "Color": "#FFA9D85C", + "SetMaterialColor": true, + "ZIndex": 0, + "Opacity": 1.0 + }, + "Center": { + "$id": "51", + "$type": "Point2D", + "Id": "be72d90f-ef23-420a-9bf5-c91d0adfe658", + "X": -0.15000000000000002, + "Y": -0.25 + }, + "RotationAngle": 0.0, + "Area": 0.0004908738521234052, + "HostPrimitive": { + "$ref": "38" + } + }, + { + "$id": "52", + "$type": "RebarNdmPrimitive", + "Id": "ac123a80-3c5e-4d3b-bc14-26ac442f8c78", + "Name": "Right bottom rebar", + "NdmElement": { + "$id": "53", + "$type": "NdmElement", + "Id": "d2e116c1-7ba9-401c-9baf-e385da77da7e", + "HeadMaterial": { + "$ref": "21" + }, + "Triangulate": true, + "UsersPrestrain": { + "$id": "54", + "$type": "ForceTuple", + "Id": "486f1a2d-035a-4f15-8b97-f18a0522a9da", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "AutoPrestrain": { + "$id": "55", + "$type": "ForceTuple", + "Id": "0eb9a6bc-1449-40ca-aa54-93bd9c0577c1", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + "VisualProperty": { + "$id": "56", + "$type": "VisualProperty", + "Id": "b7d75d66-8917-43f7-8997-6c6c0819e2e3", + "IsVisible": true, + "Color": "#FFF52D76", + "SetMaterialColor": true, + "ZIndex": 0, + "Opacity": 1.0 + }, + "Center": { + "$id": "57", + "$type": "Point2D", + "Id": "4254382b-ae86-48cc-a7ad-4d313a25fbd3", + "X": 0.15000000000000002, + "Y": -0.25 + }, + "RotationAngle": 0.0, + "Area": 0.0004908738521234052, + "HostPrimitive": { + "$ref": "38" + } + }, + { + "$id": "58", + "$type": "RebarNdmPrimitive", + "Id": "92e1e36e-5d5c-4916-b436-2ad71d5a40cb", + "Name": "Left top rebar", + "NdmElement": { + "$id": "59", + "$type": "NdmElement", + "Id": "994c5488-0b82-4098-af82-4ecf5a152227", + "HeadMaterial": { + "$ref": "21" + }, + "Triangulate": true, + "UsersPrestrain": { + "$id": "60", + "$type": "ForceTuple", + "Id": "71e2573f-47ed-4e51-9b02-5e9d9416b767", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "AutoPrestrain": { + "$id": "61", + "$type": "ForceTuple", + "Id": "8f83d338-5745-49e5-8dfe-80585c049a37", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + "VisualProperty": { + "$id": "62", + "$type": "VisualProperty", + "Id": "6bb9b771-1fe9-4623-a321-c403cad6c4c1", + "IsVisible": true, + "Color": "#FFEFCD71", + "SetMaterialColor": true, + "ZIndex": 0, + "Opacity": 1.0 + }, + "Center": { + "$id": "63", + "$type": "Point2D", + "Id": "f5e30e3e-fae0-4aa7-8d1a-040360e0f34f", + "X": -0.15000000000000002, + "Y": 0.25 + }, + "RotationAngle": 0.0, + "Area": 0.00020106192982974677, + "HostPrimitive": { + "$ref": "38" + } + }, + { + "$id": "64", + "$type": "RebarNdmPrimitive", + "Id": "c87284be-d212-4963-b99a-43f0077c16dd", + "Name": "Right top rebar", + "NdmElement": { + "$id": "65", + "$type": "NdmElement", + "Id": "31dbdde1-579f-4463-9d7c-9cd3fa05d3cb", + "HeadMaterial": { + "$ref": "21" + }, + "Triangulate": true, + "UsersPrestrain": { + "$id": "66", + "$type": "ForceTuple", + "Id": "75da3a58-8d79-4542-a807-390feb771ec8", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + }, + "AutoPrestrain": { + "$id": "67", + "$type": "ForceTuple", + "Id": "2ca8c724-7a15-487a-a862-1bfd01fb422b", + "Mx": 0.0, + "My": 0.0, + "Nz": 0.0, + "Qx": 0.0, + "Qy": 0.0, + "Mz": 0.0 + } + }, + "VisualProperty": { + "$id": "68", + "$type": "VisualProperty", + "Id": "81826ca3-8d87-4533-afa2-417604544035", + "IsVisible": true, + "Color": "#FF279548", + "SetMaterialColor": true, + "ZIndex": 0, + "Opacity": 1.0 + }, + "Center": { + "$id": "69", + "$type": "Point2D", + "Id": "3a3c5793-7eb5-489c-9822-69c17f2ae4f1", + "X": 0.15000000000000002, + "Y": 0.25 + }, + "RotationAngle": 0.0, + "Area": 0.00020106192982974677, + "HostPrimitive": { + "$ref": "38" + } + } + ] + }, + "Calculators": { + "$type": "ListOfICalculator", + "$values": [ + { + "$id": "70", + "$type": "ForceCalculator", + "Id": "92c66a20-4754-4f29-b619-3434e936f1eb", + "Name": "New Force Calculator", + "InputData": { + "$id": "71", + "$type": "ForceCalculatorInputData", + "Id": "afcb0d3f-31af-49fd-8f8c-88d734b8f4cc", + "ForceActions": { + "$id": "72", + "$type": "ListOfIForceAction", + "$values": [ + { + "$ref": "24" + }, + { + "$ref": "35" + } + ] + }, + "Primitives": { + "$id": "73", + "$type": "ListOfINdmPrimitive", + "$values": [ + { + "$ref": "38" + }, + { + "$ref": "46" + }, + { + "$ref": "52" + }, + { + "$ref": "58" + }, + { + "$ref": "64" + } + ] + }, + "LimitStatesList": { + "$id": "74", + "$type": "ListOfLimitState", + "$values": [ + 1, + 2 + ] + }, + "CalcTermList": { + "$id": "75", + "$type": "ListOfCalcTerms", + "$values": [ + 1, + 2 + ] + }, + "Accuracy": { + "$id": "76", + "$type": "Accuracy", + "Id": "fefe3ba6-7423-4495-bba6-ee438df61d54", + "IterationAccuracy": 0.001, + "MaxIterationCount": 1000 + }, + "CompressedMember": { + "$id": "77", + "$type": "CompressedMember", + "Id": "3484631a-b429-4583-bf0c-c4f44ff2e8ee", + "Bucling": false, + "GeometryLength": 3.0, + "LengthFactorX": 1.0, + "DiagramFactorX": 1.0, + "LengthFactorY": 1.0, + "DiagramFactorY": 1.0 + } + } + }, + { + "$id": "78", + "$type": "CrackCalculator", + "Id": "de8c0c42-576d-4853-a964-6af84dcb0a79", + "Name": "New Crack Calculator", + "InputData": { + "$id": "79", + "$type": "CrackCalculatorInputData", + "Id": "7b76ed27-1db0-4dbc-89b8-08d6797174b3", + "ForceActions": { + "$id": "80", + "$type": "ListOfIForceAction", + "$values": [ + { + "$ref": "24" + }, + { + "$ref": "35" + } + ] + }, + "ForcePrimitives": { + "$id": "81", + "$type": "ListOfINdmPrimitive", + "$values": [ + { + "$ref": "38" + }, + { + "$ref": "46" + }, + { + "$ref": "52" + }, + { + "$ref": "58" + }, + { + "$ref": "64" + } + ] + }, + "UserCrackInputData": { + "$id": "82", + "$type": "UserCrackInputData", + "Id": "d06c12e1-61d5-4e73-9fdb-02050f40ba81", + "LengthBetweenCracks": 0.4, + "SetLengthBetweenCracks": true, + "SetSofteningFactors": true, + "SofteningFactors": 1.0, + "UltimateLongCrackWidths": 0.0003, + "UltimateShortCrackWidths": 0.0004 + } + } + } + ] + } + } + } + } + ] + } + }, + "Comment": "", + "Color": "#FF800000" + } + } + ] + } + } +} \ No newline at end of file diff --git a/StructureHelper/StructureHelper.csproj b/StructureHelper/StructureHelper.csproj index 8327b26..1187d8f 100644 --- a/StructureHelper/StructureHelper.csproj +++ b/StructureHelper/StructureHelper.csproj @@ -92,6 +92,7 @@ + diff --git a/StructureHelper/StructureHelper.csproj.user b/StructureHelper/StructureHelper.csproj.user index c87fe02..018a483 100644 --- a/StructureHelper/StructureHelper.csproj.user +++ b/StructureHelper/StructureHelper.csproj.user @@ -84,6 +84,9 @@ Code + + Code + Code @@ -188,6 +191,9 @@ Designer + + Designer + Designer diff --git a/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs b/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs new file mode 100644 index 0000000..75584de --- /dev/null +++ b/StructureHelper/Windows/Forces/FactoredCombinationPropertyVM.cs @@ -0,0 +1,80 @@ +using StructureHelper.Infrastructure; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace StructureHelper.Windows.Forces +{ + public class FactoredCombinationPropertyVM : ViewModelBase, IFactoredCombinationProperty + { + private IFactoredCombinationProperty sourceProperty; + + public List LimitStateList { get; set; } = new() { LimitStates.ULS, LimitStates.SLS }; + public List CalcTermList { get; set; } = new() { CalcTerms.LongTerm, CalcTerms.ShortTerm }; + + public FactoredCombinationPropertyVM(IFactoredCombinationProperty sourceProperty) + { + this.sourceProperty = sourceProperty; + } + + public double ULSFactor + { + get => sourceProperty.ULSFactor; + set + { + sourceProperty.ULSFactor = value; + OnPropertyChanged(nameof(ULSFactor)); + } + } + + public double LongTermFactor + { + get => sourceProperty.LongTermFactor; + set + { + if (value < 0d) { value = 0d; } + if (value > 1d) { value = 1d; } + sourceProperty.LongTermFactor = value; + OnPropertyChanged(nameof(LongTermFactor)); + } + } + + public CalcTerms CalcTerm + { + get + { + return sourceProperty.CalcTerm; + } + set + { + sourceProperty.CalcTerm = value; + OnPropertyChanged(nameof(CalcTerm)); + } + } + public LimitStates LimitState + { + get { return sourceProperty.LimitState; } + set + { + sourceProperty.LimitState = value; + OnPropertyChanged(nameof(LimitState)); + } + } + + internal void UpdateCombinationProperty(IFactoredCombinationProperty? newValue) + { + sourceProperty = newValue; + Refresh(); + } + + private void Refresh() + { + OnPropertyChanged(nameof(ULSFactor)); + OnPropertyChanged(nameof(LongTermFactor)); + OnPropertyChanged(nameof(CalcTerm)); + OnPropertyChanged(nameof(LimitState)); + } + } +} diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs b/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs new file mode 100644 index 0000000..be21677 --- /dev/null +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorVM.cs @@ -0,0 +1,59 @@ +using StructureHelper.Windows.ViewModels.Forces; +using StructureHelperCommon.Models.Forces; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Media3D; + +namespace StructureHelper.Windows.Forces +{ + public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo + { + IForceFactoredList forceAction; + ForceTupleVM forceTupleVM; + + public ForceTupleVM ForceTupleVM => forceTupleVM; + public IFactoredCombinationProperty CombinationProperty + { + get + { + return forceAction.CombinationProperty; + } + } + + public string Error => throw new NotImplementedException(); + + public string this[string columnName] + { + get + { + string error = null; + + //if (columnName == nameof(ULSFactor)) + //{ + // if (ULSFactor <= 0) + // { + // error = "Safety factor for ULS must be greater than zero"; + // } + //} + //if (columnName == nameof(LongTermFactor)) + //{ + // if (LongTermFactor < 0d || LongTermFactor > 1d) + // { + // error = "Long term factor must be between 0.0 and 1.0"; + // } + //} + return error; + } + } + + public ForceCombinationByFactorVM(IForceFactoredList forceAction) : base(forceAction) + { + this.forceAction = forceAction; + forceTupleVM = new ForceTupleVM(this.forceAction.ForceTuples[0]); + } + } +} diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml index f6cdd63..eb7d754 100644 --- a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml @@ -4,10 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:StructureHelper.Windows.Forces" - xmlns:vm="clr-namespace:StructureHelper.Windows.ViewModels.Forces" - d:DataContext="{d:DesignInstance vm:ForceCombinationByFactorVM}" + xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls" + d:DataContext="{d:DesignInstance local:ForceCombinationByFactorVM}" mc:Ignorable="d" - Title="Force Combination By Factor" Height="290" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> + Title="Force Combination By Factor" Height="340" Width="350" MinHeight="290" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"> @@ -17,7 +17,8 @@ - + + @@ -35,20 +36,6 @@ - - - - - - - - - - - - - - diff --git a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs index 0b1826b..bb14bfa 100644 --- a/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs +++ b/StructureHelper/Windows/Forces/ForceCombinationByFactorView.xaml.cs @@ -1,5 +1,4 @@ -using StructureHelper.Windows.ViewModels.Forces; -using StructureHelperCommon.Models.Forces; +using StructureHelperCommon.Models.Forces; using System; using System.Collections.Generic; using System.Linq; @@ -22,12 +21,13 @@ namespace StructureHelper.Windows.Forces public partial class ForceCombinationByFactorView : Window { ForceCombinationByFactorVM viewModel; - public ForceCombinationByFactorView(IForceCombinationByFactor forceCombination) + public ForceCombinationByFactorView(IForceFactoredList forceCombination) { - InitializeComponent(); viewModel = new ForceCombinationByFactorVM(forceCombination); DataContext = viewModel; viewModel.ParentWindow = this; + InitializeComponent(); + FactoredCombination.CombinationProperty = viewModel.CombinationProperty; } } } diff --git a/StructureHelper/Windows/Forces/ForceInterpolationControl.xaml.cs b/StructureHelper/Windows/Forces/ForceInterpolationControl.xaml.cs index 0a95c0c..05f924a 100644 --- a/StructureHelper/Windows/Forces/ForceInterpolationControl.xaml.cs +++ b/StructureHelper/Windows/Forces/ForceInterpolationControl.xaml.cs @@ -41,7 +41,7 @@ namespace StructureHelper.Windows.Forces private void StartValueChanged(object sender, EventArgs e) { var obj = (MultiplyDouble)sender; - var tmpTuple = ForceTupleService.MultiplyTuples(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor); + var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.StartDesignForce.ForceTuple, obj.DoubleFactor); ForceTupleService.CopyProperties(tmpTuple, Properties.StartDesignForce.ForceTuple, 1d); Properties.RefreshStartTuple(); } @@ -49,7 +49,7 @@ namespace StructureHelper.Windows.Forces private void FinishValueChanged(object sender, EventArgs e) { var obj = (MultiplyDouble)sender; - var tmpTuple = ForceTupleService.MultiplyTuples(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor); + var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.FinishDesignForce.ForceTuple, obj.DoubleFactor); ForceTupleService.CopyProperties(tmpTuple, Properties.FinishDesignForce.ForceTuple, 1d); Properties.RefreshFinishTuple(); } diff --git a/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml b/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml new file mode 100644 index 0000000..ed48a59 --- /dev/null +++ b/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml.cs b/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml.cs new file mode 100644 index 0000000..e535c60 --- /dev/null +++ b/StructureHelper/Windows/UserControls/Forces/FactoredCombination.xaml.cs @@ -0,0 +1,62 @@ +using StructureHelper.Windows.Forces; +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Models.Forces; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Controls; + +namespace StructureHelper.Windows.UserControls +{ + /// + /// Interaction logic for FactoredCombination.xaml + /// + public partial class FactoredCombination : UserControl + { + FactoredCombinationPropertyVM viewModel; + + // Registering the Dependency Property + public static readonly DependencyProperty CombinationPropertyProperty = + DependencyProperty.Register( + nameof(CombinationProperty), // Property name + typeof(IFactoredCombinationProperty), // Property type + typeof(FactoredCombination), // Owner class + new PropertyMetadata( + default(IFactoredCombinationProperty), + OnCombinationPropertyChanged // PropertyChangedCallback + ) + ); + + // CLR Wrapper + public IFactoredCombinationProperty CombinationProperty + { + get => (IFactoredCombinationProperty)GetValue(CombinationPropertyProperty); + set => SetValue(CombinationPropertyProperty, value); + } + public FactoredCombination() + { + if (CombinationProperty is not null) + { + viewModel = new(CombinationProperty); + } + else + { + viewModel = new(new FactoredCombinationProperty()); + } + DataContext = viewModel; + InitializeComponent(); + } + + private static void OnCombinationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var control = d as FactoredCombination; + var newValue = e.NewValue as IFactoredCombinationProperty; + + if (control?.viewModel != null) + { + // Update the ViewModel with the new property value + control.viewModel.UpdateCombinationProperty(newValue); + } + } + } +} diff --git a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs index 0411752..92c0b3d 100644 --- a/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs +++ b/StructureHelper/Windows/ViewModels/Forces/ActionsViewModel.cs @@ -27,7 +27,7 @@ namespace StructureHelper.Windows.ViewModels.Forces } else if (paramType == ActionType.ForceCombinationByFactor) { - NewItem = new ForceCombinationByFactor() { Name = "New Factored Combination" }; + NewItem = new ForceFactoredList() { Name = "New Factored Combination" }; } else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $": Actual type: {nameof(paramType)}"); //GlobalRepository.Actions.Create(NewItem); @@ -66,9 +66,9 @@ namespace StructureHelper.Windows.ViewModels.Forces var item = (IForceCombinationList)SelectedItem; wnd = new ForceCombinationView(item); } - else if (SelectedItem is IForceCombinationByFactor) + else if (SelectedItem is IForceFactoredList) { - var item = (IForceCombinationByFactor)SelectedItem; + var item = (IForceFactoredList)SelectedItem; wnd = new ForceCombinationByFactorView(item); } else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"actual object type: {nameof(SelectedItem)}"); diff --git a/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs b/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs deleted file mode 100644 index 3d337e8..0000000 --- a/StructureHelper/Windows/ViewModels/Forces/ForceCombinationByFactorVM.cs +++ /dev/null @@ -1,73 +0,0 @@ -using StructureHelperCommon.Models.Forces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media.Media3D; - -namespace StructureHelper.Windows.ViewModels.Forces -{ - public class ForceCombinationByFactorVM : ForceActionVMBase, IDataErrorInfo - { - IForceCombinationByFactor forceAction; - ForceTupleVM forceTupleVM; - - public double ULSFactor - { - get => forceAction.ULSFactor; - set - { - forceAction.ULSFactor = value; - OnPropertyChanged(nameof(ULSFactor)); - } - } - - public ForceTupleVM ForceTupleVM => forceTupleVM; - - public double LongTermFactor - { - get => forceAction.LongTermFactor; - set - { - if (value <0d) { value = 0d; } - if (value > 1d) { value = 1d; } - forceAction.LongTermFactor = value; - OnPropertyChanged(nameof(LongTermFactor)); - } - } - - public string Error => throw new NotImplementedException(); - - public string this[string columnName] - { - get - { - string error = null; - - if (columnName == nameof(ULSFactor)) - { - if (ULSFactor <= 0) - { - error = "Safety factor for ULS must be greater than zero"; - } - } - if (columnName == nameof(LongTermFactor)) - { - if (LongTermFactor < 0d || LongTermFactor > 1d) - { - error = "Long term factor must be between 0.0 and 1.0"; - } - } - return error; - } - } - - public ForceCombinationByFactorVM(IForceCombinationByFactor forceAction) : base(forceAction) - { - this.forceAction = forceAction; - forceTupleVM = new ForceTupleVM(forceAction.FullSLSForces); - } - } -} diff --git a/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs b/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs index 70dad36..5957f5d 100644 --- a/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs +++ b/StructureHelperCommon/Infrastructures/Settings/ProgramSetting.cs @@ -91,7 +91,7 @@ namespace StructureHelperCommon.Infrastructures.Settings return new FileVersion() { VersionNumber = 1, - SubVersionNumber = 0 + SubVersionNumber = 1 }; } } diff --git a/StructureHelperCommon/Models/Forces/ForceColumnProperty.cs b/StructureHelperCommon/Models/Forces/ColumnProperty.cs similarity index 70% rename from StructureHelperCommon/Models/Forces/ForceColumnProperty.cs rename to StructureHelperCommon/Models/Forces/ColumnProperty.cs index 201e377..0ac8d12 100644 --- a/StructureHelperCommon/Models/Forces/ForceColumnProperty.cs +++ b/StructureHelperCommon/Models/Forces/ColumnProperty.cs @@ -6,18 +6,18 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Models.Forces { - public class ForceColumnProperty : IForceColumnProperty + public class ColumnProperty : IColumnProperty { 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) + public ColumnProperty(Guid id, string columnName) { Id = id; ColumnName = columnName; } - public ForceColumnProperty(string columnName) : this(Guid.NewGuid(), columnName) + public ColumnProperty(string columnName) : this(Guid.NewGuid(), columnName) { } diff --git a/StructureHelperCommon/Models/Forces/FactoredCombinationProperty.cs b/StructureHelperCommon/Models/Forces/FactoredCombinationProperty.cs new file mode 100644 index 0000000..5addcd2 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/FactoredCombinationProperty.cs @@ -0,0 +1,17 @@ +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 FactoredCombinationProperty : IFactoredCombinationProperty + { + public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; + public LimitStates LimitState { get; set; } = LimitStates.SLS; + public double LongTermFactor { get; set; } = 1d; + public double ULSFactor { get; set; } = 1.2d; + } +} diff --git a/StructureHelperCommon/Models/Forces/ForceActionProperty.cs b/StructureHelperCommon/Models/Forces/ForceActionProperty.cs new file mode 100644 index 0000000..67a228b --- /dev/null +++ b/StructureHelperCommon/Models/Forces/ForceActionProperty.cs @@ -0,0 +1,18 @@ +using StructureHelperCommon.Models.Shapes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces +{ + /// + public class ForceActionProperty : IForceActionProperty + { + /// + public bool SetInGravityCenter { get; set; } + /// + public IPoint2D ForcePoint { get; set; } + } +} diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs b/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs deleted file mode 100644 index 59caae4..0000000 --- a/StructureHelperCommon/Models/Forces/ForceCombinationByFactor.cs +++ /dev/null @@ -1,112 +0,0 @@ -using StructureHelperCommon.Infrastructures.Enums; -using StructureHelperCommon.Infrastructures.Interfaces; -using StructureHelperCommon.Models.Shapes; -using StructureHelperCommon.Services.Forces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StructureHelperCommon.Models.Forces -{ - /// - public class ForceCombinationByFactor : IForceCombinationByFactor - { - readonly IUpdateStrategy updateStrategy = new ActionUpdateStrategy(); - private ForceCombinationList result; - private List limitStates; - private List calcTerms; - - /// - public Guid Id { get; } - /// - public string Name { get; set; } = "New Factored Load"; - /// - public LimitStates LimitState { get; set; } = LimitStates.SLS; //By default create characteristic value of forces - /// - public CalcTerms CalcTerm { get; set; } = CalcTerms.ShortTerm; //By defult use full value of load - public bool SetInGravityCenter { get; set; } = true; - /// - public IPoint2D ForcePoint { get; set; } = new Point2D(); - /// - public IForceTuple FullSLSForces { get; set; } = new ForceTuple(); - /// - public double ULSFactor { get; set; } = 1.2d; - /// - public double LongTermFactor { get; set; } = 1d; - - public ForceCombinationByFactor(Guid id) - { - Id = id; - } - public ForceCombinationByFactor() : this (Guid.NewGuid()) { } - public IForceCombinationList GetCombination() - { - GetNewResult(); - ProcessResult(); - return result; - } - - private void ProcessResult() - { - foreach (var limitState in limitStates) - { - ProcessLimitState(limitState); - } - } - - 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.ULS, LimitStates.SLS - }; - calcTerms = new List() - { - CalcTerms.ShortTerm, CalcTerms.LongTerm - }; - } - - public object Clone() - { - var newItem = new ForceCombinationByFactor(); - updateStrategy.Update(newItem, this); - return newItem; - } - - public List GetCombinations() - { - var listResult = new List - { - GetCombination() - }; - return listResult; - } - } -} diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs b/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs index e953e2f..0cdd239 100644 --- a/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs +++ b/StructureHelperCommon/Models/Forces/ForceCombinationFromFile.cs @@ -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,26 +10,24 @@ namespace StructureHelperCommon.Models.Forces { internal class ForceCombinationFromFile : IForceCombinationFromFile { + private IForceFactoredCombination factoredCombination; public Guid Id { get; set; } public string Name { get; set; } = string.Empty; public List ForceFiles { get; set; } = new(); public bool SetInGravityCenter { get; set; } = true; public IPoint2D ForcePoint { get; set; } = new Point2D(); + public IFactoredCombinationProperty CombinationProperty { get; } = new FactoredCombinationProperty(); public object Clone() { throw new NotImplementedException(); } - public IForceCombinationList GetCombination() - { - throw new NotImplementedException(); - } - public List GetCombinations() { - throw new NotImplementedException(); + factoredCombination = new ForceFactoredList(); + return factoredCombination.GetCombinations(); } } } diff --git a/StructureHelperCommon/Models/Forces/ForceCombinationList.cs b/StructureHelperCommon/Models/Forces/ForceCombinationList.cs index ad99e36..af4268a 100644 --- a/StructureHelperCommon/Models/Forces/ForceCombinationList.cs +++ b/StructureHelperCommon/Models/Forces/ForceCombinationList.cs @@ -1,11 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography.X509Certificates; -using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Enums; using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Shapes; using StructureHelperCommon.Services.Forces; +using System; +using System.Collections.Generic; +using System.Linq; namespace StructureHelperCommon.Models.Forces { @@ -18,9 +17,9 @@ namespace StructureHelperCommon.Models.Forces /// public string Name { get; set; } /// - public bool SetInGravityCenter { get; set; } + public bool SetInGravityCenter { get; set; } = true; /// - public IPoint2D ForcePoint { get; set; } + public IPoint2D ForcePoint { get; set; } = new Point2D(); /// public List DesignForces { get; set; } @@ -28,8 +27,6 @@ namespace StructureHelperCommon.Models.Forces public ForceCombinationList(Guid id) { Id = id; - SetInGravityCenter = true; - ForcePoint = new Point2D() { X = 0, Y = 0 }; DesignForces = new List { new DesignForceTuple() diff --git a/StructureHelperCommon/Models/Forces/ForceFactoredList.cs b/StructureHelperCommon/Models/Forces/ForceFactoredList.cs new file mode 100644 index 0000000..4a14a58 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/ForceFactoredList.cs @@ -0,0 +1,60 @@ +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; } = new FactoredCombinationProperty(); + + + 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()); + } + } +} diff --git a/StructureHelperCommon/Models/Forces/ForceFileProperty.cs b/StructureHelperCommon/Models/Forces/ForceFileProperty.cs index 024f073..c244c11 100644 --- a/StructureHelperCommon/Models/Forces/ForceFileProperty.cs +++ b/StructureHelperCommon/Models/Forces/ForceFileProperty.cs @@ -16,9 +16,9 @@ namespace StructureHelperCommon.Models.Forces 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 IColumnProperty Mx { get; set; } = new ColumnProperty("N"); + public IColumnProperty My { get; set; } = new ColumnProperty("My"); + public IColumnProperty Nz { get; set; } = new ColumnProperty("Mz"); public ForceFileProperty(Guid id) { diff --git a/StructureHelperCommon/Models/Forces/IForceColumnProperty.cs b/StructureHelperCommon/Models/Forces/IColumnProperty.cs similarity index 92% rename from StructureHelperCommon/Models/Forces/IForceColumnProperty.cs rename to StructureHelperCommon/Models/Forces/IColumnProperty.cs index e779605..26ddfe0 100644 --- a/StructureHelperCommon/Models/Forces/IForceColumnProperty.cs +++ b/StructureHelperCommon/Models/Forces/IColumnProperty.cs @@ -10,7 +10,7 @@ namespace StructureHelperCommon.Models.Forces /// /// Settingth for column reading from MSExcel file /// - public interface IForceColumnProperty : ISaveable + public interface IColumnProperty : ISaveable { /// /// Name of column for searching diff --git a/StructureHelperCommon/Models/Forces/IFactoredCombinationProperty.cs b/StructureHelperCommon/Models/Forces/IFactoredCombinationProperty.cs new file mode 100644 index 0000000..7060cc3 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/IFactoredCombinationProperty.cs @@ -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 +{ + /// + /// Properties of factored combination of forces + /// + public interface IFactoredCombinationProperty + { + /// + /// Term of calculation for assigned combination + /// + CalcTerms CalcTerm { get; set; } + /// + /// Limit state for assigned combination + /// + LimitStates LimitState { get; set; } + /// + /// Factor of converting of short term load to long term load + /// + double LongTermFactor { get; set; } + /// + /// Factor of converting serviceability state load to ultimate limit state load + /// + double ULSFactor { get; set; } + } +} diff --git a/StructureHelperCommon/Models/Forces/IForceAction.cs b/StructureHelperCommon/Models/Forces/IForceAction.cs index 26b9fc9..277e442 100644 --- a/StructureHelperCommon/Models/Forces/IForceAction.cs +++ b/StructureHelperCommon/Models/Forces/IForceAction.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Models.Forces { /// - /// Action as force load + /// Supports common properties of action /// public interface IForceAction : IAction { @@ -21,11 +21,9 @@ namespace StructureHelperCommon.Models.Forces /// IPoint2D ForcePoint { get; set; } /// - /// Return combination of forces + /// Return combinations of forces /// - /// - IForceCombinationList GetCombination(); - + /// List of combination of forces List GetCombinations(); } } diff --git a/StructureHelperCommon/Models/Forces/IForceActionProperty.cs b/StructureHelperCommon/Models/Forces/IForceActionProperty.cs new file mode 100644 index 0000000..94cbcb1 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/IForceActionProperty.cs @@ -0,0 +1,24 @@ +using StructureHelperCommon.Models.Shapes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces +{ + /// + /// Properties of force action + /// + public interface IForceActionProperty + { + /// + /// True means force action is put in center of gravity + /// + bool SetInGravityCenter { get; set; } + /// + /// Point of applying of force load + /// + IPoint2D ForcePoint { get; set; } + } +} diff --git a/StructureHelperCommon/Models/Forces/IForceCombinationByFactor.cs b/StructureHelperCommon/Models/Forces/IForceCombinationByFactor.cs deleted file mode 100644 index 21cdd81..0000000 --- a/StructureHelperCommon/Models/Forces/IForceCombinationByFactor.cs +++ /dev/null @@ -1,19 +0,0 @@ -using StructureHelperCommon.Infrastructures.Enums; -using StructureHelperCommon.Models.Shapes; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -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; } - } -} diff --git a/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs b/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs index c344bea..9ad6baf 100644 --- a/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs +++ b/StructureHelperCommon/Models/Forces/IForceCombinationFromFile.cs @@ -6,8 +6,14 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Models.Forces { - internal interface IForceCombinationFromFile : IForceAction + /// + /// Supports list of files which provides import of combination of forces + /// + internal interface IForceCombinationFromFile : IForceFactoredCombination { + /// + /// List of file properties for import combination + /// List ForceFiles { get; set; } } } diff --git a/StructureHelperCommon/Models/Forces/IForceFactoredCombination.cs b/StructureHelperCommon/Models/Forces/IForceFactoredCombination.cs new file mode 100644 index 0000000..75e42a1 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/IForceFactoredCombination.cs @@ -0,0 +1,15 @@ +using StructureHelperCommon.Infrastructures.Enums; + +namespace StructureHelperCommon.Models.Forces +{ + /// + /// Supports common properties of factored combination of forces + /// + public interface IForceFactoredCombination : IForceAction + { + /// + /// Properties of factored combination of forces + /// + IFactoredCombinationProperty CombinationProperty { get; } + } +} \ No newline at end of file diff --git a/StructureHelperCommon/Models/Forces/IForceFactoredList.cs b/StructureHelperCommon/Models/Forces/IForceFactoredList.cs new file mode 100644 index 0000000..e7d987f --- /dev/null +++ b/StructureHelperCommon/Models/Forces/IForceFactoredList.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace StructureHelperCommon.Models.Forces +{ + public interface IForceFactoredList : IForceFactoredCombination + { + List ForceTuples { get;} + } +} diff --git a/StructureHelperCommon/Models/Forces/IForceFileProperty.cs b/StructureHelperCommon/Models/Forces/IForceFileProperty.cs index d09b193..fe42830 100644 --- a/StructureHelperCommon/Models/Forces/IForceFileProperty.cs +++ b/StructureHelperCommon/Models/Forces/IForceFileProperty.cs @@ -19,9 +19,9 @@ namespace StructureHelperCommon.Models.Forces int SkipRowBeforeHeaderCount { get; set; } int SkipRowHeaderCount { get; set; } double GlobalFactor { get; set; } - IForceColumnProperty Mx { get; set; } - IForceColumnProperty My { get; set; } - IForceColumnProperty Nz { get; set; } + IColumnProperty Mx { get; set; } + IColumnProperty My { get; set; } + IColumnProperty Nz { get; set; } } } diff --git a/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs new file mode 100644 index 0000000..25ad9d3 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs @@ -0,0 +1,24 @@ +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.Logics +{ + public class FactoredCombinationPropertyUpdateStrategy : IUpdateStrategy + { + public void Update(IFactoredCombinationProperty targetObject, IFactoredCombinationProperty sourceObject) + { + CheckObject.IsNull(targetObject); + CheckObject.IsNull(sourceObject); + if (ReferenceEquals(targetObject, sourceObject)) { return; } + targetObject.ULSFactor = sourceObject.ULSFactor; + targetObject.LongTermFactor = sourceObject.LongTermFactor; + targetObject.CalcTerm = sourceObject.CalcTerm; + targetObject.LimitState = sourceObject.LimitState; + } + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs index f13a345..c674e80 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs @@ -16,13 +16,13 @@ namespace StructureHelperCommon.Models.Forces { private readonly IUpdateStrategy forceActionUpdateStrategy; private readonly IUpdateStrategy forcePairUpdateStrategy; - private readonly IUpdateStrategy factorUpdateStrategy; + private readonly IUpdateStrategy factorUpdateStrategy; private readonly IUpdateStrategy forceListUpdateStrategy; public ForceActionUpdateStrategy( IUpdateStrategy forceActionUpdateStrategy, IUpdateStrategy forcePairUpdateStrategy, - IUpdateStrategy factorUpdateStrategy, + IUpdateStrategy factorUpdateStrategy, IUpdateStrategy forceListUpdateStrategy) { this.forceActionUpdateStrategy = forceActionUpdateStrategy; @@ -34,7 +34,7 @@ namespace StructureHelperCommon.Models.Forces public ForceActionUpdateStrategy() : this( new ForceActionBaseUpdateStrategy(), new ForcePairUpdateStrategy(), - new ForceCombinationByFactorUpdateStrategy(), + new ForceFactoredListUpdateStrategy(), new ForceCombinationListUpdateStrategy() ) { @@ -56,9 +56,9 @@ namespace StructureHelperCommon.Models.Forces { forcePairUpdateStrategy.Update(pair, (IDesignForcePair)sourceObject); } - else if (targetObject is IForceCombinationByFactor combination) + else if (targetObject is IForceFactoredList combination) { - factorUpdateStrategy.Update(combination, (IForceCombinationByFactor)sourceObject); + factorUpdateStrategy.Update(combination, (IForceFactoredList)sourceObject); } else if (targetObject is IForceCombinationList forceCombinationList) { diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceColumnPropertyUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceColumnPropertyUpdateStrategy.cs index 93f6784..cb2e5ef 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceColumnPropertyUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceColumnPropertyUpdateStrategy.cs @@ -8,9 +8,9 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Models.Forces { - public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy + public class ForceColumnPropertyUpdateStrategy : IUpdateStrategy { - public void Update(IForceColumnProperty targetObject, IForceColumnProperty sourceObject) + public void Update(IColumnProperty targetObject, IColumnProperty sourceObject) { CheckObject.IsNull(targetObject); CheckObject.IsNull(sourceObject); diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceCombinationByFactorUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceCombinationByFactorUpdateStrategy.cs deleted file mode 100644 index 427cd71..0000000 --- a/StructureHelperCommon/Models/Forces/Logics/ForceCombinationByFactorUpdateStrategy.cs +++ /dev/null @@ -1,32 +0,0 @@ -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 ForceCombinationByFactorUpdateStrategy : IUpdateStrategy - { - private IUpdateStrategy tupleUpdateStrategy; - public ForceCombinationByFactorUpdateStrategy(IUpdateStrategy tupleUpdateStrategy) - { - this.tupleUpdateStrategy = tupleUpdateStrategy; - } - public ForceCombinationByFactorUpdateStrategy() : this(new ForceTupleUpdateStrategy()) - { - - } - public void Update(IForceCombinationByFactor targetObject, IForceCombinationByFactor sourceObject) - { - CheckObject.IsNull(targetObject); - CheckObject.IsNull(sourceObject); - if (ReferenceEquals(targetObject, sourceObject)) { return; } - tupleUpdateStrategy.Update(targetObject.FullSLSForces, sourceObject.FullSLSForces); - targetObject.ULSFactor = sourceObject.ULSFactor; - targetObject.LongTermFactor = sourceObject.LongTermFactor; - } - } -} diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceFactoredListUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceFactoredListUpdateStrategy.cs new file mode 100644 index 0000000..2582177 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/ForceFactoredListUpdateStrategy.cs @@ -0,0 +1,55 @@ +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Models.Forces.Logics; +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 ForceFactoredListUpdateStrategy : IUpdateStrategy + { + private IUpdateStrategy forceActionUpdateStrategy; + private IUpdateStrategy tupleUpdateStrategy; + private IUpdateStrategy propertyUpdateStrategy; + public ForceFactoredListUpdateStrategy + ( + IUpdateStrategy forceActionUpdateStrategy, + IUpdateStrategy tupleUpdateStrategy, + IUpdateStrategy propertyUpdateStrategy) + { + this.forceActionUpdateStrategy = forceActionUpdateStrategy; + this.tupleUpdateStrategy = tupleUpdateStrategy; + this.propertyUpdateStrategy = propertyUpdateStrategy; + } + public ForceFactoredListUpdateStrategy() : this + ( + new ForceActionBaseUpdateStrategy(), + new ForceTupleUpdateStrategy(), + new FactoredCombinationPropertyUpdateStrategy()) + { + + } + public void Update(IForceFactoredList targetObject, IForceFactoredList sourceObject) + { + CheckObject.IsNull(targetObject); + CheckObject.IsNull(sourceObject); + if (ReferenceEquals(targetObject, sourceObject)) { return; } + forceActionUpdateStrategy.Update(targetObject, sourceObject); + CheckObject.IsNull(sourceObject.CombinationProperty); + CheckObject.IsNull(targetObject.CombinationProperty); + propertyUpdateStrategy.Update(targetObject.CombinationProperty, sourceObject.CombinationProperty); + CheckObject.IsNull(sourceObject.ForceTuples); + CheckObject.IsNull(targetObject.ForceTuples); + targetObject.ForceTuples.Clear(); + foreach (var item in sourceObject.ForceTuples) + { + ForceTuple newTuple = new(); + tupleUpdateStrategy.Update(newTuple, item); + targetObject.ForceTuples.Add(newTuple); + } + } + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs index 5858df7..e65867d 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceFilePropertyUpdateStrategy.cs @@ -10,9 +10,9 @@ namespace StructureHelperCommon.Models.Forces { public class ForceFilePropertyUpdateStrategy : IUpdateStrategy { - private IUpdateStrategy columnUpdateStrategy; + private IUpdateStrategy columnUpdateStrategy; - public ForceFilePropertyUpdateStrategy(IUpdateStrategy columnUpdateStrategy) + public ForceFilePropertyUpdateStrategy(IUpdateStrategy columnUpdateStrategy) { this.columnUpdateStrategy = columnUpdateStrategy; } diff --git a/StructureHelperCommon/Models/Forces/Logics/GetCombinationByFactoredTupleLogic.cs b/StructureHelperCommon/Models/Forces/Logics/GetCombinationByFactoredTupleLogic.cs new file mode 100644 index 0000000..efcfed8 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/GetCombinationByFactoredTupleLogic.cs @@ -0,0 +1,105 @@ +using StructureHelperCommon.Infrastructures.Enums; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Interfaces; +using StructureHelperCommon.Models.Calculators; +using StructureHelperCommon.Services.Forces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces.Logics +{ + public class GetCombinationByFactoredTupleLogic : IGetCombinationByFactoredTupleLogic + { + private ForceCombinationList? result; + private IForceTuple? fullSLSTuple; + private List limitStates = new() { LimitStates.ULS, LimitStates.SLS }; + private List calcTerms = new() { CalcTerms.ShortTerm, CalcTerms.LongTerm }; + + public IForceTuple? SourceForceTuple { get; set; } + public IFactoredCombinationProperty? CombinationProperty { get; set; } + public IForceActionProperty? ForceActionProperty { get; set; } + public IForceCombinationList GetCombinationList() + { + Check(); + GetFullSLSTuple(); + GetNewResult(); + ProcessResult(); + return result; + } + + private void GetFullSLSTuple() + { + double factor = 1d; + if (CombinationProperty.CalcTerm == CalcTerms.LongTerm) + { + factor /= CombinationProperty.LongTermFactor; + } + if (CombinationProperty.LimitState == LimitStates.ULS) + { + factor /= CombinationProperty.ULSFactor; + } + fullSLSTuple = ForceTupleService.MultiplyTupleByFactor(SourceForceTuple, factor); + } + + private void Check() + { + if (SourceForceTuple is null) + { + throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(SourceForceTuple)}"); + } + if (CombinationProperty is null) + { + throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(CombinationProperty)}"); + } + if (ForceActionProperty is null) + { + throw new StructureHelperException(ErrorStrings.ParameterIsNull + $": {nameof(ForceActionProperty)}"); + } + } + + private void ProcessResult() + { + foreach (var limitState in limitStates) + { + ProcessLimitState(limitState); + } + } + + private void ProcessLimitState(LimitStates limitState) + { + var factor = limitState is LimitStates.SLS ? 1d : CombinationProperty.ULSFactor; + foreach (var calcTerm in calcTerms) + { + ProcessCalcTerm(limitState, factor, calcTerm); + } + } + + private void ProcessCalcTerm(LimitStates limitState, double stateFactor, CalcTerms calcTerm) + { + var factor = calcTerm is CalcTerms.ShortTerm ? 1d : CombinationProperty.LongTermFactor; + IForceTuple forceTuple = ForceTupleService.MultiplyTupleByFactor(fullSLSTuple, stateFactor * factor); + var designForceTuple = new DesignForceTuple + { + LimitState = limitState, + CalcTerm = calcTerm, + ForceTuple = forceTuple + }; + result.DesignForces.Add(designForceTuple); + } + + private void GetNewResult() + { + result = new() + { + SetInGravityCenter = ForceActionProperty.SetInGravityCenter, + ForcePoint = ForceActionProperty.ForcePoint + }; + result.DesignForces.Clear(); + } + + + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/IGetCombinationByFactoredTupleLogic.cs b/StructureHelperCommon/Models/Forces/Logics/IGetCombinationByFactoredTupleLogic.cs new file mode 100644 index 0000000..b007fe5 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/IGetCombinationByFactoredTupleLogic.cs @@ -0,0 +1,22 @@ +namespace StructureHelperCommon.Models.Forces.Logics +{ + /// + /// Return combinations for source combination and properties + /// + public interface IGetCombinationByFactoredTupleLogic + { + /// + /// Source combination of forces + /// + IForceTuple? SourceForceTuple { get; set; } + /// + IFactoredCombinationProperty? CombinationProperty { get; set; } + /// + IForceActionProperty? ForceActionProperty { get; set; } + /// + /// Returns combination list + /// + /// + IForceCombinationList GetCombinationList(); + } +} \ No newline at end of file diff --git a/StructureHelperCommon/Services/Forces/ForceActionService.cs b/StructureHelperCommon/Services/Forces/ForceActionService.cs index 6f91266..4401997 100644 --- a/StructureHelperCommon/Services/Forces/ForceActionService.cs +++ b/StructureHelperCommon/Services/Forces/ForceActionService.cs @@ -40,7 +40,7 @@ namespace StructureHelperCommon.Services.Forces } return resultList; } - public static List ConvertCombinationToPairs(IForceCombinationByFactor combinations) + public static List ConvertCombinationToPairs(IForceFactoredList combinations) { var resultList = new List(); var limitStates = new List() { LimitStates.ULS, LimitStates.SLS }; @@ -50,9 +50,9 @@ namespace StructureHelperCommon.Services.Forces var tuples = new IForceTuple[2]; for (int i = 0; i < calcTerms.Count; i++) { - var stateFactor = limitState is LimitStates.SLS ? 1d : combinations.ULSFactor; - var termFactor = calcTerms[i] == CalcTerms.ShortTerm ? 1d : combinations.LongTermFactor; - var forceTupleList = ForceTupleService.MultiplyTuples(combinations.FullSLSForces, stateFactor * termFactor); + var stateFactor = limitState is LimitStates.SLS ? 1d : combinations.CombinationProperty.ULSFactor; + var termFactor = calcTerms[i] == CalcTerms.ShortTerm ? 1d : combinations.CombinationProperty.LongTermFactor; + var forceTupleList = ForceTupleService.MultiplyTupleByFactor(combinations.ForceTuples[0], stateFactor * termFactor); tuples[i] = forceTupleList; } var pair = new DesignForcePair() @@ -77,9 +77,9 @@ namespace StructureHelperCommon.Services.Forces var item = forceAction as IForceCombinationList; resultList.AddRange(ConvertCombinationToPairs(item)); } - else if (forceAction is IForceCombinationByFactor) + else if (forceAction is IForceFactoredList) { - var item = forceAction as IForceCombinationByFactor; + var item = forceAction as IForceFactoredList; resultList.AddRange(ConvertCombinationToPairs(item)); } else diff --git a/StructureHelperCommon/Services/Forces/ForceTupleService.cs b/StructureHelperCommon/Services/Forces/ForceTupleService.cs index 2e51453..26683ff 100644 --- a/StructureHelperCommon/Services/Forces/ForceTupleService.cs +++ b/StructureHelperCommon/Services/Forces/ForceTupleService.cs @@ -38,10 +38,16 @@ namespace StructureHelperCommon.Services.Forces }; return result; } - public static IForceTuple MultiplyTuples(IForceTuple first, double factor) + /// + /// Multyplies force tuple by factor + /// + /// Source force tuple + /// Factor which tuple multyplies by + /// + public static IForceTuple MultiplyTupleByFactor(IForceTuple forceTuple, double factor) { - var result = GetNewTupleSameType(first); - CopyProperties(first, result, factor); + var result = GetNewTupleSameType(forceTuple); + CopyProperties(forceTuple, result, factor); return result; } public static IForceTuple InterpolateTuples(IForceTuple endTuple, IForceTuple startTuple = null, double coefficient = 0.5d) diff --git a/StructureHelperLogics/Models/Templates/CrossSections/ForceLogic.cs b/StructureHelperLogics/Models/Templates/CrossSections/ForceLogic.cs index df1b77f..564ff73 100644 --- a/StructureHelperLogics/Models/Templates/CrossSections/ForceLogic.cs +++ b/StructureHelperLogics/Models/Templates/CrossSections/ForceLogic.cs @@ -16,7 +16,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections combination.DesignForces.Clear(); combination.DesignForces.AddRange(ForceCombinationListFactory.GetDesignForces(DesignForceType.Suit_1)); combinations.Add(combination); - var factorCombination = new ForceCombinationByFactor(); + var factorCombination = new ForceFactoredList(); combinations.Add(factorCombination); return combinations; } diff --git a/StructureHelperTests/UnitTests/UpdateStrategiesTests/HasForceActionUpdateCloningStrategyTests.cs b/StructureHelperTests/UnitTests/UpdateStrategiesTests/HasForceActionUpdateCloningStrategyTests.cs index 05d8ad9..c2859cf 100644 --- a/StructureHelperTests/UnitTests/UpdateStrategiesTests/HasForceActionUpdateCloningStrategyTests.cs +++ b/StructureHelperTests/UnitTests/UpdateStrategiesTests/HasForceActionUpdateCloningStrategyTests.cs @@ -69,8 +69,8 @@ namespace StructureHelperTests.UnitTests.UpdateStrategiesTests var targetObjectMock = new Mock(); var sourceObjectMock = new Mock(); - var sourceForceActions = new List { new ForceCombinationByFactor(), new ForceCombinationByFactor() }; - var clonedForceActions = new List { new ForceCombinationByFactor(), new ForceCombinationByFactor() }; + var sourceForceActions = new List { new ForceFactoredList(), new ForceFactoredList() }; + var clonedForceActions = new List { new ForceFactoredList(), new ForceFactoredList() }; sourceObjectMock.SetupGet(s => s.ForceActions).Returns(sourceForceActions); targetObjectMock.SetupGet(t => t.ForceActions).Returns(targetForceActions);