AIParkingApplicationForm - Switch Lane Features.

This commit is contained in:
DucDangAnh 2020-07-09 14:23:01 +07:00
parent d9c7da60b5
commit 766873da13
4 changed files with 125 additions and 23 deletions

View File

@ -71,18 +71,21 @@
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut"; this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra"; this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
// //
// toolStripMenuItemSwitchLaneOutOut // toolStripMenuItemSwitchLaneOutOut
// //
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut"; this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra"; this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
// //
// toolStripMenuItemSwitchLaneOutIn // toolStripMenuItemSwitchLaneOutIn
// //
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn"; this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào"; this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
// //
// AIParkingApplicationForm // AIParkingApplicationForm
// //

View File

@ -5,11 +5,12 @@ namespace AIParkingApplication
{ {
public partial class AIParkingApplicationForm : Form public partial class AIParkingApplicationForm : Form
{ {
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
private ApiController apiController; private ApiController apiController;
private IDoorControlAccess c3Device; private IDoorControlAccess c3Device;
private LaneIn laneIn; private LaneIn laneIn12;
private LaneOut laneOut; private LaneIn laneIn56;
private LaneOut laneOut34;
private LaneOut laneOut78;
private StatusBar statusBar; private StatusBar statusBar;
private Sidebar sidebar; private Sidebar sidebar;
private Config configOnWeb; private Config configOnWeb;
@ -36,32 +37,130 @@ namespace AIParkingApplication
MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Cấu hình API Plate Recognize lỗi!", "Cấu hình API Engine lỗi!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
laneIn = new LaneIn(1, this.configOnWeb.CameraData1.Id.ToString(), this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneIn.BorderStyle = BorderStyle.FixedSingle;
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
Controls.Add(laneIn);
laneOut = new LaneOut(2, this.configOnWeb.CameraData3.Id.ToString(), this.configOnWeb.CameraData3.StreamUrl, this.configOnWeb.CameraData4.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
laneOut.BorderStyle = BorderStyle.FixedSingle;
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, menuStrip.Height);
Controls.Add(laneOut);
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1)); statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
statusBar.Location = new System.Drawing.Point(0, sidebar.Location.Y + sidebar.Height + 20); statusBar.Location = new System.Drawing.Point(0, sidebar.Location.Y + sidebar.Height + 20);
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
Controls.Add(statusBar); Controls.Add(statusBar);
StartLanes(); InitAllLanes();
} }
private void StartLanes() private void InitAllLanes()
{ {
laneIn.Start(); laneIn12 = new LaneIn(10, configOnWeb.CameraData1.Id.ToString(), configOnWeb.CameraData1.StreamUrl, configOnWeb.CameraData2.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
laneOut.Start(); laneIn12.BorderStyle = BorderStyle.FixedSingle;
laneIn12.Hide();
Controls.Add(laneIn12);
laneOut34 = new LaneOut(20, configOnWeb.CameraData3.Id.ToString(), configOnWeb.CameraData3.StreamUrl, configOnWeb.CameraData4.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
laneOut34.BorderStyle = BorderStyle.FixedSingle;
laneOut34.Hide();
Controls.Add(laneOut34);
laneIn56 = new LaneIn(10, configOnWeb.CameraData5.Id.ToString(), configOnWeb.CameraData5.StreamUrl, configOnWeb.CameraData6.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
laneIn56.BorderStyle = BorderStyle.FixedSingle;
laneIn56.Hide();
Controls.Add(laneIn56);
laneOut78 = new LaneOut(20, configOnWeb.CameraData7.Id.ToString(), configOnWeb.CameraData7.StreamUrl, configOnWeb.CameraData8.StreamUrl, c3Device, apiController, engineApiController, true, false, true);
laneOut78.BorderStyle = BorderStyle.FixedSingle;
laneOut78.Hide();
Controls.Add(laneOut78);
}
private void UpdateLaneInOut()
{
laneIn12.DoorId = 1;
laneIn12.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
laneIn12.Show();
laneIn12.Start();
laneOut34.DoorId = 2;
laneOut34.Location = new System.Drawing.Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
laneOut34.Show();
laneOut34.Start();
}
private void UpdateLaneInIn()
{
laneIn12.DoorId = 1;
laneIn12.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
laneIn12.Show();
laneIn12.Start();
laneIn56.DoorId = 2;
laneIn56.Location = new System.Drawing.Point(laneIn12.Location.X + laneIn12.Width + 20, menuStrip.Height);
laneIn56.Show();
laneIn56.Start();
}
private void UpdateLaneOutIn()
{
laneOut78.DoorId = 1;
laneOut78.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
laneOut78.Show();
laneOut78.Start();
laneIn56.DoorId = 2;
laneIn56.Location = new System.Drawing.Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
laneIn56.Show();
laneIn56.Start();
}
private void UpdateLaneOutOut()
{
laneOut78.DoorId = 1;
laneOut78.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
laneOut78.Show();
laneOut78.Start();
laneOut34.DoorId = 2;
laneOut34.Location = new System.Drawing.Point(laneOut78.Location.X + laneOut78.Width + 20, menuStrip.Height);
laneOut34.Show();
laneOut34.Start();
} }
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e) private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
{ {
StopAllLanes();
UpdateLaneInIn();
}
private void toolStripMenuItemSwitchLaneInOut_Click(object sender, EventArgs e)
{
StopAllLanes();
UpdateLaneInOut();
}
private void toolStripMenuItemSwitchLaneOutIn_Click(object sender, EventArgs e)
{
StopAllLanes();
UpdateLaneOutIn();
}
private void toolStripMenuItemSwitchLaneOutOut_Click(object sender, EventArgs e)
{
StopAllLanes();
UpdateLaneOutOut();
}
private void StopAllLanes()
{
laneIn12.DoorId = 10;
laneIn56.DoorId = 10;
laneOut34.DoorId = 10;
laneOut78.DoorId = 10;
laneIn12?.Stop();
laneIn56?.Stop();
laneOut34?.Stop();
laneOut78?.Stop();
laneIn12?.Hide();
laneIn56?.Hide();
laneOut34?.Hide();
laneOut78?.Hide();
} }
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e) private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)

View File

@ -13,7 +13,7 @@ namespace AIParkingApplication
private Camera overviewCamera; private Camera overviewCamera;
private Camera plateCamera; private Camera plateCamera;
private PlateProcessor plateProcessor; private PlateProcessor plateProcessor;
private int doorId; public int DoorId { get; set; }
private string cameraId; private string cameraId;
private bool isSupportSquarePlate; private bool isSupportSquarePlate;
private bool isSupportLongPlate; private bool isSupportLongPlate;
@ -35,7 +35,7 @@ namespace AIParkingApplication
bool isRetryMode = false) bool isRetryMode = false)
{ {
InitializeComponent(); InitializeComponent();
this.doorId = doorId; DoorId = doorId;
this.cameraId = cameraId; this.cameraId = cameraId;
this.isSupportSquarePlate = isSupportSquarePlate; this.isSupportSquarePlate = isSupportSquarePlate;
this.isSupportLongPlate = isSupportLongPlate; this.isSupportLongPlate = isSupportLongPlate;
@ -50,7 +50,7 @@ namespace AIParkingApplication
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber) private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{ {
if (this.doorId != doorId) if (DoorId != doorId)
{ {
return; return;
} }
@ -87,7 +87,7 @@ namespace AIParkingApplication
if (saveLogResult.Status) if (saveLogResult.Status)
{ {
if (isAutoOpenDoor && this.doorId == doorId) if (isAutoOpenDoor && DoorId == doorId)
{ {
OpenDoor(doorId); OpenDoor(doorId);
} }

View File

@ -13,7 +13,7 @@ namespace AIParkingApplication
private Camera overviewCamera; private Camera overviewCamera;
private Camera plateCamera; private Camera plateCamera;
private PlateProcessor plateProcessor; private PlateProcessor plateProcessor;
private int doorId; public int DoorId { get; set; }
private string cameraId; private string cameraId;
private bool isSupportSquarePlate; private bool isSupportSquarePlate;
private bool isSupportLongPlate; private bool isSupportLongPlate;
@ -36,7 +36,7 @@ namespace AIParkingApplication
bool isRetryMode = false) bool isRetryMode = false)
{ {
InitializeComponent(); InitializeComponent();
this.doorId = doorId; DoorId = doorId;
this.cameraId = cameraId; this.cameraId = cameraId;
this.isSupportSquarePlate = isSupportSquarePlate; this.isSupportSquarePlate = isSupportSquarePlate;
this.isSupportLongPlate = isSupportLongPlate; this.isSupportLongPlate = isSupportLongPlate;
@ -52,7 +52,7 @@ namespace AIParkingApplication
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber) private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{ {
if (this.doorId != doorId) if (DoorId != doorId)
{ {
return; return;
} }