Add VisualAnalysisDTO
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public class DivisionSize : IDivisionSize
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public double NdmMaxSize { get; set; } = 0.01d;
|
||||
/// <inheritdoc/>
|
||||
public int NdmMinDivision { get; set; } = 10;
|
||||
/// <inheritdoc/>
|
||||
public bool ClearUnderlying { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -9,46 +9,54 @@ using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class CirclePrimitive : ICirclePrimitive
|
||||
public class EllipsePrimitive : IEllipsePrimitive
|
||||
{
|
||||
static readonly CircleUpdateStrategy updateStrategy = new();
|
||||
private static readonly EllipsePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; }
|
||||
public StrainTuple AutoPrestrain { get; }
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public double Diameter { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public bool ClearUnderlying { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
public IPoint2D Center { get; set; } = new Point2D();
|
||||
/// <inheritdoc/>
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty { Opacity = 0.8d };
|
||||
/// <inheritdoc/>
|
||||
public double DiameterByX
|
||||
{
|
||||
get
|
||||
{
|
||||
return rectangleShape.Width;
|
||||
}
|
||||
set
|
||||
{
|
||||
rectangleShape.Width = value;
|
||||
rectangleShape.Height = value;
|
||||
}
|
||||
}
|
||||
/// <inheritdoc/>
|
||||
public double DiameterByY { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
/// <inheritdoc/>
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
/// <inheritdoc/>
|
||||
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
||||
/// <inheritdoc/>
|
||||
public IShape Shape => rectangleShape;
|
||||
|
||||
public CirclePrimitive(Guid id)
|
||||
|
||||
public EllipsePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Circle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d };
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public CirclePrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
public EllipsePrimitive() : this (Guid.NewGuid()) {}
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new CirclePrimitive();
|
||||
var primitive = new EllipsePrimitive();
|
||||
updateStrategy.Update(primitive, this);
|
||||
return primitive;
|
||||
}
|
||||
@@ -70,7 +78,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
var dX = Center.X - point.X;
|
||||
var dY = Center.Y - point.Y;
|
||||
var distance = Math.Sqrt(dX * dX + dY * dY);
|
||||
if (distance > Diameter / 2) { return false; }
|
||||
if (distance > DiameterByX / 2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,28 +96,28 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Left",
|
||||
Point = new Point2D() { X = Center.X - Diameter / 2d, Y = Center.Y},
|
||||
Point = new Point2D() { X = Center.X - DiameterByX / 2d, Y = Center.Y},
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Top",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y + Diameter / 2d },
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y + DiameterByX / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Right",
|
||||
Point = new Point2D() { X = Center.X + Diameter / 2d, Y = Center.Y },
|
||||
Point = new Point2D() { X = Center.X + DiameterByX / 2d, Y = Center.Y },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
newPoint = new NamedAreaPoint
|
||||
{
|
||||
Name = "Bottom",
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y - Diameter / 2d },
|
||||
Point = new Point2D() { X = Center.X, Y = Center.Y - DiameterByX / 2d },
|
||||
Area = 0d
|
||||
};
|
||||
points.Add(newPoint);
|
||||
@@ -0,0 +1,29 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
/// Include parameters of triangulation for shapes
|
||||
/// </summary>
|
||||
public interface IDivisionSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum size of Ndm part
|
||||
/// </summary>
|
||||
double NdmMaxSize { get; set; }
|
||||
/// <summary>
|
||||
/// Mimimum division for sides of shape
|
||||
/// </summary>
|
||||
int NdmMinDivision { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of removing ndm part which located inside shape
|
||||
/// </summary>
|
||||
bool ClearUnderlying { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface ICirclePrimitive : INdmPrimitive, IHasDivisionSize, ICircleShape
|
||||
public interface IEllipsePrimitive : INdmPrimitive, IHasDivisionSize
|
||||
{
|
||||
double DiameterByX { get; set; }
|
||||
double DiameterByY { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -8,23 +7,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
/// <summary>
|
||||
/// Include parameters of triangulation for shapes
|
||||
/// </summary>
|
||||
public interface IHasDivisionSize
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum size of Ndm part
|
||||
/// </summary>
|
||||
double NdmMaxSize { get; set; }
|
||||
/// <summary>
|
||||
/// Mimimum division for sides of shape
|
||||
/// </summary>
|
||||
int NdmMinDivision { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of removing ndm part which located inside shape
|
||||
/// </summary>
|
||||
bool ClearUnderlying { get; set; }
|
||||
///<inheritdoc/>
|
||||
IDivisionSize DivisionSize { get; }
|
||||
/// <summary>
|
||||
/// Shows if point is located inside shape
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface ILinePrimitive : IHasDivisionSize, ILineShape
|
||||
public interface ILinePrimitive : IDivisionSize, ILineShape
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface INdmElement : ISaveable, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Base point of primitive
|
||||
/// </summary>
|
||||
IPoint2D Center { get; }
|
||||
/// <summary>
|
||||
/// Material of primitive
|
||||
/// </summary>
|
||||
|
||||
@@ -17,38 +17,22 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Geometrical primitive which generates ndm elemtntary part
|
||||
/// </summary>
|
||||
public interface INdmPrimitive : ISaveable, ICloneable
|
||||
public interface INdmPrimitive : ISaveable, IHasCenter2D, ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of primitive
|
||||
/// </summary>
|
||||
string? Name { get; set; }
|
||||
INdmElement NdmElement { get;}
|
||||
IShape Shape { get; }
|
||||
/// <summary>
|
||||
/// Base point of primitive
|
||||
/// Base properties of primitive
|
||||
/// </summary>
|
||||
IPoint2D Center { get; }
|
||||
INdmElement NdmElement { get;}
|
||||
/// <summary>
|
||||
/// Host cross-section for primitive
|
||||
/// </summary>
|
||||
ICrossSection? CrossSection { get; set; }
|
||||
/// <summary>
|
||||
/// Material of primitive
|
||||
/// </summary>
|
||||
IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <summary>
|
||||
/// Flag of triangulation
|
||||
/// </summary>
|
||||
bool Triangulate { get; set; }
|
||||
/// <summary>
|
||||
/// Prestrain assigned from user
|
||||
/// </summary>
|
||||
StrainTuple UsersPrestrain { get; }
|
||||
/// <summary>
|
||||
/// Prestrain assigned from calculations
|
||||
/// </summary>
|
||||
StrainTuple AutoPrestrain { get; }
|
||||
/// <summary>
|
||||
/// Visual settings
|
||||
/// </summary>
|
||||
IVisualProperty VisualProperty {get; }
|
||||
|
||||
@@ -23,11 +23,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
if (sourceObject.HeadMaterial != null) targetObject.HeadMaterial = sourceObject.HeadMaterial;
|
||||
targetObject.Triangulate = sourceObject.Triangulate;
|
||||
if (sourceObject.NdmElement.HeadMaterial != null)
|
||||
{
|
||||
targetObject.NdmElement.HeadMaterial = sourceObject.NdmElement.HeadMaterial;
|
||||
}
|
||||
targetObject.NdmElement.Triangulate = sourceObject.NdmElement.Triangulate;
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
visualPropsUpdateStrategy.Update(targetObject.VisualProperty, sourceObject.VisualProperty);
|
||||
tupleUpdateStrategy.Update(targetObject.UsersPrestrain, sourceObject.UsersPrestrain);
|
||||
tupleUpdateStrategy.Update(targetObject.NdmElement.UsersPrestrain, sourceObject.NdmElement.UsersPrestrain);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
}
|
||||
}
|
||||
|
||||
if (RebarPrimitive.HostPrimitive.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||
if (RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.HelperMaterial is not ICrackedMaterial)
|
||||
{
|
||||
result = false;
|
||||
string message = $"Material of host of {RebarPrimitive.Name} ({RebarPrimitive.HostPrimitive.HeadMaterial.Name}) does not support cracking\n";
|
||||
string message = $"Material of host of {RebarPrimitive.Name} ({RebarPrimitive.HostPrimitive.NdmElement.HeadMaterial.Name}) does not support cracking\n";
|
||||
checkResult += message;
|
||||
TraceLogger?.AddMessage(message, TraceLogStatuses.Error);
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class CircleUpdateStrategy : IUpdateStrategy<CirclePrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||
static readonly CircleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||
|
||||
public void Update(CirclePrimitive targetObject, CirclePrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IHasDivisionSize>
|
||||
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IDivisionSize>
|
||||
{
|
||||
public void Update(IHasDivisionSize targetObject, IHasDivisionSize sourceObject)
|
||||
public void Update(IDivisionSize targetObject, IDivisionSize sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.NdmMaxSize = sourceObject.NdmMaxSize;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipsePrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
private IUpdateStrategy<IShape> shapeUpdateStrategy;
|
||||
|
||||
public EllipsePrimitiveUpdateStrategy(IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy,
|
||||
IUpdateStrategy<IShape> shapeUpdateStrategy,
|
||||
IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy)
|
||||
{
|
||||
this.basePrimitiveUpdateStrategy = basePrimitiveUpdateStrategy;
|
||||
this.shapeUpdateStrategy = shapeUpdateStrategy;
|
||||
this.divisionPropsUpdateStrategy = divisionPropsUpdateStrategy;
|
||||
}
|
||||
public EllipsePrimitiveUpdateStrategy() : this(
|
||||
new BaseUpdateStrategy(),
|
||||
new ShapeUpdateStrategy(),
|
||||
new DivisionPropsUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
public void Update(IEllipsePrimitive targetObject, IEllipsePrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject.DivisionSize, sourceObject.DivisionSize);
|
||||
shapeUpdateStrategy.Update(targetObject.Shape, sourceObject.Shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,21 +5,16 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
public class INdmElementUpdateStrategy : IUpdateStrategy<INdmElement>
|
||||
public class NdmElementUpdateStrategy : IUpdateStrategy<INdmElement>
|
||||
{
|
||||
private readonly IUpdateStrategy<IPoint2D> point2DUpdateStrategy;
|
||||
private readonly IUpdateStrategy<IForceTuple> tupleUpdateStrategy;
|
||||
|
||||
public INdmElementUpdateStrategy(IUpdateStrategy<IPoint2D> point2DUpdateStrategy,
|
||||
IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
||||
public NdmElementUpdateStrategy(IUpdateStrategy<IForceTuple> tupleUpdateStrategy)
|
||||
{
|
||||
this.point2DUpdateStrategy = point2DUpdateStrategy;
|
||||
this.tupleUpdateStrategy = tupleUpdateStrategy;
|
||||
}
|
||||
|
||||
public INdmElementUpdateStrategy() : this (
|
||||
new Point2DUpdateStrategy(),
|
||||
new ForceTupleUpdateStrategy())
|
||||
public NdmElementUpdateStrategy() : this (new ForceTupleUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
@@ -29,8 +24,6 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
|
||||
point2DUpdateStrategy.Update(targetObject.Center, sourceObject.Center);
|
||||
if (sourceObject.HeadMaterial != null)
|
||||
{
|
||||
targetObject.HeadMaterial = sourceObject.HeadMaterial;
|
||||
@@ -21,11 +21,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
else if (targetObject is RectanglePrimitive rectangle)
|
||||
{
|
||||
new RectangleUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||
new RectanglePrimitiveUpdateStrategy().Update(rectangle, (RectanglePrimitive)sourceObject);
|
||||
}
|
||||
else if (targetObject is CirclePrimitive circle)
|
||||
else if (targetObject is EllipsePrimitive circle)
|
||||
{
|
||||
new CircleUpdateStrategy().Update(circle, (CirclePrimitive)sourceObject);
|
||||
new EllipsePrimitiveUpdateStrategy().Update(circle, (EllipsePrimitive)sourceObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Models.Shapes.Logics;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RectanglePrimitiveUpdateStrategy : IUpdateStrategy<IRectanglePrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
private IUpdateStrategy<IShape> shapeUpdateStrategy;
|
||||
|
||||
public RectanglePrimitiveUpdateStrategy(IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy,
|
||||
IUpdateStrategy<IShape> shapeUpdateStrategy,
|
||||
IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy)
|
||||
{
|
||||
this.basePrimitiveUpdateStrategy = basePrimitiveUpdateStrategy;
|
||||
this.shapeUpdateStrategy = shapeUpdateStrategy;
|
||||
this.divisionPropsUpdateStrategy = divisionPropsUpdateStrategy;
|
||||
}
|
||||
public RectanglePrimitiveUpdateStrategy() : this(
|
||||
new BaseUpdateStrategy(),
|
||||
new ShapeUpdateStrategy(),
|
||||
new DivisionPropsUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Update(IRectanglePrimitive targetObject, IRectanglePrimitive sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(sourceObject, "source object");
|
||||
CheckObject.IsNull(targetObject, "target object");
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject.DivisionSize, sourceObject.DivisionSize);
|
||||
shapeUpdateStrategy.Update(targetObject.Shape, sourceObject.Shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class RectangleUpdateStrategy : IUpdateStrategy<RectanglePrimitive>
|
||||
{
|
||||
static readonly BaseUpdateStrategy basePrimitiveUpdateStrategy = new();
|
||||
static readonly DivisionPropsUpdateStrategy divisionPropsUpdateStrategy = new();
|
||||
static readonly RectangleShapeUpdateStrategy shapeUpdateStrategy = new();
|
||||
public void Update(RectanglePrimitive targetObject, RectanglePrimitive sourceObject)
|
||||
{
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
basePrimitiveUpdateStrategy.Update(targetObject, sourceObject);
|
||||
divisionPropsUpdateStrategy.Update(targetObject, sourceObject);
|
||||
shapeUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,11 +18,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D Center { get; } = new Point2D();
|
||||
/// <inheritdoc/>
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public bool Triangulate { get; set; }
|
||||
public bool Triangulate { get; set; } = true;
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple UsersPrestrain { get; } = new();
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -14,34 +14,26 @@ namespace StructureHelperLogics.Models.Primitives
|
||||
static readonly PointUpdateStrategy updateStrategy = new();
|
||||
public Guid Id { get; }
|
||||
public string? Name { get; set; }
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
//public double NdmMaxSize { get; set; }
|
||||
//public int NdmMinDivision { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; private set; }
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
public double Area { get; set; }
|
||||
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public bool Triangulate { get; set; }
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty();
|
||||
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public PointPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
public PointPrimitive() : this (Guid.NewGuid())
|
||||
{}
|
||||
public PointPrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
|
||||
@@ -27,17 +27,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public string Name { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IPoint2D Center { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public bool Triangulate { get; set; }
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple UsersPrestrain { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
/// <inheritdoc/>
|
||||
public IVisualProperty VisualProperty { get; private set; }
|
||||
public IVisualProperty VisualProperty { get; private set; } = new VisualProperty();
|
||||
/// <inheritdoc/>
|
||||
public Guid Id { get; set; }
|
||||
/// <inheritdoc/>
|
||||
@@ -49,16 +41,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public IShape Shape => throw new NotImplementedException();
|
||||
|
||||
public RebarPrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Reinforcement";
|
||||
Area = 0.0005d;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty();
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
Triangulate = true;
|
||||
}
|
||||
public RebarPrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
@@ -11,46 +11,34 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
readonly RectangleUpdateStrategy updateStrategy = new();
|
||||
private readonly RectanglePrimitiveUpdateStrategy updateStrategy = new();
|
||||
private readonly RectangleShape rectangleShape = new();
|
||||
public Guid Id { get;}
|
||||
public string Name { get; set; }
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public StrainTuple UsersPrestrain { get; private set; }
|
||||
public StrainTuple AutoPrestrain { get; private set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Angle { get; set; }
|
||||
public bool ClearUnderlying { get; set; }
|
||||
public bool Triangulate { get; set; }
|
||||
public IVisualProperty VisualProperty { get; }
|
||||
public double Width { get => rectangleShape.Width; set => rectangleShape.Width = value; }
|
||||
public double Height { get => rectangleShape.Height; set => rectangleShape.Height = value; }
|
||||
public double Angle { get => rectangleShape.Angle; set => rectangleShape.Angle = value; }
|
||||
public IVisualProperty VisualProperty { get; } = new VisualProperty() { Opacity = 0.8d };
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
|
||||
public IPoint2D Center { get; private set; }
|
||||
public IPoint2D Center { get; set; } = new Point2D();
|
||||
|
||||
public INdmElement NdmElement { get; } = new NdmElement();
|
||||
|
||||
public IDivisionSize DivisionSize { get; } = new DivisionSize();
|
||||
|
||||
public IShape Shape => rectangleShape;
|
||||
|
||||
public RectanglePrimitive(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Name = "New Rectangle";
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
Center = new Point2D();
|
||||
VisualProperty = new VisualProperty { Opacity = 0.8d};
|
||||
UsersPrestrain = new StrainTuple();
|
||||
AutoPrestrain = new StrainTuple();
|
||||
ClearUnderlying = false;
|
||||
Triangulate = true;
|
||||
}
|
||||
public RectanglePrimitive() : this(Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RectanglePrimitive(IHeadMaterial material) : this() { HeadMaterial = material; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var primitive = new RectanglePrimitive();
|
||||
|
||||
Reference in New Issue
Block a user