Removed Rectangle from LocationContainer

mapped-ids-then-whole-percentages-to-location-container

save-extract-faces
This commit is contained in:
2025-07-05 22:30:19 -07:00
parent 2c9b1a68c0
commit aa8de2b985
10 changed files with 173 additions and 108 deletions

View File

@ -1,5 +1,3 @@
using System.Drawing;
namespace View_by_Distance.Shared.Models;
public record LocationContainer(DateOnly? CreationDateOnly,
@ -10,22 +8,20 @@ public record LocationContainer(DateOnly? CreationDateOnly,
int? LengthPermyriad,
FilePath? LengthSource,
PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName? PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName,
RectangleF? Rectangle,
int? WholePercentages)
{
public static LocationContainer Get(LocationContainer locationContainer, object? encoding, bool keepExifDirectory)
public static LocationContainer Get(LocationContainer locationContainer, object? encoding)
{
LocationContainer result;
result = new(CreationDateOnly: locationContainer.CreationDateOnly,
ExifDirectory: keepExifDirectory ? locationContainer.ExifDirectory : null,
ExifDirectory: locationContainer.ExifDirectory,
Encoding: encoding,
FaceFile: locationContainer.FaceFile,
FilePath: locationContainer.FilePath,
LengthPermyriad: locationContainer.LengthPermyriad,
LengthSource: locationContainer.LengthSource,
PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName: locationContainer.PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName,
Rectangle: locationContainer.Rectangle,
WholePercentages: locationContainer.WholePercentages);
return result;
}
@ -41,7 +37,6 @@ public record LocationContainer(DateOnly? CreationDateOnly,
LengthPermyriad: lengthPermyriad,
LengthSource: source.FilePath,
PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName: locationContainer.PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName,
Rectangle: locationContainer.Rectangle,
WholePercentages: locationContainer.WholePercentages);
return result;
}

View File

@ -5,11 +5,6 @@ namespace View_by_Distance.Shared.Models.Stateless;
public interface ILocation
{
RectangleF? TestStatic_GetPercentagesRectangle(DistanceSettings distanceSettings, int wholePercentages) =>
GetPercentagesRectangle(distanceSettings, wholePercentages);
static RectangleF? GetPercentagesRectangle(DistanceSettings distanceSettings, int wholePercentages) =>
Location.GetPercentagesRectangle(distanceSettings, wholePercentages);
Models.Location TestStatic_GetTrimBound(double detectionConfidence, Rectangle rectangle, int width, int height, int facesCount) =>
TrimBound(detectionConfidence, rectangle, width, height, facesCount);
static Models.Location TrimBound(double detectionConfidence, Rectangle rectangle, int width, int height, int facesCount) =>

View File

@ -1,6 +1,4 @@
using System.Drawing;
namespace View_by_Distance.Shared.Models.Stateless;
namespace View_by_Distance.Shared.Models.Stateless;
internal abstract class Location
{
@ -47,32 +45,4 @@ internal abstract class Location
return result;
}
internal static RectangleF? GetPercentagesRectangle(DistanceSettings distanceSettings, int wholePercentages)
{
RectangleF? result;
string wp = wholePercentages.ToString();
int length = (distanceSettings.LocationDigits - 1) / 4;
string[] segments =
[
wp[..1],
wp.Substring(1, length),
wp.Substring(3, length),
wp.Substring(5, length),
wp.Substring(7, length)
];
if (string.Join(string.Empty, segments) != wp)
result = null;
else
{
if (!int.TryParse(segments[1], out int xWholePercent) || !int.TryParse(segments[2], out int yWholePercent) || !int.TryParse(segments[3], out int wWholePercent) || !int.TryParse(segments[4], out int hWholePercent))
result = null;
else
{
float factor = 100;
result = new(xWholePercent / factor, yWholePercent / factor, wWholePercent / factor, hWholePercent / factor);
}
}
return result;
}
}