Add polygon to DTO convert strategy
This commit is contained in:
18
DataAccess/DTOs/DTOEntities/Shapes/CircleShapeDTO.cs
Normal file
18
DataAccess/DTOs/DTOEntities/Shapes/CircleShapeDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class CircleShapeDTO : ICircleShape
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("Diameter")]
|
||||
public double Diameter { get; set; }
|
||||
|
||||
public CircleShapeDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
DataAccess/DTOs/DTOEntities/Shapes/LinePolygonShapeDTO.cs
Normal file
53
DataAccess/DTOs/DTOEntities/Shapes/LinePolygonShapeDTO.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class LinePolygonShapeDTO : ILinePolygonShape
|
||||
{
|
||||
private readonly List<IVertex> _vertices = [];
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("Vertices")]
|
||||
public IReadOnlyList<IVertex> Vertices => _vertices;
|
||||
[JsonProperty("IsClosed")]
|
||||
public bool IsClosed { get; set; }
|
||||
|
||||
|
||||
public LinePolygonShapeDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public IVertex AddVertex(IVertex vertex)
|
||||
{
|
||||
_vertices.Add(vertex);
|
||||
return vertex;
|
||||
}
|
||||
|
||||
public IVertex AddVertexAfter(IVertex existing, IVertex vertex)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IVertex AddVertexBefore(IVertex existing, IVertex vertex)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_vertices.Clear();
|
||||
}
|
||||
|
||||
public IVertex InsertVertex(int index, IVertex vertex)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RemoveVertex(IVertex vertex)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
DataAccess/DTOs/DTOEntities/Shapes/Point2DDTO.cs
Normal file
27
DataAccess/DTOs/DTOEntities/Shapes/Point2DDTO.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class Point2DDTO : IPoint2D
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; set; }
|
||||
[JsonProperty("X")]
|
||||
public double X { get; set; }
|
||||
[JsonProperty("Y")]
|
||||
public double Y { get; set; }
|
||||
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
DataAccess/DTOs/DTOEntities/Shapes/RectangleShapeDTO.cs
Normal file
21
DataAccess/DTOs/DTOEntities/Shapes/RectangleShapeDTO.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Newtonsoft.Json;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
public class RectangleShapeDTO : IRectangleShape
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get;}
|
||||
[JsonProperty("Width")]
|
||||
public double Width { get; set; }
|
||||
[JsonProperty("Height")]
|
||||
public double Height { get; set; }
|
||||
|
||||
public RectangleShapeDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
23
DataAccess/DTOs/DTOEntities/Shapes/VertexDTO.cs
Normal file
23
DataAccess/DTOs/DTOEntities/Shapes/VertexDTO.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 VertexDTO : IVertex
|
||||
{
|
||||
[JsonProperty("Id")]
|
||||
public Guid Id { get; }
|
||||
[JsonProperty("Point")]
|
||||
public IPoint2D Point { get; set; }
|
||||
|
||||
public VertexDTO(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user