View primitives was fixed
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -13,11 +14,21 @@ using StructureHelperLogics.Models.Materials;
|
||||
|
||||
namespace StructureHelper.Models.Materials
|
||||
{
|
||||
public class HeadMaterial : IHeadMaterial
|
||||
public class HeadMaterial : IHeadMaterial, INotifyPropertyChanged
|
||||
{
|
||||
private Color color;
|
||||
|
||||
public string Id { get; }
|
||||
public string Name { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public Color Color
|
||||
{
|
||||
get => color;
|
||||
set
|
||||
{
|
||||
color = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Color)));
|
||||
}
|
||||
}
|
||||
public IHelperMaterial HelperMaterial {get; set;}
|
||||
|
||||
public HeadMaterial()
|
||||
@@ -26,6 +37,8 @@ namespace StructureHelper.Models.Materials
|
||||
Color = ColorProcessor.GetRandomColor();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
{
|
||||
return HelperMaterial.GetLoaderMaterial(limitState, calcTerm);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
internal interface IHasDivisionSize
|
||||
public interface IHasDivisionSize : INdmPrimitive
|
||||
{
|
||||
double NdmMaxSize { get; set; }
|
||||
int NdmMinDivision { get; set; }
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface ILinePrimitive : IHasDivisionSize, ILineShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,16 @@ using System.Collections;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public interface INdmPrimitive
|
||||
public interface INdmPrimitive : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
ICenter Center { get; set; }
|
||||
IShape Shape { get; set; }
|
||||
double CenterX { get; set; }
|
||||
double CenterY { get; set; }
|
||||
IHeadMaterial HeadMaterial { get; set; }
|
||||
double PrestrainKx { get; set; }
|
||||
double PrestrainKy { get; set; }
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IPointPrimitive : INdmPrimitive, IPointShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public interface IRectanglePrimitive : IHasDivisionSize, IRectangleShape
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class LinePrimitive : INdmPrimitive, ILineShape, IHasDivisionSize, ISaveable, ICloneable
|
||||
public class LinePrimitive : ILinePrimitive
|
||||
{
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
@@ -31,6 +30,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
public ICenter StartPoint { get; set; }
|
||||
public ICenter EndPoint { get; set; }
|
||||
public double Thickness { get; set; }
|
||||
|
||||
|
||||
public LinePrimitive()
|
||||
{
|
||||
@@ -44,8 +44,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
LinePrimitive primitive = new LinePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
var primitive = new LinePrimitive();
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyLineProperties(this, primitive);
|
||||
return primitive;
|
||||
|
||||
@@ -6,42 +6,56 @@ using LoaderCalculator.Data.Ndms;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
|
||||
namespace StructureHelperLogics.Models.Primitives
|
||||
{
|
||||
public class NdmPrimitive : INdmPrimitive, ISaveable, ICloneable
|
||||
public class PointPrimitive : IPointPrimitive
|
||||
{
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; private set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
public double Area { get; set; }
|
||||
|
||||
|
||||
public NdmPrimitive(IHeadMaterial material)
|
||||
public PointPrimitive()
|
||||
{
|
||||
Name = "New Point";
|
||||
Area = 0.0005d;
|
||||
}
|
||||
|
||||
public PointPrimitive(IHeadMaterial material)
|
||||
{
|
||||
HeadMaterial = material;
|
||||
}
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
var options = new PointTriangulationLogicOptions(this);
|
||||
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
return logic.GetNdmCollection(material);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
{
|
||||
var primitive = new PointPrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
primitive.Area = Area;
|
||||
return primitive;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ShapeServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Triangulations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,27 +15,34 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
{
|
||||
public class RectanglePrimitive : INdmPrimitive, IRectangleShape, IHasDivisionSize, ISaveable, ICloneable
|
||||
public class RectanglePrimitive : IRectanglePrimitive
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ICenter Center { get; set; }
|
||||
public IShape Shape { get; set; }
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public IHeadMaterial HeadMaterial { get; set; }
|
||||
public double PrestrainKx { get; set; }
|
||||
public double PrestrainKy { get; set; }
|
||||
public double PrestrainEpsZ { get; set; }
|
||||
public double NdmMaxSize { get; set; }
|
||||
public int NdmMinDivision { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Angle { get; set; }
|
||||
|
||||
public RectanglePrimitive()
|
||||
{
|
||||
Name = "New Rectangle";
|
||||
Width = 0.4d;
|
||||
Height = 0.6d;
|
||||
NdmMaxSize = 0.01d;
|
||||
NdmMinDivision = 10;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
RectanglePrimitive primitive = new RectanglePrimitive();
|
||||
NdmPrimitivesService.CopyNdmProperties(this, primitive);
|
||||
NdmPrimitivesService.CopyDivisionProperties(this, primitive);
|
||||
ShapeService.CopyRectangleProperties(this, primitive);
|
||||
return primitive;
|
||||
@@ -42,7 +50,11 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public IEnumerable<INdm> GetNdms(IMaterial material)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
List<INdm> ndms = new List<INdm>();
|
||||
var options = new RectangleTriangulationLogicOptions(this);
|
||||
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||
ndms.AddRange(logic.GetNdmCollection(material));
|
||||
return ndms;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
@@ -29,13 +30,10 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
Area = area;
|
||||
}
|
||||
|
||||
public PointTriangulationLogicOptions(INdmPrimitive primitive)
|
||||
public PointTriangulationLogicOptions(IPointPrimitive primitive)
|
||||
{
|
||||
if (!(primitive.Shape is IPoint)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
Center = primitive.Center;
|
||||
IPoint point = primitive.Shape as IPoint;
|
||||
Center = primitive.Center;
|
||||
Area = point.Area;
|
||||
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||
Area = primitive.Area;
|
||||
PrestrainKx = primitive.PrestrainKx;
|
||||
PrestrainKy = primitive.PrestrainKy;
|
||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||
|
||||
@@ -33,16 +33,12 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
NdmMinDivision = ndmMinDivision;
|
||||
}
|
||||
|
||||
public RectangleTriangulationLogicOptions(INdmPrimitive primitive)
|
||||
public RectangleTriangulationLogicOptions(IRectanglePrimitive primitive)
|
||||
{
|
||||
if (! (primitive.Shape is IRectangleShape)) { throw new StructureHelperException(ErrorStrings.ShapeIsNotCorrect); }
|
||||
Center = primitive.Center;
|
||||
Rectangle = primitive.Shape as IRectangleShape;
|
||||
if (primitive is IHasDivisionSize)
|
||||
{
|
||||
NdmMaxSize = (primitive as IHasDivisionSize).NdmMaxSize;
|
||||
NdmMinDivision = (primitive as IHasDivisionSize).NdmMinDivision;
|
||||
}
|
||||
Center = new Center() { X = primitive.CenterX, Y = primitive.CenterY };
|
||||
Rectangle = primitive;
|
||||
NdmMaxSize = primitive.NdmMaxSize;
|
||||
NdmMinDivision = primitive.NdmMinDivision;
|
||||
PrestrainKx = primitive.PrestrainKx;
|
||||
PrestrainKy = primitive.PrestrainKy;
|
||||
PrestrainEpsZ = primitive.PrestrainEpsZ;
|
||||
|
||||
@@ -70,22 +70,23 @@ namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
private static IEnumerable<INdm> GetNdmsByPrimitive(INdmPrimitive primitive, IMaterial material)
|
||||
{
|
||||
List<INdm> ndms = new List<INdm>();
|
||||
ITriangulationLogicOptions options;
|
||||
ICenter center = primitive.Center;
|
||||
IShape shape = primitive.Shape;
|
||||
if (shape is IRectangleShape)
|
||||
{
|
||||
options = new RectangleTriangulationLogicOptions(primitive);
|
||||
ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||
ndms.AddRange(logic.GetNdmCollection(material));
|
||||
}
|
||||
else if (shape is IPoint)
|
||||
{
|
||||
options = new PointTriangulationLogicOptions(primitive);
|
||||
IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
ndms.AddRange(logic.GetNdmCollection(material));
|
||||
}
|
||||
else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
||||
//ITriangulationLogicOptions options;
|
||||
//ICenter center = primitive.Center;
|
||||
//IShape shape = primitive.Shape;
|
||||
ndms.AddRange(primitive.GetNdms(material));
|
||||
//if (shape is IRectangleShape)
|
||||
//{
|
||||
// options = new RectangleTriangulationLogicOptions(primitive);
|
||||
// ITriangulationLogic logic = new RectangleTriangulationLogic(options);
|
||||
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||
//}
|
||||
//else if (shape is IPoint)
|
||||
//{
|
||||
// options = new PointTriangulationLogicOptions(primitive);
|
||||
// IPointTriangulationLogic logic = new PointTriangulationLogic(options);
|
||||
// ndms.AddRange(logic.GetNdmCollection(material));
|
||||
//}
|
||||
//else { throw new StructureHelperException($"{ErrorStrings.ShapeIsNotCorrect} :{nameof(primitive.Shape)}"); }
|
||||
return ndms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace StructureHelperLogics.Services.NdmPrimitives
|
||||
|
||||
public static void CopyDivisionProperties(IHasDivisionSize source, IHasDivisionSize target)
|
||||
{
|
||||
CopyNdmProperties(source, target);
|
||||
target.NdmMaxSize = source.NdmMaxSize;
|
||||
target.NdmMinDivision = source.NdmMinDivision;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user