private void radarEquipment_RadarTargetsAPageReceived(RadarTargetsA targs) { //Console.WriteLine(targs.RangeTarget1.ToString()); var targVars = new TargetVars(); targVars.SpeedTarget1 = targs.SpeedTarget1; targVars.SpeedTarget2 = targs.SpeedTarget2; targVars.SpeedTarget3 = targs.SpeedTarget3; targVars.SpeedTarget4 = targs.SpeedTarget4; targVars.RangeTarget1 = targs.RangeTarget1; targVars.RangeTarget2 = targs.RangeTarget2; targVars.RangeTarget3 = targs.RangeTarget3; targVars.RangeTarget4 = targs.RangeTarget4; targVars.ThreatLevelTarget1 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget1; targVars.ThreatLevelTarget2 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget2; targVars.ThreatLevelTarget3 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget3; targVars.ThreatLevelTarget4 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget4; targVars.ThreatSideTarget1 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget1; targVars.ThreatSideTarget2 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget2; targVars.ThreatSideTarget3 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget3; targVars.ThreatSideTarget4 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget4; //Console.WriteLine(targVars.SpeedTarget1.ToString() + ":" + targVars.RangeTarget1.ToString()); lock (VariaAppExt.TargetQueueLock) { VariaAppExt.TargetQueue.Add(targVars); } VariaAppExt.TargetQueueReadyWait.Set(); }
private void radarEquipment_RadarTargetsBPageReceived(RadarTargetsB targs) { //Console.WriteLine(targs.RangeTarget5.ToString()); var targVars = new TargetVars(); targVars.SpeedTarget5 = targs.SpeedTarget5; targVars.SpeedTarget6 = targs.SpeedTarget6; targVars.SpeedTarget7 = targs.SpeedTarget7; targVars.SpeedTarget8 = targs.SpeedTarget8; targVars.RangeTarget5 = targs.RangeTarget5; targVars.RangeTarget6 = targs.RangeTarget6; targVars.RangeTarget7 = targs.RangeTarget7; targVars.RangeTarget8 = targs.RangeTarget8; targVars.ThreatLevelTarget5 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget5; targVars.ThreatLevelTarget6 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget6; targVars.ThreatLevelTarget7 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget7; targVars.ThreatLevelTarget8 = (TargetVars.ThreatLevelBitField)targs.ThreatLevelTarget8; targVars.ThreatSideTarget5 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget5; targVars.ThreatSideTarget6 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget6; targVars.ThreatSideTarget7 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget7; targVars.ThreatSideTarget8 = (TargetVars.ThreatSideBitField)targs.ThreatSideTarget8; lock (VariaAppExt.TargetQueueLock) { VariaAppExt.TargetQueue.Add(targVars); } VariaAppExt.TargetQueueReadyWait.Set(); }
internal bool CreateTargetPoint(TargetVars target) { bool updated = false; if (target.RangeTarget1 != 0) { if (TargetList.TryGetValue(1, out DRAW_STRUCT targetDraw)) { TargetList.Remove(1); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget1); targetDraw.distance = CovertMtoF(target.RangeTarget1); targetDraw.targetText = "[1] " + target.ThreatSideTarget1.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget1); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(1, targetDraw); updated = true; } if (target.RangeTarget2 != 0) { if (TargetList.TryGetValue(2, out DRAW_STRUCT targetDraw)) { TargetList.Remove(2); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget2); targetDraw.distance = CovertMtoF(target.RangeTarget2); targetDraw.targetText = "[2] " + target.ThreatSideTarget2.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget2); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(2, targetDraw); updated = true; } if (target.RangeTarget3 != 0) { if (TargetList.TryGetValue(3, out DRAW_STRUCT targetDraw)) { TargetList.Remove(3); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget3); targetDraw.distance = CovertMtoF(target.RangeTarget3); targetDraw.targetText = "[3] " + target.ThreatSideTarget3.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget3); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(3, targetDraw); updated = true; } if (target.RangeTarget4 != 0) { if (TargetList.TryGetValue(4, out DRAW_STRUCT targetDraw)) { TargetList.Remove(4); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget4); targetDraw.distance = CovertMtoF(target.RangeTarget4); targetDraw.targetText = "[4] " + target.ThreatSideTarget4.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget4); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(4, targetDraw); updated = true; } if (target.RangeTarget5 != 0) { if (TargetList.TryGetValue(5, out DRAW_STRUCT targetDraw)) { TargetList.Remove(5); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget5); targetDraw.distance = CovertMtoF(target.RangeTarget5); targetDraw.targetText = "[5] " + target.ThreatSideTarget5.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget5); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(5, targetDraw); updated = true; } if (target.RangeTarget6 != 0) { if (TargetList.TryGetValue(6, out DRAW_STRUCT targetDraw)) { TargetList.Remove(6); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget6); targetDraw.distance = CovertMtoF(target.RangeTarget6); targetDraw.targetText = "[6] " + target.ThreatSideTarget6.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget6); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(6, targetDraw); updated = true; } if (target.RangeTarget7 != 0) { if (TargetList.TryGetValue(7, out DRAW_STRUCT targetDraw)) { TargetList.Remove(7); } targetDraw.targetPosition = new Point[3]; targetDraw.TimeStamp = DateTime.Now; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget7); targetDraw.distance = CovertMtoF(target.RangeTarget7); targetDraw.targetText = "[7] " + target.ThreatSideTarget7.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget7); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(7, targetDraw); updated = true; } if (target.RangeTarget8 != 0) { if (TargetList.TryGetValue(8, out DRAW_STRUCT targetDraw)) { TargetList.Remove(8); } targetDraw.TimeStamp = DateTime.Now; targetDraw.targetPosition = new Point[3]; targetDraw.speed = ConvertMetersSecToMPH(target.SpeedTarget8); targetDraw.distance = CovertMtoF(target.RangeTarget8); targetDraw.targetText = "[8] " + target.ThreatSideTarget8.ToString() + "\n" + targetDraw.speed.ToString() + " MPH Closing\n" + targetDraw.distance.ToString() + " FT Distance"; targetDraw.targetColor = GetColorByTargetSpeed(targetDraw.speed); targetDraw.targetPosition = PlotTargetPosition(targetDraw.distance, target.ThreatSideTarget8); targetDraw.targetTextFont = new System.Drawing.Font("Arial", DISP_FONT_SIZE); targetDraw.targetTextFormat = new System.Drawing.StringFormat(); targetDraw.targetTextColor = targetDraw.targetColor; targetDraw.targetTextXpos = Convert.ToSingle(targetDraw.targetPosition[2].X + TARGET_SIZE + 10);//distance of text from triangle targetDraw.targetTextYpos = Convert.ToSingle(targetDraw.targetPosition[2].Y); TargetList.Add(8, targetDraw); updated = true; } return(updated); }