Files
OCR_TEST/OCR_tester/DriverZone.cs
T

88 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OCR_tester
{
public class DriverZone : Zone
{
public DriverZone(Image fullImage, Rectangle bounds) : base(fullImage, bounds)
{
Name = "DriverZone";
}
public override void AddWindow(Rectangle bounds)
{
//base.AddWindow(bounds);
int count = Windows.Count();
Rectangle newBounds = new Rectangle(bounds.X, 0, bounds.Width, ZoneImage.Height);
switch (count)
{
case 0:
if (Fits(bounds))
{
Windows.Add(new DriverPositionWindow(ZoneImage, newBounds));
}
break;
case 1:
if (Fits(bounds))
{
Windows.Add(new DriverGapToLeaderWindow(ZoneImage, newBounds));
}
break;
case 2:
if (Fits(bounds))
{
Windows.Add(new DriverLapTimeWindow(ZoneImage, newBounds));
}
break;
case 3:
if (Fits(bounds))
{
Windows.Add(new DriverDrsWindow(ZoneImage, newBounds));
}
break;
case 4:
if (Fits(bounds))
{
Windows.Add(new DriverTyresWindow(ZoneImage, newBounds));
}
break;
case 5:
if (Fits(bounds))
{
Windows.Add(new DriverNameWindow(ZoneImage, newBounds));
}
break;
case 6:
if (Fits(bounds))
{
Windows.Add(new DriverSector1Window(ZoneImage, newBounds));
}
break;
case 7:
if (Fits(bounds))
{
Windows.Add(new DriverSector2Window(ZoneImage, newBounds));
}
break;
case 8:
if (Fits(bounds))
{
Windows.Add(new DriverSector3Window(ZoneImage, newBounds));
}
break;
default:
if (Fits(bounds))
{
Windows.Add(new Window(ZoneImage, newBounds));
}
break;
}
}
}
}