Add steel material saving
This commit is contained in:
@@ -9,33 +9,20 @@ namespace DataAccess.DTOs
|
||||
public class HelperMaterialFromDTOConvertStrategy : ConvertStrategy<IHelperMaterial, IHelperMaterial>
|
||||
{
|
||||
const string MaterialIs = "Material type is: ";
|
||||
private IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> concreteConvertStrategy;
|
||||
private IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> reinforcementConvertStrategy;
|
||||
private IConvertStrategy<ElasticMaterial, ElasticMaterialDTO> elasticConvertStrategy;
|
||||
private IConvertStrategy<FRMaterial, FRMaterialDTO> frConvertStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorsFromDTOLogic());
|
||||
private IHelperMaterialFromDTOStrategyContainer strategyContainer;
|
||||
|
||||
public HelperMaterialFromDTOConvertStrategy() : this(
|
||||
new ConcreteLibMaterialFromDTOConvertStrategy(),
|
||||
new ReinforcementLibMaterialFromDTOConvertStrategy(),
|
||||
new ElasticMaterialFromDTOConvertStrategy(),
|
||||
new FRMaterialFromDTOConvertStrategy()
|
||||
)
|
||||
|
||||
private IHelperMaterialFromDTOStrategyContainer StrategyContainer => strategyContainer ??= new HelperMaterialFromDTOStrategyContainer();
|
||||
public HelperMaterialFromDTOConvertStrategy(IHelperMaterialFromDTOStrategyContainer strategyContainer)
|
||||
{
|
||||
this.strategyContainer = strategyContainer;
|
||||
}
|
||||
|
||||
public HelperMaterialFromDTOConvertStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public HelperMaterialFromDTOConvertStrategy(
|
||||
IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> concreteConvertStrategy,
|
||||
IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> reinforcementConvertStrategy,
|
||||
IConvertStrategy<ElasticMaterial, ElasticMaterialDTO> elasticConvertStrategy,
|
||||
IConvertStrategy<FRMaterial, FRMaterialDTO> frConvertStrategy)
|
||||
{
|
||||
this.concreteConvertStrategy = concreteConvertStrategy;
|
||||
this.reinforcementConvertStrategy = reinforcementConvertStrategy;
|
||||
this.elasticConvertStrategy = elasticConvertStrategy;
|
||||
this.frConvertStrategy = frConvertStrategy;
|
||||
}
|
||||
|
||||
public override IHelperMaterial GetNewItem(IHelperMaterial source)
|
||||
{
|
||||
@@ -55,6 +42,10 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
return GetElasticMaterial(elastic);
|
||||
}
|
||||
else if (source is SteelLibMaterialDTO steel)
|
||||
{
|
||||
return GetSteelMaterial(steel);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source) + ": helper material type";
|
||||
@@ -63,43 +54,58 @@ namespace DataAccess.DTOs
|
||||
}
|
||||
}
|
||||
|
||||
private IHelperMaterial GetSteelMaterial(SteelLibMaterialDTO source)
|
||||
{
|
||||
var strategy = StrategyContainer.SteelConvertStrategy;
|
||||
TraceLogger?.AddMessage(MaterialIs + "Elastic material", TraceLogStatuses.Service);
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var newItem = strategy.Convert(source);
|
||||
strategyContainer.SafetyFactorUpdateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IHelperMaterial GetElasticMaterial(ElasticMaterialDTO source)
|
||||
{
|
||||
var strategy = StrategyContainer.ElasticConvertStrategy;
|
||||
TraceLogger?.AddMessage(MaterialIs + "Elastic material", TraceLogStatuses.Service);
|
||||
elasticConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
elasticConvertStrategy.TraceLogger = TraceLogger;
|
||||
var newItem = elasticConvertStrategy.Convert(source);
|
||||
safetyFactorUpdateStrategy.Update(newItem, source);
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var newItem = strategy.Convert(source);
|
||||
strategyContainer.SafetyFactorUpdateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IHelperMaterial GetFRMaterial(FRMaterialDTO source)
|
||||
{
|
||||
var strategy = StrategyContainer.FrConvertStrategy;
|
||||
TraceLogger?.AddMessage(MaterialIs + "Fiber reinforcement material", TraceLogStatuses.Service);
|
||||
frConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
frConvertStrategy.TraceLogger = TraceLogger;
|
||||
var newItem = frConvertStrategy.Convert(source);
|
||||
safetyFactorUpdateStrategy.Update(newItem, source);
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var newItem = strategy.Convert(source);
|
||||
StrategyContainer.SafetyFactorUpdateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IHelperMaterial GetReinforcementMaterial(ReinforcementLibMaterialDTO source)
|
||||
{
|
||||
var strategy = StrategyContainer.ReinforcementConvertStrategy;
|
||||
TraceLogger?.AddMessage(MaterialIs + "Reinforcement library material", TraceLogStatuses.Service);
|
||||
reinforcementConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
reinforcementConvertStrategy.TraceLogger = TraceLogger;
|
||||
var newItem = reinforcementConvertStrategy.Convert(source);
|
||||
safetyFactorUpdateStrategy.Update(newItem, source);
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var newItem = strategy.Convert(source);
|
||||
StrategyContainer.SafetyFactorUpdateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private IHelperMaterial GetConcreteMaterial(ConcreteLibMaterialDTO source)
|
||||
{
|
||||
var strategy = StrategyContainer.ConcreteConvertStrategy;
|
||||
TraceLogger?.AddMessage(MaterialIs + "Concrete library material", TraceLogStatuses.Service);
|
||||
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
concreteConvertStrategy.TraceLogger = TraceLogger;
|
||||
var newItem = concreteConvertStrategy.Convert(source);
|
||||
safetyFactorUpdateStrategy.Update(newItem, source);
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var newItem = strategy.Convert(source);
|
||||
StrategyContainer.SafetyFactorUpdateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class HelperMaterialFromDTOStrategyContainer : IHelperMaterialFromDTOStrategyContainer
|
||||
{
|
||||
private IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> concreteConvertStrategy;
|
||||
private IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> reinforcementConvertStrategy;
|
||||
private IConvertStrategy<ElasticMaterial, ElasticMaterialDTO> elasticConvertStrategy;
|
||||
private IConvertStrategy<FRMaterial, FRMaterialDTO> frConvertStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy;
|
||||
private IConvertStrategy<SteelLibMaterial, SteelLibMaterialDTO> steelConvertStrategy;
|
||||
public IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> ConcreteConvertStrategy => concreteConvertStrategy ??= new ConcreteLibMaterialFromDTOConvertStrategy();
|
||||
public IConvertStrategy<ElasticMaterial, ElasticMaterialDTO> ElasticConvertStrategy => elasticConvertStrategy ??= new ElasticMaterialFromDTOConvertStrategy();
|
||||
public IConvertStrategy<FRMaterial, FRMaterialDTO> FrConvertStrategy => frConvertStrategy ??= new FRMaterialFromDTOConvertStrategy();
|
||||
public IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> ReinforcementConvertStrategy => reinforcementConvertStrategy ??= new ReinforcementLibMaterialFromDTOConvertStrategy();
|
||||
public IUpdateStrategy<IHelperMaterial> SafetyFactorUpdateStrategy => safetyFactorUpdateStrategy ??= new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorsFromDTOLogic());
|
||||
public IConvertStrategy<SteelLibMaterial, SteelLibMaterialDTO> SteelConvertStrategy => steelConvertStrategy ??= new SteelLibMaterialFromDTOConvertStrategy();
|
||||
}
|
||||
}
|
||||
@@ -7,35 +7,20 @@ using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
internal class HelperMaterialToDTOConvertStrategy : IConvertStrategy<IHelperMaterial, IHelperMaterial>
|
||||
public class HelperMaterialToDTOConvertStrategy : IConvertStrategy<IHelperMaterial, IHelperMaterial>
|
||||
{
|
||||
private LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
|
||||
private LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy;
|
||||
private IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> elasticConvertStrategy;
|
||||
private IConvertStrategy<FRMaterialDTO, IFRMaterial> frMaterialConvertStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorToDTOLogic());
|
||||
private IHelperMaterialToDTOStrategyContainer strategyContainer;
|
||||
private IHelperMaterialToDTOStrategyContainer StrategyContainer => strategyContainer ??= new HelperMaterialToDTOStrategyContainer();
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public HelperMaterialToDTOConvertStrategy(
|
||||
LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy,
|
||||
LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy,
|
||||
IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> elasticConvertStrategy,
|
||||
IConvertStrategy<FRMaterialDTO, IFRMaterial> frMaterialConvertStrategy)
|
||||
public HelperMaterialToDTOConvertStrategy(IHelperMaterialToDTOStrategyContainer strategyContainer)
|
||||
{
|
||||
this.concreteConvertStrategy = concreteConvertStrategy;
|
||||
this.reinforcementConvertStrategy = reinforcementConvertStrategy;
|
||||
this.elasticConvertStrategy = elasticConvertStrategy;
|
||||
this.frMaterialConvertStrategy = frMaterialConvertStrategy;
|
||||
this.strategyContainer = strategyContainer;
|
||||
}
|
||||
|
||||
public HelperMaterialToDTOConvertStrategy() : this (
|
||||
new ConcreteLibMaterialToDTOConvertStrategy(),
|
||||
new ReinforcementLibMaterialToDTOConvertStrategy(),
|
||||
new ElasticMaterialToDTOConvertStrategy(),
|
||||
new FRMaterialToDTOConvertStrategy()
|
||||
)
|
||||
public HelperMaterialToDTOConvertStrategy()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -46,7 +31,7 @@ namespace DataAccess.DTOs
|
||||
try
|
||||
{
|
||||
IHelperMaterial helperMaterial = GetMaterial(source);
|
||||
safetyFactorUpdateStrategy.Update(helperMaterial, source);
|
||||
StrategyContainer.SafetyFactorUpdateStrategy.Update(helperMaterial, source);
|
||||
return helperMaterial;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -75,14 +60,28 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
return ProcessElastic(elasticMaterial);
|
||||
}
|
||||
else if (source is ISteelLibMaterial steelLibMaterial)
|
||||
{
|
||||
return ProcessSteel(steelLibMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
|
||||
}
|
||||
}
|
||||
|
||||
private IHelperMaterial ProcessSteel(ISteelLibMaterial steelLibMaterial)
|
||||
{
|
||||
var strategy = StrategyContainer.SteelConvertStrategy;
|
||||
strategy.ReferenceDictionary = ReferenceDictionary;
|
||||
strategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<SteelLibMaterialDTO, ISteelLibMaterial>(this, strategy);
|
||||
return convertLogic.Convert(steelLibMaterial);
|
||||
}
|
||||
|
||||
private IHelperMaterial ProcessFRMaterial(IFRMaterial frMaterial)
|
||||
{
|
||||
var frMaterialConvertStrategy = StrategyContainer.FrMaterialConvertStrategy;
|
||||
frMaterialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
frMaterialConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<FRMaterialDTO, IFRMaterial>(this, frMaterialConvertStrategy);
|
||||
@@ -91,6 +90,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private IHelperMaterial ProcessElastic(IElasticMaterial elasticMaterial)
|
||||
{
|
||||
var elasticConvertStrategy = StrategyContainer.ElasticConvertStrategy;
|
||||
elasticConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
elasticConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<ElasticMaterialDTO, IElasticMaterial>(this, elasticConvertStrategy);
|
||||
@@ -99,6 +99,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private IHelperMaterial ProcessReinforcement(IReinforcementLibMaterial reinforcementMaterial)
|
||||
{
|
||||
var reinforcementConvertStrategy = StrategyContainer.ReinforcementConvertStrategy;
|
||||
reinforcementConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
reinforcementConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial>(this, reinforcementConvertStrategy);
|
||||
@@ -107,6 +108,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
private IHelperMaterial ProcessConcrete(IConcreteLibMaterial concreteLibMaterial)
|
||||
{
|
||||
var concreteConvertStrategy = StrategyContainer.ConcreteConvertStrategy;
|
||||
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
concreteConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial>(this, concreteConvertStrategy);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class HelperMaterialToDTOStrategyContainer : IHelperMaterialToDTOStrategyContainer
|
||||
{
|
||||
private LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
|
||||
private LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> reinforcementConvertStrategy;
|
||||
private LibMaterialToDTOConvertStrategy<SteelLibMaterialDTO, ISteelLibMaterial> steelConvertStrategy;
|
||||
private IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> elasticConvertStrategy;
|
||||
private IConvertStrategy<FRMaterialDTO, IFRMaterial> frMaterialConvertStrategy;
|
||||
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorToDTOLogic());
|
||||
public LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> ConcreteConvertStrategy => concreteConvertStrategy ??= new ConcreteLibMaterialToDTOConvertStrategy();
|
||||
public IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> ElasticConvertStrategy => elasticConvertStrategy ??= new ElasticMaterialToDTOConvertStrategy();
|
||||
public IConvertStrategy<FRMaterialDTO, IFRMaterial> FrMaterialConvertStrategy => frMaterialConvertStrategy ??= new FRMaterialToDTOConvertStrategy();
|
||||
public LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> ReinforcementConvertStrategy => reinforcementConvertStrategy ??= new ReinforcementLibMaterialToDTOConvertStrategy();
|
||||
public IUpdateStrategy<IHelperMaterial> SafetyFactorUpdateStrategy => safetyFactorUpdateStrategy ??= new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorToDTOLogic());
|
||||
public LibMaterialToDTOConvertStrategy<SteelLibMaterialDTO, ISteelLibMaterial> SteelConvertStrategy => steelConvertStrategy ??= new SteelLibMaterialToDTOConvertStrategy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public interface IHelperMaterialFromDTOStrategyContainer
|
||||
{
|
||||
IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> ConcreteConvertStrategy { get; }
|
||||
IConvertStrategy<ElasticMaterial, ElasticMaterialDTO> ElasticConvertStrategy { get; }
|
||||
IConvertStrategy<FRMaterial, FRMaterialDTO> FrConvertStrategy { get; }
|
||||
IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> ReinforcementConvertStrategy { get; }
|
||||
IUpdateStrategy<IHelperMaterial> SafetyFactorUpdateStrategy { get; }
|
||||
IConvertStrategy<SteelLibMaterial, SteelLibMaterialDTO> SteelConvertStrategy { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public interface IHelperMaterialToDTOStrategyContainer
|
||||
{
|
||||
LibMaterialToDTOConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> ConcreteConvertStrategy { get; }
|
||||
IConvertStrategy<ElasticMaterialDTO, IElasticMaterial> ElasticConvertStrategy { get; }
|
||||
IConvertStrategy<FRMaterialDTO, IFRMaterial> FrMaterialConvertStrategy { get; }
|
||||
LibMaterialToDTOConvertStrategy<ReinforcementLibMaterialDTO, IReinforcementLibMaterial> ReinforcementConvertStrategy { get; }
|
||||
IUpdateStrategy<IHelperMaterial> SafetyFactorUpdateStrategy { get; }
|
||||
LibMaterialToDTOConvertStrategy<SteelLibMaterialDTO, ISteelLibMaterial> SteelConvertStrategy { get; }
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,7 @@ namespace DataAccess.DTOs
|
||||
|
||||
public override ReinforcementLibMaterialDTO GetMaterialDTO(IReinforcementLibMaterial source)
|
||||
{
|
||||
ReinforcementLibMaterialDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
};
|
||||
ReinforcementLibMaterialDTO newItem = new(source.Id);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class SteelLibMaterialFromDTOConvertStrategy : ConvertStrategy<SteelLibMaterial, SteelLibMaterialDTO>
|
||||
{
|
||||
IUpdateStrategy<ISteelLibMaterial> updateStrategy;
|
||||
IUpdateStrategy<ISteelLibMaterial> UpdateStrategy => updateStrategy ??= new SteelLibMaterialUpdateStrategy();
|
||||
public override SteelLibMaterial GetNewItem(SteelLibMaterialDTO source)
|
||||
{
|
||||
ChildClass = this;
|
||||
NewItem = new(source.Id);
|
||||
UpdateStrategy.Update(NewItem, source);
|
||||
return NewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class SteelLibMaterialToDTOConvertStrategy : LibMaterialToDTOConvertStrategy<SteelLibMaterialDTO, ISteelLibMaterial>
|
||||
{
|
||||
private IUpdateStrategy<ISteelLibMaterial> updateStrategy;
|
||||
public override IUpdateStrategy<ISteelLibMaterial> UpdateStrategy => updateStrategy ??= new SteelLibMaterialUpdateStrategy();
|
||||
|
||||
public override SteelLibMaterialDTO GetMaterialDTO(ISteelLibMaterial source)
|
||||
{
|
||||
SteelLibMaterialDTO material = new(source.Id);
|
||||
return material;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,6 @@ using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
@@ -17,7 +12,9 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
const MaterialTypes materialType = MaterialTypes.Reinforcement;
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
public Guid Id { get; }
|
||||
|
||||
|
||||
[JsonProperty("MaterialEntityId")]
|
||||
public Guid MaterialEntityId
|
||||
{
|
||||
@@ -46,6 +43,10 @@ namespace DataAccess.DTOs
|
||||
[JsonIgnore]
|
||||
public List<IMaterialLogic> MaterialLogics { get; } = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
|
||||
public ReinforcementLibMaterialDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
|
||||
81
DataAccess/DTOs/DTOEntities/Materials/SteelLibMaterialDTO.cs
Normal file
81
DataAccess/DTOs/DTOEntities/Materials/SteelLibMaterialDTO.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class SteelLibMaterialDTO : ISteelLibMaterial
|
||||
{
|
||||
const MaterialTypes materialType = MaterialTypes.Steel;
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("UlsFactor")]
|
||||
public double UlsFactor { get; set; } = 1.025;
|
||||
[JsonProperty("SlsFactor")]
|
||||
public double SlsFactor { get; set; } = 1.0;
|
||||
[JsonProperty("WorkConditionFactor")]
|
||||
public double WorkConditionFactor { get; set; } = 1.0;
|
||||
[JsonProperty("ThicknessFactor")]
|
||||
public double ThicknessFactor { get; set; } = 1.0;
|
||||
[JsonProperty("MaxPlasticStrainRatio")]
|
||||
public double MaxPlasticStrainRatio { get; set; } = 3.0;
|
||||
[JsonIgnore]
|
||||
public ILibMaterialEntity MaterialEntity { get; set; }
|
||||
[JsonProperty("SafetyFactors")]
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = [];
|
||||
[JsonProperty("MaterialEntityId")]
|
||||
public Guid MaterialEntityId
|
||||
{
|
||||
get => MaterialEntity.Id;
|
||||
set
|
||||
{
|
||||
MaterialEntity = ProgramSetting.MaterialRepository.Repository.Single(x => x.Id == value);
|
||||
}
|
||||
}
|
||||
[JsonProperty("MaterialLogicId")]
|
||||
public Guid MaterialLogicId
|
||||
{
|
||||
get => MaterialLogic.Id;
|
||||
set
|
||||
{
|
||||
MaterialLogic = MaterialLogics.Single(x => x.Id == value);
|
||||
}
|
||||
}
|
||||
[JsonIgnore]
|
||||
public IMaterialLogic MaterialLogic { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<IMaterialLogic> MaterialLogics { get; } = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
|
||||
|
||||
|
||||
public SteelLibMaterialDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetCrackedLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public (double Compressive, double Tensile) GetStrength(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,7 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
||||
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||
{ (typeof(SteelLibMaterialDTO), "SteelLibMaterial") },
|
||||
};
|
||||
return newList;
|
||||
}
|
||||
|
||||
@@ -99,14 +99,12 @@
|
||||
</Style>
|
||||
|
||||
<Color x:Key="ButtonLight" A="255" B="255" G="255" R="255"/>
|
||||
<Color x:Key="CalculatorColor" A="255" B="149" G="149" R="211"/>
|
||||
<Color x:Key="CalculatorFrameColor" A="255" B="109" G="109" R="166"/>
|
||||
|
||||
<Color x:Key="PrimitiveColor" A="255" B="190" G="120" R="120"/>
|
||||
<Color x:Key="ResultColor" A="255" B="200" G="200" R="200"/>
|
||||
<Color x:Key="ResultFrameColor" A="255" B="100" G="100" R="100"/>
|
||||
<SolidColorBrush x:Key="CalculatorCanvas" Color="{DynamicResource CalculatorColor}"/>
|
||||
|
||||
<SolidColorBrush x:Key="PrimitiveCanvas" Color="{DynamicResource PrimitiveColor}"/>
|
||||
<SolidColorBrush x:Key="CalculatorFrame" Color="{DynamicResource CalculatorFrameColor}"/>
|
||||
<SolidColorBrush x:Key="ResultCanvas" Color="{DynamicResource ResultColor}"/>
|
||||
<SolidColorBrush x:Key="ResultFrame" Color="{DynamicResource ResultFrameColor}"/>
|
||||
|
||||
@@ -116,9 +114,7 @@
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style x:Key="ButtonCalculatorCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||
<Setter Property="Background" Value="{DynamicResource CalculatorCanvas}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ButtonPrimitiveCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||
<Setter Property="Background" Value="{DynamicResource PrimitiveCanvas}"/>
|
||||
</Style>
|
||||
@@ -163,7 +159,7 @@
|
||||
<DataTemplate x:Key="Back">
|
||||
<Path Margin="4" Data="M -1 18 l 2 -9 l 1 3 a 15 15 90 0 1 22 -3 l -2 4 a 13 13 90 0 0 -18 2 l 3 3 z" Fill="White" Stroke="Black"/>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="BeamShear">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -174,7 +170,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="BeamShearInclinedSection">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -184,16 +180,18 @@
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ButtonCalculatorRectangle">
|
||||
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource CalculatorFrame}">
|
||||
|
||||
<DataTemplate x:Key="ButtonMaterialRectangle">
|
||||
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource MaterialFrame}">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="{DynamicResource ButtonLight}" Offset="0.2"/>
|
||||
<GradientStop Color="{DynamicResource CalculatorColor}" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource MaterialColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ButtonResultRectangle">
|
||||
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource ResultFrame}">
|
||||
<Rectangle.Fill>
|
||||
@@ -204,15 +202,7 @@
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CalculatorRun">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Margin="4" Data="M 4 2 l 12 10 l -12 10 l 0 -20" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ConcentratedForce">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -224,22 +214,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CrackCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Margin="4" Data="M 0 0 l 25 0 l 0 20
|
||||
l -4 0
|
||||
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||
l -3 0
|
||||
l 0 -5 l 0 -10 l -2 10 l -2 5
|
||||
l -3 0
|
||||
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||
l -4 0" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<TextBlock Margin="4,2,0,0" Text="Crc" Foreground="White" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CopyToClipboard">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -267,19 +242,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CurvatureCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Data="M 6 16 a 10 15 90 0 0 20 0 l 2 5 a 7 15 90 0 1 -24 0 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Data="M 4 18 a 8 15 90 0 0 24 0" Stroke="Black" StrokeThickness="0.5"/>
|
||||
<Line X1="16" Y1="5" X2="12" Y2="21" Stroke="Black"/>
|
||||
<Line X1="11" Y1="15" X2="12" Y2="21" Stroke="Black"/>
|
||||
<Line X1="16" Y1="16" X2="12" Y2="21" Stroke="Black"/>
|
||||
<TextBlock FontSize="8" Text="R" FontWeight="Bold" Margin="17,3,0,0"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DeSelectAll">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -297,17 +260,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="DiagramCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Line Margin="4" X1="0" Y1="20" X2="25" Y2="20" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<Line Margin="4" X1="4" Y1="0" X2="4" Y2="25" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Margin="4" Data="M 0 5 l 4 -4 l 7 4 l 7 6 l 2 4 l -2 7 l -2 2 " Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<TextBlock Margin="4,2,0,0" Text="M-N" Foreground="Black" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DistributedLoad">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -777,6 +730,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="StepSolution">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
@@ -911,16 +865,7 @@
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="ValueDiagramCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Data="M 12 6 h 12 v 6 l -12 6 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Data="M 12 26 h -6 v -4 l 6 -5 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Line X1="12" Y1="5" X2="12" Y2="26" Stroke="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ValuePointDiagram">
|
||||
<Canvas Style="{DynamicResource ButtonResultCanvas}">
|
||||
<Canvas.Children>
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Color x:Key="CalculatorColor" A="255" B="149" G="149" R="211"/>
|
||||
<Color x:Key="CalculatorFrameColor" A="255" B="109" G="109" R="166"/>
|
||||
|
||||
<SolidColorBrush x:Key="CalculatorCanvas" Color="{DynamicResource CalculatorColor}"/>
|
||||
<SolidColorBrush x:Key="CalculatorFrame" Color="{DynamicResource CalculatorFrameColor}"/>
|
||||
|
||||
<Style x:Key="ButtonCalculatorCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||
<Setter Property="Background" Value="{DynamicResource CalculatorCanvas}"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="ButtonCalculatorRectangle">
|
||||
<Rectangle Style="{DynamicResource ButtonRect}" Stroke="{DynamicResource CalculatorFrame}">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="{DynamicResource ButtonLight}" Offset="0.2"/>
|
||||
<GradientStop Color="{DynamicResource CalculatorColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CalculatorRun">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Margin="4" Data="M 4 2 l 12 10 l -12 10 l 0 -20" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CrackCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Margin="4" Data="M 0 0 l 25 0 l 0 20
|
||||
l -4 0
|
||||
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||
l -3 0
|
||||
l 0 -5 l 0 -10 l -2 10 l -2 5
|
||||
l -3 0
|
||||
l -1 -5 l 1 -5 l -2 5 l -2 5
|
||||
l -4 0" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<TextBlock Margin="4,2,0,0" Text="Crc" Foreground="White" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="CurvatureCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Data="M 6 16 a 10 15 90 0 0 20 0 l 2 5 a 7 15 90 0 1 -24 0 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Data="M 4 18 a 8 15 90 0 0 24 0" Stroke="Black" StrokeThickness="0.5"/>
|
||||
<Line X1="16" Y1="5" X2="12" Y2="21" Stroke="Black"/>
|
||||
<Line X1="11" Y1="15" X2="12" Y2="21" Stroke="Black"/>
|
||||
<Line X1="16" Y1="16" X2="12" Y2="21" Stroke="Black"/>
|
||||
<TextBlock FontSize="8" Text="R" FontWeight="Bold" Margin="17,3,0,0"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DiagramCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Line Margin="4" X1="0" Y1="20" X2="25" Y2="20" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<Line Margin="4" X1="4" Y1="0" X2="4" Y2="25" StrokeThickness="1.5" Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Margin="4" Data="M 0 5 l 4 -4 l 7 4 l 7 6 l 2 4 l -2 7 l -2 2 " Stroke="{DynamicResource CalculatorFrame}"/>
|
||||
<TextBlock Margin="4,2,0,0" Text="M-N" Foreground="Black" FontSize="10" HorizontalAlignment="Stretch" FontWeight="Bold" />
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ValueDiagramCalculator">
|
||||
<Canvas Style="{DynamicResource ButtonCalculatorCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonCalculatorRectangle}"/>
|
||||
<Path Data="M 12 6 h 12 v 6 l -12 6 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Path Data="M 12 26 h -6 v -4 l 6 -5 z" Fill="{DynamicResource CalculatorFrame}"/>
|
||||
<Line X1="12" Y1="5" X2="12" Y2="26" Stroke="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,151 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Color x:Key="MaterialColor" A="255" B="149" G="149" R="50"/>
|
||||
<Color x:Key="MaterialFrameColor" A="255" B="100" G="100" R="0"/>
|
||||
|
||||
<SolidColorBrush x:Key="MaterialCanvas" Color="{DynamicResource MaterialColor}"/>
|
||||
<SolidColorBrush x:Key="MaterialFrame" Color="{DynamicResource MaterialFrameColor}"/>
|
||||
|
||||
<Style x:Key="ButtonMaterialCanvas" TargetType="Canvas" BasedOn="{StaticResource ButtonCanvas}">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialCanvas}"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DashedLine" TargetType="Line">
|
||||
<Setter Property="StrokeThickness" Value="0.5"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DashedConcreteLine" TargetType="Line" BasedOn="{StaticResource DashedLine}">
|
||||
<Setter Property="StrokeDashArray" Value="10 4 1 4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DashedCarbonLine" TargetType="Line" BasedOn="{StaticResource DashedLine}">
|
||||
<Setter Property="StrokeDashArray" Value="1 1"/>
|
||||
<Setter Property="StrokeThickness" Value="2"/>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="CarbonFiberMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="3" Y1="10" X2="10" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="3" Y1="15" X2="15" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="3" Y1="20" X2="20" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="3" Y1="25" X2="25" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="4" Y1="29" X2="29" Y2="4" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="9" Y1="29" X2="29" Y2="9" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="14" Y1="29" X2="29" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="19" Y1="29" X2="29" Y2="19" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedCarbonLine}" X1="24" Y1="29" X2="29" Y2="24" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<TextBlock FontSize="10" Text="FRP" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ConcreteMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="10" X2="10" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="15" X2="15" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="20" X2="20" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="25" X2="25" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="4" Y1="29" X2="29" Y2="4" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="9" Y1="29" X2="29" Y2="9" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="14" Y1="29" X2="29" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="19" Y1="29" X2="29" Y2="19" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="24" Y1="29" X2="29" Y2="24" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<TextBlock FontSize="10" Text="Con" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ElasticMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line X1="16" Y1="5" X2="16" Y2="27" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line X1="5" Y1="16" X2="27" Y2="16" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line X1="5" Y1="27" X2="27" Y2="5" Stroke="{StaticResource MaterialFrame}" StrokeThickness="0.5"/>
|
||||
<TextBlock FontSize="10" Text="Elast" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="GlassFiberMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="10" X2="10" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="15" X2="15" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="20" X2="20" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="8" Y1="24" X2="11" Y2="17" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="11" Y1="17" X2="17" Y2="15" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="17" Y1="15" X2="23" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="17" Y1="15" X2="16" Y2="10" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="14" Y1="29" X2="29" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="19" Y1="29" X2="29" Y2="19" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="24" Y1="29" X2="29" Y2="24" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<TextBlock FontSize="10" Text="GFR" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="Materials">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Ellipse Height="12" Width="12" Canvas.Left="7" Canvas.Top="10" Stroke="{StaticResource MaterialFrame}" >
|
||||
<Ellipse.Fill>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="{StaticResource MaterialFrameColor}"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
<Line X1="18" Y1="19.5" X2="25" Y2="25" Stroke="{StaticResource MaterialFrame}" StrokeThickness="1"/>
|
||||
<TextBlock FontSize="10" Text="Prop" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ReinforcementMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="10" X2="10" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="15" X2="15" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="20" X2="20" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="3" Y1="25" X2="25" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="4" Y1="29" X2="29" Y2="4" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="9" Y1="29" X2="29" Y2="9" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="14" Y1="29" X2="29" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="19" Y1="29" X2="29" Y2="19" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedConcreteLine}" X1="24" Y1="29" X2="29" Y2="24" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Ellipse Height="6" Width="6" Canvas.Top="20" Canvas.Left="6" Fill="{StaticResource MaterialFrame}"/>
|
||||
<Ellipse Height="6" Width="6" Canvas.Top="20" Canvas.Left="13.5" Fill="{StaticResource MaterialFrame}"/>
|
||||
<Ellipse Height="6" Width="6" Canvas.Top="20" Canvas.Left="21" Fill="{StaticResource MaterialFrame}"/>
|
||||
<TextBlock FontSize="10" Text="Rf" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SteelMaterial">
|
||||
<Canvas Style="{DynamicResource ButtonMaterialCanvas}">
|
||||
<Canvas.Children>
|
||||
<ContentControl ContentTemplate="{DynamicResource ButtonMaterialRectangle}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="10" X2="10" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="15" X2="15" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="20" X2="20" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="3" Y1="25" X2="25" Y2="3" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="4" Y1="29" X2="29" Y2="4" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="9" Y1="29" X2="29" Y2="9" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="14" Y1="29" X2="29" Y2="14" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="19" Y1="29" X2="29" Y2="19" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<Line Style="{StaticResource DashedLine}" X1="24" Y1="29" X2="29" Y2="24" Stroke="{StaticResource MaterialFrame}"/>
|
||||
<TextBlock FontSize="10" Text="Steel" FontWeight="Bold" Margin="5,2,0,0" Foreground="Black"/>
|
||||
</Canvas.Children>
|
||||
</Canvas>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,6 +1,38 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<DataTemplate x:Key="MainMaterialProperties">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="46"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="1"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Color"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
|
||||
<Rectangle Width="100" Margin="1" Stroke="Black">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Margin="1" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="LibraryMaterial">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Material Code"/>
|
||||
@@ -32,7 +64,7 @@
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="SafetyFactors">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -140,7 +172,7 @@
|
||||
<ContentControl ContentTemplate="{StaticResource SafetyFactors}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<DataTemplate x:Key="ElasticMaterial">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -162,13 +194,4 @@
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TensileStrength, Converter={StaticResource StressConverter}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="SteelMaterial">
|
||||
<StackPanel>
|
||||
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding}"/>
|
||||
<Button Content="Show Safety Factors" Command="{Binding ShowSafetyFactors}"/>
|
||||
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding SafetyFactors}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
</ResourceDictionary>
|
||||
Binary file not shown.
@@ -144,6 +144,9 @@
|
||||
<Compile Update="Windows\Graphs\MaterialDiagramView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\MainWindow\Materials\SteelMaterialView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\PrimitiveTemplates\RCs\Beams\CircleView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d"
|
||||
Title="{Binding WindowTitle}" Height="390" Width="400" MinHeight="300" MinWidth="400"
|
||||
ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
|
||||
Closing="Window_Closing" Icon="{Binding Mode=OneWay, Source={StaticResource CrackCalculator}}"
|
||||
Closing="Window_Closing"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
||||
@@ -24,6 +24,28 @@
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<ToolBar DataContext="{Binding SaveCopyViewModel}">
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding CopyToClipboardCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Copy to clipboard"
|
||||
IconContent="{StaticResource CopyToClipboard}"
|
||||
DescriptionText="Copy chart to clipboard as image"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource CopyToClipboard}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding SaveAsImageCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Export to *.png"
|
||||
IconContent="{StaticResource PngImage}"
|
||||
DescriptionText="Export chart to *.png file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource PngImage}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -53,39 +75,13 @@
|
||||
<CheckBox Content="Invert normals" IsChecked="{Binding InvertNormal}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DockPanel Grid.Column="1">
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar DataContext="{Binding SaveCopyViewModel}">
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding CopyToClipboardCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Copy to clipboard"
|
||||
IconContent="{StaticResource CopyToClipboard}"
|
||||
DescriptionText="Copy chart to clipboard as image"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource CopyToClipboard}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding SaveAsImageCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Export to *.png"
|
||||
IconContent="{StaticResource PngImage}"
|
||||
DescriptionText="Export chart to *.png file"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{DynamicResource PngImage}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="ViewportGrid" Background="White">
|
||||
<hx:Viewport3DX x:Name="View3D" DataContext="{Binding ViewportViewModel}" Title="{Binding Title}"
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="ViewportGrid" Background="White">
|
||||
<hx:Viewport3DX x:Name="View3D" DataContext="{Binding ViewportViewModel}" Title="{Binding Title}"
|
||||
Grid.Row="0"
|
||||
BackgroundColor="White"
|
||||
Camera="{Binding Camera}"
|
||||
@@ -99,38 +95,36 @@ ShowCoordinateSystem="True"
|
||||
SubTitle="{Binding SubTitle}"
|
||||
TextBrush="Black"
|
||||
UseDefaultGestures="False">
|
||||
<hx:Viewport3DX.InputBindings>
|
||||
<KeyBinding Key="B"
|
||||
<hx:Viewport3DX.InputBindings>
|
||||
<KeyBinding Key="B"
|
||||
Command="hx:ViewportCommands.BackView" />
|
||||
<KeyBinding Key="F"
|
||||
<KeyBinding Key="F"
|
||||
Command="hx:ViewportCommands.FrontView" />
|
||||
<KeyBinding Key="U"
|
||||
<KeyBinding Key="U"
|
||||
Command="hx:ViewportCommands.TopView" />
|
||||
<KeyBinding Key="D"
|
||||
<KeyBinding Key="D"
|
||||
Command="hx:ViewportCommands.BottomView" />
|
||||
<KeyBinding Key="L"
|
||||
<KeyBinding Key="L"
|
||||
Command="hx:ViewportCommands.LeftView" />
|
||||
<KeyBinding Key="R"
|
||||
<KeyBinding Key="R"
|
||||
Command="hx:ViewportCommands.RightView" />
|
||||
<KeyBinding Command="hx:ViewportCommands.ZoomExtents"
|
||||
<KeyBinding Command="hx:ViewportCommands.ZoomExtents"
|
||||
Gesture="Control+E" />
|
||||
<MouseBinding Command="hx:ViewportCommands.Rotate"
|
||||
<MouseBinding Command="hx:ViewportCommands.Rotate"
|
||||
Gesture="RightClick" />
|
||||
<MouseBinding Command="hx:ViewportCommands.Zoom"
|
||||
<MouseBinding Command="hx:ViewportCommands.Zoom"
|
||||
Gesture="MiddleClick" />
|
||||
<MouseBinding Command="hx:ViewportCommands.Pan"
|
||||
<MouseBinding Command="hx:ViewportCommands.Pan"
|
||||
Gesture="LeftClick" />
|
||||
</hx:Viewport3DX.InputBindings>
|
||||
<hx:AmbientLight3D Color="{Binding AmbientLightColor}" />
|
||||
<hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}"
|
||||
</hx:Viewport3DX.InputBindings>
|
||||
<hx:AmbientLight3D Color="{Binding AmbientLightColor}" />
|
||||
<hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}"
|
||||
Color="{Binding DirectionalLightColor}" />
|
||||
<hx:ScreenQuadModel3D Texture="{Binding BackgroundTexture}" />
|
||||
</hx:Viewport3DX>
|
||||
</Grid>
|
||||
<Slider Grid.Row="1" Minimum="0" Maximum="100" Value="{Binding UserZoomFactor}"/>
|
||||
<hx:ScreenQuadModel3D Texture="{Binding BackgroundTexture}" />
|
||||
</hx:Viewport3DX>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<Slider Grid.Row="1" Minimum="0" Maximum="100" Value="{Binding UserZoomFactor}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews
|
||||
{
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
d:DataContext="{d:DesignInstance local:CrossSectionViewModel}"
|
||||
Title="Cross-Section NDM Analysis" Height="700" Width="1000" MinHeight="400" MinWidth="600" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Infrastructure/UI/Resources/MaterialButtonStyles.xaml"/>
|
||||
<ResourceDictionary Source="/Infrastructure/UI/Resources/CalculatorButtonStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<DataTemplate DataType="{x:Type dataContexts:RectangleViewPrimitive}">
|
||||
<dataTemplates:RectangleTemplate/>
|
||||
</DataTemplate>
|
||||
@@ -29,7 +35,7 @@
|
||||
<DataTemplate DataType="{x:Type dataContexts:ShapeViewPrimitive}">
|
||||
<dataTemplates:PolygonTemplate/>
|
||||
</DataTemplate>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
@@ -48,23 +54,75 @@
|
||||
Content="File" ToolTip="Add Combination From File"/>
|
||||
</ToolBar>
|
||||
<ToolBar DataContext="{Binding MaterialsLogic}" ToolTip="Materials">
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||
<Image Source="/Windows/MainWindow/ConMaterial32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add concrete material"
|
||||
IconContent="{StaticResource ConcreteMaterial}"
|
||||
DescriptionText="Adds new material of concrete according to SP63.13330.2018"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource ConcreteMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}" ToolTip="Add Reinforcement Material">
|
||||
<Image Source="/Windows/MainWindow/RFMaterial32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add Reinforcement material"
|
||||
IconContent="{StaticResource ReinforcementMaterial}"
|
||||
DescriptionText="Adds new material of reinforcement according to SP63.13330.2018"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource ReinforcementMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}" ToolTip="Add Elastic Material">
|
||||
<Image Source="/Windows/MainWindow/ElasticMaterial32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Steel}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add Steel material"
|
||||
IconContent="{StaticResource SteelMaterial}"
|
||||
DescriptionText="Adds new material of steel according to SP16.13330.2017"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource SteelMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}" ToolTip="Add Carbon Fiber Material">
|
||||
<Image Style="{StaticResource ButtonImage32}" Source="/Windows/MainWindow/СarbonMaterial32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add Carbon Fiber material"
|
||||
IconContent="{StaticResource ElasticMaterial}"
|
||||
DescriptionText="Adds new elastic material with linear stress-strain curve"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource ElasticMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}" ToolTip="Add Glass Fiber Material">
|
||||
<Image Source="/Windows/MainWindow/GlassMaterial32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add Carbon Fiber material"
|
||||
IconContent="{StaticResource CarbonFiberMaterial}"
|
||||
DescriptionText="Adds new carbon fiber material according to SP164.1325800.2014"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource CarbonFiberMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ToolButton}" Command="{Binding EditMaterialsCommand}" ToolTip="Show Materials">
|
||||
<Image Source="/Windows/MainWindow/Materials32.png"/>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Add Glass Fiber material"
|
||||
IconContent="{StaticResource GlassFiberMaterial}"
|
||||
DescriptionText="Adds new glass fiber material according to SP164.1325800.2014"/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource GlassFiberMaterial}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
<Button Style="{DynamicResource ToolButton}" Command="{Binding EditMaterialsCommand}">
|
||||
<Button.ToolTip>
|
||||
<uc:ButtonToolTipEh HeaderText="Show materials"
|
||||
IconContent="{StaticResource Materials}"
|
||||
DescriptionText="Shows material properties like diagrams, etc."/>
|
||||
</Button.ToolTip>
|
||||
<Viewbox>
|
||||
<ContentControl ContentTemplate="{StaticResource Materials}"/>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
|
||||
@@ -236,32 +294,44 @@
|
||||
<MenuItem Header="Add">
|
||||
<MenuItem Header="Concrete" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Concrete}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/ConMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource ConcreteMaterial}" />
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Reinforcement" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Reinforcement}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RFMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource ReinforcementMaterial}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Steel" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Steel}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/RFMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource SteelMaterial}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Elastic" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.Elastic}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/ElasticMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource ElasticMaterial}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="CarbonFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.CarbonFiber}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/СarbonMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource CarbonFiberMaterial}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="GlassFiber" Command="{Binding Add}" CommandParameter="{x:Static enums:MaterialType.GlassFiber}">
|
||||
<MenuItem.Icon>
|
||||
<Image Style="{StaticResource ButtonImage16}" Source="/Windows/MainWindow/GlassMaterial32.png" />
|
||||
<Viewbox Width="16" Height="16">
|
||||
<ContentControl ContentTemplate="{DynamicResource GlassFiberMaterial}"/>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
public class ConcreteViewModel : LibMaterialViewModel<IConcreteMaterialEntity>
|
||||
{
|
||||
readonly IConcreteLibMaterial concreteMaterial;
|
||||
private readonly IConcreteLibMaterial concreteMaterial;
|
||||
public bool TensionForULS
|
||||
{
|
||||
get => concreteMaterial.TensionForULS;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
public class HeadMaterialBaseViewModel : OkCancelViewModelBase
|
||||
{
|
||||
private readonly IHeadMaterial headMaterial;
|
||||
private ICommand showSafetyFactors;
|
||||
private ICommand editColorCommand;
|
||||
|
||||
public HeadMaterialBaseViewModel(IHeadMaterial headMaterial)
|
||||
{
|
||||
this.headMaterial = headMaterial;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => headMaterial.Name;
|
||||
set
|
||||
{
|
||||
headMaterial.Name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get => headMaterial.Color;
|
||||
}
|
||||
|
||||
public HelperMaterialViewModel HelperMaterialViewModel { get; set; }
|
||||
|
||||
public ICommand ShowSafetyFactors
|
||||
{
|
||||
get
|
||||
{
|
||||
return showSafetyFactors ??= new RelayCommand(o =>
|
||||
{
|
||||
if (headMaterial is ILibMaterial libMaterial)
|
||||
{
|
||||
var wnd = new SafetyFactorsView(libMaterial.SafetyFactors);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}, o => headMaterial is LibMaterial
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand EditColorCommand => editColorCommand ??= new RelayCommand(o => EditColor());
|
||||
|
||||
private void EditColor()
|
||||
{
|
||||
Color color = headMaterial.Color;
|
||||
ColorProcessor.EditColor(ref color);
|
||||
headMaterial.Color = color;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,38 +19,15 @@
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="46"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="1"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Name"/>
|
||||
<TextBlock Grid.Row="1" Text="Color"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="1" Text="{Binding Name}"/>
|
||||
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
|
||||
<Rectangle Width="100" Margin="1" Stroke="Black">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="{Binding Color}"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button Width="50" Margin="1" Content="..." Command="{Binding EditColorCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ContentControl ContentTemplate="{StaticResource MainMaterialProperties}" Content="{Binding}"/>
|
||||
<StackPanel Grid.Row="1" x:Name="StpMaterialProperties"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,91 +1,36 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
public class HeadMaterialViewModel : OkCancelViewModelBase
|
||||
public class HeadMaterialViewModel : HeadMaterialBaseViewModel
|
||||
{
|
||||
private readonly IHeadMaterial headMaterial;
|
||||
private readonly HelperMaterialViewModel helperMaterialViewModel;
|
||||
private ICommand showSafetyFactors;
|
||||
private ICommand editColorCommand;
|
||||
|
||||
public string Name
|
||||
public HeadMaterialViewModel(IHeadMaterial headMaterial) : base(headMaterial)
|
||||
{
|
||||
get => headMaterial.Name;
|
||||
set
|
||||
{
|
||||
headMaterial.Name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get => headMaterial.Color;
|
||||
}
|
||||
|
||||
public HelperMaterialViewModel HelperMaterialViewModel => helperMaterialViewModel;
|
||||
|
||||
public ICommand ShowSafetyFactors
|
||||
{
|
||||
get
|
||||
{
|
||||
return showSafetyFactors ??= new RelayCommand(o =>
|
||||
{
|
||||
if (headMaterial is ILibMaterial libMaterial)
|
||||
{
|
||||
var wnd = new SafetyFactorsView(libMaterial.SafetyFactors);
|
||||
wnd.ShowDialog();
|
||||
}
|
||||
}, o => headMaterial is LibMaterial
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand EditColorCommand => editColorCommand ??= new RelayCommand(o => EditColor());
|
||||
|
||||
private void EditColor()
|
||||
{
|
||||
Color color = headMaterial.Color;
|
||||
ColorProcessor.EditColor(ref color);
|
||||
headMaterial.Color = color;
|
||||
OnPropertyChanged(nameof(Color));
|
||||
}
|
||||
|
||||
public HeadMaterialViewModel(IHeadMaterial headMaterial)
|
||||
{
|
||||
this.headMaterial = headMaterial;
|
||||
var helperMaterial = headMaterial.HelperMaterial;
|
||||
if (helperMaterial is IConcreteLibMaterial concreteMaterial)
|
||||
{
|
||||
helperMaterialViewModel = new ConcreteViewModel(concreteMaterial);
|
||||
HelperMaterialViewModel = new ConcreteViewModel(concreteMaterial);
|
||||
}
|
||||
else if (helperMaterial is IReinforcementLibMaterial reinforcementMaterial)
|
||||
{
|
||||
helperMaterialViewModel = new LibMaterialViewModel<IReinforcementMaterialEntity>(reinforcementMaterial);
|
||||
}
|
||||
else if (helperMaterial is ISteelLibMaterial steelMaterial)
|
||||
{
|
||||
helperMaterialViewModel = new LibMaterialViewModel<ISteelMaterialEntity>(steelMaterial);
|
||||
HelperMaterialViewModel = new LibMaterialViewModel<IReinforcementMaterialEntity>(reinforcementMaterial);
|
||||
}
|
||||
else if (helperMaterial is IElasticMaterial elasticMaterial)
|
||||
{
|
||||
if (helperMaterial is IFRMaterial fRMaterial)
|
||||
{
|
||||
helperMaterialViewModel = new FRViewModel(fRMaterial);
|
||||
HelperMaterialViewModel = new FRViewModel(fRMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
helperMaterialViewModel = new ElasticViewModel(elasticMaterial);
|
||||
HelperMaterialViewModel = new ElasticViewModel(elasticMaterial);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
|
||||
@@ -3,14 +3,17 @@ using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.PrimitivePropertiesWindow;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using MessageBox = System.Windows.Forms.MessageBox;
|
||||
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
@@ -81,7 +84,15 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
//var copyObject = GlobalRepository.Materials.GetById(SelectedItem.Id).Clone() as IHeadMaterial;
|
||||
var copyObject = SelectedItem.Clone() as IHeadMaterial;
|
||||
var wnd = new HeadMaterialView(SelectedItem);
|
||||
Window wnd;
|
||||
if (SelectedItem.HelperMaterial is ISteelLibMaterial steelHeadMaterial)
|
||||
{
|
||||
wnd = new SteelMaterialView(SelectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
wnd = new HeadMaterialView(SelectedItem);
|
||||
}
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
@@ -140,9 +151,12 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
}
|
||||
private void EditHeadMaterials()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(repository);
|
||||
wnd.ShowDialog();
|
||||
Refresh();
|
||||
SafetyProcessor.RunSafeProcess(delegate()
|
||||
{
|
||||
var wnd = new HeadMaterialsView(repository);
|
||||
wnd.ShowDialog();
|
||||
Refresh();
|
||||
}, "Error of material propertis exibition");
|
||||
}
|
||||
|
||||
private RelayCommand setMaterialToPrimititveCommand;
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
public class SteelHelperMaterialViewModel : HelperMaterialViewModel
|
||||
{
|
||||
private readonly ISteelLibMaterial steelLibMaterial;
|
||||
private double workConditionFactor;
|
||||
|
||||
public LibMaterialViewModel<ISteelMaterialEntity> LibMaterialViewModel { get; set; }
|
||||
|
||||
public double UlsFactor
|
||||
{
|
||||
get => steelLibMaterial.UlsFactor;
|
||||
set
|
||||
{
|
||||
steelLibMaterial.UlsFactor = Math.Min(value, 1.0);
|
||||
OnPropertyChanged(nameof(UlsFactor));
|
||||
}
|
||||
}
|
||||
public double ThicknessFactor
|
||||
{
|
||||
get => steelLibMaterial.ThicknessFactor;
|
||||
set
|
||||
{
|
||||
value = Math.Max(value, 0.0);
|
||||
steelLibMaterial.ThicknessFactor = Math.Min(value, 1.0);
|
||||
OnPropertyChanged(nameof(ThicknessFactor));
|
||||
}
|
||||
}
|
||||
public double MaxPlasticStrainRatio
|
||||
{
|
||||
get => steelLibMaterial.MaxPlasticStrainRatio;
|
||||
set
|
||||
{
|
||||
steelLibMaterial.MaxPlasticStrainRatio = Math.Max(value, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public double WorkConditionFactor
|
||||
{
|
||||
get => steelLibMaterial.WorkConditionFactor;
|
||||
set
|
||||
{
|
||||
steelLibMaterial.WorkConditionFactor = Math.Max(value, 0.0);
|
||||
OnPropertyChanged(nameof(WorkConditionFactor));
|
||||
}
|
||||
}
|
||||
|
||||
public SteelHelperMaterialViewModel(ISteelLibMaterial steelLibMaterial)
|
||||
{
|
||||
this.steelLibMaterial = steelLibMaterial;
|
||||
LibMaterialViewModel = new(steelLibMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<Window x:Class="StructureHelper.Windows.MainWindow.Materials.SteelMaterialView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow.Materials"
|
||||
d:DataContext="{d:DesignInstance local:SteelMaterialViewModel}"
|
||||
mc:Ignorable="d"
|
||||
Title="Steel Material" Height="350" Width="300" MinHeight="350" MinWidth="300" MaxHeight="800" MaxWidth="500" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="/Infrastructure/UI/Resources/Materials.xaml"/>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="Main">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<ContentControl ContentTemplate="{StaticResource MainMaterialProperties}" Content="{Binding}"/>
|
||||
<ContentControl ContentTemplate="{StaticResource LibraryMaterial}" Content="{Binding HelperMaterialViewModel.LibMaterialViewModel}"/>
|
||||
<Button Content="Show Safety Factors" Command="{Binding HelperMaterialViewModel.LibMaterialViewModel.ShowSafetyFactors}"/>
|
||||
<ContentControl ContentTemplate="{StaticResource MaterialSafetyFactors}" Content="{Binding HelperMaterialViewModel.LibMaterialViewModel.SafetyFactors}"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Misc.">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
<RowDefinition Height="22"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="ULS Factor"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding HelperMaterialViewModel.UlsFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="1" Text="Thickness Factor"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding HelperMaterialViewModel.ThicknessFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="2" Text="Work condition factor"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding HelperMaterialViewModel.WorkConditionFactor, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
<TextBlock Grid.Row="3" Text="Plastic strain ratio"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding HelperMaterialViewModel.MaxPlasticStrainRatio, Converter={StaticResource PlainDouble}, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using System.Windows;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SteelMaterialView.xaml
|
||||
/// </summary>
|
||||
public partial class SteelMaterialView : Window
|
||||
{
|
||||
private SteelMaterialViewModel viewModel;
|
||||
|
||||
public SteelMaterialView(IHeadMaterial steelLibMaterial) : this (new SteelMaterialViewModel(steelLibMaterial))
|
||||
{
|
||||
}
|
||||
|
||||
public SteelMaterialView(SteelMaterialViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.viewModel = viewModel;
|
||||
this.DataContext = this.viewModel;
|
||||
this.viewModel.ParentWindow = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
public class SteelMaterialViewModel : HeadMaterialBaseViewModel
|
||||
{
|
||||
private readonly ISteelLibMaterial steelLibMaterial;
|
||||
|
||||
public SteelMaterialViewModel(IHeadMaterial steelHeadMaterial) : base(steelHeadMaterial)
|
||||
{
|
||||
if (steelHeadMaterial.HelperMaterial is not ISteelLibMaterial steelHelperMaterial)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(steelHeadMaterial));
|
||||
}
|
||||
this.steelLibMaterial = steelHelperMaterial;
|
||||
HelperMaterialViewModel = new SteelHelperMaterialViewModel(steelLibMaterial);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,12 @@ namespace StructureHelperCommon.Models.Materials
|
||||
DiagramType = DiagramType.Curve
|
||||
},
|
||||
new SteelMaterialBuilderLogic(new Guid("C3BE4B92-DC61-43CF-A632-ADFC1AA57D8F"))
|
||||
{
|
||||
MaterialType = MaterialTypes.Steel,
|
||||
Name="Bilinear",
|
||||
DiagramType = DiagramType.Bilinear
|
||||
},
|
||||
new SteelMaterialBuilderLogic(new Guid("7D6F9280-4DDF-43CE-8FBB-56FAE26BDA75"))
|
||||
{
|
||||
MaterialType = MaterialTypes.Steel,
|
||||
Name="Triplelinear",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries.Factories
|
||||
{
|
||||
public enum SteelFactorTypes
|
||||
{
|
||||
WorkCondition = 0,
|
||||
}
|
||||
public class SteelFactorsFactory
|
||||
{
|
||||
public static IMaterialSafetyFactor GetFactor(SteelFactorTypes factorType)
|
||||
{
|
||||
if (factorType == SteelFactorTypes.WorkCondition) { return WorkCondition(); }
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown);
|
||||
}
|
||||
|
||||
private static IMaterialSafetyFactor WorkCondition()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,10 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
/// </summary>
|
||||
double BaseStrength { get; set; }
|
||||
/// <summary>
|
||||
/// Strain of start of yielding under bilinear diagram
|
||||
/// </summary>
|
||||
double BaseStrain { get; set; }
|
||||
/// <summary>
|
||||
/// Stress at point of limit of proportionality, Pa
|
||||
/// </summary>
|
||||
double StressOfProportionality { get; set; }
|
||||
|
||||
@@ -4,8 +4,12 @@ using System.Text;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
internal interface ISteelMaterialLogicOption : IMaterialLogicOptions
|
||||
public interface ISteelMaterialLogicOption : IMaterialLogicOptions
|
||||
{
|
||||
double MaxPlasticStrainRatio { get; set; }
|
||||
double UlsFactor { get; set; }
|
||||
double SlsFactor { get; set; }
|
||||
double ThicknessFactor { get; set; }
|
||||
double WorkConditionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials.Libraries.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -11,9 +12,9 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class SteelMaterialBuilderLogic : IMaterialLogic
|
||||
{
|
||||
private const double safetyFactorForULS = 1.05;
|
||||
private const double safetyFactorforSLS = 1.0;
|
||||
private ISteelMaterialLogicOption option;
|
||||
private ICheckEntityLogic<ISteelMaterialLogicOption> checkEntityLogic;
|
||||
private ICheckEntityLogic<ISteelMaterialLogicOption> CheckEntityLogic => checkEntityLogic ??= new SteelMaterialLogicOptionCheckStrategy() { Entity = option};
|
||||
IObjectConvertStrategy<ISteelDiagramAbsoluteProperty, ISteelDiagramRelativeProperty> convertStrategy;
|
||||
private IMaterialFactorLogic factorLogic;
|
||||
private double compressionStrength;
|
||||
@@ -33,23 +34,29 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
|
||||
public IMaterial GetLoaderMaterial()
|
||||
{
|
||||
option = Options as ISteelMaterialLogicOption;
|
||||
if (DiagramType == DiagramType.TripleLinear)
|
||||
CheckOptions();
|
||||
factorLogic = new MaterialFactorLogic(Options.SafetyFactors);
|
||||
GetStrength();
|
||||
Material material = new()
|
||||
{
|
||||
factorLogic = new MaterialFactorLogic(Options.SafetyFactors);
|
||||
GetStrength();
|
||||
Material material = new()
|
||||
{
|
||||
InitModulus = option.MaterialEntity.InitialModulus,
|
||||
Diagram = GetDiagram(),
|
||||
LimitPositiveStrain = GetMaxStrain(tensionStrength),
|
||||
LimitNegativeStrain = -GetMaxStrain(compressionStrength),
|
||||
};
|
||||
return material;
|
||||
InitModulus = option.MaterialEntity.InitialModulus,
|
||||
Diagram = GetDiagram(),
|
||||
LimitPositiveStrain = GetMaxStrain(tensionStrength),
|
||||
LimitNegativeStrain = -GetMaxStrain(compressionStrength),
|
||||
};
|
||||
return material;
|
||||
}
|
||||
|
||||
private void CheckOptions()
|
||||
{
|
||||
if (Options is not ISteelMaterialLogicOption steelOption)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(Options));
|
||||
}
|
||||
else
|
||||
option = steelOption;
|
||||
if (CheckEntityLogic.Check() == false)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(DiagramType));
|
||||
throw new StructureHelperException("Option is not correct: \n" + CheckEntityLogic.CheckResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,18 +69,61 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
|
||||
private Func<double, double> GetDiagram()
|
||||
{
|
||||
MultiLinearStressStrainDiagram compressionDiagram = GetMultiLinearDiagram(compressionStrength);
|
||||
MultiLinearStressStrainDiagram tensionDiagram = GetMultiLinearDiagram(tensionStrength);
|
||||
IDiagram compressionDiagram = GetDiagram(compressionStrength);
|
||||
IDiagram tensionDiagram = GetDiagram(tensionStrength);
|
||||
var posNegDiagram = new PosNegDigramDecorator(tensionDiagram, compressionDiagram);
|
||||
return posNegDiagram.GetStressByStrain;
|
||||
}
|
||||
|
||||
private IDiagram GetDiagram(double strength)
|
||||
{
|
||||
if (strength == 0.0)
|
||||
{
|
||||
ConstantValueDiagram diagram = new() { ConstantValue = 0.0 };
|
||||
return diagram;
|
||||
}
|
||||
MultiLinearStressStrainDiagram multiDiagram = GetMultiLinearDiagram(strength);
|
||||
return multiDiagram;
|
||||
}
|
||||
|
||||
private MultiLinearStressStrainDiagram GetMultiLinearDiagram(double strength)
|
||||
{
|
||||
convertStrategy = new SteelRelativeToAbsoluteDiagramConvertLogic(Options.MaterialEntity.InitialModulus, strength);
|
||||
var diagramProperty = SteelDiagramPropertyFactory.GetProperty(((ISteelMaterialEntity)Options.MaterialEntity).PropertyType);
|
||||
var absoluteProperty = convertStrategy.Convert(diagramProperty);
|
||||
List<IStressStrainPair> stressStrainPairs = new()
|
||||
List<IStressStrainPair> stressStrainPairs;
|
||||
if (DiagramType == DiagramType.Bilinear)
|
||||
{
|
||||
stressStrainPairs = GetBiLinearStressStrainPairs(absoluteProperty);
|
||||
}
|
||||
else if (DiagramType == DiagramType.TripleLinear)
|
||||
{
|
||||
stressStrainPairs = GetTripleLinearStressStrainPairs(absoluteProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(DiagramType));
|
||||
}
|
||||
var multiDiagram = new MultiLinearStressStrainDiagram(stressStrainPairs);
|
||||
return multiDiagram;
|
||||
}
|
||||
|
||||
private static List<IStressStrainPair> GetBiLinearStressStrainPairs(ISteelDiagramAbsoluteProperty absoluteProperty)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new StressStrainPair() { Stress = 0, Strain = 0},
|
||||
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.BaseStrain},
|
||||
new StressStrainPair() { Stress = absoluteProperty.BaseStrength, Strain = absoluteProperty.StrainOfEndOfYielding},
|
||||
new StressStrainPair() { Stress = absoluteProperty.StressOfUltimateStrength, Strain = absoluteProperty.StrainOfUltimateStrength},
|
||||
new StressStrainPair() { Stress = absoluteProperty.StressOfFracture, Strain = absoluteProperty.StrainOfFracture},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private static List<IStressStrainPair> GetTripleLinearStressStrainPairs(ISteelDiagramAbsoluteProperty absoluteProperty)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new StressStrainPair() { Stress = 0, Strain = 0},
|
||||
new StressStrainPair() { Stress = absoluteProperty.StressOfProportionality, Strain = absoluteProperty.StrainOfProportionality},
|
||||
@@ -83,8 +133,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
new StressStrainPair() { Stress = absoluteProperty.StressOfFracture, Strain = absoluteProperty.StrainOfFracture},
|
||||
|
||||
};
|
||||
var multiDiagram = new MultiLinearStressStrainDiagram(stressStrainPairs);
|
||||
return multiDiagram;
|
||||
}
|
||||
|
||||
public void GetStrength()
|
||||
@@ -98,17 +146,17 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
double factor;
|
||||
if (Options.LimitState == Infrastructures.Enums.LimitStates.ULS)
|
||||
{
|
||||
factor = safetyFactorForULS;
|
||||
factor = option.UlsFactor;
|
||||
}
|
||||
else if (Options.LimitState == Infrastructures.Enums.LimitStates.SLS)
|
||||
{
|
||||
factor = safetyFactorforSLS;
|
||||
factor = option.SlsFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(Options.LimitState));
|
||||
}
|
||||
double strength = baseStength / factor;
|
||||
double strength = baseStength * option.ThicknessFactor * option.WorkConditionFactor / factor;
|
||||
compressionStrength = strength * compressionFactor;
|
||||
tensionStrength = strength * tensionFactor;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries.Logics
|
||||
{
|
||||
public class SteelMaterialLogicOptionCheckStrategy : CheckEntityLogic<ISteelMaterialLogicOption>
|
||||
{
|
||||
public override bool Check()
|
||||
{
|
||||
bool result = true;
|
||||
if (Entity is null)
|
||||
{
|
||||
throw new StructureHelperNullReferenceException("Option is null");
|
||||
}
|
||||
if (Entity.SafetyFactors is null)
|
||||
{
|
||||
TraceMessage("Option safety factors collection is null");
|
||||
result = false;
|
||||
}
|
||||
if (Entity.ThicknessFactor < 0 )
|
||||
{
|
||||
TraceMessage("Option thickness factor is null");
|
||||
result = false;
|
||||
}
|
||||
if (Entity.WorkConditionFactor < 0)
|
||||
{
|
||||
TraceMessage("Option work condition factor is null");
|
||||
result = false;
|
||||
}
|
||||
if (Entity.UlsFactor < 0)
|
||||
{
|
||||
TraceMessage("Option ULS factor is null");
|
||||
result = false;
|
||||
}
|
||||
if (Entity.SlsFactor < 0)
|
||||
{
|
||||
TraceMessage("Option SLS factor is null");
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
InitialYoungsModulus = initialYoungsModulus,
|
||||
BaseStrength = baseStrength,
|
||||
BaseStrain = absoluteYieldingStrain,
|
||||
StressOfProportionality = baseStrength * source.StrainOfProportionality,
|
||||
StrainOfProportionality = absoluteYieldingStrain * source.StrainOfProportionality,
|
||||
StrainOfStartOfYielding = absoluteYieldingStrain * source.StrainOfStartOfYielding,
|
||||
|
||||
@@ -27,5 +27,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
public double StressOfUltimateStrength { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public double StressOfFracture { get; set; }
|
||||
public double BaseStrain { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,5 +14,9 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
public bool WorkInCompression { get; set; } = true;
|
||||
public bool WorkInTension { get; set; } = true;
|
||||
public double MaxPlasticStrainRatio { get; set; }
|
||||
public double UlsFactor { get; set; }
|
||||
public double SlsFactor { get; set; }
|
||||
public double ThicknessFactor { get; set; }
|
||||
public double WorkConditionFactor { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Models.Materials.Libraries.Factories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -18,6 +19,22 @@ namespace StructureHelperLogics.Models.Materials
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + ": " + codeType);
|
||||
}
|
||||
|
||||
public static List<IMaterialSafetyFactor> GetDefaultSteelSafetyFactors(CodeTypes codeType)
|
||||
{
|
||||
if (codeType == CodeTypes.SP16_2017) return GetSteelFactorsSP16_2017();
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + ": " + codeType);
|
||||
}
|
||||
|
||||
private static List<IMaterialSafetyFactor> GetSteelFactorsSP16_2017()
|
||||
{
|
||||
List<IMaterialSafetyFactor> factors = new List<IMaterialSafetyFactor>();
|
||||
IMaterialSafetyFactor coefficient;
|
||||
coefficient = SteelFactorsFactory.GetFactor(SteelFactorTypes.WorkCondition);
|
||||
coefficient.Take = true;
|
||||
factors.Add(coefficient);
|
||||
return factors;
|
||||
}
|
||||
|
||||
public static List<IMaterialSafetyFactor> GetDefaultFRSafetyFactors(CodeTypes codeType, MaterialTypes materialType)
|
||||
{
|
||||
if (codeType == CodeTypes.SP164_2014) return GetFRFactorsSP164_2014(materialType);
|
||||
|
||||
@@ -7,6 +7,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public interface ISteelLibMaterial : ILibMaterial
|
||||
{
|
||||
double UlsFactor { get; set; }
|
||||
double SlsFactor { get; set; }
|
||||
double WorkConditionFactor { get; set; }
|
||||
double ThicknessFactor { get; set; }
|
||||
double MaxPlasticStrainRatio { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services;
|
||||
using StructureHelperLogics.Models.Materials.Logics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
@@ -67,7 +61,7 @@ namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
if (sourceObject is IConcreteLibMaterial concreteLibMaterial)
|
||||
{
|
||||
concreteUpdateStrategy.Update(targetObject as IConcreteLibMaterial, concreteLibMaterial);
|
||||
ConcreteUpdateStrategy.Update(targetObject as IConcreteLibMaterial, concreteLibMaterial);
|
||||
}
|
||||
else if (sourceObject is IReinforcementLibMaterial reinforcementLibMaterial)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace StructureHelperLogics.Models.Materials
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
LibUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.MaxPlasticStrainRatio = sourceObject.MaxPlasticStrainRatio;
|
||||
targetObject.UlsFactor = sourceObject.UlsFactor;
|
||||
targetObject.ThicknessFactor = sourceObject.ThicknessFactor;
|
||||
targetObject.WorkConditionFactor = sourceObject.WorkConditionFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace StructureHelperLogics.Models.Materials
|
||||
public class SteelLibMaterial : ISteelLibMaterial
|
||||
{
|
||||
const MaterialTypes materialType = MaterialTypes.Steel;
|
||||
private const double safetyFactorForULS = 1.05;
|
||||
private const double safetyFactorforSLS = 1.0;
|
||||
|
||||
private IMaterialFactorLogic factorLogic => new MaterialFactorLogic(SafetyFactors);
|
||||
private readonly List<IMaterialLogic> materialLogics = ProgramSetting.MaterialLogics.Where(x => x.MaterialType == materialType).ToList();
|
||||
@@ -25,6 +23,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public List<IMaterialSafetyFactor> SafetyFactors { get; set; } = [];
|
||||
public double MaxPlasticStrainRatio { get; set; } = 3.0;
|
||||
public double UlsFactor { get; set; } = 1.025;
|
||||
public double SlsFactor { get; set; } = 1.0;
|
||||
public double ThicknessFactor { get; set; } = 1.0;
|
||||
public double WorkConditionFactor { get; set; } = 1.0;
|
||||
|
||||
public SteelLibMaterial(Guid id)
|
||||
{
|
||||
@@ -55,6 +57,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
MaxPlasticStrainRatio = MaxPlasticStrainRatio,
|
||||
LimitState = limitState,
|
||||
CalcTerm = calcTerm,
|
||||
UlsFactor = UlsFactor,
|
||||
SlsFactor = SlsFactor,
|
||||
ThicknessFactor = ThicknessFactor,
|
||||
WorkConditionFactor = WorkConditionFactor,
|
||||
};
|
||||
MaterialLogic.Options = options;
|
||||
var material = MaterialLogic.GetLoaderMaterial();
|
||||
@@ -72,17 +78,17 @@ namespace StructureHelperLogics.Models.Materials
|
||||
double factor;
|
||||
if (limitState == LimitStates.ULS)
|
||||
{
|
||||
factor = safetyFactorForULS;
|
||||
factor = UlsFactor;
|
||||
}
|
||||
else if (limitState == LimitStates.SLS)
|
||||
{
|
||||
factor = safetyFactorforSLS;
|
||||
factor = SlsFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(limitState));
|
||||
}
|
||||
double strength = baseStength / factor;
|
||||
double strength = baseStength * ThicknessFactor / factor;
|
||||
return (strength * compressionFactor, strength * tensionFactor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user