Add work plane property saving
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements properties of work plane
|
||||
/// </summary>
|
||||
public interface IWorkPlaneProperty : ISaveable, IRectangleShape
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of grid of work plane
|
||||
/// </summary>
|
||||
double GridSize { get; set; }
|
||||
/// <summary>
|
||||
/// Thickness of axis line
|
||||
/// </summary>
|
||||
double AxisLineThickness { get; set; }
|
||||
/// <summary>
|
||||
/// Thickness of lines of main grid
|
||||
/// </summary>
|
||||
double GridLineThickness { get; set; }
|
||||
}
|
||||
}
|
||||
24
StructureHelperCommon/Models/WorkPlanes/WorkPlaneProperty.cs
Normal file
24
StructureHelperCommon/Models/WorkPlanes/WorkPlaneProperty.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
public class WorkPlaneProperty : IWorkPlaneProperty
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public double GridSize { get; set; } = 0.05;
|
||||
public double Height { get; set; } = 1.2;
|
||||
public double Width { get; set; } = 1.2;
|
||||
public double AxisLineThickness { get; set; } = 2;
|
||||
public double GridLineThickness { get; set; } = 0.25;
|
||||
|
||||
public WorkPlaneProperty(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.WorkPlanes
|
||||
{
|
||||
public class WorkPlanePropertyUpdateStrategy : IUpdateStrategy<IWorkPlaneProperty>
|
||||
{
|
||||
public void Update(IWorkPlaneProperty targetObject, IWorkPlaneProperty sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject);
|
||||
CheckObject.IsNull(sourceObject);
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.AxisLineThickness = sourceObject.AxisLineThickness;
|
||||
targetObject.GridSize = sourceObject.GridSize;
|
||||
targetObject.GridLineThickness = sourceObject.GridLineThickness;
|
||||
targetObject.Height = sourceObject.Height;
|
||||
targetObject.Width = sourceObject.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user