Add VisualAnalysisDTO

This commit is contained in:
Evgeny Redikultsev
2024-09-14 19:03:35 +05:00
parent 5a9e7c3c4f
commit c10d6eb94e
84 changed files with 958 additions and 410 deletions

View File

@@ -1,15 +1,12 @@
using StructureHelperCommon.Models.Analyses;
using StructureHelperLogics.Models.Analyses;
using StructureHelperLogics.Models.CrossSections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogic.Models.Analyses
{
public class CrossSectionNdmAnalysis : IAnalysis
{
private CrossSectionNdmAnalysisUpdateStrategy updateStrategy = new();
public Guid Id { get; private set; }
public string Name { get; set; }
public string Tags { get; set; }
@@ -21,7 +18,7 @@ namespace StructureHelperLogic.Models.Analyses
VersionProcessor = versionProcessor;
}
public CrossSectionNdmAnalysis() : this(new Guid(), new VersionProcessor())
public CrossSectionNdmAnalysis() : this(Guid.NewGuid(), new VersionProcessor())
{
CrossSection crossSection = new CrossSection();
VersionProcessor.AddVersion(crossSection);
@@ -29,7 +26,9 @@ namespace StructureHelperLogic.Models.Analyses
public object Clone()
{
throw new NotImplementedException();
CrossSectionNdmAnalysis newAnalysis = new();
updateStrategy.Update(newAnalysis, this);
return newAnalysis;
}
}
}

View File

@@ -0,0 +1,68 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Analyses;
using StructureHelperCommon.Services;
using StructureHelperLogic.Models.Analyses;
using StructureHelperLogics.Models.CrossSections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperLogics.Models.Analyses
{
public class CrossSectionNdmAnalysisUpdateStrategy : IUpdateStrategy<CrossSectionNdmAnalysis>
{
private IUpdateStrategy<IAnalysis> analysisUpdateStrategy;
private IUpdateStrategy<ICrossSection> crossSectionUpdateStrategy;
private IUpdateStrategy<IDateVersion> dateUpdateStrategy;
public CrossSectionNdmAnalysisUpdateStrategy(IUpdateStrategy<IAnalysis> analysisUpdateStrategy,
IUpdateStrategy<ICrossSection> crossSectionUpdateStrategy,
IUpdateStrategy<IDateVersion> dateUpdateStrategy)
{
this.analysisUpdateStrategy = analysisUpdateStrategy;
this.crossSectionUpdateStrategy = crossSectionUpdateStrategy;
this.dateUpdateStrategy = dateUpdateStrategy;
}
public CrossSectionNdmAnalysisUpdateStrategy() : this(
new AnalysisUpdateStrategy(),
new CrossSectionUpdateStrategy(),
new DateVersionUpdateStrategy())
{
}
public void Update(CrossSectionNdmAnalysis targetObject, CrossSectionNdmAnalysis sourceObject)
{
CheckObject.IsNull(sourceObject, ErrorStrings.SourceObject);
CheckObject.IsNull(targetObject, ErrorStrings.TargetObject);
if (ReferenceEquals(targetObject, sourceObject)) { return; };
analysisUpdateStrategy.Update(targetObject, sourceObject);
targetObject.VersionProcessor.Versions.Clear();
foreach (var version in sourceObject.VersionProcessor.Versions)
{
if (version.Item is ICrossSection crossSection)
{
updateVersion(targetObject, version, crossSection);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(version.Item));
}
}
}
private void updateVersion(CrossSectionNdmAnalysis targetObject, IDateVersion version, ICrossSection crossSection)
{
DateVersion newVersion = new();
dateUpdateStrategy.Update(newVersion, version);
CrossSection newCrossection = new();
crossSectionUpdateStrategy.Update(newCrossection, crossSection);
newVersion.Item = newCrossection;
targetObject.VersionProcessor.Versions.Add(newVersion);
}
}
}

View File

@@ -13,7 +13,7 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
public class CircleGeometryLogic : IRCGeometryLogic
{
ICircleTemplate template;
CirclePrimitive concreteBlock;
EllipsePrimitive concreteBlock;
public IEnumerable<IHeadMaterial> HeadMaterials { get; set; }
@@ -35,7 +35,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
var diameter = template.Shape.Diameter;
var concreteMaterial = HeadMaterials.ToList()[0];
var primitives = new List<INdmPrimitive>();
concreteBlock = new CirclePrimitive() { Diameter = diameter, Name = "Concrete block", HeadMaterial = concreteMaterial };
concreteBlock = new EllipsePrimitive() { DiameterByX = diameter, Name = "Concrete block"};
concreteBlock.NdmElement.HeadMaterial = concreteMaterial;
primitives.Add(concreteBlock);
return primitives;
}
@@ -56,11 +57,11 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = barArea,
Name = "Left bottom point",
HeadMaterial = reinforcementMaterial,
HostPrimitive=concreteBlock };
point.Center.X = x;
point.Center.Y = y;
primitives.Add(point);
point.NdmElement.HeadMaterial = reinforcementMaterial;
}
return primitives;
}

View File

@@ -48,7 +48,8 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
private IEnumerable<INdmPrimitive> GetConcretePrimitives()
{
var primitives = new List<INdmPrimitive>();
concreteBlock = new RectanglePrimitive(concrete) { Width = width, Height = height, Name = "Concrete block" };
concreteBlock = new RectanglePrimitive() { Width = width, Height = height, Name = "Concrete block" };
concreteBlock.NdmElement.HeadMaterial = concrete;
primitives.Add(concreteBlock);
return primitives;
}
@@ -63,9 +64,10 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area1,
Name = "Left bottom rebar",
HeadMaterial = reinforcement,
HostPrimitive=concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[0];
point.Center.Y = ys[0];
primitives.Add(point);
@@ -73,9 +75,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area1,
Name = "Right bottom rebar",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[1];
point.Center.Y = ys[0];
primitives.Add(point);
@@ -83,9 +85,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area2,
Name = "Left top rebar",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[0];
point.Center.Y = ys[1];
primitives.Add(point);
@@ -93,9 +95,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area2,
Name = "Right top rebar",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[1];
point.Center.Y = ys[1];
primitives.Add(point);
@@ -115,11 +117,23 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
double dist = (xs[1] - xs[0]) / count;
for (int i = 1; i < count; i++)
{
point = new RebarPrimitive() { Area = area1, Name = $"Bottom rebar {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area1,
Name = $"Bottom rebar {i}",
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[0] + dist * i;
point.Center.Y = ys[0];
primitives.Add(point);
point = new RebarPrimitive() {Area = area2, Name = $"Top rebar {i}", HeadMaterial = reinforcement, HostPrimitive = concreteBlock };
point = new RebarPrimitive()
{
Area = area2,
Name = $"Top rebar {i}",
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[0] + dist * i;
point.Center.Y = ys[1];
primitives.Add(point);
@@ -135,9 +149,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area1,
Name = $"Left point {i}",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[0];
point.Center.Y = ys[0] + dist * i;
primitives.Add(point);
@@ -145,9 +159,9 @@ namespace StructureHelperLogics.Models.Templates.CrossSections.RCs
{
Area = area1,
Name = $"Right point {i}",
HeadMaterial = reinforcement,
HostPrimitive = concreteBlock
};
point.NdmElement.HeadMaterial = reinforcement;
point.Center.X = xs[1];
point.Center.Y = ys[0] + dist * i;
primitives.Add(point);