Skip to content

Commit 0005748

Browse files
committed
preparing for free-text, bug fix for squawk stdby
1 parent 83e1129 commit 0005748

File tree

2 files changed

+61
-15
lines changed

2 files changed

+61
-15
lines changed

CSiTRadar.cpp

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
3535
}
3636

3737
RECT radarea = GetRadarArea();
38+
AddScreenObject(SCREEN_BACKGROUND, "", radarea, false, "");
3839

3940
// time based functions
4041
double time = ((double)clock() - (double)halfSec) / ((double)CLOCKS_PER_SEC);
@@ -72,6 +73,13 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
7273
continue;
7374
}
7475

76+
// aircraft equipment parsing
77+
string icaoACData = radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetAircraftInfo();
78+
regex icaoRVSM("(.*)\\/(.*)\\-(.*)[W](.*)\\/(.*)", regex::icase);
79+
bool isRVSM = regex_search(icaoACData, icaoRVSM);
80+
regex icaoADSB("(.*)\\/(.*)\\-(.*)\\/(.*)(E|L|B1|B2|U1|U2|V1|V2)(.*)");
81+
bool isADSB = regex_search(icaoACData, icaoADSB);
82+
7583
// get the target's position on the screen and add it as a screen object
7684
POINT p = ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition());
7785
RECT prect;
@@ -81,19 +89,14 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
8189
prect.bottom = p.y + 5;
8290
AddScreenObject(AIRCRAFT_SYMBOL, radarTarget.GetCallsign(), prect, FALSE, "");
8391

84-
// Handoff warning system: if the plane is within 2 minutes of exiting your airspace, CJS will blink
92+
// Handoff warning system: if the plane is within 2 minutes of exiting your airspace, CJS will blink
8593

8694
if (radarTarget.GetCorrelatedFlightPlan().GetTrackingControllerIsMe()) {
8795
if (radarTarget.GetCorrelatedFlightPlan().GetSectorExitMinutes() <= 2
8896
&& radarTarget.GetCorrelatedFlightPlan().GetSectorExitMinutes() >= 0) {
8997
// blink the CJS
9098
string callsign = radarTarget.GetCallsign();
9199
isBlinking[callsign] = TRUE;
92-
93-
if (isBlinking.find(radarTarget.GetCallsign()) != isBlinking.end()
94-
&& halfSecTick) {
95-
continue; // skips CJS symbol drawing when blinked out
96-
}
97100
}
98101
}
99102
else {
@@ -120,9 +123,14 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
120123
lgfont.lfHeight = 12;
121124
font.CreateFontIndirect(&lgfont);
122125

123-
dc.SelectObject(font);
124126
dc.SetTextColor(RGB(255, 255, 255));
125127

128+
dc.SelectObject(font);
129+
if (isBlinking.find(radarTarget.GetCallsign()) != isBlinking.end()
130+
&& halfSecTick) {
131+
handOffText=""; // blank CJS symbol drawing when blinked out
132+
}
133+
126134
RECT rectCJS;
127135
rectCJS.left = p.x - 6;
128136
rectCJS.right = p.x + 75;
@@ -175,6 +183,34 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
175183
}
176184
}
177185

186+
// ADSB targets; if no primary or secondary radar, but the plane has ADSB equipment suffix (assumed space based ADS-B with no gaps)
187+
188+
if (radarTarget.GetPosition().GetRadarFlags() == 0) { // need to add ADSB equipment logic
189+
190+
COLORREF targetPenColor;
191+
targetPenColor = RGB(202, 205, 169); // amber colour
192+
HPEN targetPen;
193+
targetPen = CreatePen(PS_SOLID, 1, targetPenColor);
194+
dc.SelectObject(targetPen);
195+
dc.SelectStockObject(NULL_BRUSH);
196+
197+
// draw the shape
198+
dc.MoveTo(p.x - 5, p.y - 5);
199+
dc.LineTo(p.x + 5, p.y -5);
200+
dc.LineTo(p.x + 5, p.y + 5);
201+
dc.LineTo(p.x - 5, p.y + 5);
202+
dc.LineTo(p.x - 5, p.y - 5);
203+
204+
// if primary and secondary target, draw the middle line
205+
if (isRVSM) {
206+
dc.MoveTo(p.x, p.y - 5);
207+
dc.LineTo(p.x, p.y + 5);
208+
}
209+
210+
// cleanup
211+
DeleteObject(targetPen);
212+
}
213+
178214
// if primary target draw the symbol in magenta
179215

180216
if (radarTarget.GetPosition().GetRadarFlags() == 1) {
@@ -199,16 +235,13 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
199235

200236
// if RVSM draw the RVSM diamond
201237

202-
string icaoACData = radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetAircraftInfo();
203-
regex isRVSM("(.*)\\/(.*)\\-(.*)[W](.*)\\/(.*)", regex::icase);
204-
bool icaoRVSM = regex_search(icaoACData,isRVSM);
205-
206238
if ((radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetCapibilities() == 'L' ||
207239
radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetCapibilities() == 'W' ||
208240
radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetCapibilities() == 'Z' || // FAA RVSM
209-
icaoRVSM) // ICAO equpmnet code indicates RVSM -- contains 'W'
241+
isRVSM) // ICAO equpmnet code indicates RVSM -- contains 'W'
210242

211-
&& radarTarget.GetPosition().GetRadarFlags() != 0) {
243+
&& radarTarget.GetPosition().GetRadarFlags() != 0 &&
244+
radarTarget.GetPosition().GetRadarFlags() != 1) {
212245

213246
COLORREF targetPenColor;
214247
targetPenColor = RGB(202, 205, 169); // amber colour
@@ -235,7 +268,8 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
235268
else {
236269

237270
if (strcmp(radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType(), "I") == 0
238-
&& radarTarget.GetPosition().GetRadarFlags() != 0) {
271+
&& radarTarget.GetPosition().GetRadarFlags() != 0
272+
&& radarTarget.GetPosition().GetRadarFlags() != 1) {
239273
COLORREF targetPenColor;
240274
targetPenColor = RGB(202, 205, 169); // white when squawking ident
241275
HPEN targetPen;
@@ -271,7 +305,8 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
271305
// if VFR
272306
if (strcmp(radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType(), "V") == 0
273307
&& radarTarget.GetPosition().GetTransponderC() == TRUE
274-
&& radarTarget.GetPosition().GetRadarFlags() != 0) {
308+
&& radarTarget.GetPosition().GetRadarFlags() != 0
309+
&& radarTarget.GetPosition().GetRadarFlags() != 1) {
275310

276311
COLORREF targetPenColor;
277312
targetPenColor = RGB(242, 120, 57); // PPS orange color
@@ -532,6 +567,14 @@ void CSiTRadar::OnClickScreenObject(int ObjectType,
532567
altFilterOn = !altFilterOn;
533568
}
534569

570+
if (ObjectType == SCREEN_BACKGROUND) {
571+
if (Button == BUTTON_MIDDLE) {
572+
// open Free Text menu
573+
574+
575+
}
576+
}
577+
535578
}
536579

537580
void CSiTRadar::OnFunctionCall(int FunctionId,

constants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const int FUNCTION_ALT_FILT_LOW = 301;
2828
const int FUNCTION_ALT_FILT_HIGH = 302;
2929
const int FUNCTION_ALT_FILT_SAVE = 303;
3030

31+
// Radar Background
32+
const int SCREEN_BACKGROUND = 501;
33+
3134
// Module 2 : distances relative to module origin
3235
const int HALO_TOOL_X = 0;
3336
const int HALO_TOOL_Y = 0;

0 commit comments

Comments
 (0)