diff --git a/OCR_Decode/Zone.cs b/OCR_Decode/Zone.cs
index b0263ce..619eded 100644
--- a/OCR_Decode/Zone.cs
+++ b/OCR_Decode/Zone.cs
@@ -1,4 +1,10 @@
-using System;
+/// Author : Maxime Rohmer
+/// Date : 25/04/2023
+/// File : Zone.cs
+/// Brief : Parent for futur zones and the that contains all the usefull methods for any zone
+/// Version : 0.1
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -18,6 +24,7 @@ namespace OCR_Decode
{
get
{
+ //This little trickery lets you have the image that the zone sees
Bitmap sample = new Bitmap(Bounds.Width, Bounds.Height);
Graphics g = Graphics.FromImage(sample);
g.DrawImage(Image, new Rectangle(0, 0, sample.Width, sample.Height), Bounds, GraphicsUnit.Pixel);
@@ -29,6 +36,7 @@ namespace OCR_Decode
get { return _image; }
set
{
+ //It automatically sets the image for the contained windows and zones
_image = Image;
foreach (Window w in Windows)
{
@@ -54,21 +62,35 @@ namespace OCR_Decode
_image = image;
Bounds = bounds;
}
+ ///
+ /// Adds a zone to the list of zones
+ ///
+ /// The zone you want to add
public virtual void AddZone(Zone zone)
{
Zones.Add(zone);
}
+ ///
+ /// Add a window to the list of windows
+ ///
+ /// the window you want to add
public virtual void AddWindow(Window window)
{
Windows.Add(window);
}
- public virtual async Task Decode(List drivers)
+ ///
+ /// Calls all the zones and windows to do OCR and to give back the results so we can send them to the model
+ ///
+ /// A list of all the driver in the race to help with text recognition
+ /// A driver data object that contains all the infos about a driver
+ public virtual async Task Decode(List driverList)
{
DriverData result = new DriverData();
Parallel.ForEach(Windows,async w =>
{
+ // A switch would be prettier but I dont think its supported in this C# version
if (w is DriverNameWindow)
- result.Name = (string)await (w as DriverNameWindow).DecodePng(drivers);
+ result.Name = (string)await (w as DriverNameWindow).DecodePng(driverList);
if (w is DriverDrsWindow)
result.DRS = (bool)await (w as DriverDrsWindow).DecodePng();
if (w is DriverGapToLeaderWindow)