Add EllipsePrimitive to DTO Converter
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CirclePrimitiveDTO
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -21,6 +22,7 @@ namespace DataAccess.DTOs
|
||||
private IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy;
|
||||
private IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy;
|
||||
private IConvertStrategy<ForceCombinationListDTO, IForceCombinationList> forceCombinationListConvertStrategy;
|
||||
private IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipsePrimitive> ellipseConvertStrategy = new EllipsePrimitiveDTOConvertStrategy();
|
||||
|
||||
public CrossSectionRepositoryToDTOConvertStrategy(IConvertStrategy<HeadMaterialDTO, IHeadMaterial> materialConvertStrategy,
|
||||
IConvertStrategy<ForceCombinationByFactorDTO, IForceCombinationByFactor> forceCombinationByFactorConvertStrategy,
|
||||
@@ -66,12 +68,31 @@ namespace DataAccess.DTOs
|
||||
Id = source.Id
|
||||
};
|
||||
List<IForceAction> forceActions = ProcessForceActions(source);
|
||||
List<HeadMaterialDTO> materials = ProcessMaterials(source);
|
||||
newItem.ForceActions.AddRange(forceActions);
|
||||
List<IHeadMaterial> materials = ProcessMaterials(source);
|
||||
newItem.HeadMaterials.AddRange(materials);
|
||||
List<INdmPrimitive> primitives = ProcessPrimitives(source);
|
||||
newItem.Primitives.AddRange(primitives);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private List<INdmPrimitive> ProcessPrimitives(ICrossSectionRepository source)
|
||||
{
|
||||
List<INdmPrimitive> primitives = new();
|
||||
foreach (var item in source.Primitives)
|
||||
{
|
||||
if (item is IEllipsePrimitive ellipse)
|
||||
{
|
||||
ellipseConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
ellipseConvertStrategy.TraceLogger = TraceLogger;
|
||||
INdmPrimitive ndmPrimitive;
|
||||
ndmPrimitive = ellipseConvertStrategy.Convert(ellipse);
|
||||
primitives.Add(ndmPrimitive);
|
||||
}
|
||||
}
|
||||
return primitives;
|
||||
}
|
||||
|
||||
private List<IForceAction> ProcessForceActions(ICrossSectionRepository source)
|
||||
{
|
||||
List<IForceAction> forceActions = new();
|
||||
@@ -113,7 +134,7 @@ namespace DataAccess.DTOs
|
||||
return forceCombination;
|
||||
}
|
||||
|
||||
private List<HeadMaterialDTO> ProcessMaterials(ICrossSectionRepository source)
|
||||
private List<IHeadMaterial> ProcessMaterials(ICrossSectionRepository source)
|
||||
{
|
||||
materialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
materialConvertStrategy.TraceLogger = TraceLogger;
|
||||
@@ -123,7 +144,7 @@ namespace DataAccess.DTOs
|
||||
ConvertStrategy = materialConvertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
List<HeadMaterialDTO> materials = new();
|
||||
List<IHeadMaterial> materials = new();
|
||||
foreach (var item in source.HeadMaterials)
|
||||
{
|
||||
materials.Add(convertLogic.Convert(item));
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DivisionSizeToDTOConvertStrategy : IConvertStrategy<DivisionSizeDTO, IDivisionSize>
|
||||
{
|
||||
private IUpdateStrategy<IDivisionSize> updateStrategy;
|
||||
|
||||
public DivisionSizeToDTOConvertStrategy(IUpdateStrategy<IDivisionSize> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public DivisionSizeToDTOConvertStrategy() : this (new DivisionSizeUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public DivisionSizeDTO Convert(IDivisionSize source)
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetNewDivisionSize(source);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private DivisionSizeDTO GetNewDivisionSize(IDivisionSize source)
|
||||
{
|
||||
DivisionSizeDTO newItem = new() { Id = source.Id };
|
||||
updateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
DataAccess/DTOs/Converters/EllipsePrimitiveDTOConvertStrategy.cs
Normal file
105
DataAccess/DTOs/Converters/EllipsePrimitiveDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class EllipsePrimitiveDTOConvertStrategy : IConvertStrategy<EllipseNdmPrimitiveDTO, IEllipsePrimitive>
|
||||
{
|
||||
private IUpdateStrategy<IEllipsePrimitive> updateStrategy;
|
||||
private IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy;
|
||||
private IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy;
|
||||
private IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy;
|
||||
private IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy;
|
||||
private IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy;
|
||||
|
||||
public EllipsePrimitiveDTOConvertStrategy(
|
||||
IUpdateStrategy<IEllipsePrimitive> updateStrategy,
|
||||
IConvertStrategy<RectangleShapeDTO, IRectangleShape> rectangleShapeConvertStrategy,
|
||||
IConvertStrategy<NdmElementDTO, INdmElement> ndmElementConvertStrategy,
|
||||
IConvertStrategy<Point2DDTO, IPoint2D> pointConvertStrategy,
|
||||
IConvertStrategy<VisualPropertyDTO, IVisualProperty> visualPropsConvertStrategy,
|
||||
IConvertStrategy<DivisionSizeDTO, IDivisionSize> divisionConvertStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.rectangleShapeConvertStrategy = rectangleShapeConvertStrategy;
|
||||
this.ndmElementConvertStrategy = ndmElementConvertStrategy;
|
||||
this.pointConvertStrategy = pointConvertStrategy;
|
||||
this.visualPropsConvertStrategy = visualPropsConvertStrategy;
|
||||
this.divisionConvertStrategy = divisionConvertStrategy;
|
||||
}
|
||||
|
||||
public EllipsePrimitiveDTOConvertStrategy() : this(
|
||||
new EllipsePrimitiveUpdateStrategy(),
|
||||
new RectangleShapeToDTOConvertStrategy(),
|
||||
new NdmElementDTOConvertStrategy(),
|
||||
new Point2DToDTOConvertStrategy(),
|
||||
new VisualPropertyToDTOConvertStrategy(),
|
||||
new DivisionSizeToDTOConvertStrategy()
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public EllipseNdmPrimitiveDTO Convert(IEllipsePrimitive source)
|
||||
{
|
||||
try
|
||||
{
|
||||
Check();
|
||||
PrepareStrategies();
|
||||
return GetNewEllipsePrimitive(source);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private EllipseNdmPrimitiveDTO GetNewEllipsePrimitive(IEllipsePrimitive source)
|
||||
{
|
||||
EllipseNdmPrimitiveDTO newItem = new() { Id = source.Id };
|
||||
updateStrategy.Update(newItem, source);
|
||||
newItem.NdmElement = ndmElementConvertStrategy.Convert(source.NdmElement);
|
||||
newItem.RectangleShape = rectangleShapeConvertStrategy.Convert(source.Shape as IRectangleShape);
|
||||
newItem.Center = pointConvertStrategy.Convert(source.Center);
|
||||
newItem.VisualProperty = visualPropsConvertStrategy.Convert(source.VisualProperty);
|
||||
newItem.DivisionSize = divisionConvertStrategy.Convert(source.DivisionSize);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void PrepareStrategies()
|
||||
{
|
||||
rectangleShapeConvertStrategy.ReferenceDictionary =
|
||||
ndmElementConvertStrategy.ReferenceDictionary =
|
||||
pointConvertStrategy.ReferenceDictionary =
|
||||
visualPropsConvertStrategy.ReferenceDictionary =
|
||||
divisionConvertStrategy.ReferenceDictionary =
|
||||
ReferenceDictionary;
|
||||
rectangleShapeConvertStrategy.TraceLogger =
|
||||
ndmElementConvertStrategy.TraceLogger =
|
||||
pointConvertStrategy.TraceLogger =
|
||||
visualPropsConvertStrategy.TraceLogger =
|
||||
divisionConvertStrategy.TraceLogger =
|
||||
TraceLogger;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<EllipseNdmPrimitiveDTO, IEllipsePrimitive>(this);
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
71
DataAccess/DTOs/Converters/NdmElementDTOConvertStrategy.cs
Normal file
71
DataAccess/DTOs/Converters/NdmElementDTOConvertStrategy.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives.Logics;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class NdmElementDTOConvertStrategy : IConvertStrategy<NdmElementDTO, INdmElement>
|
||||
{
|
||||
private IUpdateStrategy<INdmElement> updateStrategy;
|
||||
private IConvertStrategy<HeadMaterialDTO, IHeadMaterial> headMaterialConvertStrategy;
|
||||
private IUpdateStrategy<IForceTuple> forceUpdateStrategy = new ForceTupleUpdateStrategy();
|
||||
|
||||
public NdmElementDTOConvertStrategy(
|
||||
IUpdateStrategy<INdmElement> updateStrategy,
|
||||
IConvertStrategy<HeadMaterialDTO, IHeadMaterial> headMaterialConvertStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
this.headMaterialConvertStrategy = headMaterialConvertStrategy;
|
||||
}
|
||||
|
||||
public NdmElementDTOConvertStrategy() : this(
|
||||
new NdmElementUpdateStrategy(),
|
||||
new HeadMaterialToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public NdmElementDTO Convert(INdmElement source)
|
||||
{
|
||||
Check();
|
||||
try
|
||||
{
|
||||
return GenNewNdmElementDTO(source);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private NdmElementDTO GenNewNdmElementDTO(INdmElement source)
|
||||
{
|
||||
NdmElementDTO newItem = new() { Id = source.Id };
|
||||
updateStrategy.Update(newItem, source);
|
||||
headMaterialConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
headMaterialConvertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<HeadMaterialDTO, IHeadMaterial>(this, headMaterialConvertStrategy);
|
||||
var headMaterial = convertLogic.Convert(source.HeadMaterial);
|
||||
newItem.HeadMaterial = headMaterial;
|
||||
forceUpdateStrategy.Update(newItem.UsersPrestrain, source.UsersPrestrain);
|
||||
forceUpdateStrategy.Update(newItem.AutoPrestrain, source.AutoPrestrain);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<NdmElementDTO, INdmElement>(this);
|
||||
checkLogic.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class RectangleShapeToDTOConvertStrategy : IConvertStrategy<RectangleShapeDTO, IRectangleShape>
|
||||
{
|
||||
private IUpdateStrategy<IRectangleShape> updateStrategy;
|
||||
|
||||
public RectangleShapeToDTOConvertStrategy(IUpdateStrategy<IRectangleShape> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public RectangleShapeToDTOConvertStrategy() : this (new RectangleShapeUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public RectangleShapeDTO Convert(IRectangleShape source)
|
||||
{
|
||||
RectangleShapeDTO newItem = new() { Id = source.Id};
|
||||
updateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -31,6 +32,21 @@ namespace DataAccess.DTOs
|
||||
public VersionProcessorDTO Convert(IVersionProcessor source)
|
||||
{
|
||||
Check();
|
||||
try
|
||||
{
|
||||
VersionProcessorDTO versionProcessorDTO = GetNewVersionProcessor(source);
|
||||
return versionProcessorDTO;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private VersionProcessorDTO GetNewVersionProcessor(IVersionProcessor source)
|
||||
{
|
||||
VersionProcessorDTO newItem = new()
|
||||
{
|
||||
Id = source.Id
|
||||
@@ -44,6 +60,7 @@ namespace DataAccess.DTOs
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
{
|
||||
checkLogic = new CheckConvertLogic<VersionProcessorDTO, IVersionProcessor>(this);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
public class VisualPropertyToDTOConvertStrategy : IConvertStrategy<VisualPropertyDTO, IVisualProperty>
|
||||
{
|
||||
private IUpdateStrategy<IVisualProperty> updateStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public VisualPropertyToDTOConvertStrategy(IUpdateStrategy<IVisualProperty> updateStrategy)
|
||||
{
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
|
||||
public VisualPropertyToDTOConvertStrategy() : this (new VisualPropsUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public VisualPropertyDTO Convert(IVisualProperty source)
|
||||
{
|
||||
try
|
||||
{
|
||||
VisualPropertyDTO newItem = new() { Id = source.Id };
|
||||
updateStrategy.Update(newItem, source);
|
||||
return newItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TraceLogger?.AddMessage(LoggerStrings.LogicType(this), TraceLogStatuses.Debug);
|
||||
TraceLogger?.AddMessage(ex.Message, TraceLogStatuses.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
DataAccess/DTOs/DTOEntities/DivisionSizeDTO.cs
Normal file
23
DataAccess/DTOs/DTOEntities/DivisionSizeDTO.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class DivisionSizeDTO : IDivisionSize
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("NdmMaxSize")]
|
||||
public double NdmMaxSize { get; set; }
|
||||
[JsonProperty("NdmMinDivision")]
|
||||
public int NdmMinDivision { get; set; }
|
||||
[JsonProperty("ClearUnderlying")]
|
||||
public bool ClearUnderlying { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
67
DataAccess/DTOs/DTOEntities/EllipseNdmPrimitiveDTO.cs
Normal file
67
DataAccess/DTOs/DTOEntities/EllipseNdmPrimitiveDTO.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class EllipseNdmPrimitiveDTO : IEllipsePrimitive
|
||||
{
|
||||
private IRectangleShape shape = new RectangleShapeDTO();
|
||||
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Name")]
|
||||
public string? Name { get; set; }
|
||||
[JsonProperty("RectangleShape")]
|
||||
public IRectangleShape RectangleShape
|
||||
{
|
||||
get => shape;
|
||||
set => shape = value;
|
||||
}
|
||||
[JsonIgnore]
|
||||
public IShape Shape => shape;
|
||||
[JsonProperty("NdmElement")]
|
||||
public INdmElement NdmElement { get; set; } = new NdmElementDTO();
|
||||
[JsonProperty("VisualProperty")]
|
||||
public IVisualProperty VisualProperty { get; set; } = new VisualPropertyDTO();
|
||||
[JsonProperty("Center")]
|
||||
public IPoint2D Center { get; set; } = new Point2DDTO();
|
||||
[JsonProperty("DivisionSize")]
|
||||
public IDivisionSize DivisionSize { get; set; } = new DivisionSizeDTO();
|
||||
[JsonIgnore]
|
||||
public double Width { get; set; }
|
||||
[JsonIgnore]
|
||||
public double Height {get; set; }
|
||||
[JsonIgnore]
|
||||
public double Angle { get; set; }
|
||||
[JsonIgnore]
|
||||
public ICrossSection? CrossSection { get; set; }
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(ITriangulationOptions triangulationOptions)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<INamedAreaPoint> GetValuePoints()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsPointInside(IPoint2D point)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,18 +10,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class NdmPrimitiveDTO : INdmElement
|
||||
public class NdmElementDTO : INdmElement
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("HeadMaterial")]
|
||||
public IHeadMaterial? HeadMaterial { get; set; }
|
||||
public IHeadMaterial? HeadMaterial { get; set; } = new HeadMaterial();
|
||||
[JsonProperty("Triangulate")]
|
||||
public bool Triangulate { get; set; }
|
||||
[JsonProperty("UserPrestrain")]
|
||||
public StrainTuple UsersPrestrain { get; } = new StrainTuple();
|
||||
[JsonIgnore]
|
||||
public StrainTuple AutoPrestrain => throw new NotImplementedException();
|
||||
[JsonProperty("UsersPrestrain")]
|
||||
public IForceTuple UsersPrestrain { get; set; } = new ForceTupleDTO();
|
||||
[JsonProperty("AutoPrestrain")]
|
||||
public IForceTuple AutoPrestrain { get; set; } = new ForceTupleDTO();
|
||||
|
||||
|
||||
public object Clone()
|
||||
23
DataAccess/DTOs/DTOEntities/RectangleShapeDTO.cs
Normal file
23
DataAccess/DTOs/DTOEntities/RectangleShapeDTO.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class RectangleShapeDTO : IRectangleShape
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("Width")]
|
||||
public double Width { get; set; }
|
||||
[JsonProperty("Height")]
|
||||
public double Height { get; set; }
|
||||
[JsonProperty("Angle")]
|
||||
public double Angle { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,13 +36,14 @@ namespace DataAccess.DTOs
|
||||
{
|
||||
return new List<(Type type, string name)>
|
||||
{
|
||||
{ (typeof(CirclePrimitiveDTO), "CircleNdmPrimitive") },
|
||||
{ (typeof(ConcreteLibMaterialDTO), "ConcreteLibMaterial") },
|
||||
{ (typeof(CrossSectionDTO), "CrossSection") },
|
||||
{ (typeof(CrossSectionNdmAnalysisDTO), "CrossSectionNdmAnalysis") },
|
||||
{ (typeof(CrossSectionRepositoryDTO), "CrossSectionRepository") },
|
||||
{ (typeof(DateVersionDTO), "DateVersion") },
|
||||
{ (typeof(EllipseNdmPrimitiveDTO), "EllipseNdmPrimitive") },
|
||||
{ (typeof(DesignForceTupleDTO), "DesignForceTuple") },
|
||||
{ (typeof(DivisionSizeDTO), "DivisionSize") },
|
||||
{ (typeof(ElasticMaterialDTO), "ElasticMaterial") },
|
||||
{ (typeof(FileVersionDTO), "FileVersion") },
|
||||
{ (typeof(ForceCombinationByFactorDTO), "ForceCombinationByFactor") },
|
||||
@@ -51,7 +52,7 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(FRMaterialDTO), "FRMaterial") },
|
||||
{ (typeof(HeadMaterialDTO), "HeadMaterial") },
|
||||
{ (typeof(MaterialSafetyFactorDTO), "MaterialSafetyFactor") },
|
||||
{ (typeof(NdmPrimitiveDTO), "NdmPrimitive") },
|
||||
{ (typeof(NdmElementDTO), "NdmElement") },
|
||||
{ (typeof(IVisualAnalysis), "IVisualAnalysis") },
|
||||
{ (typeof(List<ICalculator>), "ListOfICalculator") },
|
||||
{ (typeof(List<IDateVersion>), "ListOfIDateVersion") },
|
||||
@@ -65,10 +66,12 @@ namespace DataAccess.DTOs
|
||||
{ (typeof(List<IVisualAnalysis>), "ListOfIVisualAnalysis") },
|
||||
{ (typeof(Point2DDTO), "Point2D") },
|
||||
{ (typeof(ProjectDTO), "Project") },
|
||||
{ (typeof(RectangleShapeDTO), "RectangleShape") },
|
||||
{ (typeof(ReinforcementLibMaterialDTO), "ReinforcementLibMaterial") },
|
||||
{ (typeof(MaterialPartialFactorDTO), "MaterialPartialFactor") },
|
||||
{ (typeof(VersionProcessorDTO), "VersionProcessor") },
|
||||
{ (typeof(VisualAnalysisDTO), "VisualAnalysis") },
|
||||
{ (typeof(VisualPropertyDTO), "VisualProperty") },
|
||||
};
|
||||
}
|
||||
}
|
||||
28
DataAccess/DTOs/DTOEntities/VisualPropertyDTO.cs
Normal file
28
DataAccess/DTOs/DTOEntities/VisualPropertyDTO.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class VisualPropertyDTO : IVisualProperty
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("IsVisible")]
|
||||
public bool IsVisible { get; set; }
|
||||
[JsonProperty("Color")]
|
||||
public Color Color { get; set; }
|
||||
[JsonProperty("SetMaterialColor")]
|
||||
public bool SetMaterialColor { get; set; }
|
||||
[JsonProperty("ZIndex")]
|
||||
public int ZIndex { get; set; }
|
||||
[JsonProperty("Opacity")]
|
||||
public double Opacity { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,8 @@ namespace StructureHelper.Windows.MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public AxisCanvasVM()
|
||||
{
|
||||
AxisLineThickness = 2d;
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
public class HasDivisionViewModel : ViewModelBase, IDivisionSize
|
||||
{
|
||||
private IDivisionSize primitive;
|
||||
public Guid Id { get; }
|
||||
|
||||
public double NdmMaxSize
|
||||
{
|
||||
@@ -42,6 +43,7 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HasDivisionViewModel(IDivisionSize primitive)
|
||||
{
|
||||
this.primitive = primitive;
|
||||
|
||||
@@ -323,6 +323,8 @@ namespace StructureHelper.Windows.ViewModels.NdmCrossSections
|
||||
|
||||
public double Angle { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public Guid Id => throw new NotImplementedException();
|
||||
|
||||
public void AddItems(IEnumerable<PrimitiveBase> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
|
||||
@@ -10,6 +10,11 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Check parameters of strategy of converting of one class to another one
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Target type</typeparam>
|
||||
/// <typeparam name="V">Source type</typeparam>
|
||||
public class CheckConvertLogic<T, V> : ICheckConvertLogic<T, V> where T : ISaveable
|
||||
where V : ISaveable
|
||||
{
|
||||
|
||||
@@ -8,6 +8,17 @@ namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class CircleShape : ICircleShape
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public double Diameter { get; set; }
|
||||
public CircleShape(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public CircleShape() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public interface IShape
|
||||
public interface IShape : ISaveable
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class LineShape : ILineShape
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public IPoint2D StartPoint { get; set; }
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
public IPoint2D EndPoint { get; set; }
|
||||
public IPoint2D StartPoint { get; set; } = new Point2D();
|
||||
/// <inheritdoc />
|
||||
public double Thickness { get; set; }
|
||||
public IPoint2D EndPoint { get; set; } = new Point2D();
|
||||
/// <inheritdoc />
|
||||
public double Thickness { get; set; } = 0d;
|
||||
|
||||
public LineShape()
|
||||
public LineShape(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public LineShape() : this (Guid.NewGuid())
|
||||
{
|
||||
StartPoint = new Point2D();
|
||||
EndPoint = new Point2D();
|
||||
Thickness = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
public class PointShape : IPointShape
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public double Area { get; set; }
|
||||
|
||||
public PointShape(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public PointShape() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Shapes
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class RectangleShape : IRectangleShape
|
||||
{
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc />
|
||||
public double Width { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Height { get; set; }
|
||||
/// <inheritdoc />
|
||||
public double Angle { get; set; }
|
||||
|
||||
public RectangleShape(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
public RectangleShape() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,22 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public class DivisionSize : IDivisionSize
|
||||
{
|
||||
public Guid Id { get; }
|
||||
/// <inheritdoc/>
|
||||
public double NdmMaxSize { get; set; } = 0.01d;
|
||||
/// <inheritdoc/>
|
||||
public int NdmMinDivision { get; set; } = 10;
|
||||
/// <inheritdoc/>
|
||||
public bool ClearUnderlying { get; set; } = false;
|
||||
|
||||
public DivisionSize(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public DivisionSize() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,7 +12,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Include parameters of triangulation for shapes
|
||||
/// </summary>
|
||||
public interface IDivisionSize
|
||||
public interface IDivisionSize : ISaveable
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum size of Ndm part
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <summary>
|
||||
/// Prestrain assigned from user
|
||||
/// </summary>
|
||||
StrainTuple UsersPrestrain { get; }
|
||||
IForceTuple UsersPrestrain { get; }
|
||||
/// <summary>
|
||||
/// Prestrain assigned from calculations
|
||||
/// </summary>
|
||||
StrainTuple AutoPrestrain { get; }
|
||||
IForceTuple AutoPrestrain { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -7,7 +8,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IVisualProperty
|
||||
public interface IVisualProperty : ISaveable
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag of visibility
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class LinePrimitive : ILinePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid Id { get;}
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class DivisionPropsUpdateStrategy : IUpdateStrategy<IDivisionSize>
|
||||
public class DivisionSizeUpdateStrategy : IUpdateStrategy<IDivisionSize>
|
||||
{
|
||||
public void Update(IDivisionSize targetObject, IDivisionSize sourceObject)
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using StructureHelperCommon.Services;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipsePrimitive>
|
||||
public class EllipsePrimitiveUpdateStrategy : IUpdateStrategy<IEllipsePrimitive>
|
||||
{
|
||||
private IUpdateStrategy<INdmPrimitive> basePrimitiveUpdateStrategy;
|
||||
private IUpdateStrategy<IDivisionSize> divisionPropsUpdateStrategy;
|
||||
@@ -22,7 +22,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public EllipsePrimitiveUpdateStrategy() : this(
|
||||
new BaseUpdateStrategy(),
|
||||
new ShapeUpdateStrategy(),
|
||||
new DivisionPropsUpdateStrategy())
|
||||
new DivisionSizeUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public RectanglePrimitiveUpdateStrategy() : this(
|
||||
new BaseUpdateStrategy(),
|
||||
new ShapeUpdateStrategy(),
|
||||
new DivisionPropsUpdateStrategy())
|
||||
new DivisionSizeUpdateStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
/// <inheritdoc/>
|
||||
public bool Triangulate { get; set; } = true;
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple UsersPrestrain { get; } = new();
|
||||
public IForceTuple UsersPrestrain { get; } = new StrainTuple();
|
||||
/// <inheritdoc/>
|
||||
public StrainTuple AutoPrestrain { get; } = new();
|
||||
public IForceTuple AutoPrestrain { get; } = new StrainTuple();
|
||||
|
||||
public NdmElement(Guid id)
|
||||
{
|
||||
|
||||
@@ -12,11 +12,15 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public class VisualProperty : IVisualProperty
|
||||
{
|
||||
|
||||
public bool IsVisible { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public bool SetMaterialColor { get; set; }
|
||||
public int ZIndex { get; set; }
|
||||
private double opacity;
|
||||
public Guid Id { get; }
|
||||
|
||||
|
||||
|
||||
public bool IsVisible { get; set; } = true;
|
||||
public Color Color { get; set; } = ColorProcessor.GetRandomColor();
|
||||
public bool SetMaterialColor { get; set; } = true;
|
||||
public int ZIndex { get; set; } = 0;
|
||||
private double opacity = 1d;
|
||||
|
||||
public double Opacity
|
||||
{
|
||||
@@ -28,14 +32,14 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public VisualProperty()
|
||||
public VisualProperty(Guid id)
|
||||
{
|
||||
IsVisible = true;
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
SetMaterialColor = true;
|
||||
ZIndex = 0;
|
||||
Opacity = 1;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public VisualProperty() : this (Guid.NewGuid())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user