69 lines
2.9 KiB
C#
69 lines
2.9 KiB
C#
using View_by_Distance.Shared.Models.Methods;
|
|
|
|
namespace View_by_Distance.Distance.Models;
|
|
|
|
public class DistanceLimits : IDistanceLimits
|
|
{
|
|
|
|
private int _Area;
|
|
private int _Days;
|
|
private int _Distance;
|
|
private int _Confidence;
|
|
|
|
public double FaceAreaPermille { init; get; }
|
|
public double RangeDaysDeltaTolerance { init; get; }
|
|
public double FaceConfidencePercent { init; get; }
|
|
public double FaceDistancePermyriad { init; get; }
|
|
public int SortingMaximumPerFaceShouldBeHigh { init; get; }
|
|
public bool RangeDaysDeltaTargetLessThenUpper { init; get; }
|
|
|
|
public DistanceLimits(int faceConfidencePercent,
|
|
int faceDistancePermyriad,
|
|
int[] rangeDaysDeltaTolerance,
|
|
double[] rangeDistanceTolerance,
|
|
int[] rangeFaceAreaPermilleTolerance,
|
|
double[] rangeFaceConfidence,
|
|
int sortingMaximumPerFaceShouldBeHigh,
|
|
int? useFiltersCounter = null)
|
|
{
|
|
SortingMaximumPerFaceShouldBeHigh = sortingMaximumPerFaceShouldBeHigh;
|
|
RangeDaysDeltaTargetLessThenUpper = rangeDaysDeltaTolerance[1] > rangeDaysDeltaTolerance[2];
|
|
if (useFiltersCounter is null)
|
|
{
|
|
FaceAreaPermille = rangeFaceAreaPermilleTolerance[1];
|
|
RangeDaysDeltaTolerance = rangeDaysDeltaTolerance[1];
|
|
FaceConfidencePercent = faceConfidencePercent * rangeFaceConfidence[1];
|
|
FaceDistancePermyriad = faceDistancePermyriad * rangeDistanceTolerance[1];
|
|
}
|
|
else
|
|
{
|
|
RangeDaysDeltaTolerance = ((rangeDaysDeltaTolerance[2] - rangeDaysDeltaTolerance[0]) * 0.01 * useFiltersCounter.Value) + rangeDaysDeltaTolerance[1];
|
|
FaceConfidencePercent = faceConfidencePercent * ((rangeFaceConfidence[2] - rangeFaceConfidence[0]) * 0.01 * useFiltersCounter.Value) + rangeFaceConfidence[1];
|
|
FaceAreaPermille = ((rangeFaceAreaPermilleTolerance[2] - rangeFaceAreaPermilleTolerance[0]) * 0.01 * useFiltersCounter.Value) + rangeFaceAreaPermilleTolerance[1];
|
|
FaceDistancePermyriad = faceDistancePermyriad * ((rangeDistanceTolerance[2] - rangeDistanceTolerance[0]) * 0.01 * useFiltersCounter.Value) + rangeDistanceTolerance[1];
|
|
}
|
|
}
|
|
|
|
string IDistanceLimits.GetCounts()
|
|
{
|
|
string result;
|
|
List<(int Value, string Name)> results = new()
|
|
{
|
|
new(_Area, nameof(_Area)),
|
|
new(_Confidence, nameof(_Confidence)),
|
|
new(_Days, nameof(_Days)),
|
|
new(_Distance, nameof(_Distance))
|
|
};
|
|
result = string.Join(' ', from l in results orderby l.Value descending select $"{l.Name}_{l.Value};");
|
|
return result;
|
|
}
|
|
|
|
void IDistanceLimits.AddCounts(int area, int days, int distance, int confidence)
|
|
{
|
|
_Area += area;
|
|
_Days += days;
|
|
_Distance += distance;
|
|
_Confidence += confidence;
|
|
}
|
|
|
|
} |