diff --git a/DataAccess/DTOs/DTOEntities/BeamShearAnalysisDTO.cs b/DataAccess/DTOs/DTOEntities/BeamShearAnalysisDTO.cs new file mode 100644 index 0000000..e417db5 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/BeamShearAnalysisDTO.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Models.Analyses; +using StructureHelperLogics.Models.Analyses; +using System.Windows.Media; + +namespace DataAccess.DTOs.DTOEntities +{ + public class BeamShearAnalysisDTO : IBeamShearAnalysis + { + [JsonProperty("Id")] + public Guid Id { get; } + [JsonProperty("Name")] + public string Name { get; set; } + [JsonProperty("Tags")] + public string Tags { get; set; } + [JsonProperty("Comment")] + public string Comment { get; set; } = string.Empty; + [JsonProperty("Color")] + public Color Color { get; set; } + public IVersionProcessor VersionProcessor { get; set; } = new VersionProcessorDTO(); + + + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/BeamShearDTO.cs b/DataAccess/DTOs/DTOEntities/BeamShearDTO.cs new file mode 100644 index 0000000..ada2f50 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/BeamShearDTO.cs @@ -0,0 +1,19 @@ +using Newtonsoft.Json; +using StructureHelperLogics.Models.BeamShears; + +namespace DataAccess.DTOs.DTOEntities +{ + public class BeamShearDTO : IBeamShear + { + [JsonProperty("Id")] + public Guid Id { get; } + [JsonProperty("Repository")] + public IBeamShearRepository Repository { get; set; } + + + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/BeamShearRepositoryDTO.cs b/DataAccess/DTOs/DTOEntities/BeamShearRepositoryDTO.cs new file mode 100644 index 0000000..1363700 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/BeamShearRepositoryDTO.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Models.Calculators; +using StructureHelperCommon.Models.Forces; +using StructureHelperLogics.Models.BeamShears; + +namespace DataAccess.DTOs.DTOEntities +{ + public class BeamShearRepositoryDTO : IBeamShearRepository + { + [JsonProperty("Id")] + public Guid Id { get; } + [JsonProperty("Actions")] + public List Actions { get; } = new(); + [JsonProperty("Calculators")] + public List Calculators { get; } = new(); + [JsonProperty("Sections")] + public List Sections { get; } = new(); + [JsonProperty("Stirrups")] + public List Stirrups { get; } = new(); + + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/ConcentratedForceDTO.cs b/DataAccess/DTOs/DTOEntities/ConcentratedForceDTO.cs new file mode 100644 index 0000000..3fec7e7 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/ConcentratedForceDTO.cs @@ -0,0 +1,29 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Models.Forces; + +namespace DataAccess.DTOs.DTOEntities +{ + public class ConcentratedForceDTO : IConcentratedForce + { + [JsonProperty("Id")] + public Guid Id { get; } + [JsonProperty("Name")] + public string Name { get; set; } = string.Empty; + [JsonProperty("ForceValue")] + public IForceTuple ForceValue { get; set; } + [JsonProperty("ForceCoordinate")] + public double ForceCoordinate { get; set; } + [JsonProperty("RelativeLoadLevel")] + public double RelativeLoadLevel { get; set; } + [JsonProperty("LoadRatio")] + public double LoadRatio { get; set; } + [JsonProperty("CombinationProperty")] + public IFactoredCombinationProperty CombinationProperty { get; set; } + + + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/DataAccess/DTOs/DTOEntities/CrossSectionNdmAnalysisDTO.cs b/DataAccess/DTOs/DTOEntities/CrossSectionNdmAnalysisDTO.cs index 0d76d9a..494195f 100644 --- a/DataAccess/DTOs/DTOEntities/CrossSectionNdmAnalysisDTO.cs +++ b/DataAccess/DTOs/DTOEntities/CrossSectionNdmAnalysisDTO.cs @@ -1,13 +1,6 @@ using Newtonsoft.Json; -using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Models.Analyses; using StructureHelperLogic.Models.Analyses; -using StructureHelperLogics.Models.Analyses; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Media; namespace DataAccess.DTOs @@ -15,7 +8,7 @@ namespace DataAccess.DTOs public class CrossSectionNdmAnalysisDTO : ICrossSectionNdmAnalysis { [JsonProperty("Id")] - public Guid Id { get; set; } + public Guid Id { get; set;} [JsonProperty("Name")] public string Name { get; set; } [JsonProperty("Tags")] diff --git a/DataAccess/DTOs/DTOEntities/DistributedLoadDTO.cs b/DataAccess/DTOs/DTOEntities/DistributedLoadDTO.cs new file mode 100644 index 0000000..3d4d7d9 --- /dev/null +++ b/DataAccess/DTOs/DTOEntities/DistributedLoadDTO.cs @@ -0,0 +1,31 @@ +using Newtonsoft.Json; +using StructureHelperCommon.Models.Forces; + +namespace DataAccess.DTOs.DTOEntities +{ + public class DistributedLoadDTO : IDistributedLoad + { + [JsonProperty("Id")] + public Guid Id { get; } + [JsonProperty("Name")] + public string Name { get; set; } = string.Empty; + [JsonProperty("LoadValue")] + public IForceTuple LoadValue { get; set; } + [JsonProperty("StartCoordinate")] + public double StartCoordinate { get; set; } + [JsonProperty("EndCoordinate")] + public double EndCoordinate { get; set; } + [JsonProperty("RelativeLoadLevel")] + public double RelativeLoadLevel { get; set; } + [JsonProperty("LoadRatio")] + public double LoadRatio { get; set; } + [JsonProperty("CombinationProperty")] + public IFactoredCombinationProperty CombinationProperty { get; set; } + + + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs index 5680052..a2685a5 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearActionsViewModel.cs @@ -4,6 +4,7 @@ using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces.BeamShearActions; using StructureHelperLogics.Models.BeamShears; using System.Collections.Generic; +using System.Windows.Forms; namespace StructureHelper.Windows.BeamShears { @@ -36,8 +37,12 @@ namespace StructureHelper.Windows.BeamShears } public override void DeleteMethod(object parameter) { - BeamShearRepositoryService.DeleteAction(shearRepository, SelectedItem); - base.DeleteMethod(parameter); + var dialogResult = MessageBox.Show("Delete action?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dialogResult == DialogResult.Yes) + { + BeamShearRepositoryService.DeleteAction(shearRepository, SelectedItem); + base.DeleteMethod(parameter); + } } } } diff --git a/StructureHelper/Windows/BeamShears/BeamShearCalculatorsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearCalculatorsViewModel.cs index 037d7c9..f71d812 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearCalculatorsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearCalculatorsViewModel.cs @@ -10,6 +10,7 @@ using StructureHelperCommon.Models.Forces.BeamShearActions; using StructureHelperLogics.Models.BeamShears; using System; using System.Windows; +using System.Windows.Forms; using System.Windows.Input; namespace StructureHelper.Windows.BeamShears @@ -46,6 +47,15 @@ namespace StructureHelper.Windows.BeamShears base.EditMethod(parameter); } + public override void DeleteMethod(object parameter) + { + var dialogResult = System.Windows.Forms.MessageBox.Show("Delete calculator?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dialogResult == DialogResult.Yes) + { + base.DeleteMethod(parameter); + } + } + public BeamShearCalculatorsViewModel(IBeamShearRepository shearRepository) : base(shearRepository.Calculators) { this.shearRepository = shearRepository; diff --git a/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs index fc611a4..263e451 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearLoadsViewModel.cs @@ -6,6 +6,7 @@ using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Models.Forces.BeamShearActions; using System.Collections.Generic; using System.Windows; +using System.Windows.Forms; namespace StructureHelper.Windows.BeamShears { @@ -57,5 +58,13 @@ namespace StructureHelper.Windows.BeamShears } base.EditMethod(parameter); } + public override void DeleteMethod(object parameter) + { + var dialogResult = System.Windows.Forms.MessageBox.Show("Delete load?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dialogResult == DialogResult.Yes) + { + base.DeleteMethod(parameter); + } + } } } diff --git a/StructureHelper/Windows/BeamShears/BeamShearSectionsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamShearSectionsViewModel.cs index 447e3b2..bead138 100644 --- a/StructureHelper/Windows/BeamShears/BeamShearSectionsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamShearSectionsViewModel.cs @@ -6,6 +6,7 @@ using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperLogics.Models.BeamShears; using System; using System.Windows; +using System.Windows.Forms; namespace StructureHelper.Windows.BeamShears { @@ -66,8 +67,13 @@ namespace StructureHelper.Windows.BeamShears public override void DeleteMethod(object parameter) { - BeamShearRepositoryService.DeleteSection(shearRepository, SelectedItem); - base.DeleteMethod(parameter); + var dialogResult = System.Windows.Forms.MessageBox.Show("Delete stirrup?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dialogResult == DialogResult.Yes) + { + BeamShearRepositoryService.DeleteSection(shearRepository, SelectedItem); + base.DeleteMethod(parameter); + } + } } } diff --git a/StructureHelper/Windows/BeamShears/BeamStirrupsViewModel.cs b/StructureHelper/Windows/BeamShears/BeamStirrupsViewModel.cs index 8e86959..e05f259 100644 --- a/StructureHelper/Windows/BeamShears/BeamStirrupsViewModel.cs +++ b/StructureHelper/Windows/BeamShears/BeamStirrupsViewModel.cs @@ -8,6 +8,7 @@ using StructureHelperLogics.Models.BeamShears.Logics; using StructureHelperLogics.Models.Materials; using System; using System.Windows; +using System.Windows.Forms; //Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia //All rights reserved. @@ -113,8 +114,12 @@ namespace StructureHelper.Windows.BeamShears public override void DeleteMethod(object parameter) { - BeamShearRepositoryService.DeleteStirrup(shearRepository, SelectedItem); - base.DeleteMethod(parameter); + var dialogResult = System.Windows.Forms.MessageBox.Show("Delete stirrup?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (dialogResult == DialogResult.Yes) + { + BeamShearRepositoryService.DeleteStirrup(shearRepository, SelectedItem); + base.DeleteMethod(parameter); + } } } } diff --git a/StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs b/StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceCalculatorViewModel.cs similarity index 100% rename from StructureHelper/Windows/ViewModels/Calculations/Calculators/ForceCalculatorViewModel.cs rename to StructureHelper/Windows/CalculationWindows/CalculatorsViews/ForceCalculatorViews/ForceCalculatorViewModel.cs diff --git a/StructureHelperCommon/Infrastructures/Interfaces/DeepCloningStrategy.cs b/StructureHelperCommon/Infrastructures/Interfaces/DeepCloningStrategy.cs index 98edf94..9da68a7 100644 --- a/StructureHelperCommon/Infrastructures/Interfaces/DeepCloningStrategy.cs +++ b/StructureHelperCommon/Infrastructures/Interfaces/DeepCloningStrategy.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace StructureHelperCommon.Infrastructures.Interfaces { /// - /// Creates deep copy of object by dictionary (if copy of object is not created it create copy, otherwise take copy from dictionary) + /// Creates deep copy of object by dictionary (if copy of object is not created it creates copy, otherwise take copy from dictionary) /// public class DeepCloningStrategy : ICloningStrategy { diff --git a/StructureHelperCommon/Infrastructures/Interfaces/ICloneStrategy.cs b/StructureHelperCommon/Infrastructures/Interfaces/ICloneStrategy.cs index acb4a5c..40e75e4 100644 --- a/StructureHelperCommon/Infrastructures/Interfaces/ICloneStrategy.cs +++ b/StructureHelperCommon/Infrastructures/Interfaces/ICloneStrategy.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StructureHelperCommon.Infrastructures.Interfaces +namespace StructureHelperCommon.Infrastructures.Interfaces { /// /// Creates deep clone of object diff --git a/StructureHelperCommon/Infrastructures/Interfaces/ICloningStrategy.cs b/StructureHelperCommon/Infrastructures/Interfaces/ICloningStrategy.cs index daf9fef..92267fc 100644 --- a/StructureHelperCommon/Infrastructures/Interfaces/ICloningStrategy.cs +++ b/StructureHelperCommon/Infrastructures/Interfaces/ICloningStrategy.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StructureHelperCommon.Infrastructures.Interfaces +namespace StructureHelperCommon.Infrastructures.Interfaces { /// /// Interface for cloning objects diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAction.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAction.cs index b737ed9..0748518 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAction.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAction.cs @@ -15,9 +15,9 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions /// public string Name { get; set; } /// - public IFactoredForceTuple ExternalForce { get; } = new FactoredForceTuple(Guid.NewGuid()); + public IFactoredForceTuple ExternalForce { get; set; } = new FactoredForceTuple(Guid.NewGuid()); /// - public IBeamShearAxisAction SupportAction { get; } = new BeamShearAxisAction(Guid.NewGuid()); + public IBeamShearAxisAction SupportAction { get; set; } = new BeamShearAxisAction(Guid.NewGuid()); public BeamShearAction(Guid id) { @@ -26,10 +26,10 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions public object Clone() { - BeamShearAction beamShearAction = new(Guid.NewGuid()); + BeamShearAction newItem = new(Guid.NewGuid()); updateStrategy ??= new BeamShearActionUpdateStrategy(); - updateStrategy.Update(beamShearAction, this); - return beamShearAction; + updateStrategy.Update(newItem, this); + return newItem; } } } diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionCloneStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionCloneStrategy.cs new file mode 100644 index 0000000..b236a9c --- /dev/null +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionCloneStrategy.cs @@ -0,0 +1,19 @@ +using StructureHelperCommon.Infrastructures.Interfaces; +using System; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. + +namespace StructureHelperCommon.Models.Forces.BeamShearActions +{ + internal class BeamShearActionCloneStrategy : ICloneStrategy + { + private BeamShearAction targetObject; + + public IBeamShearAction GetClone(IBeamShearAction sourceObject) + { + targetObject = new(Guid.NewGuid()); + return targetObject; + } + } +} diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionUpdateStrategy.cs index aea50a2..b49a546 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearActionUpdateStrategy.cs @@ -12,6 +12,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions CheckObject.IsNull(sourceObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } targetObject.Name = sourceObject.Name; + targetObject.ExternalForce = sourceObject.ExternalForce.Clone() as IFactoredForceTuple; InitializeStrategies(); CheckObject.IsNull(sourceObject.SupportAction); CheckObject.IsNull(targetObject.SupportAction); diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionCloneStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionCloneStrategy.cs new file mode 100644 index 0000000..8006943 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionCloneStrategy.cs @@ -0,0 +1,40 @@ +using StructureHelperCommon.Infrastructures.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StructureHelperCommon.Models.Forces.BeamShearActions +{ + internal class BeamShearAxisActionCloneStrategy : ICloneStrategy + { + private ICloningStrategy cloningStrategy; + private IUpdateStrategy updateStrategy; + + public BeamShearAxisActionCloneStrategy(ICloningStrategy cloningStrategy) + { + this.cloningStrategy = cloningStrategy; + } + + private BeamShearAxisAction targetObject; + + public IBeamShearAxisAction GetClone(IBeamShearAxisAction sourceObject) + { + InitializeStrategies(); + targetObject = new(Guid.NewGuid()); + updateStrategy.Update(targetObject, sourceObject); + targetObject.ShearLoads.Clear(); + foreach (var shearLoad in sourceObject.ShearLoads) + { + targetObject.ShearLoads.Add(cloningStrategy.Clone(shearLoad)); + } + return targetObject; + } + + private void InitializeStrategies() + { + updateStrategy ??= new BeamShearAxisActionUpdateStrategy(); + } + } +} diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionUpdateStrategy.cs index 09e5367..98d0073 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/BeamShearAxisActionUpdateStrategy.cs @@ -1,11 +1,9 @@ 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; + +//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia +//All rights reserved. namespace StructureHelperCommon.Models.Forces.BeamShearActions { @@ -19,10 +17,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions if (ReferenceEquals(targetObject, sourceObject)) { return; } InitializeStrategies(); targetObject.Name = sourceObject.Name; - targetObject.SupportForce = sourceObject.SupportForce; - CheckObject.IsNull(targetObject.SupportForce.CombinationProperty); - CheckObject.IsNull(sourceObject.SupportForce.CombinationProperty); - combinationUpdateStrategy.Update(targetObject.SupportForce.CombinationProperty, sourceObject.SupportForce.CombinationProperty); + targetObject.SupportForce = sourceObject.SupportForce.Clone() as IFactoredForceTuple; CheckObject.IsNull(targetObject.ShearLoads); targetObject.ShearLoads.Clear(); CheckObject.IsNull(sourceObject.ShearLoads); diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/ConcentratedForceUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/ConcentratedForceUpdateStrategy.cs index 407870e..9fcc365 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/ConcentratedForceUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/ConcentratedForceUpdateStrategy.cs @@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions if (ReferenceEquals(targetObject, sourceObject)) { return; } InitializeStrategies(); baseUpdateStrategy.Update(targetObject, sourceObject); - targetObject.ForceValue = sourceObject.ForceValue; + targetObject.ForceValue = sourceObject.ForceValue.Clone() as IForceTuple; targetObject.ForceCoordinate = sourceObject.ForceCoordinate; } diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/DistributedLoadUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/DistributedLoadUpdateStrategy.cs index ce2692d..ea50b8d 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/DistributedLoadUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/DistributedLoadUpdateStrategy.cs @@ -13,7 +13,7 @@ namespace StructureHelperCommon.Models.Forces.BeamShearActions if (ReferenceEquals(targetObject, sourceObject)) { return; } InitializeStrategies(); baseUpdateStrategy.Update(targetObject, sourceObject); - targetObject.LoadValue = sourceObject.LoadValue; + targetObject.LoadValue = sourceObject.LoadValue.Clone() as IForceTuple; targetObject.StartCoordinate = sourceObject.StartCoordinate; targetObject.EndCoordinate = sourceObject.EndCoordinate; } diff --git a/StructureHelperCommon/Models/Forces/BeamShearActions/IBeamShearAction.cs b/StructureHelperCommon/Models/Forces/BeamShearActions/IBeamShearAction.cs index 7e97e7b..7be3ddd 100644 --- a/StructureHelperCommon/Models/Forces/BeamShearActions/IBeamShearAction.cs +++ b/StructureHelperCommon/Models/Forces/BeamShearActions/IBeamShearAction.cs @@ -17,10 +17,10 @@ namespace StructureHelperCommon.Models.Forces /// /// External force at the end of bar /// - IFactoredForceTuple ExternalForce { get; } + IFactoredForceTuple ExternalForce { get; set; } /// /// Internal loads on bar /// - IBeamShearAxisAction SupportAction { get; } + IBeamShearAxisAction SupportAction { get; set; } } } diff --git a/StructureHelperCommon/Models/Forces/DistributedLoad.cs b/StructureHelperCommon/Models/Forces/DistributedLoad.cs index 92388e0..389757c 100644 --- a/StructureHelperCommon/Models/Forces/DistributedLoad.cs +++ b/StructureHelperCommon/Models/Forces/DistributedLoad.cs @@ -42,10 +42,10 @@ namespace StructureHelperCommon.Models.Forces public object Clone() { - DistributedLoad distributedLoad = new(Guid.NewGuid()); + DistributedLoad newItem = new(Guid.NewGuid()); updateStrategy ??= new DistributedLoadUpdateStrategy(); - updateStrategy.Update(distributedLoad, this); - return distributedLoad; + updateStrategy.Update(newItem, this); + return newItem; } } } diff --git a/StructureHelperCommon/Models/Forces/FactoredForceTuple.cs b/StructureHelperCommon/Models/Forces/FactoredForceTuple.cs index fefc768..b98ddb3 100644 --- a/StructureHelperCommon/Models/Forces/FactoredForceTuple.cs +++ b/StructureHelperCommon/Models/Forces/FactoredForceTuple.cs @@ -1,13 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using StructureHelperCommon.Infrastructures.Interfaces; +using System; namespace StructureHelperCommon.Models.Forces { public class FactoredForceTuple : IFactoredForceTuple { + private IUpdateStrategy updateStrategy; + public Guid Id { get; } public IForceTuple ForceTuple { get; set; } = new ForceTuple(); public IFactoredCombinationProperty CombinationProperty { get; set; } = new FactoredCombinationProperty(Guid.NewGuid()); @@ -19,7 +18,10 @@ namespace StructureHelperCommon.Models.Forces public object Clone() { - throw new NotImplementedException(); + updateStrategy ??= new FactoredForceTupleUpdateStrategy(); + FactoredForceTuple newItem = new(Guid.NewGuid()); + updateStrategy.Update(newItem, this); + return newItem; } } } diff --git a/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs index 25ad9d3..aa69f6f 100644 --- a/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/FactoredCombinationPropertyUpdateStrategy.cs @@ -1,10 +1,5 @@ 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 { @@ -15,10 +10,10 @@ namespace StructureHelperCommon.Models.Forces.Logics CheckObject.IsNull(targetObject); CheckObject.IsNull(sourceObject); if (ReferenceEquals(targetObject, sourceObject)) { return; } + targetObject.LimitState = sourceObject.LimitState; targetObject.ULSFactor = sourceObject.ULSFactor; targetObject.LongTermFactor = sourceObject.LongTermFactor; targetObject.CalcTerm = sourceObject.CalcTerm; - targetObject.LimitState = sourceObject.LimitState; } } } diff --git a/StructureHelperCommon/Models/Forces/Logics/FactoredForceTupleUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/FactoredForceTupleUpdateStrategy.cs new file mode 100644 index 0000000..61a2015 --- /dev/null +++ b/StructureHelperCommon/Models/Forces/Logics/FactoredForceTupleUpdateStrategy.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 +{ + public class FactoredForceTupleUpdateStrategy : IUpdateStrategy + { + public void Update(IFactoredForceTuple targetObject, IFactoredForceTuple sourceObject) + { + CheckObject.IsNull(targetObject); + CheckObject.IsNull(sourceObject); + if (ReferenceEquals(targetObject, sourceObject)) { return; } + CheckObject.IsNull(sourceObject.ForceTuple); + targetObject.ForceTuple = sourceObject.ForceTuple.Clone() as IForceTuple; + CheckObject.IsNull(sourceObject.CombinationProperty); + targetObject.CombinationProperty = sourceObject.CombinationProperty.Clone() as IFactoredCombinationProperty; + } + } +} diff --git a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs index d2bf4ae..b640b13 100644 --- a/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs +++ b/StructureHelperCommon/Models/Forces/Logics/ForceActionUpdateStrategy.cs @@ -1,14 +1,6 @@ -using StructureHelperCommon.Infrastructures.Interfaces; -using StructureHelperCommon.Models.Shapes.Logics; -using StructureHelperCommon.Models.Shapes; +using StructureHelperCommon.Infrastructures.Exceptions; +using StructureHelperCommon.Infrastructures.Interfaces; using StructureHelperCommon.Services; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using StructureHelperCommon.Infrastructures.Exceptions; -using StructureHelperCommon.Models.Forces.Logics; //Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia //All rights reserved. diff --git a/StructureHelperLogics/Models/BeamShears/Logics/HasBeamShearActionUpdateStrategy.cs b/StructureHelperLogics/Models/BeamShears/Logics/HasBeamShearActionUpdateStrategy.cs index 75de505..ab86fe7 100644 --- a/StructureHelperLogics/Models/BeamShears/Logics/HasBeamShearActionUpdateStrategy.cs +++ b/StructureHelperLogics/Models/BeamShears/Logics/HasBeamShearActionUpdateStrategy.cs @@ -1,6 +1,5 @@ using StructureHelperCommon.Infrastructures.Exceptions; using StructureHelperCommon.Infrastructures.Interfaces; -using StructureHelperCommon.Models.Forces; using StructureHelperCommon.Services; namespace StructureHelperLogics.Models.BeamShears diff --git a/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs b/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs index c4cd2a3..888413c 100644 --- a/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs +++ b/StructureHelperLogics/Models/CrossSections/CrossSectionCloneStrategy.cs @@ -1,5 +1,4 @@ using StructureHelperCommon.Infrastructures.Interfaces; -using StructureHelperCommon.Infrastructures.Settings; using StructureHelperCommon.Models.WorkPlanes; using StructureHelperCommon.Services; diff --git a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurvesCalculatorInputDataCloneStrategy.cs b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurvesCalculatorInputDataCloneStrategy.cs index ed94434..83010cb 100644 --- a/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurvesCalculatorInputDataCloneStrategy.cs +++ b/StructureHelperLogics/NdmCalculations/Analyses/ByForces/LimitCurve/LimitCurvesCalculatorInputDataCloneStrategy.cs @@ -1,13 +1,8 @@ using StructureHelperCommon.Infrastructures.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces.LimitCurve { - + public class LimitCurvesCalculatorInputDataCloneStrategy : ICloneStrategy { private IUpdateStrategy updateStrategy;