LinePrimitive and RectanglePrimitive was added

This commit is contained in:
Evgeny Redikultsev
2022-11-19 21:12:55 +05:00
parent 667b91cbfa
commit b566373f16
37 changed files with 544 additions and 69 deletions

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface ISaveable
{
int Id { get; set; }
void Save();
}
}

View File

@@ -10,11 +10,11 @@
/// Coordinate of center of rectangle by local axis X, m
/// Координата центра вдоль локальной оси X, м
/// </summary>
double X { get;}
double X { get; set; }
/// <summary>
/// Coordinate of center of rectangle by local axis Y, m
/// Координата центра вдоль локальной оси Y, м
/// </summary>
double Y { get;}
double Y { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes
{
public interface ILineShape : IShape
{
ICenter StartPoint { get; set; }
ICenter EndPoint { get; set; }
double Thickness { get; set; }
}
}

View File

@@ -1,18 +1,18 @@
namespace StructureHelperCommon.Models.Shapes
{
public interface IRectangle : IShape
public interface IRectangleShape : IShape
{
/// <summary>
/// Width of rectangle, m
/// </summary>
double Width { get; }
double Width { get; set; }
/// <summary>
/// Height of rectangle, m
/// </summary>
double Height { get; }
double Height { get; set; }
/// <summary>
/// Angle of rotating rectangle, rad
/// </summary>
double Angle { get; }
double Angle { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Shapes
{
/// <inheritdoc />
public class LineShape : ILineShape
{
/// <inheritdoc />
public ICenter StartPoint { get; set; }
/// <inheritdoc />
public ICenter EndPoint { get; set; }
/// <inheritdoc />
public double Thickness { get; set; }
public LineShape()
{
StartPoint = new Center();
EndPoint = new Center();
Thickness = 0;
}
}
}

View File

@@ -1,6 +1,6 @@
namespace StructureHelperCommon.Models.Shapes
{
public class Point : IPoint
public class PointShape : IPoint
{
public double Area { get; set; }
}

View File

@@ -1,7 +1,7 @@
namespace StructureHelperCommon.Models.Shapes
{
/// <inheritdoc />
public class Rectangle : IRectangle
public class RectangleShape : IRectangleShape
{
/// <inheritdoc />
public double Width { get; set; }

View File

@@ -0,0 +1,27 @@
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services.ShapeServices
{
public static class ShapeService
{
public static void CopyLineProperties(ILineShape source, ILineShape target)
{
target.StartPoint.X = source.StartPoint.X;
target.StartPoint.Y = source.StartPoint.Y;
target.EndPoint.X = source.EndPoint.X;
target.EndPoint.Y = source.EndPoint.Y;
}
public static void CopyRectangleProperties(IRectangleShape source, IRectangleShape target)
{
target.Width = source.Width;
target.Height = source.Height;
target.Angle = source.Angle;
}
}
}

View File

@@ -51,19 +51,23 @@
<Compile Include="Infrastructures\Enums\LimitStates.cs" />
<Compile Include="Infrastructures\Exceptions\StructureHelperException.cs" />
<Compile Include="Infrastructures\Interfaces\IHasParent.cs" />
<Compile Include="Infrastructures\Interfaces\ISaveable.cs" />
<Compile Include="Infrastructures\Strings\ErrorString.cs" />
<Compile Include="Infrastructures\Enums\MaterialTypes.cs" />
<Compile Include="Models\Shapes\Center.cs" />
<Compile Include="Models\Shapes\ICenter.cs" />
<Compile Include="Models\Shapes\ICenterShape.cs" />
<Compile Include="Models\Shapes\ICircle.cs" />
<Compile Include="Models\Shapes\ILineShape.cs" />
<Compile Include="Models\Shapes\IPoint.cs" />
<Compile Include="Models\Shapes\IRectangle.cs" />
<Compile Include="Models\Shapes\IRectangleShape.cs" />
<Compile Include="Models\Shapes\IShape.cs" />
<Compile Include="Models\Shapes\Point.cs" />
<Compile Include="Models\Shapes\Rectangle.cs" />
<Compile Include="Models\Shapes\LineShape.cs" />
<Compile Include="Models\Shapes\PointShape.cs" />
<Compile Include="Models\Shapes\RectangleShape.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\ColorServices\ColorProcessor.cs" />
<Compile Include="Services\ShapeServices\ShapeService.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>