Add series to graph

This commit is contained in:
Evgeny Redikultsev
2023-12-23 22:40:42 +05:00
parent a19333f7df
commit 0a6d29bcfc
38 changed files with 762 additions and 233 deletions

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Models.Shapes;
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Models.Shapes;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,13 +13,20 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
private List<IPoint2D> surroundList;
public SurroundData SurroundData { get; set; }
public int PointCount { get; set; }
public RectSurroundProc()
{
}
public List<IPoint2D> GetPoints()
{
CheckParameters();
var xRadius = (SurroundData.XMax - SurroundData.XMin) / 2;
var yRadius = (SurroundData.YMax - SurroundData.YMin) / 2;
surroundList = new();
var pointCount = Convert.ToInt32(Math.Ceiling(SurroundData.PointCount / 8d));
var pointCount = Convert.ToInt32(Math.Ceiling(PointCount / 8d));
double xStep = xRadius / pointCount;
double yStep = yRadius / pointCount;
double x, y;
@@ -49,5 +57,17 @@ namespace StructureHelperLogics.NdmCalculations.Analyses.ByForces
surroundList.Add(surroundList[0].Clone() as IPoint2D);
return surroundList;
}
private void CheckParameters()
{
//if (surroundList is null || surroundList.Count == 0)
//{
// throw new StructureHelperException(ErrorStrings.ParameterIsNull);
//}
if (PointCount < 12)
{
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $": Point count must be grater than 12, but was {PointCount}");
}
}
}
}