Skip to content

Commit 4e17656

Browse files
authored
Merge pull request #6 from ronyan/alt-filter
tag drawing, prelim free text
2 parents a429e7f + f9028fa commit 4e17656

File tree

3 files changed

+78
-16
lines changed

3 files changed

+78
-16
lines changed

CSiTRadar.cpp

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
7272
continue;
7373
}
7474

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

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

8693
if (radarTarget.GetCorrelatedFlightPlan().GetTrackingControllerIsMe()) {
8794
if (radarTarget.GetCorrelatedFlightPlan().GetSectorExitMinutes() <= 2
8895
&& radarTarget.GetCorrelatedFlightPlan().GetSectorExitMinutes() >= 0) {
8996
// blink the CJS
9097
string callsign = radarTarget.GetCallsign();
9198
isBlinking[callsign] = TRUE;
92-
93-
if (isBlinking.find(radarTarget.GetCallsign()) != isBlinking.end()
94-
&& halfSecTick) {
95-
continue; // skips CJS symbol drawing when blinked out
96-
}
9799
}
98100
}
99101
else {
@@ -120,9 +122,14 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
120122
lgfont.lfHeight = 12;
121123
font.CreateFontIndirect(&lgfont);
122124

123-
dc.SelectObject(font);
124125
dc.SetTextColor(RGB(255, 255, 255));
125126

127+
dc.SelectObject(font);
128+
if (isBlinking.find(radarTarget.GetCallsign()) != isBlinking.end()
129+
&& halfSecTick) {
130+
handOffText=""; // blank CJS symbol drawing when blinked out
131+
}
132+
126133
RECT rectCJS;
127134
rectCJS.left = p.x - 6;
128135
rectCJS.right = p.x + 75;
@@ -175,6 +182,34 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
175182
}
176183
}
177184

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

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

200235
// if RVSM draw the RVSM diamond
201236

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

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

213245
COLORREF targetPenColor;
214246
targetPenColor = RGB(202, 205, 169); // amber colour
@@ -235,7 +267,8 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
235267
else {
236268

237269
if (strcmp(radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType(), "I") == 0
238-
&& radarTarget.GetPosition().GetRadarFlags() != 0) {
270+
&& radarTarget.GetPosition().GetRadarFlags() != 0
271+
&& radarTarget.GetPosition().GetRadarFlags() != 1) {
239272
COLORREF targetPenColor;
240273
targetPenColor = RGB(202, 205, 169); // white when squawking ident
241274
HPEN targetPen;
@@ -271,7 +304,8 @@ void CSiTRadar::OnRefresh(HDC hdc, int phase)
271304
// if VFR
272305
if (strcmp(radarTarget.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType(), "V") == 0
273306
&& radarTarget.GetPosition().GetTransponderC() == TRUE
274-
&& radarTarget.GetPosition().GetRadarFlags() != 0) {
307+
&& radarTarget.GetPosition().GetRadarFlags() != 0
308+
&& radarTarget.GetPosition().GetRadarFlags() != 1) {
275309

276310
COLORREF targetPenColor;
277311
targetPenColor = RGB(242, 120, 57); // PPS orange color
@@ -532,6 +566,26 @@ void CSiTRadar::OnClickScreenObject(int ObjectType,
532566
altFilterOn = !altFilterOn;
533567
}
534568

569+
570+
571+
if (Button == BUTTON_MIDDLE) {
572+
// open Free Text menu
573+
574+
RECT freeTextPopUp;
575+
freeTextPopUp.left = Pt.x;
576+
freeTextPopUp.top = Pt.y;
577+
freeTextPopUp.right = Pt.x + 20;
578+
freeTextPopUp.bottom = Pt.y + 10;
579+
580+
GetPlugIn()->OpenPopupList(freeTextPopUp, "Free Text", 1);
581+
582+
GetPlugIn()->AddPopupListElement("ADD FREE TEXT", "", ADD_FREE_TEXT);
583+
GetPlugIn()->AddPopupListElement("DELETE", "", DELETE_FREE_TEXT, FALSE, POPUP_ELEMENT_NO_CHECKBOX, true, false);
584+
GetPlugIn()->AddPopupListElement("DELETE ALL", "", DELETE_ALL_FREE_TEXT);
585+
586+
}
587+
588+
535589
}
536590

537591
void CSiTRadar::OnFunctionCall(int FunctionId,

SituPlugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
SituPlugin::SituPlugin()
77
: EuroScopePlugIn::CPlugIn(EuroScopePlugIn::COMPATIBILITY_CODE,
88
"NAVCANSitu",
9-
"0.2",
9+
"0.2.4.1",
1010
"Ron Yan",
1111
"Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)")
1212
{

constants.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ 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+
34+
const int ADD_FREE_TEXT = 1101;
35+
const int DELETE_FREE_TEXT = 1102;
36+
const int DELETE_ALL_FREE_TEXT = 1103;
37+
38+
3139
// Module 2 : distances relative to module origin
3240
const int HALO_TOOL_X = 0;
3341
const int HALO_TOOL_Y = 0;

0 commit comments

Comments
 (0)