Refactoring of beam shear calculation, add test for beam shea
This commit is contained in:
@@ -5,10 +5,7 @@ using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Models.Projects;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Linq;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
@@ -16,6 +13,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
private static List<IMaterialLogic> materialLogics;
|
||||
private static List<ICodeEntity> codesList;
|
||||
private static List<ICodeRevision> codesRevisions;
|
||||
private static IMaterialRepository materialRepository;
|
||||
private static NatSystems natSystem;
|
||||
private static GeometryNames geometryNames;
|
||||
@@ -28,10 +26,7 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
set
|
||||
{
|
||||
natSystem = value;
|
||||
codesList ??= CodeFactory
|
||||
.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == natSystem)
|
||||
.ToList();
|
||||
SetCodeList();
|
||||
materialRepository ??= new MaterialRepository(codesList);
|
||||
}
|
||||
}
|
||||
@@ -41,22 +36,30 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
public static List<ICodeEntity> CodesList
|
||||
{ get
|
||||
{
|
||||
codesList ??= CodeFactory
|
||||
.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
SetCodeList();
|
||||
return codesList;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetCodeList()
|
||||
{
|
||||
if (codesList is null)
|
||||
{
|
||||
var codes = CodeFactory.GetCodeEntities();
|
||||
codesList = codes.codes
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
codesRevisions = codes.codeRevisions
|
||||
.Where(x => codesList.Contains(x.CodeEntity))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static IMaterialRepository MaterialRepository
|
||||
{
|
||||
get
|
||||
{
|
||||
codesList ??= CodeFactory
|
||||
.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
SetCodeList();
|
||||
materialRepository ??= new MaterialRepository(codesList);
|
||||
return materialRepository;
|
||||
}
|
||||
@@ -78,6 +81,9 @@ namespace StructureHelperCommon.Infrastructures.Settings
|
||||
return materialLogics;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ICodeRevision> CodesRevisions { get => codesRevisions; set => codesRevisions = value; }
|
||||
|
||||
public static void SetCurrentProjectToNotActual()
|
||||
{
|
||||
if (CurrentProject is null)
|
||||
|
||||
24
StructureHelperCommon/Models/Codes/CodeRevision.cs
Normal file
24
StructureHelperCommon/Models/Codes/CodeRevision.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Codes
|
||||
{
|
||||
public class CodeRevision : ICodeRevision
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public ICodeEntity CodeEntity { get; set; }
|
||||
public string RevisionNumber { get; set; }
|
||||
public DateOnly PublicationDate { get; set; }
|
||||
public RevisionStatus RevisionStatus { get; set; }
|
||||
public string FullName => $"{CodeEntity.FullName} Rev. {RevisionNumber} ({PublicationDate})";
|
||||
|
||||
public CodeRevision(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,42 +9,93 @@ namespace StructureHelperCommon.Models.Codes.Factories
|
||||
{
|
||||
public static class CodeFactory
|
||||
{
|
||||
public static List<ICodeEntity> GetCodeEntities()
|
||||
public static (List<ICodeEntity> codes, List<ICodeRevision> codeRevisions) GetCodeEntities()
|
||||
{
|
||||
List<ICodeEntity> items = new List<ICodeEntity>();
|
||||
items.AddRange(GetRussianCodes());
|
||||
items.AddRange(GetEuropeanCodes());
|
||||
return items;
|
||||
List<ICodeEntity> codes = new List<ICodeEntity>();
|
||||
List<ICodeRevision> codeRevisions = new();
|
||||
(List<ICodeEntity> codes, List<ICodeRevision> codeRevisions) russianCodes = GetRussianCodes();
|
||||
codes.AddRange(russianCodes.codes);
|
||||
codeRevisions.AddRange(russianCodes.codeRevisions);
|
||||
codes.AddRange(GetEuropeanCodes());
|
||||
return (codes, codeRevisions);
|
||||
}
|
||||
|
||||
private static List<ICodeEntity> GetRussianCodes()
|
||||
private static (List<ICodeEntity> codes, List<ICodeRevision> codeRevisions) GetRussianCodes()
|
||||
{
|
||||
const NatSystems natSystem = NatSystems.RU;
|
||||
return new List<ICodeEntity>
|
||||
List<ICodeEntity> codeEntities = new();
|
||||
List<ICodeRevision> codeRevisions = new();
|
||||
ICodeEntity codeEntity;
|
||||
ICodeRevision codeRevision;
|
||||
var code = GetSP63_13330_2018(natSystem);
|
||||
codeEntities.Add(code.code);
|
||||
codeRevisions.AddRange(code.codeRevisions);
|
||||
codeEntity = new CodeEntity(new Guid("1a717049-cee7-40e0-923c-7a32a573a303"), natSystem)
|
||||
{
|
||||
new CodeEntity(new Guid("d4ab402a-ce2f-46db-8b3b-a5a66fb384e1"), natSystem)
|
||||
{
|
||||
Name = "SP 63.13330.2018",
|
||||
FullName = "Plain concrete and reinforced concrete structures"
|
||||
},
|
||||
new CodeEntity(new Guid("1a717049-cee7-40e0-923c-7a32a573a303"), natSystem)
|
||||
{
|
||||
Name = "GOST 26633-2015",
|
||||
FullName = "Heavy-weight and sand concretes. Specifications"
|
||||
},
|
||||
new CodeEntity(new Guid("c7c0f60f-2c82-45d1-8786-4c340fb5fb98"), natSystem)
|
||||
{
|
||||
Name = "GOST 34028-2016",
|
||||
FullName = "Reinforcing rolled products for reinforced concrete constructions. Specifications"
|
||||
}
|
||||
,
|
||||
new CodeEntity(new Guid("d934763d-4cb4-4923-ad15-2e78b0fe3b37"), natSystem)
|
||||
{
|
||||
Name = "GOST 53772-2010",
|
||||
FullName = "Reinforced steel low-relaxation 7-wire strands. Specifications"
|
||||
}
|
||||
Name = "GOST 26633-2015",
|
||||
FullName = "Heavy-weight and sand concretes. Specifications"
|
||||
};
|
||||
codeEntities.Add(codeEntity);
|
||||
codeEntity = new CodeEntity(new Guid("c7c0f60f-2c82-45d1-8786-4c340fb5fb98"), natSystem)
|
||||
{
|
||||
Name = "GOST 34028-2016",
|
||||
FullName = "Reinforcing rolled products for reinforced concrete constructions. Specifications"
|
||||
};
|
||||
codeEntities.Add(codeEntity);
|
||||
codeEntity = new CodeEntity(new Guid("d934763d-4cb4-4923-ad15-2e78b0fe3b37"), natSystem)
|
||||
{
|
||||
Name = "GOST 53772-2010",
|
||||
FullName = "Reinforced steel low-relaxation 7-wire strands. Specifications"
|
||||
};
|
||||
codeEntities.Add(codeEntity);
|
||||
return (codeEntities, codeRevisions);
|
||||
}
|
||||
|
||||
private static (ICodeEntity code, List<ICodeRevision> codeRevisions) GetSP63_13330_2018(NatSystems natSystem)
|
||||
{
|
||||
ICodeEntity codeEntity;
|
||||
ICodeRevision codeRevision;
|
||||
List<ICodeRevision> codeRevisions = new();
|
||||
codeEntity = new CodeEntity(new Guid("d4ab402a-ce2f-46db-8b3b-a5a66fb384e1"), natSystem)
|
||||
{
|
||||
Name = "SP 63.13330.2018",
|
||||
FullName = "Plain concrete and reinforced concrete structures"
|
||||
};
|
||||
codeRevision = new CodeRevision(new Guid("1c6047df-cc40-413e-8ed1-c0043182fe0a"))
|
||||
{
|
||||
CodeEntity = codeEntity,
|
||||
RevisionNumber = "0",
|
||||
PublicationDate = new DateOnly(2018, 1, 1),
|
||||
RevisionStatus = RevisionStatus.Withdrawn
|
||||
};
|
||||
codeRevisions.Add(codeRevision);
|
||||
codeRevision = new CodeRevision(new Guid("f9f66a43-e50d-40bf-8a82-0359b54a3ab0"))
|
||||
{
|
||||
CodeEntity = codeEntity,
|
||||
RevisionNumber = "1",
|
||||
PublicationDate = new DateOnly(2019, 1, 1),
|
||||
RevisionStatus = RevisionStatus.Withdrawn
|
||||
};
|
||||
codeRevisions.Add(codeRevision);
|
||||
codeRevision = new CodeRevision(new Guid("010325ae-5182-4d8e-9b30-7a3ec4860745"))
|
||||
{
|
||||
CodeEntity = codeEntity,
|
||||
RevisionNumber = "2",
|
||||
PublicationDate = new DateOnly(2020, 1, 1),
|
||||
RevisionStatus = RevisionStatus.Withdrawn
|
||||
};
|
||||
codeRevisions.Add(codeRevision);
|
||||
codeRevision = new CodeRevision(new Guid("17b6fb62-97b3-4c13-bf38-b91ea16af819"))
|
||||
{
|
||||
CodeEntity = codeEntity,
|
||||
RevisionNumber = "3",
|
||||
PublicationDate = new DateOnly(2021, 1, 1),
|
||||
RevisionStatus = RevisionStatus.Official
|
||||
};
|
||||
codeRevisions.Add(codeRevision);
|
||||
return (codeEntity, codeRevisions);
|
||||
}
|
||||
|
||||
private static List<ICodeEntity> GetEuropeanCodes()
|
||||
{
|
||||
const NatSystems natSystem = NatSystems.EU;
|
||||
|
||||
21
StructureHelperCommon/Models/Codes/ICodeRevision.cs
Normal file
21
StructureHelperCommon/Models/Codes/ICodeRevision.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Codes
|
||||
{
|
||||
public enum RevisionStatus
|
||||
{
|
||||
Draft,
|
||||
Official,
|
||||
Withdrawn
|
||||
}
|
||||
|
||||
public interface ICodeRevision : ISaveable
|
||||
{
|
||||
ICodeEntity CodeEntity { get; set; }
|
||||
string RevisionNumber { get; set; }
|
||||
string FullName { get; }
|
||||
DateOnly PublicationDate { get; set; }
|
||||
RevisionStatus RevisionStatus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace StructureHelperCommon.Models.Projects
|
||||
}
|
||||
if (currentVersion.SubVersionNumber < FileVersion.SubVersionNumber)
|
||||
{
|
||||
string message = $"File version {FileVersion.VersionNumber}.{FileVersion.SubVersionNumber} is bigger than suitable version {currentVersion.VersionNumber}.{currentVersion.VersionNumber}";
|
||||
string message = $"File version {FileVersion.VersionNumber}.{FileVersion.SubVersionNumber} is bigger than suitable version {currentVersion.VersionNumber}.{currentVersion.SubVersionNumber}";
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
CheckResult += message;
|
||||
return false;
|
||||
|
||||
@@ -6,5 +6,7 @@
|
||||
public const string Meters = "(m)";
|
||||
public const string SquareMeters = "(m2)";
|
||||
public const string Newtons = "(N)";
|
||||
public const string Pa = "(Pa)";
|
||||
public const string NewtonMeters = $"{Newtons}*{Meters}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user