Add triangulation of polygon
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class DivisionSizeFromDTOConvertStrategy : ConvertStrategy<IDivisionSize, IDivisionSize>
|
||||||
|
{
|
||||||
|
IUpdateStrategy<IDivisionSize> updateStrategy;
|
||||||
|
|
||||||
|
public DivisionSizeFromDTOConvertStrategy(IUpdateStrategy<IDivisionSize> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DivisionSizeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
updateStrategy = new DivisionSizeUpdateStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IDivisionSize GetNewItem(IDivisionSize source)
|
||||||
|
{
|
||||||
|
if (source is not DivisionSizeDTO sourceDTO)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
|
||||||
|
}
|
||||||
|
NewItem = new DivisionSize(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, sourceDTO);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,7 +104,7 @@ namespace DataAccess.DTOs
|
|||||||
private void InitializeStrategies()
|
private void InitializeStrategies()
|
||||||
{
|
{
|
||||||
updateStrategy ??= new ForceCombinationFromFileUpdateStrategy();
|
updateStrategy ??= new ForceCombinationFromFileUpdateStrategy();
|
||||||
pointConvertStrategy = new Point2DFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger};
|
pointConvertStrategy = new Point2DFromDTOConvertStrategy(this);
|
||||||
combinationPropertyConvertStrategy = new FactoredCombinationPropertyFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
combinationPropertyConvertStrategy = new FactoredCombinationPropertyFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||||
fileConvertStrategy ??= new ColumnedFilePropertyFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
fileConvertStrategy ??= new ColumnedFilePropertyFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
||||||
updateStrategy ??= new ForceCombinationListUpdateStrategy();
|
updateStrategy ??= new ForceCombinationListUpdateStrategy();
|
||||||
pointConvertStrategy ??= new Point2DFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger};
|
pointConvertStrategy ??= new Point2DFromDTOConvertStrategy(this);
|
||||||
designTupleConvertStrategy ??= new DesignForceTupleFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
designTupleConvertStrategy ??= new DesignForceTupleFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
baseUpdateStrategy ??= new ForceActionBaseUpdateStrategy();
|
||||||
updateStrategy ??= new ForceFactoredListUpdateStrategy();
|
updateStrategy ??= new ForceFactoredListUpdateStrategy();
|
||||||
pointConvertStrategy ??= new Point2DFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger};
|
pointConvertStrategy ??= new Point2DFromDTOConvertStrategy(this);
|
||||||
forceTupleConvertStrategy ??= new ForceTupleFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
forceTupleConvertStrategy ??= new ForceTupleFromDTOConvertStrategy() { ReferenceDictionary = ReferenceDictionary, TraceLogger = TraceLogger };
|
||||||
combinationPropertyConvertStrategy ??= new FactoredCombinationPropertyFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
combinationPropertyConvertStrategy ??= new FactoredCombinationPropertyFromDTOConvertStrategy(ReferenceDictionary, TraceLogger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs.Converters
|
namespace DataAccess.DTOs.Converters
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class NdmElementFromDTOConvertStrategy : ConvertStrategy<INdmElement, INdmElement>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<INdmElement> updateStrategy;
|
||||||
|
private IUpdateStrategy<IForceTuple> forceUpdateStrategy = new ForceTupleUpdateStrategy();
|
||||||
|
private NdmElement newItem;
|
||||||
|
|
||||||
|
public NdmElementFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override INdmElement GetNewItem(INdmElement source)
|
||||||
|
{
|
||||||
|
if (source is not NdmElementDTO sourceDTO)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
|
||||||
|
}
|
||||||
|
newItem = new NdmElement(sourceDTO.Id);
|
||||||
|
updateStrategy = new NdmElementUpdateStrategy() { UpdateChildren = false};
|
||||||
|
updateStrategy.Update(newItem, sourceDTO);
|
||||||
|
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
||||||
|
//newItem.UsersPrestrain.Id = source.UsersPrestrain.Id;
|
||||||
|
//forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
||||||
|
//(newItem.AutoPrestrain as ForceTupleDTO).Id = source.AutoPrestrain.Id;
|
||||||
|
NewItem = newItem;
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,16 +54,20 @@ namespace DataAccess.DTOs
|
|||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(newItem, source);
|
||||||
headMaterialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
headMaterialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||||
headMaterialConvertStrategy.TraceLogger = TraceLogger;
|
headMaterialConvertStrategy.TraceLogger = TraceLogger;
|
||||||
var convertLogic = new DictionaryConvertStrategy<HeadMaterialDTO, IHeadMaterial>(this, headMaterialConvertStrategy);
|
var headMaterialLogic = new DictionaryConvertStrategy<HeadMaterialDTO, IHeadMaterial>(this, headMaterialConvertStrategy);
|
||||||
if (source.HeadMaterial != null)
|
if (source.HeadMaterial != null)
|
||||||
{
|
{
|
||||||
var headMaterial = convertLogic.Convert(source.HeadMaterial);
|
var headMaterial = headMaterialLogic.Convert(source.HeadMaterial);
|
||||||
newItem.HeadMaterial = headMaterial;
|
newItem.HeadMaterial = headMaterial;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newItem.HeadMaterial = null;
|
||||||
|
}
|
||||||
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
||||||
(newItem.UsersPrestrain as ForceTupleDTO).Id = source.UsersPrestrain.Id;
|
(newItem.UsersPrestrain as ForceTupleDTO).Id = source.UsersPrestrain.Id;
|
||||||
forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
//forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
||||||
(newItem.AutoPrestrain as ForceTupleDTO).Id = source.AutoPrestrain.Id;
|
//(newItem.AutoPrestrain as ForceTupleDTO).Id = source.AutoPrestrain.Id;
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,12 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
public override INdmPrimitive GetNewItem(INdmPrimitive source)
|
public override INdmPrimitive GetNewItem(INdmPrimitive source)
|
||||||
{
|
{
|
||||||
GetMaterial(source.NdmElement.HeadMaterial);
|
|
||||||
INdmPrimitive newItem = GetNewPrimitive(source);
|
INdmPrimitive newItem = GetNewPrimitive(source);
|
||||||
newItem.NdmElement.HeadMaterial = headMaterial;
|
if (source.NdmElement.HeadMaterial != null)
|
||||||
|
{
|
||||||
|
GetMaterial(source.NdmElement.HeadMaterial);
|
||||||
|
newItem.NdmElement.HeadMaterial = headMaterial;
|
||||||
|
}
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,11 +72,23 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
return GetRectangle(rectangle);
|
return GetRectangle(rectangle);
|
||||||
}
|
}
|
||||||
|
if (source is ShapeNdmPrimitiveDTO shape)
|
||||||
|
{
|
||||||
|
return GetShape(shape);
|
||||||
|
}
|
||||||
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
string errorString = ErrorStrings.ObjectTypeIsUnknownObj(source);
|
||||||
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
TraceLogger.AddMessage(errorString, TraceLogStatuses.Error);
|
||||||
throw new StructureHelperException(errorString);
|
throw new StructureHelperException(errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private INdmPrimitive GetShape(ShapeNdmPrimitiveDTO shape)
|
||||||
|
{
|
||||||
|
TraceLogger?.AddMessage($"{PrimitiveIs} shape ndm primitive");
|
||||||
|
ShapeNdmPrimitiveFromDTOConvertStrategy convertStrategy = new(this);
|
||||||
|
IShapeNdmPrimitive shapeNdmPrimitive = convertStrategy.Convert(shape);
|
||||||
|
return shapeNdmPrimitive;
|
||||||
|
}
|
||||||
|
|
||||||
private void GetMaterial(IHeadMaterial source)
|
private void GetMaterial(IHeadMaterial source)
|
||||||
{
|
{
|
||||||
HeadMaterialFromDTOConvertStrategy convertStrategy = new()
|
HeadMaterialFromDTOConvertStrategy convertStrategy = new()
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class ShapeNdmPrimitiveFromDTOConvertStrategy : ConvertStrategy<IShapeNdmPrimitive, IShapeNdmPrimitive>
|
||||||
|
{
|
||||||
|
IUpdateStrategy<IShapeNdmPrimitive> updateStrategy;
|
||||||
|
private IConvertStrategy<IShape, IShape> shapeConvertStrategy;
|
||||||
|
private IConvertStrategy<INdmElement, INdmElement> ndmElementConvertStrategy;
|
||||||
|
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
|
||||||
|
private IConvertStrategy<IVisualProperty, VisualPropertyDTO> visualPropsConvertStrategy;
|
||||||
|
private IConvertStrategy<IDivisionSize, IDivisionSize> divisionConvertStrategy;
|
||||||
|
|
||||||
|
private ShapeNdmPrimitive newItem;
|
||||||
|
|
||||||
|
public ShapeNdmPrimitiveFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
updateStrategy = new ShapeNdmPrimitiveUpdateStrategy() { UpdateChildren = false };
|
||||||
|
shapeConvertStrategy = new ShapeFromDTOConvertStrategy(this);
|
||||||
|
ndmElementConvertStrategy = new NdmElementFromDTOConvertStrategy(this);
|
||||||
|
pointConvertStrategy = new Point2DFromDTOConvertStrategy(this);
|
||||||
|
visualPropsConvertStrategy = new VisualPropertyFromDTOConvertStrategy(this);
|
||||||
|
divisionConvertStrategy = new DivisionSizeFromDTOConvertStrategy(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IShapeNdmPrimitive GetNewItem(IShapeNdmPrimitive source)
|
||||||
|
{
|
||||||
|
ChildClass = this;
|
||||||
|
if (source is not ShapeNdmPrimitiveDTO sourceDTO)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": source shape is not DTO object");
|
||||||
|
}
|
||||||
|
newItem = new(source.Id);
|
||||||
|
updateStrategy.Update(newItem, sourceDTO);
|
||||||
|
updateChildProperties(sourceDTO);
|
||||||
|
NewItem = newItem;
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
private void updateChildProperties(ShapeNdmPrimitiveDTO source)
|
||||||
|
{
|
||||||
|
newItem.SetShape(shapeConvertStrategy.Convert(source.Shape));
|
||||||
|
newItem.NdmElement = ndmElementConvertStrategy.Convert(source.NdmElement);
|
||||||
|
newItem.Center = pointConvertStrategy.Convert(source.Center as Point2DDTO);
|
||||||
|
newItem.VisualProperty = visualPropsConvertStrategy.Convert(source.VisualProperty as VisualPropertyDTO);
|
||||||
|
newItem.DivisionSize = divisionConvertStrategy.Convert(source.DivisionSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class LinePolygonFromDTOConvertStrategy : ConvertStrategy<ILinePolygonShape, ILinePolygonShape>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<ILinePolygonShape> updateStrategy;
|
||||||
|
private IConvertStrategy<IVertex, IVertex> vertexConvertStrategy;
|
||||||
|
private LinePolygonShape newItem;
|
||||||
|
|
||||||
|
public LinePolygonFromDTOConvertStrategy(IUpdateStrategy<ILinePolygonShape> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinePolygonFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
updateStrategy = new LinePolygonShapeUpdateStrategy() { UpdateChildren = false };
|
||||||
|
vertexConvertStrategy = new VertexFtomDTOConvertStrategy(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override ILinePolygonShape GetNewItem(ILinePolygonShape source)
|
||||||
|
{
|
||||||
|
ChildClass = this;
|
||||||
|
if (source is not LinePolygonShapeDTO sourceDTO)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": source line polygon is not DTO object");
|
||||||
|
}
|
||||||
|
newItem = new(sourceDTO.Id);
|
||||||
|
updateStrategy.Update(newItem, sourceDTO);
|
||||||
|
newItem.Clear();
|
||||||
|
foreach (var item in source.Vertices)
|
||||||
|
{
|
||||||
|
IVertex newVertex = vertexConvertStrategy.Convert(item);
|
||||||
|
newItem.AddVertex(newVertex);
|
||||||
|
}
|
||||||
|
NewItem = newItem;
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,24 +12,26 @@ namespace DataAccess.DTOs
|
|||||||
{
|
{
|
||||||
private IUpdateStrategy<ILinePolygonShape> updateStrategy;
|
private IUpdateStrategy<ILinePolygonShape> updateStrategy;
|
||||||
private IConvertStrategy<VertexDTO, IVertex> vertexConvertStrategy;
|
private IConvertStrategy<VertexDTO, IVertex> vertexConvertStrategy;
|
||||||
|
private LinePolygonShapeDTO newItem;
|
||||||
|
|
||||||
public LinePolygonToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
public LinePolygonToDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
{
|
{
|
||||||
|
updateStrategy = new LinePolygonShapeUpdateStrategy() { UpdateChildren = false };
|
||||||
|
vertexConvertStrategy = new VertexToDTOConvertStrategy(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LinePolygonShapeDTO GetNewItem(ILinePolygonShape source)
|
public override LinePolygonShapeDTO GetNewItem(ILinePolygonShape source)
|
||||||
{
|
{
|
||||||
ChildClass = this;
|
ChildClass = this;
|
||||||
NewItem = new(source.Id);
|
newItem = new(source.Id);
|
||||||
updateStrategy = new LinePolygonShapeUpdateStrategy() { UpdateChildren = false };
|
updateStrategy.Update(newItem, source);
|
||||||
vertexConvertStrategy = new VertexToDTOConvertStrategy(this);
|
newItem.Clear();
|
||||||
updateStrategy.Update(NewItem, source);
|
|
||||||
NewItem.Clear();
|
|
||||||
foreach (var item in source.Vertices)
|
foreach (var item in source.Vertices)
|
||||||
{
|
{
|
||||||
VertexDTO newVertex = vertexConvertStrategy.Convert(item);
|
VertexDTO newVertex = vertexConvertStrategy.Convert(item);
|
||||||
NewItem.AddVertex(newVertex);
|
newItem.AddVertex(newVertex);
|
||||||
}
|
}
|
||||||
|
NewItem = newItem;
|
||||||
return NewItem;
|
return NewItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Loggers;
|
|
||||||
using StructureHelperCommon.Models;
|
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace DataAccess.DTOs
|
namespace DataAccess.DTOs
|
||||||
{
|
{
|
||||||
@@ -24,27 +17,16 @@ namespace DataAccess.DTOs
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Point2D GetNewItem(Point2DDTO source)
|
public Point2DFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
{
|
{
|
||||||
TraceLogger?.AddMessage("Point 2D converting has been started");
|
updateStrategy = new Point2DUpdateStrategy();
|
||||||
try
|
|
||||||
{
|
|
||||||
Point2D newItem = GetNewItemBySource(source);
|
|
||||||
TraceLogger?.AddMessage("Point 2D converting has been finished");
|
|
||||||
return newItem;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
TraceLogger?.AddMessage($"Logic: {LoggerStrings.LogicType(this)} made error: {ex.Message}", TraceLogStatuses.Error);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point2D GetNewItemBySource(Point2DDTO source)
|
public override Point2D GetNewItem(Point2DDTO source)
|
||||||
{
|
{
|
||||||
Point2D newItem = new(source.Id);
|
NewItem = new(source.Id);
|
||||||
updateStrategy.Update(newItem, source);
|
updateStrategy.Update(NewItem, source);
|
||||||
return newItem;
|
return NewItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ namespace DataAccess.DTOs
|
|||||||
(this, new CircleShapeFromDTOConvertStrategy(this));
|
(this, new CircleShapeFromDTOConvertStrategy(this));
|
||||||
NewItem = circleConvertStrategy.Convert(circleShapeDTO);
|
NewItem = circleConvertStrategy.Convert(circleShapeDTO);
|
||||||
}
|
}
|
||||||
|
else if (source is LinePolygonShapeDTO linePolygonDTO)
|
||||||
|
{
|
||||||
|
var polygonConvertStrategy = new DictionaryConvertStrategy<ILinePolygonShape, ILinePolygonShape>
|
||||||
|
(this, new LinePolygonFromDTOConvertStrategy(this));
|
||||||
|
NewItem = polygonConvertStrategy.Convert(linePolygonDTO);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown");
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown");
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class VertexFtomDTOConvertStrategy : ConvertStrategy<IVertex, IVertex>
|
||||||
|
{
|
||||||
|
private IUpdateStrategy<IVertex> updateStrategy;
|
||||||
|
private IConvertStrategy<Point2D, Point2DDTO> pointConvertStrategy;
|
||||||
|
private Vertex newItem;
|
||||||
|
|
||||||
|
public VertexFtomDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
updateStrategy = new VertexUpdateStrategy() { UpdateChildren = false };
|
||||||
|
pointConvertStrategy = new Point2DFromDTOConvertStrategy(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IVertex GetNewItem(IVertex source)
|
||||||
|
{
|
||||||
|
ChildClass = this;
|
||||||
|
if (source is not VertexDTO sourceDTO)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": source vertex is not DTO object");
|
||||||
|
}
|
||||||
|
newItem = new(sourceDTO.Id);
|
||||||
|
updateStrategy.Update(newItem, sourceDTO);
|
||||||
|
newItem.Point = pointConvertStrategy.Convert(sourceDTO.Point as Point2DDTO);
|
||||||
|
NewItem = newItem;
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
|
namespace DataAccess.DTOs
|
||||||
|
{
|
||||||
|
public class VisualPropertyFromDTOConvertStrategy : ConvertStrategy<IVisualProperty, VisualPropertyDTO>
|
||||||
|
{
|
||||||
|
IUpdateStrategy<IVisualProperty> updateStrategy;
|
||||||
|
|
||||||
|
public VisualPropertyFromDTOConvertStrategy(IUpdateStrategy<IVisualProperty> updateStrategy)
|
||||||
|
{
|
||||||
|
this.updateStrategy = updateStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VisualPropertyFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
|
||||||
|
{
|
||||||
|
updateStrategy = new VisualPropsUpdateStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IVisualProperty GetNewItem(VisualPropertyDTO source)
|
||||||
|
{
|
||||||
|
NewItem = new VisualProperty(source.Id);
|
||||||
|
updateStrategy.Update(NewItem, source);
|
||||||
|
return NewItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace DataAccess.DTOs
|
|||||||
public bool Triangulate { get; set; }
|
public bool Triangulate { get; set; }
|
||||||
[JsonProperty("UsersPrestrain")]
|
[JsonProperty("UsersPrestrain")]
|
||||||
public IForceTuple UsersPrestrain { get; set; } = new ForceTupleDTO(Guid.NewGuid());
|
public IForceTuple UsersPrestrain { get; set; } = new ForceTupleDTO(Guid.NewGuid());
|
||||||
[JsonProperty("AutoPrestrain")]
|
[JsonIgnore]
|
||||||
public IForceTuple AutoPrestrain { get; set; } = new ForceTupleDTO(Guid.NewGuid());
|
public IForceTuple AutoPrestrain { get; set; } = new ForceTupleDTO(Guid.NewGuid());
|
||||||
|
|
||||||
public NdmElementDTO(Guid id)
|
public NdmElementDTO(Guid id)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("Name")]
|
[JsonProperty("Name")]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
[JsonProperty("Shape")]
|
[JsonProperty("Shape")]
|
||||||
public IShape Shape => shape;
|
public IShape Shape { get => shape; set => shape = value; }
|
||||||
[JsonProperty("NdmElement")]
|
[JsonProperty("NdmElement")]
|
||||||
public INdmElement NdmElement { get; set; }
|
public INdmElement NdmElement { get; set; }
|
||||||
[JsonProperty("Center")]
|
[JsonProperty("Center")]
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ namespace DataAccess.DTOs
|
|||||||
[JsonProperty("Id")]
|
[JsonProperty("Id")]
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
[JsonProperty("Vertices")]
|
[JsonProperty("Vertices")]
|
||||||
public IReadOnlyList<IVertex> Vertices => _vertices;
|
public List<IVertex> VerticesList {get => _vertices;}
|
||||||
[JsonProperty("IsClosed")]
|
[JsonProperty("IsClosed")]
|
||||||
public bool IsClosed { get; set; }
|
public bool IsClosed { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public IReadOnlyList<IVertex> Vertices => _vertices;
|
||||||
|
|
||||||
public LinePolygonShapeDTO(Guid id)
|
public LinePolygonShapeDTO(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using StructureHelperCommon.Models.Analyses;
|
|||||||
using StructureHelperCommon.Models.Calculators;
|
using StructureHelperCommon.Models.Calculators;
|
||||||
using StructureHelperCommon.Models.Forces;
|
using StructureHelperCommon.Models.Forces;
|
||||||
using StructureHelperCommon.Models.Materials.Libraries;
|
using StructureHelperCommon.Models.Materials.Libraries;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperLogics.Models.BeamShears;
|
using StructureHelperLogics.Models.BeamShears;
|
||||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
|
||||||
@@ -34,70 +35,117 @@ namespace DataAccess.DTOs
|
|||||||
List<(Type type, string name)> newList = new List<(Type type, string name)>
|
List<(Type type, string name)> newList = new List<(Type type, string name)>
|
||||||
{
|
{
|
||||||
{ (typeof(AccuracyDTO), "Accuracy") },
|
{ (typeof(AccuracyDTO), "Accuracy") },
|
||||||
{ (typeof(CircleShapeDTO), "CircleShape") },
|
|
||||||
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
|
||||||
{ (typeof(ColumnFilePropertyDTO), "ColumnFileProperty") },
|
{ (typeof(ColumnFilePropertyDTO), "ColumnFileProperty") },
|
||||||
{ (typeof(ColumnedFilePropertyDTO), "ColumnedFileProperty") },
|
{ (typeof(ColumnedFilePropertyDTO), "ColumnedFileProperty") },
|
||||||
{ (typeof(CompressedMemberDTO), "CompressedMember") },
|
{ (typeof(CompressedMemberDTO), "CompressedMember") },
|
||||||
{ (typeof(CrackCalculatorDTO), "CrackCalculator") },
|
|
||||||
{ (typeof(CrackCalculatorInputDataDTO), "CrackCalculatorInputData") },
|
|
||||||
{ (typeof(CrossSectionDTO), "CrossSection") },
|
|
||||||
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
|
||||||
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
|
||||||
{ (typeof(DateVersionDTO), "DateVersion") },
|
|
||||||
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
|
||||||
{ (typeof(DivisionSizeDTO), "DivisionSize") },
|
{ (typeof(DivisionSizeDTO), "DivisionSize") },
|
||||||
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
|
||||||
{ (typeof(EllipseNdmPrimitiveDTO), "EllipseNdmPrimitive") },
|
|
||||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
|
||||||
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
|
|
||||||
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
|
|
||||||
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
|
||||||
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
|
||||||
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
|
||||||
{ (typeof(NdmElementDTO), "NdmElement") },
|
|
||||||
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
|
||||||
{ (typeof(List<CalcTerms>), "ListOfCalcTerms") },
|
{ (typeof(List<CalcTerms>), "ListOfCalcTerms") },
|
||||||
{ (typeof(List<IColumnFileProperty>), "ColumnFileProperties") },
|
{ (typeof(List<IColumnFileProperty>), "ColumnFileProperties") },
|
||||||
{ (typeof(List<IColumnedFileProperty>), "ColumnedFileProperties") },
|
{ (typeof(List<IColumnedFileProperty>), "ColumnedFileProperties") },
|
||||||
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
|
||||||
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
|
||||||
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
|
|
||||||
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
|
||||||
{ (typeof(List<IForceTuple>), "ListOfIForceTuple") },
|
|
||||||
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
|
||||||
{ (typeof(List<LimitStates>), "ListOfLimitState") },
|
{ (typeof(List<LimitStates>), "ListOfLimitState") },
|
||||||
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
|
||||||
{ (typeof(List<IMaterialPartialFactor>), "ListOfMaterialPartialFactor") },
|
|
||||||
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
|
|
||||||
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
|
{ (typeof(List<IPartialFactor>), "ListOfPartialFactor") },
|
||||||
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
|
||||||
{ (typeof(Point2DDTO), "Point2D") },
|
|
||||||
{ (typeof(PointNdmPrimitiveDTO), "PointNdmPrimitive") },
|
|
||||||
{ (typeof(PrimitiveVisualPropertyDTO), "PrimitiveVisualProperty") },
|
|
||||||
{ (typeof(ProjectDTO), "Project") },
|
|
||||||
{ (typeof(RebarNdmPrimitiveDTO), "RebarNdmPrimitive") },
|
|
||||||
{ (typeof(RebarSectionDTO), "RebarSection") },
|
{ (typeof(RebarSectionDTO), "RebarSection") },
|
||||||
{ (typeof(RectangleNdmPrimitiveDTO), "RectangleNdmPrimitive") },
|
|
||||||
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
|
||||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
|
||||||
{ (typeof(RootObjectDTO), "RootObject") },
|
|
||||||
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
|
||||||
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
|
||||||
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
|
||||||
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
||||||
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
|
||||||
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
|
{ (typeof(WorkPlanePropertyDTO), "WorkPlanePropertyDTO") },
|
||||||
};
|
};
|
||||||
|
newList.AddRange(GetProjectList());
|
||||||
|
newList.AddRange(GetGeometryShapeList());
|
||||||
newList.AddRange(GetForceList());
|
newList.AddRange(GetForceList());
|
||||||
newList.AddRange(GetListForBeamShear());
|
newList.AddRange(GetMaterialList());
|
||||||
|
newList.AddRange(GetCalculatorList());
|
||||||
|
newList.AddRange(GetNdmPrimitiveList());
|
||||||
|
newList.AddRange(GetBeamShearList());
|
||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<(Type type, string name)> GetProjectList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
||||||
|
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
||||||
|
{ (typeof(RootObjectDTO), "RootObject") },
|
||||||
|
{ (typeof(ProjectDTO), "Project") },
|
||||||
|
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
||||||
|
{ (typeof(DateVersionDTO), "DateVersion") },
|
||||||
|
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
||||||
|
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
||||||
|
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||||
|
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
private static List<(Type type, string name)> GetMaterialList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(List<IMaterialPartialFactor>), "ListOfMaterialPartialFactor") },
|
||||||
|
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
||||||
|
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
||||||
|
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
||||||
|
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
||||||
|
{ (typeof(List<IHeadMaterial>), "ListOfIHeadMaterial") },
|
||||||
|
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
||||||
|
{ (typeof(List<IMaterialSafetyFactor>), "ListOfMaterialSafetyFactor") },
|
||||||
|
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
||||||
|
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
private static List<(Type type, string name)> GetCalculatorList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
||||||
|
{ (typeof(ForceCalculatorDTO), "ForceCalculator") },
|
||||||
|
{ (typeof(ForceCalculatorInputDataDTO), "ForceCalculatorInputData") },
|
||||||
|
{ (typeof(CrackCalculatorDTO), "CrackCalculator") },
|
||||||
|
{ (typeof(CrackCalculatorInputDataDTO), "CrackCalculatorInputData") },
|
||||||
|
{ (typeof(UserCrackInputDataDTO), "UserCrackInputData") },
|
||||||
|
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
private static List<(Type type, string name)> GetNdmPrimitiveList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(List<INdmPrimitive>), "ListOfINdmPrimitive") },
|
||||||
|
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
||||||
|
{ (typeof(CrossSectionDTO), "CrossSection") },
|
||||||
|
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
||||||
|
{ (typeof(NdmElementDTO), "NdmElement") },
|
||||||
|
{ (typeof(PointNdmPrimitiveDTO), "PointNdmPrimitive") },
|
||||||
|
{ (typeof(RebarNdmPrimitiveDTO), "RebarNdmPrimitive") },
|
||||||
|
{ (typeof(RectangleNdmPrimitiveDTO), "RectangleNdmPrimitive") },
|
||||||
|
{ (typeof(EllipseNdmPrimitiveDTO), "EllipseNdmPrimitive") },
|
||||||
|
{ (typeof(ShapeNdmPrimitiveDTO), "ShapeNdmPrimitive") },
|
||||||
|
{ (typeof(PrimitiveVisualPropertyDTO), "PrimitiveVisualProperty") },
|
||||||
|
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
private static List<(Type type, string name)> GetGeometryShapeList()
|
||||||
|
{
|
||||||
|
List<(Type type, string name)> newList = new()
|
||||||
|
{
|
||||||
|
{ (typeof(List<IVertex>), "ListOfVertex2D") },
|
||||||
|
{ (typeof(Point2DDTO), "Point2D") },
|
||||||
|
{ (typeof(VertexDTO), "Vertex2D") },
|
||||||
|
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
||||||
|
{ (typeof(CircleShapeDTO), "CircleShape") },
|
||||||
|
{ (typeof(LinePolygonShapeDTO), "LinePolygonShape") },
|
||||||
|
};
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
private static List<(Type type, string name)> GetForceList()
|
private static List<(Type type, string name)> GetForceList()
|
||||||
{
|
{
|
||||||
List<(Type type, string name)> newList = new()
|
List<(Type type, string name)> newList = new()
|
||||||
{
|
{
|
||||||
|
{ (typeof(List<IForceAction>), "ListOfIForceAction") },
|
||||||
|
{ (typeof(List<IDesignForceTuple>), "ListOfIDesignForceTuple") },
|
||||||
|
{ (typeof(List<IForceTuple>), "ListOfIForceTuple") },
|
||||||
|
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
||||||
{ (typeof(ConcentratedForceDTO), "ConcentratedForce") },
|
{ (typeof(ConcentratedForceDTO), "ConcentratedForce") },
|
||||||
{ (typeof(DistributedLoadDTO), "DistributedLoad") },
|
{ (typeof(DistributedLoadDTO), "DistributedLoad") },
|
||||||
{ (typeof(FactoredForceTupleDTO), "FactoredForceTuple") },
|
{ (typeof(FactoredForceTupleDTO), "FactoredForceTuple") },
|
||||||
@@ -110,8 +158,7 @@ namespace DataAccess.DTOs
|
|||||||
};
|
};
|
||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
private static List<(Type type, string name)> GetBeamShearList()
|
||||||
private static List<(Type type, string name)> GetListForBeamShear()
|
|
||||||
{
|
{
|
||||||
List<(Type type, string name)> newList = new()
|
List<(Type type, string name)> newList = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FieldVisualizer.Entities.Values.Primitives
|
||||||
|
{
|
||||||
|
public interface ITrianglePrimitive : IValuePrimitive
|
||||||
|
{
|
||||||
|
IPoint2D Point1 { get; set; }
|
||||||
|
IPoint2D Point2 { get; set; }
|
||||||
|
IPoint2D Point3 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FieldVisualizer.Entities.Values.Primitives
|
||||||
|
{
|
||||||
|
public class TrianglePrimitive : ITrianglePrimitive
|
||||||
|
{
|
||||||
|
public double Value { get; set; }
|
||||||
|
|
||||||
|
public IPoint2D Point1 { get; set; }
|
||||||
|
public IPoint2D Point2 { get; set; }
|
||||||
|
public IPoint2D Point3 { get; set; }
|
||||||
|
|
||||||
|
// --- Computed properties ---
|
||||||
|
|
||||||
|
// Centroid (geometric center)
|
||||||
|
public double CenterX => (Point1.X + Point2.X + Point3.X) / 3.0;
|
||||||
|
public double CenterY => (Point1.Y + Point2.Y + Point3.Y) / 3.0;
|
||||||
|
|
||||||
|
// Triangle area using determinant formula
|
||||||
|
public double Area =>
|
||||||
|
0.5 * Math.Abs(
|
||||||
|
(Point2.X - Point1.X) * (Point3.Y - Point1.Y) -
|
||||||
|
(Point3.X - Point1.X) * (Point2.Y - Point1.Y)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,19 +53,23 @@ namespace FieldVisualizer.Services.PrimitiveServices
|
|||||||
List<double> coords = new List<double>();
|
List<double> coords = new List<double>();
|
||||||
foreach (var primitive in valuePrimitives)
|
foreach (var primitive in valuePrimitives)
|
||||||
{
|
{
|
||||||
if (primitive is IRectanglePrimitive)
|
if (primitive is IRectanglePrimitive rectanglePrimitive)
|
||||||
{
|
{
|
||||||
IRectanglePrimitive rectanglePrimitive = primitive as IRectanglePrimitive;
|
|
||||||
coords.Add(rectanglePrimitive.CenterX + rectanglePrimitive.Width / 2);
|
coords.Add(rectanglePrimitive.CenterX + rectanglePrimitive.Width / 2);
|
||||||
coords.Add(rectanglePrimitive.CenterX - rectanglePrimitive.Width / 2);
|
coords.Add(rectanglePrimitive.CenterX - rectanglePrimitive.Width / 2);
|
||||||
}
|
}
|
||||||
else if (primitive is ICirclePrimitive)
|
else if (primitive is ICirclePrimitive circlePrimitive)
|
||||||
{
|
{
|
||||||
ICirclePrimitive circlePrimitive = primitive as ICirclePrimitive;
|
|
||||||
coords.Add(circlePrimitive.CenterX + circlePrimitive.Diameter / 2);
|
coords.Add(circlePrimitive.CenterX + circlePrimitive.Diameter / 2);
|
||||||
coords.Add(circlePrimitive.CenterX - circlePrimitive.Diameter / 2);
|
coords.Add(circlePrimitive.CenterX - circlePrimitive.Diameter / 2);
|
||||||
}
|
}
|
||||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown);}
|
else if (primitive is ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
coords.Add(triangle.Point1.X);
|
||||||
|
coords.Add(triangle.Point2.X);
|
||||||
|
coords.Add(triangle.Point3.X);
|
||||||
|
}
|
||||||
|
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
||||||
}
|
}
|
||||||
return coords;
|
return coords;
|
||||||
}
|
}
|
||||||
@@ -87,6 +91,12 @@ namespace FieldVisualizer.Services.PrimitiveServices
|
|||||||
coords.Add(circlePrimitive.CenterY + circlePrimitive.Diameter / 2);
|
coords.Add(circlePrimitive.CenterY + circlePrimitive.Diameter / 2);
|
||||||
coords.Add(circlePrimitive.CenterY - circlePrimitive.Diameter / 2);
|
coords.Add(circlePrimitive.CenterY - circlePrimitive.Diameter / 2);
|
||||||
}
|
}
|
||||||
|
else if (primitive is ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
coords.Add(triangle.Point1.Y);
|
||||||
|
coords.Add(triangle.Point2.Y);
|
||||||
|
coords.Add(triangle.Point3.Y);
|
||||||
|
}
|
||||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
||||||
}
|
}
|
||||||
return coords;
|
return coords;
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Ink;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
@@ -50,20 +52,20 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
primitiveSet = value;
|
primitiveSet = value;
|
||||||
OnPropertyChanged(nameof(PrimitiveSet));
|
|
||||||
AreaTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Area);
|
AreaTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Area);
|
||||||
OnPropertyChanged(nameof(AreaTotal));
|
|
||||||
AreaNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Area);
|
AreaNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Area);
|
||||||
OnPropertyChanged(nameof(AreaNeg));
|
|
||||||
AreaZero = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value == 0d).Sum(x => x.Area);
|
AreaZero = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value == 0d).Sum(x => x.Area);
|
||||||
OnPropertyChanged(nameof(AreaZero));
|
|
||||||
AreaPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Area);
|
AreaPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Area);
|
||||||
OnPropertyChanged(nameof(AreaPos));
|
|
||||||
SumTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Value);
|
SumTotal = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Sum(x => x.Value);
|
||||||
OnPropertyChanged(nameof(SumTotal));
|
|
||||||
SumNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Value);
|
SumNeg = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value < 0d).Sum(x => x.Value);
|
||||||
OnPropertyChanged(nameof(SumNeg));
|
|
||||||
SumPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Value);
|
SumPos = primitiveSet is null ? 0 : primitiveSet.ValuePrimitives.Where(x => x.Value > 0d).Sum(x => x.Value);
|
||||||
|
OnPropertyChanged(nameof(PrimitiveSet));
|
||||||
|
OnPropertyChanged(nameof(AreaTotal));
|
||||||
|
OnPropertyChanged(nameof(AreaNeg));
|
||||||
|
OnPropertyChanged(nameof(AreaZero));
|
||||||
|
OnPropertyChanged(nameof(AreaPos));
|
||||||
|
OnPropertyChanged(nameof(SumTotal));
|
||||||
|
OnPropertyChanged(nameof(SumNeg));
|
||||||
OnPropertyChanged(nameof(SumPos));
|
OnPropertyChanged(nameof(SumPos));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -215,21 +217,56 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
WorkPlaneBox.Height = ScrolHeight - 50;
|
WorkPlaneBox.Height = ScrolHeight - 50;
|
||||||
foreach (var primitive in PrimitiveSet.ValuePrimitives)
|
foreach (var primitive in PrimitiveSet.ValuePrimitives)
|
||||||
{
|
{
|
||||||
if (primitive is IRectanglePrimitive)
|
if (primitive is IRectanglePrimitive rectanglePrimitive)
|
||||||
{
|
{
|
||||||
IRectanglePrimitive rectanglePrimitive = primitive as IRectanglePrimitive;
|
|
||||||
Rectangle rectangle = ProcessRectanglePrimitive(rectanglePrimitive);
|
Rectangle rectangle = ProcessRectanglePrimitive(rectanglePrimitive);
|
||||||
WorkPlaneCanvas.Children.Add(rectangle);
|
WorkPlaneCanvas.Children.Add(rectangle);
|
||||||
}
|
}
|
||||||
else if (primitive is ICirclePrimitive)
|
else if (primitive is ICirclePrimitive circlePrimitive)
|
||||||
{
|
{
|
||||||
ICirclePrimitive circlePrimitive = primitive as ICirclePrimitive;
|
|
||||||
Ellipse ellipse = ProcessCirclePrimitive(circlePrimitive);
|
Ellipse ellipse = ProcessCirclePrimitive(circlePrimitive);
|
||||||
WorkPlaneCanvas.Children.Add(ellipse);
|
WorkPlaneCanvas.Children.Add(ellipse);
|
||||||
}
|
}
|
||||||
|
else if (primitive is ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
Path path = ProcessTrianglePrimitive(triangle);
|
||||||
|
WorkPlaneCanvas.Children.Add(path);
|
||||||
|
}
|
||||||
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
else { throw new FieldVisulizerException(ErrorStrings.PrimitiveTypeIsUnknown); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Path ProcessTrianglePrimitive(ITrianglePrimitive triangle)
|
||||||
|
{
|
||||||
|
// Create the PathFigure using triangle vertices.
|
||||||
|
var figure = new PathFigure
|
||||||
|
{
|
||||||
|
StartPoint = new Point(triangle.Point1.X, triangle.Point1.Y),
|
||||||
|
IsClosed = true,
|
||||||
|
IsFilled = true
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add the remaining vertices as LineSegments
|
||||||
|
var segments = new PathSegmentCollection
|
||||||
|
{
|
||||||
|
new LineSegment(new Point(triangle.Point2.X, triangle.Point2.Y), true),
|
||||||
|
new LineSegment(new Point(triangle.Point3.X, triangle.Point3.Y), true)
|
||||||
|
// Closing is handled by IsClosed = true, so we don't need to add a segment back to Point1
|
||||||
|
};
|
||||||
|
figure.Segments = segments;
|
||||||
|
|
||||||
|
// Create geometry and path
|
||||||
|
var geometry = new PathGeometry();
|
||||||
|
geometry.Figures.Add(figure);
|
||||||
|
|
||||||
|
var path = new Path
|
||||||
|
{
|
||||||
|
Data = geometry,
|
||||||
|
};
|
||||||
|
ProcessShape(path, triangle, 0, 0, false);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
private Rectangle ProcessRectanglePrimitive(IRectanglePrimitive rectanglePrimitive)
|
private Rectangle ProcessRectanglePrimitive(IRectanglePrimitive rectanglePrimitive)
|
||||||
{
|
{
|
||||||
Rectangle rectangle = new Rectangle
|
Rectangle rectangle = new Rectangle
|
||||||
@@ -239,7 +276,7 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
};
|
};
|
||||||
double addX = rectanglePrimitive.Width / 2;
|
double addX = rectanglePrimitive.Width / 2;
|
||||||
double addY = rectanglePrimitive.Height / 2;
|
double addY = rectanglePrimitive.Height / 2;
|
||||||
ProcessShape(rectangle, rectanglePrimitive, addX, addY);
|
ProcessShape(rectangle, rectanglePrimitive, addX, addY, true);
|
||||||
return rectangle;
|
return rectangle;
|
||||||
}
|
}
|
||||||
private Ellipse ProcessCirclePrimitive(ICirclePrimitive circlePrimitive)
|
private Ellipse ProcessCirclePrimitive(ICirclePrimitive circlePrimitive)
|
||||||
@@ -252,10 +289,10 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
double addX = circlePrimitive.Diameter / 2;
|
double addX = circlePrimitive.Diameter / 2;
|
||||||
double addY = circlePrimitive.Diameter / 2;
|
double addY = circlePrimitive.Diameter / 2;
|
||||||
|
|
||||||
ProcessShape(ellipse, circlePrimitive, addX, addY);
|
ProcessShape(ellipse, circlePrimitive, addX, addY, true);
|
||||||
return ellipse;
|
return ellipse;
|
||||||
}
|
}
|
||||||
private void ProcessShape(Shape shape, IValuePrimitive valuePrimitive, double addX, double addY)
|
private void ProcessShape(Shape shape, IValuePrimitive valuePrimitive, double addX, double addY, bool addCenter)
|
||||||
{
|
{
|
||||||
SolidColorBrush brush = new SolidColorBrush();
|
SolidColorBrush brush = new SolidColorBrush();
|
||||||
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
brush.Color = ColorOperations.GetColorByValue(valueRange, _ColorMap, valuePrimitive.Value);
|
||||||
@@ -269,8 +306,15 @@ namespace FieldVisualizer.ViewModels.FieldViewerViewModels
|
|||||||
shape.ToolTip = roundLogic.RoundValue(valuePrimitive.Value);
|
shape.ToolTip = roundLogic.RoundValue(valuePrimitive.Value);
|
||||||
shape.Tag = valuePrimitive;
|
shape.Tag = valuePrimitive;
|
||||||
shape.Fill = brush;
|
shape.Fill = brush;
|
||||||
Canvas.SetLeft(shape, valuePrimitive.CenterX - addX - dX);
|
double addLeft = - addX - dX;
|
||||||
Canvas.SetTop(shape, -valuePrimitive.CenterY - addY + dY);
|
double addTop = - addY + dY;
|
||||||
|
if (addCenter == true)
|
||||||
|
{
|
||||||
|
addLeft += valuePrimitive.CenterX;
|
||||||
|
addTop -= valuePrimitive.CenterY;
|
||||||
|
}
|
||||||
|
Canvas.SetLeft(shape, addLeft);
|
||||||
|
Canvas.SetTop(shape, addTop);
|
||||||
}
|
}
|
||||||
private void Zoom(double coefficient)
|
private void Zoom(double coefficient)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
BIN
StructureHelper/Libraries/Triangle.dll
Normal file
BIN
StructureHelper/Libraries/Triangle.dll
Normal file
Binary file not shown.
@@ -5,6 +5,7 @@ using LoaderCalculator.Data.Ndms;
|
|||||||
using LoaderCalculator.Data.ResultData;
|
using LoaderCalculator.Data.ResultData;
|
||||||
using LoaderCalculator.Logics;
|
using LoaderCalculator.Logics;
|
||||||
using StructureHelperCommon.Infrastructures.Enums;
|
using StructureHelperCommon.Infrastructures.Enums;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
using StructureHelperLogics.NdmCalculations.Cracking;
|
using StructureHelperLogics.NdmCalculations.Cracking;
|
||||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||||
@@ -85,6 +86,10 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
{
|
{
|
||||||
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
valuePrimitive = ProcessRectangle(shapeNdm, val);
|
||||||
}
|
}
|
||||||
|
else if (ndm is ITriangleNdm triangle)
|
||||||
|
{
|
||||||
|
valuePrimitive = ProcessTriangle(triangle, val);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valuePrimitive = ProcessCircle(ndm, val);
|
valuePrimitive = ProcessCircle(ndm, val);
|
||||||
@@ -92,6 +97,18 @@ namespace StructureHelper.Services.ResultViewers
|
|||||||
return valuePrimitive;
|
return valuePrimitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IValuePrimitive ProcessTriangle(ITriangleNdm triangle, double val)
|
||||||
|
{
|
||||||
|
var primitive = new TrianglePrimitive()
|
||||||
|
{
|
||||||
|
Point1 = new Point2D() { X = triangle.Point1.X, Y = triangle.Point1.Y },
|
||||||
|
Point2 = new Point2D() { X = triangle.Point2.X, Y = triangle.Point2.Y },
|
||||||
|
Point3 = new Point2D() { X = triangle.Point3.X, Y = triangle.Point3.Y },
|
||||||
|
Value = val
|
||||||
|
};
|
||||||
|
return primitive;
|
||||||
|
}
|
||||||
|
|
||||||
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
private static IValuePrimitive ProcessRectangle(IRectangleNdm shapeNdm, double val)
|
||||||
{
|
{
|
||||||
return new RectanglePrimitive()
|
return new RectanglePrimitive()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace StructureHelperCommon.Models.Shapes
|
|||||||
{
|
{
|
||||||
public static class PolygonGeometryUtils
|
public static class PolygonGeometryUtils
|
||||||
{
|
{
|
||||||
public static ILinePolygonShape GetTratsfromedPolygon(ILinePolygonShape polygon, double dx, double dy)
|
public static ILinePolygonShape GetTransfromedPolygon(ILinePolygonShape polygon, double dx, double dy)
|
||||||
{
|
{
|
||||||
ILinePolygonShape newPolygon = new LinePolygonShape(Guid.Empty);
|
ILinePolygonShape newPolygon = new LinePolygonShape(Guid.Empty);
|
||||||
var updateLogic = new LinePolygonShapeUpdateStrategy();
|
var updateLogic = new LinePolygonShapeUpdateStrategy();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ExcelDataReader" Version="3.8.0" />
|
<PackageReference Include="ExcelDataReader" Version="3.8.0" />
|
||||||
<PackageReference Include="NLog" Version="6.0.4" />
|
<PackageReference Include="NLog" Version="6.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
var ndms = new List<INdm>();
|
var ndms = new List<INdm>();
|
||||||
var options = new CircleTriangulationLogicOptions(this)
|
var options = new CircleTriangulationLogicOptions(this)
|
||||||
{
|
{
|
||||||
triangulationOptions = triangulationOptions
|
TriangulationOptions = triangulationOptions
|
||||||
};
|
};
|
||||||
var logic = new CircleTriangulationLogic(options);
|
var logic = new CircleTriangulationLogic(options);
|
||||||
ndms.AddRange(logic.GetNdmCollection());
|
ndms.AddRange(logic.GetNdmCollection());
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
using StructureHelperCommon.Models.Shapes.Logics;
|
|
||||||
using StructureHelperCommon.Services;
|
using StructureHelperCommon.Services;
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives.Logics
|
|||||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||||
targetObject.Triangulate = sourceObject.Triangulate;
|
targetObject.Triangulate = sourceObject.Triangulate;
|
||||||
tupleUpdateStrategy.Update(targetObject.UsersPrestrain, sourceObject.UsersPrestrain);
|
tupleUpdateStrategy.Update(targetObject.UsersPrestrain, sourceObject.UsersPrestrain);
|
||||||
|
tupleUpdateStrategy.Update(targetObject.AutoPrestrain, sourceObject.AutoPrestrain);
|
||||||
if (UpdateChildren == true)
|
if (UpdateChildren == true)
|
||||||
{
|
{
|
||||||
if (sourceObject.HeadMaterial != null)
|
if (sourceObject.HeadMaterial != null)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||||
{
|
{
|
||||||
var options = new PointTriangulationLogicOptions(this) { triangulationOptions = triangulationOptions};
|
var options = new PointTriangulationLogicOptions(this) { TriangulationOptions = triangulationOptions};
|
||||||
var logic = new PointTriangulationLogic(options);
|
var logic = new PointTriangulationLogic(options);
|
||||||
return logic.GetNdmCollection();
|
return logic.GetNdmCollection();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
{
|
{
|
||||||
var options = new RebarTriangulationLogicOptions(this)
|
var options = new RebarTriangulationLogicOptions(this)
|
||||||
{
|
{
|
||||||
triangulationOptions = triangulationOptions
|
TriangulationOptions = triangulationOptions
|
||||||
};
|
};
|
||||||
var logic = new RebarTriangulationLogic(options);
|
var logic = new RebarTriangulationLogic(options);
|
||||||
var rebar = logic.GetRebarNdm();
|
var rebar = logic.GetRebarNdm();
|
||||||
@@ -89,7 +89,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
{
|
{
|
||||||
var options = new RebarTriangulationLogicOptions(this)
|
var options = new RebarTriangulationLogicOptions(this)
|
||||||
{
|
{
|
||||||
triangulationOptions = triangulationOptions
|
TriangulationOptions = triangulationOptions
|
||||||
};
|
};
|
||||||
var logic = new RebarTriangulationLogic(options);
|
var logic = new RebarTriangulationLogic(options);
|
||||||
var concrete = logic.GetConcreteNdm();
|
var concrete = logic.GetConcreteNdm();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
var ndms = new List<INdm>();
|
var ndms = new List<INdm>();
|
||||||
var options = new RectangleTriangulationLogicOptions(this)
|
var options = new RectangleTriangulationLogicOptions(this)
|
||||||
{
|
{
|
||||||
triangulationOptions = triangulationOptions
|
TriangulationOptions = triangulationOptions
|
||||||
};
|
};
|
||||||
var logic = new RectangleTriangulationLogic(options);
|
var logic = new RectangleTriangulationLogic(options);
|
||||||
ndms.AddRange(logic.GetNdmCollection());
|
ndms.AddRange(logic.GetNdmCollection());
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
public string? Name { get; set; } = string.Empty;
|
public string? Name { get; set; } = string.Empty;
|
||||||
public IPoint2D Center { get; set; } = new Point2D();
|
public IPoint2D Center { get; set; } = new Point2D();
|
||||||
public IShape Shape => shape;
|
public IShape Shape => shape;
|
||||||
public INdmElement NdmElement { get; } = new NdmElement(Guid.NewGuid());
|
public INdmElement NdmElement { get; set; } = new NdmElement(Guid.NewGuid());
|
||||||
public ICrossSection? CrossSection { get; set; }
|
public ICrossSection? CrossSection { get; set; }
|
||||||
public IVisualProperty VisualProperty { get; } = new VisualProperty { Opacity = 0.8d };
|
public IVisualProperty VisualProperty { get; set; } = new VisualProperty { Opacity = 0.8d };
|
||||||
public double RotationAngle { get; set; }
|
public double RotationAngle { get; set; }
|
||||||
public IDivisionSize DivisionSize { get; } = new DivisionSize(Guid.NewGuid());
|
public IDivisionSize DivisionSize { get; set; } = new DivisionSize(Guid.NewGuid());
|
||||||
public ShapeNdmPrimitive(Guid id)
|
public ShapeNdmPrimitive(Guid id)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
@@ -38,7 +38,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
|
|
||||||
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var triangulationLogicOption = new LinePolygonTriangulationLogicOption(this, triangulationOptions);
|
||||||
|
var logic = new LinePolygonTriangulationLogic(triangulationLogicOption);
|
||||||
|
return logic.GetNdmCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<INamedAreaPoint> GetValuePoints()
|
public List<INamedAreaPoint> GetValuePoints()
|
||||||
@@ -74,7 +76,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
|||||||
{
|
{
|
||||||
if (shape is ILinePolygonShape polygon)
|
if (shape is ILinePolygonShape polygon)
|
||||||
{
|
{
|
||||||
var newShape = PolygonGeometryUtils.GetTratsfromedPolygon(polygon, Center.X, Center.Y);
|
var newShape = PolygonGeometryUtils.GetTransfromedPolygon(polygon, Center.X, Center.Y);
|
||||||
var calculator = new PolygonCalculator();
|
var calculator = new PolygonCalculator();
|
||||||
return calculator.ContainsPoint(newShape, point);
|
return calculator.ContainsPoint(newShape, point);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
|
|
||||||
double diameter = options.Circle.Diameter;
|
double diameter = options.Circle.Diameter;
|
||||||
double ndmMaxSize = options.NdmMaxSize;
|
double ndmMaxSize = options.DivisionSize.NdmMaxSize;
|
||||||
int ndmMinDivision = options.NdmMinDivision;
|
int ndmMinDivision = options.DivisionSize.NdmMinDivision;
|
||||||
var logicOptions = new LoaderCalculator.Triangulations.CircleTriangulationLogicOptions(diameter, ndmMaxSize, ndmMinDivision);
|
var logicOptions = new LoaderCalculator.Triangulations.CircleTriangulationLogicOptions(diameter, ndmMaxSize, ndmMinDivision);
|
||||||
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
|
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
|
||||||
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.CirclePlane
|
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.CirclePlane
|
||||||
{
|
{
|
||||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
Material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm)
|
||||||
});
|
});
|
||||||
TriangulationService.CommonTransform(ndmCollection, options);
|
TriangulationService.CommonTransform(ndmCollection, options);
|
||||||
TriangulationService.SetPrestrain(ndmCollection, options.Prestrain);
|
TriangulationService.SetPrestrain(ndmCollection, options.Prestrain);
|
||||||
|
|||||||
@@ -18,22 +18,19 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
|
|
||||||
public IPoint2D Center { get; set; }
|
public IPoint2D Center { get; set; }
|
||||||
|
|
||||||
public double NdmMaxSize { get; }
|
|
||||||
|
|
||||||
public int NdmMinDivision { get; }
|
|
||||||
|
|
||||||
public StrainTuple Prestrain { get; set; }
|
public StrainTuple Prestrain { get; set; }
|
||||||
public ITriangulationOptions triangulationOptions { get; set; }
|
public ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get; set; }
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
public double RotationAngle { get; set; }
|
public double RotationAngle { get; set; }
|
||||||
|
|
||||||
|
public IDivisionSize DivisionSize { get; }
|
||||||
|
|
||||||
public CircleTriangulationLogicOptions(IEllipseNdmPrimitive primitive)
|
public CircleTriangulationLogicOptions(IEllipseNdmPrimitive primitive)
|
||||||
{
|
{
|
||||||
Center = primitive.Center.Clone() as Point2D;
|
Center = primitive.Center.Clone() as Point2D;
|
||||||
//to do change to ellipse
|
//to do change to ellipse
|
||||||
Circle = new CircleShape() { Diameter = primitive.Width };
|
Circle = new CircleShape() { Diameter = primitive.Width };
|
||||||
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
DivisionSize = primitive.DivisionSize;
|
||||||
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
|
||||||
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
||||||
Prestrain = ForceTupleService.SumTuples(primitive.NdmElement.UsersPrestrain, primitive.NdmElement.AutoPrestrain) as StrainTuple;
|
Prestrain = ForceTupleService.SumTuples(primitive.NdmElement.UsersPrestrain, primitive.NdmElement.AutoPrestrain) as StrainTuple;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
using StructureHelperCommon.Models.Shapes;
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -11,16 +12,8 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
public interface IShapeTriangulationLogicOptions : ITriangulationLogicOptions, IHasCenter2D
|
public interface IShapeTriangulationLogicOptions : ITriangulationLogicOptions, IHasCenter2D
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Center of shape
|
/// Parameters of division
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IPoint2D Center { get; }
|
IDivisionSize DivisionSize { get; }
|
||||||
/// <summary>
|
|
||||||
/// Maximum size (width or height) of ndm part after triangulation
|
|
||||||
/// </summary>
|
|
||||||
double NdmMaxSize { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Minimum quantity of division of side of rectangle after triangulation
|
|
||||||
/// </summary>
|
|
||||||
int NdmMinDivision { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
using System.Collections.Generic;
|
using LoaderCalculator.Data.Ndms;
|
||||||
using LoaderCalculator.Data.Ndms;
|
|
||||||
using LoaderCalculator.Data.Materials;
|
|
||||||
|
|
||||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Implements logic of obtaining of collection of ndm parts
|
||||||
|
/// </summary>
|
||||||
public interface ITriangulationLogic
|
public interface ITriangulationLogic
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Returns collection of ndm parts
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
IEnumerable<INdm> GetNdmCollection();
|
IEnumerable<INdm> GetNdmCollection();
|
||||||
|
/// <summary>
|
||||||
|
/// Check options of triangulation
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="options"></param>
|
||||||
void ValidateOptions(ITriangulationLogicOptions options);
|
void ValidateOptions(ITriangulationLogicOptions options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
public interface ITriangulationLogicOptions
|
public interface ITriangulationLogicOptions
|
||||||
{
|
{
|
||||||
ITriangulationOptions triangulationOptions { get; set; }
|
ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
StrainTuple Prestrain { get; set; }
|
StrainTuple Prestrain { get; set; }
|
||||||
IHeadMaterial HeadMaterial { get; set; }
|
IHeadMaterial HeadMaterial { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
using LoaderCalculator.Data.Materials;
|
||||||
|
using LoaderCalculator.Data.Ndms;
|
||||||
|
using LoaderCalculator.Infrastructure.Geometry;
|
||||||
|
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using TriangleNet.Geometry;
|
||||||
|
using TriangleNet.Meshing;
|
||||||
|
using static System.Windows.Forms.Design.AxImporter;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Logic for triangulation of line poligon shapr into collection of ndm parts
|
||||||
|
/// </summary>
|
||||||
|
public class LinePolygonTriangulationLogic : ITriangulationLogic
|
||||||
|
{
|
||||||
|
private LinePolygonTriangulationLogicOption options;
|
||||||
|
|
||||||
|
public LinePolygonTriangulationLogic(LinePolygonTriangulationLogicOption triangulationLogicOption)
|
||||||
|
{
|
||||||
|
this.options = triangulationLogicOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IEnumerable<INdm> GetNdmCollection()
|
||||||
|
{
|
||||||
|
IMesh mesh = GetMesh();
|
||||||
|
var material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm);
|
||||||
|
List<INdm> ndms = GetNdmsByMesh(mesh, material);
|
||||||
|
return ndms;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<INdm> GetNdmsByMesh(IMesh mesh, IMaterial material)
|
||||||
|
{
|
||||||
|
List<INdm> ndmCollection = [];
|
||||||
|
foreach (var triangle in mesh.Triangles)
|
||||||
|
{
|
||||||
|
List<IPointLd2D> points = [];
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
var vertex1 = triangle.GetVertex(i);
|
||||||
|
points.Add(new PointLd2D() { X = vertex1.X, Y = vertex1.Y });
|
||||||
|
|
||||||
|
}
|
||||||
|
var ndm = new TriangleNdm() { Point1 = points[0], Point2 = points[1], Point3 = points[2] };
|
||||||
|
ndm.Material = material;
|
||||||
|
var ndm2 = new RectangleNdm() { Width = Math.Sqrt(ndm.Area), Height = Math.Sqrt(ndm.Area), CenterX = ndm.CenterX, CenterY = ndm.CenterY, Material = ndm.Material};
|
||||||
|
ndmCollection.Add(ndm);
|
||||||
|
}
|
||||||
|
TriangulationService.SetPrestrain(ndmCollection, options.Prestrain);
|
||||||
|
return ndmCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IMesh GetMesh()
|
||||||
|
{
|
||||||
|
if (options.Shape is not ILinePolygonShape polygonShape)
|
||||||
|
{
|
||||||
|
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(options.Shape) + ": Shape is not line polygon shape");
|
||||||
|
}
|
||||||
|
var polygon = new Polygon();
|
||||||
|
List<IVertex> vertices = polygonShape.Vertices.ToList();
|
||||||
|
var contour = new List<TriangleNet.Geometry.Vertex>();
|
||||||
|
foreach (var vertex in vertices)
|
||||||
|
{
|
||||||
|
contour.Add(new TriangleNet.Geometry.Vertex(vertex.Point.X, vertex.Point.Y));
|
||||||
|
|
||||||
|
}
|
||||||
|
// Add contour to polygon — this automatically defines the connecting segments
|
||||||
|
polygon.Add(new Contour(contour));
|
||||||
|
var quality = new QualityOptions()
|
||||||
|
{
|
||||||
|
MinimumAngle = 25.0,
|
||||||
|
MaximumArea = options.DivisionSize.NdmMaxSize * options.DivisionSize.NdmMaxSize,
|
||||||
|
};
|
||||||
|
var mesh = polygon.Triangulate(quality);
|
||||||
|
return mesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public void ValidateOptions(ITriangulationLogicOptions options)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using StructureHelper.Models.Materials;
|
||||||
|
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||||
|
using StructureHelperCommon.Models.Forces;
|
||||||
|
using StructureHelperCommon.Models.Shapes;
|
||||||
|
using StructureHelperCommon.Services.Forces;
|
||||||
|
using StructureHelperLogics.Models.Primitives;
|
||||||
|
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||||
|
{
|
||||||
|
public class LinePolygonTriangulationLogicOption : IShapeTriangulationLogicOptions
|
||||||
|
{
|
||||||
|
public IPoint2D Center { get; set; }
|
||||||
|
public IDivisionSize DivisionSize { get; set; }
|
||||||
|
public ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
|
public StrainTuple Prestrain { get; set; }
|
||||||
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
|
public double RotationAngle { get; set; } = 0;
|
||||||
|
public IShape Shape { get; set; }
|
||||||
|
public LinePolygonTriangulationLogicOption(IShapeNdmPrimitive primitive, ITriangulationOptions triangulationOptions)
|
||||||
|
{
|
||||||
|
Center = primitive.Center;
|
||||||
|
DivisionSize = primitive.DivisionSize;
|
||||||
|
TriangulationOptions = triangulationOptions;
|
||||||
|
Shape = primitive.Shape;
|
||||||
|
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
||||||
|
Prestrain = ForceTupleService.SumTuples(primitive.NdmElement.UsersPrestrain, primitive.NdmElement.AutoPrestrain) as StrainTuple;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
CenterX = options.Center.X,
|
CenterX = options.Center.X,
|
||||||
CenterY = options.Center.Y,
|
CenterY = options.Center.Y,
|
||||||
Area = options.Area,
|
Area = options.Area,
|
||||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
Material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm)
|
||||||
};
|
};
|
||||||
List<INdm> ndmCollection = new () { ndm};
|
List<INdm> ndmCollection = new () { ndm};
|
||||||
NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
NdmTransform.SetPrestrain(ndmCollection, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PointTriangulationLogicOptions : ITriangulationLogicOptions
|
public class PointTriangulationLogicOptions : ITriangulationLogicOptions
|
||||||
{
|
{
|
||||||
public ITriangulationOptions triangulationOptions { get; set; }
|
public ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
CenterX = options.Center.X,
|
CenterX = options.Center.X,
|
||||||
CenterY = options.Center.Y,
|
CenterY = options.Center.Y,
|
||||||
Area = options.Area,
|
Area = options.Area,
|
||||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
Material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm)
|
||||||
};
|
};
|
||||||
;
|
;
|
||||||
NdmTransform.SetPrestrain(rebarNdm, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
NdmTransform.SetPrestrain(rebarNdm, TupleConverter.ConvertToLoaderStrainMatrix(options.Prestrain));
|
||||||
@@ -58,7 +58,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
var material = hostPrimitive
|
var material = hostPrimitive
|
||||||
.NdmElement
|
.NdmElement
|
||||||
.HeadMaterial
|
.HeadMaterial
|
||||||
.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm);
|
.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm);
|
||||||
|
|
||||||
var prestrain = ForceTupleService.SumTuples(hostPrimitive.NdmElement.UsersPrestrain,
|
var prestrain = ForceTupleService.SumTuples(hostPrimitive.NdmElement.UsersPrestrain,
|
||||||
hostPrimitive.NdmElement.AutoPrestrain)
|
hostPrimitive.NdmElement.AutoPrestrain)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
public class RebarTriangulationLogicOptions : ITriangulationLogicOptions
|
public class RebarTriangulationLogicOptions : ITriangulationLogicOptions
|
||||||
{
|
{
|
||||||
public ITriangulationOptions triangulationOptions { get; set; }
|
public ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
{
|
{
|
||||||
double width = options.Rectangle.Width;
|
double width = options.Rectangle.Width;
|
||||||
double height = options.Rectangle.Height;
|
double height = options.Rectangle.Height;
|
||||||
double ndmMaxSize = options.NdmMaxSize;
|
double ndmMaxSize = options.DivisionSize.NdmMaxSize;
|
||||||
int ndmMinDivision = options.NdmMinDivision;
|
int ndmMinDivision = options.DivisionSize.NdmMinDivision;
|
||||||
LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions logicOptions = new LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions(width, height, ndmMaxSize, ndmMinDivision);
|
LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions logicOptions = new LoaderCalculator.Triangulations.RectangleTriangulationLogicOptions(width, height, ndmMaxSize, ndmMinDivision);
|
||||||
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
|
var logic = LoaderCalculator.Triangulations.Triangulation.GetLogicInstance(logicOptions);
|
||||||
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.RectangularPlane
|
var ndmCollection = logic.GetNdmCollection(new LoaderCalculator.Data.Planes.RectangularPlane
|
||||||
{
|
{
|
||||||
Material = options.HeadMaterial.GetLoaderMaterial(options.triangulationOptions.LimiteState, options.triangulationOptions.CalcTerm)
|
Material = options.HeadMaterial.GetLoaderMaterial(options.TriangulationOptions.LimiteState, options.TriangulationOptions.CalcTerm)
|
||||||
});
|
});
|
||||||
TriangulationService.CommonTransform(ndmCollection, options);
|
TriangulationService.CommonTransform(ndmCollection, options);
|
||||||
double angle = options.RotationAngle;
|
double angle = options.RotationAngle;
|
||||||
|
|||||||
@@ -16,21 +16,20 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
public double RotationAngle { get; set; } = 0d;
|
public double RotationAngle { get; set; } = 0d;
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IRectangleShape Rectangle { get; }
|
public IRectangleShape Rectangle { get; }
|
||||||
/// <inheritdoc />
|
|
||||||
public double NdmMaxSize { get; }
|
|
||||||
/// <inheritdoc />
|
|
||||||
public int NdmMinDivision { get; }
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public StrainTuple Prestrain { get; set; }
|
public StrainTuple Prestrain { get; set; }
|
||||||
public ITriangulationOptions triangulationOptions { get; set; }
|
public ITriangulationOptions TriangulationOptions { get; set; }
|
||||||
public IHeadMaterial HeadMaterial { get; set; }
|
public IHeadMaterial HeadMaterial { get; set; }
|
||||||
|
|
||||||
|
public IDivisionSize DivisionSize { get; } = new DivisionSize(Guid.Empty);
|
||||||
|
|
||||||
public RectangleTriangulationLogicOptions(IPoint2D center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
|
public RectangleTriangulationLogicOptions(IPoint2D center, IRectangleShape rectangle, double ndmMaxSize, int ndmMinDivision)
|
||||||
{
|
{
|
||||||
Center = center;
|
Center = center;
|
||||||
Rectangle = rectangle;
|
Rectangle = rectangle;
|
||||||
NdmMaxSize = ndmMaxSize;
|
DivisionSize.NdmMaxSize = ndmMaxSize;
|
||||||
NdmMinDivision = ndmMinDivision;
|
DivisionSize.NdmMinDivision = ndmMinDivision;
|
||||||
Prestrain = new StrainTuple();
|
Prestrain = new StrainTuple();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,8 +38,8 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
|||||||
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
|
Center = new Point2D() {X = primitive.Center.X, Y = primitive.Center.Y };
|
||||||
RotationAngle = primitive.RotationAngle;
|
RotationAngle = primitive.RotationAngle;
|
||||||
Rectangle = primitive;
|
Rectangle = primitive;
|
||||||
NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
DivisionSize.NdmMaxSize = primitive.DivisionSize.NdmMaxSize;
|
||||||
NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
DivisionSize.NdmMinDivision = primitive.DivisionSize.NdmMinDivision;
|
||||||
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
HeadMaterial = primitive.NdmElement.HeadMaterial;
|
||||||
Prestrain = ForceTupleService.SumTuples(primitive.NdmElement.UsersPrestrain, primitive.NdmElement.AutoPrestrain) as StrainTuple;
|
Prestrain = ForceTupleService.SumTuples(primitive.NdmElement.UsersPrestrain, primitive.NdmElement.AutoPrestrain) as StrainTuple;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
<Reference Include="LoaderCalculator">
|
<Reference Include="LoaderCalculator">
|
||||||
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
<HintPath>..\StructureHelper\Libraries\LoaderCalculator.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Triangle">
|
||||||
|
<HintPath>..\StructureHelper\Libraries\Triangle.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace StructureHelperTests.UnitTests.Ndms.Triangulations
|
|||||||
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height};
|
IRectangleShape rectangle = new RectangleShape { Width = width, Height = height};
|
||||||
var options = new RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision)
|
var options = new RectangleTriangulationLogicOptions(center, rectangle, ndmMaxSize, ndmMinDivision)
|
||||||
{
|
{
|
||||||
triangulationOptions = new TriangulationOptions() { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm },
|
TriangulationOptions = new TriangulationOptions() { LimiteState = LimitStates.ULS, CalcTerm = CalcTerms.ShortTerm },
|
||||||
HeadMaterial = materialMock.Object,
|
HeadMaterial = materialMock.Object,
|
||||||
RotationAngle = angle
|
RotationAngle = angle
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user