Re-Write without checking mapped
This commit is contained in:
@ -3,52 +3,105 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public class Mapping : Properties.IMapping
|
||||
public class MappingFromItem : Properties.IMappingFromItem
|
||||
{
|
||||
|
||||
protected int? _ApproximateYears;
|
||||
protected readonly string _DisplayDirectoryName;
|
||||
protected bool? _Filtered;
|
||||
protected bool _Forced;
|
||||
protected readonly int? _NormalizedPixelPercentage;
|
||||
protected PersonBirthday _PersonBirthday;
|
||||
protected readonly string _SegmentB;
|
||||
public int? ApproximateYears => _ApproximateYears;
|
||||
public string DisplayDirectoryName => _DisplayDirectoryName;
|
||||
public bool? Filtered => _Filtered;
|
||||
public bool Forced => _Forced;
|
||||
public int? NormalizedPixelPercentage => _NormalizedPixelPercentage;
|
||||
public PersonBirthday PersonBirthday => _PersonBirthday;
|
||||
public string SegmentB => _SegmentB;
|
||||
public int Id { init; get; }
|
||||
public FileHolder ImageFileHolder { init; get; }
|
||||
public bool? IsWrongYear { init; get; }
|
||||
public DateTime MinimumDateTime { init; get; }
|
||||
public FileHolder ResizedFileHolder { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public Mapping(int? approximateYears, string displayDirectoryName, bool? filtered, bool forced, int? normalizedPixelPercentage, PersonBirthday personBirthday, string segmentB)
|
||||
public MappingFromItem(int id, FileHolder imageFileHolder, bool? isWrongYear, DateTime minimumDateTime, FileHolder resizedFileHolder)
|
||||
{
|
||||
_ApproximateYears = approximateYears;
|
||||
_DisplayDirectoryName = displayDirectoryName;
|
||||
_Filtered = filtered;
|
||||
_Forced = forced;
|
||||
_NormalizedPixelPercentage = normalizedPixelPercentage;
|
||||
_PersonBirthday = personBirthday;
|
||||
_SegmentB = segmentB;
|
||||
Id = id;
|
||||
ImageFileHolder = imageFileHolder;
|
||||
IsWrongYear = isWrongYear;
|
||||
MinimumDateTime = minimumDateTime;
|
||||
ResizedFileHolder = resizedFileHolder;
|
||||
}
|
||||
|
||||
public Mapping(int? approximateYears, string displayDirectoryName, bool forced, int? normalizedPixelPercentage, PersonBirthday personBirthday, string segmentB) :
|
||||
this(approximateYears, displayDirectoryName, null, forced, normalizedPixelPercentage, personBirthday, segmentB)
|
||||
{ }
|
||||
|
||||
public Mapping(int? approximateYears, string displayDirectoryName, bool forced, PersonBirthday personBirthday, string segmentB) :
|
||||
this(approximateYears, displayDirectoryName, null, forced, null, personBirthday, segmentB)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void SetFiltered() => _Filtered = true;
|
||||
}
|
||||
|
||||
public void SetFiltered(bool value) => _Filtered = value;
|
||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
{
|
||||
|
||||
public double Confidence { init; get; }
|
||||
public string DeterministicHashCodeKeyDisplay { init; get; }
|
||||
public int NormalizedPixelPercentage { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(double confidence, string deterministicHashCodeKeyDisplay, int normalizedPixelPercentage)
|
||||
{
|
||||
Confidence = confidence;
|
||||
DeterministicHashCodeKeyDisplay = deterministicHashCodeKeyDisplay;
|
||||
NormalizedPixelPercentage = normalizedPixelPercentage;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 string SegmentB { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday? personBirthday, string segmentB)
|
||||
{
|
||||
ApproximateYears = approximateYears;
|
||||
By = by;
|
||||
DisplayDirectoryName = displayDirectoryName;
|
||||
PersonBirthday = personBirthday;
|
||||
SegmentB = segmentB;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Mapping : Properties.IMapping
|
||||
{
|
||||
|
||||
protected MappingFromPerson _MappingFromPerson;
|
||||
public MappingFromItem MappingFromItem { init; get; }
|
||||
public MappingFromLocation MappingFromLocation { init; get; }
|
||||
public MappingFromPerson MappingFromPerson => _MappingFromPerson;
|
||||
|
||||
[JsonConstructor]
|
||||
public Mapping(MappingFromItem mappingFromItem, MappingFromLocation mappingFromLocation, MappingFromPerson mappingFromPerson)
|
||||
{
|
||||
MappingFromItem = mappingFromItem;
|
||||
MappingFromLocation = mappingFromLocation;
|
||||
_MappingFromPerson = mappingFromPerson;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UpdateMappingFromPerson(int? approximateYears, int? by, string displayDirectoryName, PersonBirthday personBirthday, string segmentB) => _MappingFromPerson = new(approximateYears, by, displayDirectoryName, personBirthday, segmentB);
|
||||
|
||||
}
|
Reference in New Issue
Block a user