Force Single Image => Sorting
This commit is contained in:
@ -61,16 +61,14 @@ public class MappingFromPerson : Properties.IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public int? By { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday? PersonBirthday { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday? personBirthday, string segmentB)
|
||||
public MappingFromPerson(int? approximateYears, string displayDirectoryName, PersonBirthday personBirthday, string segmentB)
|
||||
{
|
||||
ApproximateYears = approximateYears;
|
||||
By = by;
|
||||
DisplayDirectoryName = displayDirectoryName;
|
||||
PersonBirthday = personBirthday;
|
||||
SegmentB = segmentB;
|
||||
@ -87,24 +85,27 @@ public class MappingFromPerson : Properties.IMappingFromPerson
|
||||
public class Mapping : Properties.IMapping
|
||||
{
|
||||
|
||||
protected MappingFromPerson _MappingFromPerson;
|
||||
protected int? _By;
|
||||
protected MappingFromPerson? _MappingFromPerson;
|
||||
protected SortingContainer? _SortingContainer;
|
||||
public int? By => _By;
|
||||
public MappingFromItem MappingFromItem { init; get; }
|
||||
public MappingFromLocation MappingFromLocation { init; get; }
|
||||
public MappingFromPerson MappingFromPerson => _MappingFromPerson;
|
||||
public MappingFromPerson? MappingFromPerson => _MappingFromPerson;
|
||||
public SortingContainer? SortingContainer => _SortingContainer;
|
||||
|
||||
[JsonConstructor]
|
||||
public Mapping(MappingFromItem mappingFromItem, MappingFromLocation mappingFromLocation, MappingFromPerson mappingFromPerson, SortingContainer? sortingContainer)
|
||||
public Mapping(int? by, MappingFromItem mappingFromItem, MappingFromLocation mappingFromLocation, MappingFromPerson? mappingFromPerson, SortingContainer? sortingContainer)
|
||||
{
|
||||
_By = by;
|
||||
MappingFromItem = mappingFromItem;
|
||||
MappingFromLocation = mappingFromLocation;
|
||||
_MappingFromPerson = mappingFromPerson;
|
||||
_SortingContainer = sortingContainer;
|
||||
}
|
||||
|
||||
public Mapping(MappingFromItem mappingFromItem, MappingFromLocation mappingFromLocation, MappingFromPerson mappingFromPerson) :
|
||||
this(mappingFromItem, mappingFromLocation, mappingFromPerson, null)
|
||||
public Mapping(MappingFromItem mappingFromItem, MappingFromLocation mappingFromLocation) :
|
||||
this(null, mappingFromItem, mappingFromLocation, null, null)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
@ -113,8 +114,24 @@ public class Mapping : Properties.IMapping
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UpdateMappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday personBirthday, string segmentB) => _MappingFromPerson = new(approximateYears, by, displayDirectoryName, personBirthday, segmentB);
|
||||
public void UpdateMappingFromUnknownPerson(int? by, SortingContainer sortingContainer)
|
||||
{
|
||||
_By = by;
|
||||
_SortingContainer = sortingContainer;
|
||||
}
|
||||
|
||||
public void SetSortingContainer(SortingContainer sortingContainer) => _SortingContainer = sortingContainer;
|
||||
public void UpdateMappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday personBirthday, string segmentB)
|
||||
{
|
||||
_By = by;
|
||||
_SortingContainer = null;
|
||||
_MappingFromPerson = new(approximateYears, displayDirectoryName, personBirthday, segmentB);
|
||||
}
|
||||
|
||||
public void UpdateMappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday personBirthday, string segmentB, SortingContainer sortingContainer)
|
||||
{
|
||||
_By = by;
|
||||
_SortingContainer = sortingContainer;
|
||||
_MappingFromPerson = new(approximateYears, displayDirectoryName, personBirthday, segmentB);
|
||||
}
|
||||
|
||||
}
|
@ -26,9 +26,8 @@ public interface IMappingFromPerson
|
||||
{
|
||||
|
||||
public int? ApproximateYears { init; get; }
|
||||
public int? By { init; get; }
|
||||
public string DisplayDirectoryName { init; get; }
|
||||
public PersonBirthday? PersonBirthday { init; get; }
|
||||
public PersonBirthday PersonBirthday { init; get; }
|
||||
public string SegmentB { init; get; }
|
||||
|
||||
}
|
||||
@ -36,9 +35,10 @@ public interface IMappingFromPerson
|
||||
public interface IMapping
|
||||
{
|
||||
|
||||
public int? By { get; }
|
||||
public MappingFromItem MappingFromItem { init; get; }
|
||||
public MappingFromLocation MappingFromLocation { init; get; }
|
||||
public MappingFromPerson MappingFromPerson { get; }
|
||||
public MappingFromPerson? MappingFromPerson { get; }
|
||||
public SortingContainer? SortingContainer { get; }
|
||||
|
||||
}
|
@ -18,14 +18,19 @@ internal abstract class Sorting
|
||||
bool older = timeSpan.TotalMilliseconds < 0;
|
||||
int daysDelta = (int)Math.Round(Math.Abs(timeSpan.TotalDays), 0);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / faceDistanceTolerance * faceDistancePermyriad);
|
||||
foreach ((long lcl, long minimum, long maximum, long ucl) in personKeysRangesCollection)
|
||||
if (!personKeysRangesCollection.Any())
|
||||
withinRanges.Add(0);
|
||||
else
|
||||
{
|
||||
if (ticks > minimum && ticks < maximum)
|
||||
withinRanges.Add(0);
|
||||
else if (ticks > lcl && ticks < ucl)
|
||||
withinRanges.Add(1);
|
||||
else
|
||||
withinRanges.Add(2);
|
||||
foreach ((long lcl, long minimum, long maximum, long ucl) in personKeysRangesCollection)
|
||||
{
|
||||
if (ticks > minimum && ticks < maximum)
|
||||
withinRanges.Add(0);
|
||||
else if (ticks > lcl && ticks < ucl)
|
||||
withinRanges.Add(1);
|
||||
else
|
||||
withinRanges.Add(2);
|
||||
}
|
||||
}
|
||||
int withinRange = withinRanges.Max();
|
||||
result = new(daysDelta, distancePermyriad, faceDistanceLength.Id, faceDistanceLength.NormalizedPixelPercentage.Value, older, withinRange);
|
||||
|
Reference in New Issue
Block a user