├── .gitignore ├── LICENSE ├── MUAC.sln ├── MUAC ├── AcSymbols.h ├── AntiOverlap.h ├── CPDLCHandler.cpp ├── CPDLCHandler.h ├── CallsignLookup.cpp ├── CallsignLookup.h ├── Colours.h ├── Constants.h ├── FIMWindow.h ├── FontManager.h ├── Helper.h ├── HttpHelper.cpp ├── HttpHelper.h ├── MTCD.h ├── MTCDWindow.h ├── MUAC.cpp ├── MUAC.h ├── MUAC.rc ├── MUAC.vcxproj ├── MUAC.vcxproj.filters ├── MenuBar.h ├── PopoutMenu.h ├── RadarScreen.cpp ├── RadarScreen.h ├── ReadMe.txt ├── RouteRenderer.h ├── STCA.cpp ├── STCA.h ├── Tag.h ├── TagItem.h ├── TagRenderer.h ├── VERA.h ├── dllmain.cpp ├── resource.h ├── stdafx.cpp ├── stdafx.h └── targetver.h ├── README.md ├── appveyor.yml ├── docs ├── _config.yml ├── img │ └── header.png └── keep └── lib ├── EuroScopePlugInDll.lib └── include └── EuroScopePlugIn.h /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /MUAC.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30225.117 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MUAC", "MUAC\MUAC.vcxproj", "{23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Debug|x64.ActiveCfg = Debug|Win32 17 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Debug|x86.ActiveCfg = Debug|Win32 18 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Debug|x86.Build.0 = Debug|Win32 19 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Release|x64.ActiveCfg = Release|Win32 20 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Release|x86.ActiveCfg = Release|Win32 21 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5}.Release|x86.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(ExtensibilityGlobals) = postSolution 27 | SolutionGuid = {BA934A07-5FB4-4919-8D7E-172100BDAB51} 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /MUAC/AcSymbols.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Colours.h" 4 | #include "EuroScopePlugIn.h" 5 | 6 | using namespace std; 7 | using namespace Gdiplus; 8 | using namespace EuroScopePlugIn; 9 | 10 | class AcSymbols 11 | { 12 | public: 13 | static CRect DrawSquareAndTrail(CDC* dc, TagConfiguration::TagStates State, CRadarScreen* radar, CRadarTarget radarTarget, bool drawTrail, bool isSoft, bool isStca, bool blink, bool isDetailed) { 14 | int save = dc->SaveDC(); 15 | 16 | COLORREF SymbolColor = Colours::AircraftDarkGrey.ToCOLORREF(); 17 | COLORREF TrailColor = Colours::AircraftDarkGrey.ToCOLORREF(); 18 | 19 | if (!isSoft) { 20 | TrailColor = Colours::AircraftLightGrey.ToCOLORREF(); 21 | SymbolColor = Colours::AircraftLightGrey.ToCOLORREF(); 22 | } 23 | 24 | if (State == TagConfiguration::TagStates::Assumed) { 25 | TrailColor = Colours::AircraftGreen.ToCOLORREF(); 26 | SymbolColor = Colours::AircraftGreen.ToCOLORREF(); 27 | } 28 | 29 | if (State == TagConfiguration::TagStates::Next) 30 | SymbolColor = Colours::AircraftGreen.ToCOLORREF(); 31 | 32 | if (State == TagConfiguration::TagStates::TransferredToMe) { 33 | SymbolColor = Colours::AircraftGreen.ToCOLORREF(); 34 | 35 | if (blink) 36 | SymbolColor = Colours::AircraftLightGrey.ToCOLORREF(); 37 | } 38 | 39 | if (State == TagConfiguration::TagStates::Redundant) 40 | SymbolColor = Colours::AircraftBlue.ToCOLORREF(); 41 | 42 | if (isStca) { 43 | if (blink) 44 | SymbolColor = Colours::YellowHighlight.ToCOLORREF(); 45 | else 46 | SymbolColor = Colours::RedWarning.ToCOLORREF(); 47 | } 48 | 49 | CPen TrailPen(PS_SOLID, 1, TrailColor); 50 | CPen SymbolPen(PS_SOLID, 1, SymbolColor); 51 | 52 | dc->SelectObject(&TrailPen); 53 | CBrush *oldBrush = (CBrush *)dc->SelectStockObject(NULL_BRUSH); 54 | 55 | // History Trail 56 | CRadarTargetPositionData TrailPosition = radarTarget.GetPreviousPosition(radarTarget.GetPreviousPosition(radarTarget.GetPosition())); 57 | for (int i = 0; i < 5; i++) { 58 | if (!drawTrail) 59 | break; 60 | 61 | POINT historyTrailPoint = radar->ConvertCoordFromPositionToPixel(TrailPosition.GetPosition()); 62 | 63 | CRect Area(historyTrailPoint.x - DRAWING_AC_SQUARE_TRAIL_SIZE, historyTrailPoint.y - DRAWING_AC_SQUARE_TRAIL_SIZE, 64 | historyTrailPoint.x + DRAWING_AC_SQUARE_TRAIL_SIZE, historyTrailPoint.y + DRAWING_AC_SQUARE_TRAIL_SIZE); 65 | Area.NormalizeRect(); 66 | dc->Rectangle(Area); 67 | 68 | // We skip one position for the other 69 | TrailPosition = radarTarget.GetPreviousPosition(radarTarget.GetPreviousPosition(TrailPosition)); 70 | } 71 | 72 | dc->SelectObject(&SymbolPen); 73 | 74 | // Symbol itself 75 | POINT radarTargetPoint = radar->ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition()); 76 | 77 | int Size = DRAWING_AC_SQUARE_SYMBOL_SIZE; 78 | 79 | // Bigger target if ident 80 | if (isDetailed || radarTarget.GetPosition().GetTransponderI()) 81 | Size += (int)(Size*0.25); 82 | 83 | CRect Area(radarTargetPoint.x - Size, radarTargetPoint.y - Size, 84 | radarTargetPoint.x + Size, radarTargetPoint.y + Size); 85 | Area.NormalizeRect(); 86 | 87 | // if STCA or Ident, filled in target 88 | if (isStca || radarTarget.GetPosition().GetTransponderI()) { 89 | CBrush brush(SymbolColor); 90 | dc->FillRect(Area, &brush); 91 | } 92 | else { 93 | dc->Rectangle(Area); 94 | } 95 | 96 | // Pixel in center 97 | //dc->SetPixel(Area.CenterPoint(), SymbolColor); 98 | 99 | dc->RestoreDC(save); 100 | 101 | return Area; 102 | } 103 | 104 | static CRect DrawPrimaryTrailAndDiamong(CDC* dc, CRadarScreen* radar, CRadarTarget radarTarget, bool drawTrail) { 105 | int save = dc->SaveDC(); 106 | 107 | COLORREF TrailColor = Colours::AircraftLightGrey.ToCOLORREF(); 108 | COLORREF SymbolColor = Colours::AircraftLightGrey.ToCOLORREF(); 109 | 110 | CPen TrailPen(PS_SOLID, 1, TrailColor); 111 | CPen SymbolPen(PS_SOLID, 1, SymbolColor); 112 | 113 | dc->SelectObject(&TrailPen); 114 | dc->SelectStockObject(NULL_BRUSH); 115 | 116 | 117 | 118 | // History Trail 119 | CRadarTargetPositionData TrailPosition = radarTarget.GetPreviousPosition(radarTarget.GetPreviousPosition(radarTarget.GetPosition())); 120 | for (int i = 0; i < 5; i++) { 121 | if (!drawTrail) 122 | break; 123 | 124 | POINT historyTrailPoint = radar->ConvertCoordFromPositionToPixel(TrailPosition.GetPosition()); 125 | 126 | CRect Area(historyTrailPoint.x - DRAWING_AC_SQUARE_TRAIL_SIZE, historyTrailPoint.y - DRAWING_AC_SQUARE_TRAIL_SIZE, 127 | historyTrailPoint.x + DRAWING_AC_SQUARE_TRAIL_SIZE, historyTrailPoint.y + DRAWING_AC_SQUARE_TRAIL_SIZE); 128 | Area.NormalizeRect(); 129 | dc->Rectangle(Area); 130 | 131 | // We skip one position for the other 132 | TrailPosition = radarTarget.GetPreviousPosition(radarTarget.GetPreviousPosition(TrailPosition)); 133 | } 134 | 135 | dc->SelectObject(&SymbolPen); 136 | 137 | // Symbol itself 138 | POINT radarTargetPoint = radar->ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition()); 139 | 140 | int DiamondSize = DRAWING_AC_PRIMARY_DIAMOND_SIZE; 141 | 142 | dc->MoveTo(radarTargetPoint.x, radarTargetPoint.y - DiamondSize); 143 | dc->LineTo(radarTargetPoint.x - DiamondSize, radarTargetPoint.y); 144 | dc->LineTo(radarTargetPoint.x, radarTargetPoint.y + DiamondSize); 145 | dc->LineTo(radarTargetPoint.x + DiamondSize, radarTargetPoint.y); 146 | dc->LineTo(radarTargetPoint.x, radarTargetPoint.y - DiamondSize); 147 | 148 | dc->RestoreDC(save); 149 | return CRect(radarTargetPoint.x - DiamondSize, radarTargetPoint.y - DiamondSize, radarTargetPoint.x + DiamondSize, radarTargetPoint.y + DiamondSize); 150 | } 151 | 152 | static void DrawSpeedVector(CDC* dc, TagConfiguration::TagStates State, CRadarScreen* radar, CRadarTarget radarTarget, bool isPrimary, bool isSoft, int Seconds) { 153 | int save = dc->SaveDC(); 154 | 155 | COLORREF VectorColor = Colours::AircraftDarkGrey.ToCOLORREF(); 156 | 157 | if (!isSoft) 158 | VectorColor = Colours::AircraftLightGrey.ToCOLORREF(); 159 | 160 | if (State == TagConfiguration::TagStates::Assumed || State == TagConfiguration::TagStates::Next || State == TagConfiguration::TagStates::TransferredToMe) 161 | VectorColor = Colours::AircraftGreen.ToCOLORREF(); 162 | 163 | CPen GreenPen(PS_SOLID, 1, VectorColor); 164 | dc->SelectObject(&GreenPen); 165 | 166 | POINT AcPoint = radar->ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition()); 167 | 168 | double d = double(radarTarget.GetPosition().GetReportedGS()*0.514444) * (Seconds); 169 | CPosition PredictedEnd = Extrapolate(radarTarget.GetPosition().GetPosition(), radarTarget.GetTrackHeading(), d); 170 | POINT PredictedEndPoint = radar->ConvertCoordFromPositionToPixel(PredictedEnd); 171 | 172 | int bound = DRAWING_AC_SQUARE_SYMBOL_SIZE + DRAWING_PADDING; 173 | 174 | if (isPrimary) 175 | bound = DRAWING_AC_PRIMARY_DIAMOND_SIZE + DRAWING_PADDING; 176 | 177 | CRect Area(AcPoint.x - bound, AcPoint.y - bound, 178 | AcPoint.x + bound, AcPoint.y + bound); 179 | 180 | POINT ClipFrom, ClipTo; 181 | if (LiangBarsky(Area, AcPoint, PredictedEndPoint, ClipFrom, ClipTo)) { 182 | dc->MoveTo(ClipTo.x, ClipTo.y); 183 | dc->LineTo(PredictedEndPoint.x, PredictedEndPoint.y); 184 | } 185 | 186 | dc->RestoreDC(save); 187 | } 188 | 189 | static CRect DrawApproachVector(CDC* dc, CRadarScreen* radar, CRadarTarget radarTarget, double distance = 3) { 190 | int save = dc->SaveDC(); 191 | 192 | double reverseHeading = (int)(radarTarget.GetTrackHeading() + 180) % 360; 193 | CPosition middlePointArrow = Extrapolate(radarTarget.GetPosition().GetPosition(), reverseHeading, distance * 1852); 194 | 195 | double topArrowHeading = (int)(reverseHeading - 40) % 360; 196 | CPosition topPointArrow = Extrapolate(middlePointArrow, topArrowHeading, 0.6 * 1852); 197 | double bottomArrowHeading = (int)(reverseHeading + 40) % 360; 198 | CPosition bottomPointArrow = Extrapolate(middlePointArrow, bottomArrowHeading, 0.6 * 1852); 199 | 200 | CPen ArrowPen(PS_SOLID, 1, Colours::PurpleDisplay.ToCOLORREF()); 201 | dc->SelectObject(&ArrowPen); 202 | 203 | POINT middleArrowPointPx = radar->ConvertCoordFromPositionToPixel(middlePointArrow); 204 | 205 | POINT topArrowPointPx = radar->ConvertCoordFromPositionToPixel(topPointArrow); 206 | dc->MoveTo(middleArrowPointPx); 207 | dc->LineTo(topArrowPointPx); 208 | 209 | POINT bottomArrowPointPx = radar->ConvertCoordFromPositionToPixel(bottomPointArrow); 210 | dc->MoveTo(middleArrowPointPx); 211 | dc->LineTo(bottomArrowPointPx); 212 | 213 | dc->RestoreDC(save); 214 | 215 | CRect r(topArrowPointPx.x, topArrowPointPx.y, middleArrowPointPx.x, bottomArrowPointPx.y); 216 | r.NormalizeRect(); 217 | return r; 218 | 219 | }; 220 | }; 221 | -------------------------------------------------------------------------------- /MUAC/AntiOverlap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Helper.h" 4 | #include 5 | #include 6 | #include "EuroScopePlugIn.h" 7 | #include 8 | 9 | 10 | using namespace std; 11 | using namespace EuroScopePlugIn; 12 | 13 | class AntiOverlap 14 | { 15 | private: 16 | static int CalculateCost(CRadarScreen* instance, 17 | map TagAreas, map TagOffsets, CRect Tile, int vvTime, CRadarTarget radarTrack) { 18 | 19 | POINT AcPoint = instance->ConvertCoordFromPositionToPixel(radarTrack.GetPosition().GetPosition()); 20 | 21 | int overlapCost = 0; 22 | 23 | // 24 | // Overlap cost 25 | // 26 | 27 | // If the AC is in the tile, then maximum cost 28 | if (IsInRect(AcPoint, Tile)) 29 | overlapCost += 99999; 30 | 31 | // If the leader line of the ac is in the tag 32 | double d = double(radarTrack.GetPosition().GetReportedGS()*0.514444) * 8*60; 33 | POINT VvPoint = instance->ConvertCoordFromPositionToPixel(Extrapolate(radarTrack.GetPosition().GetPosition(), radarTrack.GetTrackHeading(), d)); 34 | 35 | POINT t1, t2; 36 | if (LiangBarsky(Tile, AcPoint, VvPoint, t1, t2)) 37 | overlapCost += 40; 38 | 39 | 40 | for (auto TagAreaskv: TagAreas) 41 | { 42 | if (TagAreaskv.first == radarTrack.GetCallsign()) 43 | continue; 44 | 45 | CRect work; 46 | CRadarTarget testTarget = instance->GetPlugIn()->RadarTargetSelect(TagAreaskv.first.c_str()); 47 | POINT TestPoint = instance->ConvertCoordFromPositionToPixel(testTarget.GetPosition().GetPosition()); 48 | 49 | 50 | if (work.IntersectRect(TagAreaskv.second, Tile)) 51 | overlapCost += 30; 52 | 53 | if (IsInRect(TestPoint, Tile)) 54 | overlapCost += 40; 55 | 56 | // Leader line 57 | POINT endPointLeader = { TestPoint.x + TagOffsets[TagAreaskv.first.c_str()].x, TestPoint.y + TagOffsets[TagAreaskv.first.c_str()].y }; 58 | POINT t1, t2; 59 | if (LiangBarsky(Tile, TestPoint, endPointLeader, t1, t2)) 60 | overlapCost += 20; 61 | 62 | // TODO: Add speed vector line 63 | 64 | } 65 | 66 | // 67 | // Angle cost 68 | // 69 | double angle1 = atan2(VvPoint.y - AcPoint.y, VvPoint.x - AcPoint.x); 70 | double angle2 = atan2(Tile.top - AcPoint.y, Tile.left - AcPoint.x); 71 | 72 | int angleLeaderAc = (int)(angle1-angle2); 73 | int angleCost = (int)((fmod(angleLeaderAc, 180) - 135)); 74 | 75 | // 76 | // Distance cost 77 | // 78 | 79 | int xDelta = Tile.left - TagAreas[radarTrack.GetCallsign()].left; 80 | int yDelta = Tile.top - TagAreas[radarTrack.GetCallsign()].top; 81 | int distanceCost = (int)sqrt(xDelta*xDelta + yDelta*yDelta); 82 | 83 | return 100* overlapCost + 10 * angleCost + 2 * distanceCost; 84 | }; 85 | 86 | static bool IsConflicting(CRadarScreen* instance, CRect Area, map TagAreas) { 87 | bool IsConflicting = false; 88 | // We check for conflicts 89 | for (auto kv : TagAreas) { 90 | if (kv.second == Area) 91 | continue; 92 | 93 | // 94 | // Filter situatiosn where tags are more than 400px apart for performance 95 | // 96 | if (abs(kv.second.top - Area.top) > 400) 97 | continue; 98 | 99 | if (abs(kv.second.right - Area.right) > 400) 100 | continue; 101 | 102 | 103 | 104 | POINT acPt = instance->ConvertCoordFromPositionToPixel(instance->GetPlugIn()->RadarTargetSelect(kv.first.c_str()).GetPosition().GetPosition()); 105 | 106 | // If tags intersect 107 | CRect h; 108 | if (h.IntersectRect(Area, kv.second)) { 109 | IsConflicting = true; 110 | break; 111 | } 112 | 113 | // If symbols overlap 114 | if (IsInRect(acPt, Area)) { 115 | IsConflicting = true; 116 | break; 117 | } 118 | } 119 | 120 | return IsConflicting; 121 | } 122 | 123 | public: 124 | static map BuildGrid(POINT AcPoint, int TileWidth, int TileHeight) { 125 | map out; 126 | 127 | POINT WorkingPoint = { AcPoint.x - (TileWidth + TileWidth/2), AcPoint.y - (TileHeight + TileHeight/2) }; 128 | for (int i = 0; i < 9; i++) { 129 | 130 | POINT TopLeftWorking = { WorkingPoint.x + i*TileWidth, WorkingPoint.y}; 131 | out[i] = { TopLeftWorking.x, TopLeftWorking.y, TopLeftWorking.x + TileWidth, TopLeftWorking.y + TileHeight }; 132 | 133 | if (i == 2 || i == 5) { 134 | WorkingPoint.x -= TileWidth*3; 135 | WorkingPoint.y += TileHeight; 136 | } 137 | 138 | } 139 | 140 | return out; 141 | }; 142 | 143 | static map CalculateGridCost(CRadarScreen* instance, map TagAreas, map TagOffsets, 144 | map Grid, int vvTime, CRadarTarget radarTrack) { 145 | 146 | map out; 147 | 148 | for (auto kv : Grid) 149 | out[kv.first] = CalculateCost(instance, TagAreas, TagOffsets, kv.second, vvTime, radarTrack); 150 | 151 | return out; 152 | } 153 | 154 | static POINT Execute(CRadarScreen* instance, map TagAreas, map TagOffsets, int vvTime, CRadarTarget radarTarget) { 155 | POINT AcPoint = instance->ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition()); 156 | 157 | if (IsConflicting(instance, TagAreas[radarTarget.GetCallsign()], TagAreas)) { 158 | int TileWidth = TagAreas[radarTarget.GetCallsign()].Size().cx + (int)(TagAreas[radarTarget.GetCallsign()].Size().cx*0.20); 159 | int TileHeight = TagAreas[radarTarget.GetCallsign()].Size().cy + (int)(TagAreas[radarTarget.GetCallsign()].Size().cy*0.05); 160 | 161 | map Grid = BuildGrid(AcPoint, TileWidth, TileHeight); 162 | map Cost = CalculateGridCost(instance, TagAreas, TagOffsets, Grid, vvTime, radarTarget); 163 | 164 | int minCost = -1; 165 | int minKey = -1; 166 | for (auto kv : Cost) { 167 | if (kv.second < minCost || minCost == -1) { 168 | minCost = kv.second; 169 | minKey = kv.first; 170 | } 171 | } 172 | 173 | return { Grid[minKey].left - AcPoint.x, Grid[minKey].top - AcPoint.y }; 174 | } 175 | else { 176 | return TagOffsets[radarTarget.GetCallsign()]; 177 | } 178 | }; 179 | 180 | }; -------------------------------------------------------------------------------- /MUAC/CPDLCHandler.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CPDLCHandler.h" 3 | -------------------------------------------------------------------------------- /MUAC/CPDLCHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "HttpHelper.h" 5 | #include "Constants.h" 6 | 7 | using namespace std; 8 | 9 | class CPDLCHandler 10 | { 11 | public: 12 | static inline void PollOnlineStations() { 13 | string s = LoadHttpString("http://www.hoppie.nl/acars/system/connect.html?logon=&from=ALL-CALLSIGNS&to=ALL-CALLSIGNS&type=ping&packet=ALL-CALLSIGNS"); 14 | 15 | if (s.size() > 0) { 16 | CPDLCHandler::OnlineCPDLCStations.clear(); 17 | 18 | s.erase(0, 4); 19 | s.pop_back(); 20 | 21 | 22 | } 23 | } 24 | 25 | static vector OnlineCPDLCStations; 26 | 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /MUAC/CallsignLookup.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "CallsignLookup.h" 3 | 4 | // 5 | // CCallsignLookup Class by Even Rognlien, used with permission 6 | // 7 | 8 | bool CCallsignLookup::Available = false; 9 | CCallsignLookup* CCallsignLookup::Lookup = nullptr; 10 | 11 | CCallsignLookup::CCallsignLookup(std::string fileName) { 12 | 13 | ifstream myfile; 14 | 15 | myfile.open(fileName); 16 | 17 | if (myfile) { 18 | string line; 19 | 20 | while (getline(myfile, line)) { 21 | istringstream iss(line); 22 | vector tokens; 23 | string token; 24 | 25 | while (std::getline(iss, token, '\t')) 26 | tokens.push_back(token); 27 | 28 | if (tokens.size() >= 3) { 29 | callsigns[tokens.front()] = tokens.at(2); 30 | } 31 | } 32 | } 33 | 34 | myfile.close(); 35 | } 36 | 37 | string CCallsignLookup::getCallsign(string airlineCode) { 38 | 39 | if (callsigns.find(airlineCode) == callsigns.end()) 40 | return ""; 41 | 42 | return callsigns.find(airlineCode)->second; 43 | } 44 | 45 | CCallsignLookup::~CCallsignLookup() 46 | { 47 | } -------------------------------------------------------------------------------- /MUAC/CallsignLookup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class CCallsignLookup 11 | { 12 | private: 13 | std::map callsigns; 14 | 15 | public: 16 | CCallsignLookup(string fileName); 17 | string getCallsign(string airlineCode); 18 | 19 | static bool Available; 20 | static CCallsignLookup* Lookup; 21 | 22 | ~CCallsignLookup(); 23 | }; -------------------------------------------------------------------------------- /MUAC/Colours.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | using namespace Gdiplus; 5 | 6 | namespace Colours { 7 | const Color AircraftGreen(23, 185, 27); // 28, 190, 32 8 | const Color AircraftBlue(111, 177, 203); 9 | const Color AircraftLightGrey(165, 165, 165); 10 | const Color AircraftDarkGrey(79, 79, 79); 11 | const Color YellowWarning(167, 167, 0); 12 | const Color PurpleDisplay(235, 0, 201); 13 | const Color OrangeTool(200, 80, 0); 14 | const Color BlueTool(68, 165, 201); 15 | const Color LightOrange(224, 160, 0); 16 | const Color AirwayBlue(0, 170, 170); 17 | const Color RedWarning(255, 0, 0); 18 | 19 | const Color YellowHighlight(255, 255, 0); 20 | 21 | const Color DarkBlueMenu(0, 2, 48); 22 | const Color LightBlueMenu(23, 156, 155); 23 | const Color MenuButtonTop(165, 165, 165); 24 | const Color MenuButtonBottom(74, 74, 74); 25 | const Color GreyTextMenu(162, 162, 162); 26 | 27 | const Color SectorActive(4, 7, 14); 28 | const Color SectorInactive(22, 22, 22); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /MUAC/Constants.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "EuroScopePlugIn.h" 4 | 5 | using namespace std; 6 | using namespace EuroScopePlugIn; 7 | 8 | const string PLUGIN_NAME = "MUAC PlugIn"; 9 | const string PLUGIN_VERSION = "@appveyor_build"; 10 | const string PLUGIN_AUTHOR = "github.com/pierr3"; 11 | const string PLUGIN_COPY = "GPL v3"; 12 | 13 | #define MUAC_RADAR_SCREEN_VIEW "MUAC Radar Screen" 14 | 15 | const string PREFIX_PURPLE_COLOR = "_/"; 16 | const string PREFIX_BLUE_COLOR = "_}"; 17 | const string PREFIX_ORANGE_COLOR = "_-"; 18 | const string PREFIX_GREY_COLOR = "_]"; 19 | const string PREFIX_YELLOW_UNDERLINE = "_["; 20 | const string PREFIX_BACKSTEP = "_'"; 21 | const string PREFIX_FORESTEP = "_|"; 22 | 23 | const int SCREEN_TAG = 0; 24 | const int SCREEN_AC_SYMBOL = 1; 25 | const int SCREEN_AC_APP_ARROW = 5; 26 | 27 | const int SCREEN_SEP_TOOL = 20; 28 | const int SCREEN_QDM_TOOL = 21; 29 | 30 | const int SCREEN_BACKGROUND = 31; 31 | 32 | const int DRAWING_AC_SQUARE_SYMBOL_SIZE = 4; 33 | const int DRAWING_AC_SQUARE_TRAIL_SIZE = 1; 34 | const int DRAWING_AC_PRIMARY_DIAMOND_SIZE = 4; 35 | 36 | const int DRAWING_PADDING = 3; 37 | 38 | const long FONT_SIZE = 15; 39 | 40 | // Menu Buttons 41 | const int BUTTON_HIDEMENU = 401; 42 | const int BUTTON_DECREASE_RANGE = 402; 43 | const int BUTTON_RANGE = 403; 44 | const int BUTTON_INCREASE_RANGE = 404; 45 | 46 | const int BUTTON_FILTER_ON = 405; 47 | const int BUTTON_FILTER_HARD_LOW = 406; 48 | const int BUTTON_FILTER_SOFT_LOW = 407; 49 | const int BUTTON_FILTER_SOFT_HIGH = 408; 50 | const int BUTTON_FILTER_HARD_HIGH = 409; 51 | 52 | const int BUTTON_MTCD = 410; 53 | const int BUTTON_FIM = 411; 54 | 55 | const int BUTTON_QDM = 421; 56 | const int BUTTON_TOPDOWN = 422; 57 | 58 | const int BUTTON_MODE_A = 423; 59 | const int BUTTON_LABEL_V = 424; 60 | 61 | const int BUTTON_PRIMARY_TARGETS_ON = 425; 62 | 63 | const int BUTTON_VFR_ON = 426; 64 | 65 | const int BUTTON_VELOTH = 427; 66 | const int BUTTON_VEL1 = 428; 67 | const int BUTTON_VEL2 = 429; 68 | const int BUTTON_VEL4 = 430; 69 | const int BUTTON_VEL8 = 431; 70 | 71 | const int BUTTON_DOTS = 432; 72 | 73 | const int BUTTON_FIN = 433; 74 | 75 | 76 | const int FIM_WINDOW = 501; 77 | 78 | const int FIM_STAR = 502; 79 | const int FIM_RWY = 503; 80 | const int FIM_SCRATCHPAD = 504; 81 | const int FIM_CLOSE = 505; 82 | 83 | const int MTCD_WINDOW = 551; 84 | const int MTCD_WINDOW_BUTTONS = 552; 85 | 86 | // Clickable tag items 87 | 88 | const int SCREEN_TAG_CALLSIGN = 701; 89 | const int SCREEN_TAG_SECTOR = 702; 90 | const int SCREEN_TAG_ROUTE = 703; 91 | const int SCREEN_TAG_CFL = 704; 92 | const int SCREEN_TAG_HORIZ = 705; 93 | const int SCREEN_TAG_RFL = 706; 94 | const int SCREEN_TAG_XFL = 707; 95 | const int SCREEN_TAG_COP = 708; 96 | const int SCREEN_TAG_SEP = 709; 97 | const int SCREEN_TAG_SSR = 710; 98 | const int SCREEN_TAG_ASPEED = 711; 99 | const int SCREEN_TAG_RWY = 712; 100 | const int SCREEN_TAG_ADES = 713; 101 | const int SCREEN_TAG_GSPEED = 714; 102 | const int SCREEN_TAG_STAR = 715; 103 | 104 | // Functions 105 | const int FUNC_FILTER_HARD_LOW = BUTTON_FILTER_HARD_LOW; 106 | const int FUNC_FILTER_SOFT_LOW = BUTTON_FILTER_SOFT_LOW; 107 | const int FUNC_FILTER_SOFT_HIGH = BUTTON_FILTER_SOFT_HIGH; 108 | const int FUNC_FILTER_HARD_HIGH = BUTTON_FILTER_HARD_HIGH; 109 | 110 | // Saved Status 111 | 112 | const string SAVE_MTCD_POSX = "MTCDWindowPosX"; 113 | const string SAVE_MTCD_POSY = "MTCDWindowPosY"; 114 | const string SAVE_FIM_POSX = "FIMWindowPosX"; 115 | const string SAVE_FIM_POSY = "FIMWindowPosY"; 116 | 117 | const string SAVE_HARD_FILTER_LOWER = "UACFilterHardLower"; 118 | const string SAVE_SOFT_FILTER_LOWER = "UACFilterSoftLower"; 119 | const string SAVE_SOFT_FILTER_UPPER = "UACFilterSoftUpper"; 120 | const string SAVE_HARD_FILTER_UPPER = "UACFilterHardUpper"; 121 | 122 | const string SAVE_VEL_TIME = "UACVELTime"; 123 | 124 | const string SAVE_VFR_FILTER = "UACVFRFilter"; 125 | 126 | const enum AircraftStates { 127 | NOT_CONCERNED, NOTIFIED, CONCERNED, TRANSFERRED, ASSUMED 128 | }; 129 | -------------------------------------------------------------------------------- /MUAC/FIMWindow.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/MUAC/FIMWindow.h -------------------------------------------------------------------------------- /MUAC/FontManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Constants.h" 4 | 5 | 6 | using namespace std; 7 | using namespace EuroScopePlugIn; 8 | 9 | 10 | class FontManager 11 | { 12 | public: 13 | static void SelectStandardFont(CDC* dc) { 14 | CFont* pOldFont = dc->GetCurrentFont(); 15 | LOGFONT logFont; 16 | pOldFont->GetLogFont(&logFont); 17 | logFont.lfHeight = FONT_SIZE; 18 | CFont font; 19 | font.CreateFontIndirect(&logFont); 20 | 21 | dc->SelectObject(&font); 22 | }; 23 | 24 | static void SelectBoldBigFont(CDC* dc) { 25 | CFont* pOldFont = dc->GetCurrentFont(); 26 | LOGFONT logFont; 27 | pOldFont->GetLogFont(&logFont); 28 | logFont.lfHeight += (long)(logFont.lfHeight*0.15); 29 | logFont.lfWeight = 700; 30 | CFont font; 31 | font.CreateFontIndirect(&logFont); 32 | 33 | dc->SelectObject(&font); 34 | }; 35 | }; -------------------------------------------------------------------------------- /MUAC/Helper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #define _USE_MATH_DEFINES 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "Colours.h" 11 | #include "CallsignLookup.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "EuroScopePlugIn.h" 17 | 18 | using namespace std; 19 | using namespace EuroScopePlugIn; 20 | 21 | static void FillInAltitudeList(CPlugIn* Plugin, int FunctionId, int Current) { 22 | Plugin->AddPopupListElement(" 999 ", "", FunctionId, Current == 99999); 23 | for(int i = 410; i >= 0; i -= 10) 24 | Plugin->AddPopupListElement(string(string(" ") + to_string(i) + string(" ")).c_str(), "", FunctionId, Current/100 == i); 25 | }; 26 | 27 | // Radians 28 | 29 | inline static double DegToRad(double x) 30 | { 31 | return x / 180.0 * M_PI; 32 | }; 33 | 34 | inline static double RadToDeg(double x) 35 | { 36 | return x / M_PI * 180.0; 37 | }; 38 | 39 | // Utils 40 | 41 | inline static bool IsInRect(POINT pt, CRect rect) { 42 | if (pt.x >= rect.left + 1 && pt.x <= rect.right - 1 && pt.y >= rect.top + 1 && pt.y <= rect.bottom - 1) 43 | return true; 44 | return false; 45 | } 46 | 47 | inline static int RandomInt(int min, int max) { 48 | std::random_device rd; 49 | std::mt19937 rng(rd()); 50 | std::uniform_int_distribution uni(min, max); 51 | 52 | return uni(rng); 53 | } 54 | 55 | static void DrawCross(CDC* dc, POINT position, int size = 2) { 56 | dc->MoveTo(position.x, position.y - size); 57 | dc->LineTo(position.x, position.y + size); 58 | 59 | dc->MoveTo(position.x - size, position.y); 60 | dc->LineTo(position.x + size, position.y); 61 | }; 62 | 63 | static void DrawHourGlassWithLeader(CDC * dc, POINT Position, POINT PositionOfLeader) { 64 | int save = dc->SaveDC(); 65 | 66 | CPen SepToolColorPen(PS_SOLID, 1, Colours::OrangeTool.ToCOLORREF()); 67 | dc->SelectObject(&SepToolColorPen); 68 | 69 | int Distance = 8; 70 | 71 | dc->MoveTo(Position); 72 | dc->LineTo(Position.x - Distance / 2, Position.y - Distance); 73 | dc->LineTo(Position.x + Distance / 2, Position.y - Distance); 74 | dc->LineTo(Position); 75 | dc->LineTo(Position.x - Distance / 2, Position.y + Distance); 76 | dc->LineTo(Position.x + Distance / 2, Position.y + Distance); 77 | dc->LineTo(Position); 78 | dc->LineTo(PositionOfLeader); 79 | 80 | dc->RestoreDC(save); 81 | } 82 | 83 | inline static Gdiplus::Rect RectToGdiplus(CRect &rect) 84 | { 85 | return Gdiplus::Rect(rect.left, rect.top, rect.Width(), rect.Height()); 86 | }; 87 | 88 | static bool file_exist(string fileName) 89 | { 90 | ifstream infile(fileName); 91 | return infile.good(); 92 | } 93 | 94 | static bool clipT(double num, double denom, POINT c) { 95 | double tE = c.x, tL = c.y; 96 | if (abs(denom) < 1e-6) return num < 0; 97 | double t = num / denom; 98 | 99 | if (denom > 0) { 100 | if (t > tL) return 0; 101 | if (t > tE) c.x = t; 102 | } 103 | else { 104 | if (t < tE) return 0; 105 | if (t < tL) c.y = t; 106 | } 107 | return true; 108 | } 109 | 110 | static bool LiangBarsky2(RECT box, POINT a, POINT b, POINT &da, POINT &db) { 111 | double x1 = a.x, y1 = -a.y; 112 | double x2 = b.x, y2 = -b.y; 113 | double dx = x2 - x1; 114 | double dy = y2 - y1; 115 | 116 | da = a; 117 | db = b; 118 | 119 | if ( 120 | abs(dx) < 1e-6 && 121 | abs(dy) < 1e-6 && 122 | x1 >= box.left && 123 | x1 <= box.right && 124 | y1 >= box.bottom && 125 | y1 <= box.top 126 | ) { 127 | return true; 128 | } 129 | 130 | POINT c = { 0, 1 }; 131 | if ( 132 | clipT(box.left - x1, dx, c) && 133 | clipT(x1 - box.right, -dx, c) && 134 | clipT(box.bottom - y1, dy, c) && 135 | clipT(y1 - box.top, -dy, c) 136 | ) { 137 | double tE = c.x, tL = c.y; 138 | if (tL < 1) { 139 | db.x = x1 + tL * dx; 140 | db.y = y1 + tL * dy; 141 | } 142 | if (tE > 0) { 143 | da.x += tE * dx; 144 | da.y += tE * dy; 145 | } 146 | return true; 147 | } 148 | return false; 149 | } 150 | 151 | // Liang-Barsky function by Daniel White @ http://www.skytopia.com/project/articles/compsci/clipping.html 152 | // This function inputs 8 numbers, and outputs 4 new numbers (plus a boolean value to say whether the clipped line is drawn at all). 153 | // 154 | static bool LiangBarsky(RECT Area, POINT fromSrc, POINT toSrc, POINT &ClipFrom, POINT &ClipTo) // The output values, so declare these outside. 155 | { 156 | 157 | double edgeLeft, edgeRight, edgeBottom, edgeTop, x0src, y0src, x1src, y1src; 158 | 159 | edgeLeft = Area.left; 160 | edgeRight = Area.right; 161 | edgeBottom = Area.top; 162 | edgeTop = Area.bottom; 163 | 164 | x0src = fromSrc.x; 165 | y0src = fromSrc.y; 166 | x1src = toSrc.x; 167 | y1src = toSrc.y; 168 | 169 | double t0 = 0.0; double t1 = 1.0; 170 | double xdelta = x1src - x0src; 171 | double ydelta = y1src - y0src; 172 | 173 | double p = 0, q = 0, r; 174 | 175 | for (int edge = 0; edge<4; edge++) { // Traverse through left, right, bottom, top edges. 176 | if (edge == 0) { p = -xdelta; q = -(edgeLeft - x0src); } 177 | if (edge == 1) { p = xdelta; q = (edgeRight - x0src); } 178 | if (edge == 2) { p = -ydelta; q = -(edgeBottom - y0src); } 179 | if (edge == 3) { p = ydelta; q = (edgeTop - y0src); } 180 | r = q / p; 181 | if (p == 0 && q<0) return false; // Don't draw line at all. (parallel line outside) 182 | 183 | if (p<0) { 184 | if (r>t1) return false; // Don't draw line at all. 185 | else if (r>t0) t0 = r; // Line is clipped! 186 | } 187 | else if (p>0) { 188 | if (r &split(const std::string &s, char delim, std::vector &elems) { 302 | std::stringstream ss(s); 303 | std::string item; 304 | while (std::getline(ss, item, delim)) 305 | elems.push_back(item); 306 | return elems; 307 | }; 308 | inline static std::vector split(const std::string &s, char delim) { 309 | std::vector elems; 310 | split(s, delim, elems); 311 | return elems; 312 | }; 313 | 314 | static void DrawTextMultiline(CDC* dc, string Text, POINT TextPosition) { 315 | int yOffset = 0; 316 | vector data = split(Text, '|'); 317 | 318 | for (auto& line : data) { 319 | POINT textPt = TextPosition; 320 | textPt.y += yOffset; 321 | 322 | dc->TextOutA(textPt.x, textPt.y, line.c_str()); 323 | 324 | CSize cs = dc->GetTextExtent(line.c_str()); 325 | yOffset += cs.cy; 326 | } 327 | } 328 | 329 | static string getUtcTimePlusMinutes(int minutes, string format = "%H%M") { 330 | chrono::system_clock::time_point time_now = chrono::system_clock::now(); 331 | time_t now_c = chrono::system_clock::to_time_t(time_now + chrono::minutes(minutes)); 332 | 333 | stringstream ss; 334 | ss << put_time(std::gmtime(&now_c), format.c_str()); 335 | return ss.str(); 336 | } 337 | -------------------------------------------------------------------------------- /MUAC/HttpHelper.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "HttpHelper.h" 3 | 4 | string LoadHttpString(string url) 5 | { 6 | const string AGENT{ "EuroScopeMUAC/" + PLUGIN_VERSION }; 7 | HINTERNET connect = InternetOpen(AGENT.c_str(), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); 8 | if (connect) { 9 | HINTERNET OpenAddress = InternetOpenUrl(connect, url.c_str(), NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD, 0); 10 | if (OpenAddress) { 11 | char DataReceived[256]; 12 | DWORD NumberOfBytesRead{ 0 }; 13 | std::string answer; 14 | while (InternetReadFile(OpenAddress, DataReceived, 256, &NumberOfBytesRead) && NumberOfBytesRead) 15 | answer.append(DataReceived, NumberOfBytesRead); 16 | 17 | InternetCloseHandle(OpenAddress); 18 | InternetCloseHandle(connect); 19 | return answer; 20 | } 21 | else { 22 | InternetCloseHandle(connect); 23 | } 24 | } 25 | 26 | return ""; 27 | } 28 | -------------------------------------------------------------------------------- /MUAC/HttpHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "Constants.h" 6 | 7 | using namespace std; 8 | 9 | string LoadHttpString(string url); 10 | 11 | -------------------------------------------------------------------------------- /MUAC/MTCD.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "VERA.h" 3 | #include "STCA.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | using namespace EuroScopePlugIn; 11 | 12 | 13 | class CMTCD 14 | { 15 | public: 16 | int mtcd_distance = 9; 17 | int mtcd_height = 950; 18 | int mtcd_disable_level = 10500; 19 | int max_extrapolate_time = 20; 20 | 21 | int start_time = CSTCA::time_to_extrapolate/60; 22 | 23 | struct MtcdAlertStruct { 24 | string sourceCallsign, conflictCallsign; 25 | int minDistanceMin, minDistanceNm; 26 | VERA::VERADataStruct vera; 27 | }; 28 | 29 | vector Alerts; 30 | 31 | void OnRefresh(CPlugIn * pl) { 32 | Alerts.clear(); 33 | 34 | CFlightPlan fp; 35 | for (fp = pl->FlightPlanSelectFirst(); 36 | fp.IsValid(); 37 | fp = pl->FlightPlanSelectNext(fp)) 38 | { 39 | CFlightPlanPositionPredictions PosPred = fp.GetPositionPredictions(); 40 | 41 | if (PosPred.GetPointsNumber() <= start_time) 42 | continue; 43 | 44 | // if not following route 45 | if (fp.GetRAMFlag()) 46 | continue; 47 | 48 | // is on a heading 49 | if (fp.GetControllerAssignedData().GetAssignedHeading() != 0) 50 | continue; 51 | 52 | // MTCD Only works for assumed flights and incoming flights 53 | if (!fp.GetTrackingControllerIsMe() && fp.GetFPState() != FLIGHT_PLAN_STATE_COORDINATED) { 54 | continue; 55 | } 56 | 57 | if (!fp.GetTrackingControllerIsMe()) 58 | continue; 59 | 60 | // We scan up to x 61 | int toExtract = min(max_extrapolate_time, PosPred.GetPointsNumber()); 62 | 63 | // For each minute left in the route, we check for conflicts 64 | for (int i = start_time; i < toExtract; i++) { 65 | 66 | // If is below the level, then we ignore 67 | if (PosPred.GetAltitude(i) < mtcd_disable_level) 68 | continue; 69 | 70 | CPosition Pos = PosPred.GetPosition(i); 71 | 72 | // if not, we find conflicting targets 73 | 74 | CFlightPlan conflicting; 75 | for (conflicting = pl->FlightPlanSelectFirst(); 76 | conflicting.IsValid(); 77 | conflicting = pl->FlightPlanSelectNext(conflicting)) 78 | { 79 | CFlightPlanPositionPredictions PosPredConflicting = conflicting.GetPositionPredictions(); 80 | 81 | if (conflicting.GetCallsign() == fp.GetCallsign()) 82 | continue; 83 | 84 | if (PosPredConflicting.GetPointsNumber() <= start_time) 85 | continue; 86 | 87 | // if not following route 88 | if (conflicting.GetRAMFlag()) 89 | continue; 90 | 91 | // is on a heading 92 | if (conflicting.GetControllerAssignedData().GetAssignedHeading() != 0) 93 | continue; 94 | 95 | if (PosPredConflicting.GetPointsNumber() < i) 96 | continue; 97 | 98 | if (IsPairInMtcd(fp.GetCallsign(), conflicting.GetCallsign())) 99 | continue; 100 | 101 | CPosition conflictingPos = PosPredConflicting.GetPosition(i); 102 | 103 | // We have an MTCD conflicting on distance, lets save the position with the altitude for probe tool 104 | if (Pos.DistanceTo(conflictingPos) < mtcd_distance) { 105 | 106 | // We have a true mtcd conflict 107 | if (abs(PosPred.GetAltitude(i) - PosPredConflicting.GetAltitude(i)) < mtcd_height) { 108 | MtcdAlertStruct alert; 109 | alert.sourceCallsign = fp.GetCallsign(); 110 | alert.conflictCallsign = conflicting.GetCallsign(); 111 | alert.minDistanceMin = i; 112 | alert.minDistanceNm = (int)Pos.DistanceTo(conflictingPos); 113 | alert.vera = VERA::Calculate(pl->RadarTargetSelect(fp.GetCallsign()), pl->RadarTargetSelect(conflicting.GetCallsign())); 114 | 115 | Alerts.push_back(alert); 116 | } 117 | 118 | } 119 | 120 | } 121 | 122 | } 123 | } 124 | }; 125 | 126 | bool IsPairInMtcd(string callsign1, string callsign2) { 127 | for (auto &data : Alerts) { 128 | if (data.sourceCallsign == callsign1 && data.conflictCallsign == callsign2) 129 | return true; 130 | if (data.sourceCallsign == callsign2 && data.conflictCallsign == callsign1) 131 | return true; 132 | } 133 | 134 | return false; 135 | }; 136 | 137 | bool IsMTCD(string callsign) { 138 | for (auto &data : Alerts) { 139 | if (data.sourceCallsign == callsign || data.conflictCallsign == callsign) 140 | return true; 141 | } 142 | 143 | return false; 144 | }; 145 | }; -------------------------------------------------------------------------------- /MUAC/MTCDWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "MUAC.h" 4 | #include "Constants.h" 5 | #include "Colours.h" 6 | #include "MenuBar.h" 7 | #include "FontManager.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | using namespace EuroScopePlugIn; 16 | 17 | 18 | class CMTCDWindow 19 | { 20 | 21 | private: 22 | private: 23 | POINT TopLeftPosition; 24 | CSize WindowSize; 25 | bool Display = true; 26 | bool Released = true; 27 | 28 | string lengthString = "AAA0000 AAA0000 00 00 00.0 00.0 ^"; 29 | 30 | int PaddingSides = 3; 31 | int PaddingTops = 5; 32 | public: 33 | CMTCDWindow(POINT TopLeft) { 34 | TopLeftPosition = TopLeft; 35 | }; 36 | 37 | void Move(CRect Area, bool isReleased) { 38 | Released = isReleased; 39 | TopLeftPosition = { Area.left, Area.top }; 40 | }; 41 | 42 | POINT GetTopLeftPosition() { 43 | return TopLeftPosition; 44 | }; 45 | 46 | CRect Render(CDC* dc, CRadarScreen* instance, POINT mousePt, CMTCD* mtcd, multimap veraTools, bool display) { 47 | Display = display; 48 | 49 | if (!Display) 50 | return {0, 0, 0, 0}; 51 | 52 | int saveDc = dc->SaveDC(); 53 | 54 | FontManager::SelectStandardFont(dc); 55 | 56 | // We need to count how many we show in the vera list 57 | int veraLn = 0; 58 | map, VERA::VERADataStruct> veraPrecalcData; 59 | for (auto &kv : veraTools) { 60 | if (mtcd->IsPairInMtcd(kv.first, kv.second)) 61 | continue; 62 | 63 | CRadarTarget FirstTarget = instance->GetPlugIn()->RadarTargetSelect(kv.first.c_str()); 64 | CRadarTarget SecondTarget = instance->GetPlugIn()->RadarTargetSelect(kv.second.c_str()); 65 | 66 | VERA::VERADataStruct vera = VERA::Calculate(FirstTarget, SecondTarget); 67 | 68 | if (vera.minDistanceSeconds == -1) 69 | continue; 70 | 71 | veraPrecalcData.insert(std::pair, VERA::VERADataStruct>(kv, vera)); 72 | 73 | veraLn++; 74 | } 75 | 76 | // Always at least one line for topbar 77 | int lineNumbers = veraLn + mtcd->Alerts.size() + 1; 78 | 79 | // We need to calculate the size of the menu 80 | CSize TextSize = dc->GetTextExtent(lengthString.c_str()); 81 | WindowSize.cx = TextSize.cx + PaddingSides * 2; 82 | WindowSize.cy = TextSize.cy * lineNumbers + PaddingTops * 2; 83 | 84 | int LineHeight = (int)TextSize.cy + PaddingTops; 85 | 86 | // Whole window 87 | CRect Window(TopLeftPosition.x, TopLeftPosition.y, TopLeftPosition.x + WindowSize.cx, TopLeftPosition.y + WindowSize.cy); 88 | 89 | if (Released) 90 | dc->FillSolidRect(Window, Colours::MenuButtonBottom.ToCOLORREF()); 91 | 92 | // Black outline 93 | CRect WinOutline = Window; 94 | WinOutline.InflateRect(1, 1); 95 | WinOutline.NormalizeRect(); 96 | 97 | CPen BlackPen(PS_SOLID, 1, RGB(0, 0, 0)); 98 | CPen GreyPen(PS_SOLID, 1, Colours::AircraftLightGrey.ToCOLORREF()); 99 | if (IsInRect(mousePt, Window) || !Released) 100 | dc->SelectObject(&GreyPen); 101 | else 102 | dc->SelectObject(&BlackPen); 103 | 104 | dc->SelectStockObject(NULL_BRUSH); 105 | dc->Rectangle(WinOutline); 106 | 107 | instance->AddScreenObject(MTCD_WINDOW, "", Window, true, ""); 108 | 109 | if (!Released) 110 | return Window; 111 | 112 | // Topbar 113 | CRect TopBar(TopLeftPosition.x, TopLeftPosition.y, TopLeftPosition.x + WindowSize.cx, TopLeftPosition.y + LineHeight); 114 | dc->FillSolidRect(TopBar, Colours::DarkBlueMenu.ToCOLORREF()); 115 | 116 | dc->SetTextColor(Colours::GreyTextMenu.ToCOLORREF()); 117 | 118 | // 119 | // Topbar text 120 | // 121 | 122 | dc->SetTextAlign(TA_LEFT | TA_BASELINE); 123 | 124 | dc->TextOutA(TopLeftPosition.x + 3, TopBar.bottom - PaddingSides, " MTCD VERA"); 125 | 126 | // Close button, first one for size, second one for render 127 | dc->SetTextAlign(TA_LEFT | TA_TOP); 128 | int LeftButtonOffset = TopBar.right - dc->GetTextExtent("X").cx * 2 - 3; 129 | CRect ButtonRect = MenuBar::DrawMenuBarButton(dc, { LeftButtonOffset, TopLeftPosition.y }, "X", mousePt, false); 130 | 131 | instance->AddScreenObject(MTCD_WINDOW_BUTTONS, "CLOSE", ButtonRect, false, "Close MTCD Window"); 132 | 133 | dc->SetTextColor(Colours::AircraftBlue.ToCOLORREF()); 134 | 135 | // MTCD List first 136 | int TopOffset = TopBar.bottom + 2; 137 | for (auto &mtcdAlert : mtcd->Alerts) { 138 | string veraString = " DIV"; 139 | 140 | if (mtcdAlert.vera.minDistanceSeconds != -1) { 141 | string veraTime = padWithZeros(2, (int)(mtcdAlert.vera.minDistanceSeconds / 60)) 142 | + "." + to_string(mtcdAlert.vera.minDistanceSeconds % 60).substr(0, 1); 143 | 144 | string veraDistance = to_string(mtcdAlert.vera.minDistanceNm); 145 | size_t decimal_pos = veraDistance.find("."); 146 | veraDistance = veraDistance.substr(0, decimal_pos + 2); 147 | if (mtcdAlert.vera.minDistanceNm < 10) 148 | veraDistance = "0" + veraDistance; 149 | 150 | veraString = veraTime + " " + veraDistance; 151 | } 152 | 153 | string line = mtcdAlert.sourceCallsign + " " + mtcdAlert.conflictCallsign + " " 154 | + padWithZeros(2, mtcdAlert.minDistanceMin) + " " + padWithZeros(2, mtcdAlert.minDistanceNm) + " " 155 | + veraString; 156 | 157 | CSize extent = dc->GetTextExtent(line.c_str()); 158 | 159 | dc->TextOutA(TopBar.left + 3, TopOffset, line.c_str()); 160 | 161 | 162 | TopOffset += extent.cy; 163 | } 164 | 165 | CPen WhitePen(PS_SOLID, 1, Colours::AircraftLightGrey.ToCOLORREF()); 166 | dc->SelectObject(&WhitePen); 167 | 168 | dc->MoveTo(TopBar.left + 2, TopOffset); 169 | dc->LineTo(TopBar.right - 2, TopOffset); 170 | 171 | // VERA List 172 | for (auto &kv : veraTools) { 173 | if (mtcd->IsPairInMtcd(kv.first, kv.second)) 174 | continue; 175 | 176 | VERA::VERADataStruct vera = veraPrecalcData[kv]; 177 | 178 | if (vera.minDistanceSeconds == -1) 179 | continue; 180 | 181 | string veraTime = padWithZeros(2, (int)(vera.minDistanceSeconds / 60)) 182 | + "." + to_string(vera.minDistanceSeconds % 60).substr(0, 1); 183 | 184 | string veraDistance = to_string(vera.minDistanceNm); 185 | size_t decimal_pos = veraDistance.find("."); 186 | veraDistance = veraDistance.substr(0, decimal_pos + 2); 187 | if (vera.minDistanceNm < 10) 188 | veraDistance = "0" + veraDistance; 189 | 190 | string line = kv.first + " " + kv.second + " 00 00 " + veraTime + " " + veraDistance; 191 | CSize extent = dc->GetTextExtent(string(line + " ").c_str()); 192 | 193 | dc->TextOutA(TopBar.left + 3, TopOffset, line.c_str()); 194 | 195 | // Push to mtcd button 196 | CSize singleExtent = dc->GetTextExtent("^"); 197 | dc->TextOutA(TopBar.left + 3 + extent.cx, TopOffset, "^"); 198 | 199 | CRect pushRect = { TopBar.left + 3 + extent.cx, TopOffset, 200 | TopBar.left + 3 + extent.cx + singleExtent.cx, TopOffset + singleExtent.cy }; 201 | 202 | CPen YellowPen(PS_SOLID, 1, Colours::YellowHighlight.ToCOLORREF()); 203 | 204 | if (IsInRect(mousePt, pushRect)) { 205 | dc->SelectStockObject(NULL_BRUSH); 206 | dc->SelectObject(&YellowPen); 207 | dc->Rectangle(pushRect); 208 | } 209 | 210 | TopOffset += extent.cy; 211 | } 212 | 213 | dc->RestoreDC(saveDc); 214 | 215 | return Window; 216 | }; 217 | }; -------------------------------------------------------------------------------- /MUAC/MUAC.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "MUAC.h" 3 | 4 | future fRDFString; 5 | 6 | MUAC::MUAC():CPlugIn(COMPATIBILITY_CODE, PLUGIN_NAME.c_str(), PLUGIN_VERSION.c_str(), PLUGIN_AUTHOR.c_str(), PLUGIN_COPY.c_str()) { 7 | 8 | srand((unsigned int)time(nullptr)); 9 | this->RegisterPlugin(); 10 | 11 | DisplayUserMessage("Message", "MUAC PlugIn", string("Version " + PLUGIN_VERSION + " loaded").c_str(), false, false, false, false, false); 12 | 13 | char DllPathFile[_MAX_PATH]; 14 | string DllPath; 15 | GetModuleFileNameA(HINSTANCE(&__ImageBase), DllPathFile, sizeof(DllPathFile)); 16 | DllPath = DllPathFile; 17 | DllPath.resize(DllPath.size() - strlen("MUAC.dll")); 18 | 19 | string FilePath = DllPath + "\\ICAO_Airlines.txt"; 20 | if (file_exist(FilePath)) { 21 | CCallsignLookup::Lookup = new CCallsignLookup(FilePath); 22 | CCallsignLookup::Available = true; 23 | } 24 | else { 25 | CCallsignLookup::Available = false; 26 | DisplayUserMessage("Message", "MUAC PlugIn", string("Warning: Could not load callsigns, they will be unavailable").c_str(), 27 | true, true, false, false, true); 28 | } 29 | 30 | } 31 | 32 | MUAC::~MUAC() {} 33 | 34 | CRadarScreen * MUAC::OnRadarScreenCreated(const char * sDisplayName, bool NeedRadarContent, bool GeoReferenced, bool CanBeSaved, bool CanBeCreated) 35 | { 36 | if (!strcmp(sDisplayName, MUAC_RADAR_SCREEN_VIEW)) 37 | return new RadarScreen(); 38 | 39 | return nullptr; 40 | } 41 | 42 | void MUAC::OnTimer(int Counter) 43 | { 44 | if (Counter % 5 == 0) { 45 | 46 | } 47 | } 48 | 49 | void MUAC::RegisterPlugin() { 50 | RegisterDisplayType(MUAC_RADAR_SCREEN_VIEW, false, true, true, true); 51 | } 52 | -------------------------------------------------------------------------------- /MUAC/MUAC.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "EuroScopePlugIn.h" 6 | #include "Constants.h" 7 | #include "CallsignLookup.h" 8 | #include "RadarScreen.h" 9 | 10 | using namespace std; 11 | using namespace EuroScopePlugIn; 12 | 13 | class MUAC : CPlugIn 14 | { 15 | public: 16 | MUAC(); 17 | virtual ~MUAC(); 18 | 19 | CRadarScreen * OnRadarScreenCreated(const char * sDisplayName, bool NeedRadarContent, bool GeoReferenced, bool CanBeSaved, bool CanBeCreated); 20 | 21 | void OnTimer(int Counter); 22 | 23 | protected: 24 | void RegisterPlugin(); 25 | 26 | private: 27 | 28 | }; -------------------------------------------------------------------------------- /MUAC/MUAC.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/MUAC/MUAC.rc -------------------------------------------------------------------------------- /MUAC/MUAC.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {23F8E3F7-2110-49B6-95B5-DBAF8D03D0C5} 15 | Win32Proj 16 | MUAC 17 | 10.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | v142 24 | MultiByte 25 | Static 26 | 27 | 28 | DynamicLibrary 29 | false 30 | v142 31 | true 32 | MultiByte 33 | Static 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | true 55 | 56 | 57 | true 58 | 59 | 60 | false 61 | 62 | 63 | false 64 | 65 | 66 | 67 | Use 68 | Level3 69 | Disabled 70 | WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;MUAC_EXPORTS;%(PreprocessorDefinitions) 71 | true 72 | $(SolutionDir)\lib\include;%(AdditionalIncludeDirectories) 73 | 74 | 75 | Windows 76 | true 77 | $(SolutionDir)\lib\EuroScopePlugInDll.lib;%(AdditionalDependencies) 78 | 79 | 80 | 81 | 82 | Use 83 | Level3 84 | Disabled 85 | _DEBUG;_WINDOWS;_USRDLL;MUAC_EXPORTS;%(PreprocessorDefinitions) 86 | true 87 | 88 | 89 | Windows 90 | true 91 | 92 | 93 | 94 | 95 | Level3 96 | Use 97 | MaxSpeed 98 | true 99 | true 100 | WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MUAC_EXPORTS;%(PreprocessorDefinitions) 101 | true 102 | $(SolutionDir)\lib\include;%(AdditionalIncludeDirectories) 103 | 104 | 105 | Windows 106 | true 107 | true 108 | true 109 | $(SolutionDir)\lib\EuroScopePlugInDll.lib;%(AdditionalDependencies) 110 | 111 | 112 | 113 | 114 | Level3 115 | Use 116 | MaxSpeed 117 | true 118 | true 119 | NDEBUG;_WINDOWS;_USRDLL;MUAC_EXPORTS;%(PreprocessorDefinitions) 120 | true 121 | 122 | 123 | Windows 124 | true 125 | true 126 | true 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | false 164 | 165 | 166 | false 167 | 168 | 169 | false 170 | 171 | 172 | false 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Create 182 | Create 183 | Create 184 | Create 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /MUAC/MUAC.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files 71 | 72 | 73 | Header Files 74 | 75 | 76 | Header Files 77 | 78 | 79 | Header Files 80 | 81 | 82 | Header Files 83 | 84 | 85 | Header Files 86 | 87 | 88 | Header Files 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | 98 | 99 | Source Files 100 | 101 | 102 | Source Files 103 | 104 | 105 | Source Files 106 | 107 | 108 | Source Files 109 | 110 | 111 | Source Files 112 | 113 | 114 | Source Files 115 | 116 | 117 | Source Files 118 | 119 | 120 | Source Files 121 | 122 | 123 | 124 | 125 | Resource Files 126 | 127 | 128 | -------------------------------------------------------------------------------- /MUAC/MenuBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Constants.h" 4 | #include "Colours.h" 5 | #include 6 | #include 7 | #include 8 | #include "EuroScopePlugIn.h" 9 | 10 | using namespace std; 11 | using namespace EuroScopePlugIn; 12 | 13 | class MenuBar 14 | { 15 | private: 16 | const static int ButtonPaddingSides = 5; 17 | const static int ButtonPaddingTop = 2; 18 | 19 | public: 20 | static map MakeButtonData() { 21 | map data; 22 | data[BUTTON_HIDEMENU] = "X"; 23 | data[BUTTON_DECREASE_RANGE] = "-"; 24 | data[BUTTON_RANGE] = "120 ="; 25 | data[BUTTON_INCREASE_RANGE] = "+"; 26 | data[BUTTON_FILTER_ON] = "FILTER ON"; 27 | data[BUTTON_FILTER_HARD_LOW] = "0 ="; 28 | data[BUTTON_FILTER_SOFT_LOW] = "200 ="; 29 | data[BUTTON_FILTER_SOFT_HIGH] = "999 ="; 30 | data[BUTTON_FILTER_HARD_HIGH] = "999 ="; 31 | data[BUTTON_MTCD] = "MTCD"; 32 | data[BUTTON_FIM] = "VAR FIM"; 33 | data[BUTTON_QDM] = "QDM"; 34 | data[BUTTON_TOPDOWN] = "T"; 35 | data[BUTTON_MODE_A] = "A"; 36 | data[BUTTON_LABEL_V] = "V"; 37 | data[BUTTON_PRIMARY_TARGETS_ON] = "PR"; 38 | data[BUTTON_VFR_ON] = "VFR"; 39 | data[BUTTON_VELOTH] = "VEL OTH"; 40 | data[BUTTON_VEL1] = "1"; 41 | data[BUTTON_VEL2] = "2"; 42 | data[BUTTON_VEL4] = "4"; 43 | data[BUTTON_VEL8] = "8"; 44 | data[BUTTON_DOTS] = "DOTS"; 45 | data[BUTTON_FIN] = "FIN"; 46 | return data; 47 | } 48 | 49 | static void DrawMenuBar(CDC* dc, CRadarScreen* radarScreen, POINT TopLeft, POINT MousePt, map ButtonData, map PressedData) { 50 | int LeftOffset = TopLeft.x; 51 | CRect r; 52 | for (auto kv : ButtonData) { 53 | r = DrawMenuBarButton(dc, { LeftOffset, TopLeft.y }, kv.second, MousePt, PressedData[kv.first]); 54 | LeftOffset += r.Width(); 55 | radarScreen->AddScreenObject(kv.first, "", r, false, ""); 56 | 57 | // If the menu is hidden, we stop at the first button 58 | if (PressedData[BUTTON_HIDEMENU]) 59 | break; 60 | } 61 | }; 62 | 63 | static CRect DrawMenuBarButton(CDC* dc, POINT TopLeft, string Text, POINT MousePt, bool Pressed) { 64 | CBrush ButtonBackground(Colours::DarkBlueMenu.ToCOLORREF()); 65 | CBrush ButtonPressedBackground(Colours::LightBlueMenu.ToCOLORREF()); 66 | CPen YellowPen(PS_SOLID, 1, Colours::YellowHighlight.ToCOLORREF()); 67 | 68 | // We need to calculate the size of the button according to the text fitting 69 | CSize TextSize = dc->GetTextExtent(Text.c_str()); 70 | 71 | int Width = TextSize.cx + ButtonPaddingSides * 2; 72 | int Height = TextSize.cy + ButtonPaddingTop * 2; 73 | 74 | CRect Button(TopLeft.x, TopLeft.y, TopLeft.x + Width, TopLeft.y + Height); 75 | 76 | if (!Pressed) 77 | dc->FillSolidRect(Button, Colours::DarkBlueMenu.ToCOLORREF()); 78 | else 79 | dc->FillSolidRect(Button, Colours::LightBlueMenu.ToCOLORREF()); 80 | 81 | dc->Draw3dRect(TopLeft.x, TopLeft.y, Width, Height, Colours::MenuButtonTop.ToCOLORREF(), Colours::MenuButtonBottom.ToCOLORREF()); 82 | 83 | if (IsInRect(MousePt, Button)) { 84 | dc->SelectStockObject(NULL_BRUSH); 85 | dc->SelectObject(&YellowPen); 86 | dc->Rectangle(Button); 87 | } 88 | 89 | // Text Draw 90 | if (!Pressed) 91 | dc->SetTextColor(Colours::GreyTextMenu.ToCOLORREF()); 92 | else 93 | dc->SetTextColor(Colours::DarkBlueMenu.ToCOLORREF()); 94 | 95 | dc->TextOutA(TopLeft.x + ButtonPaddingSides, TopLeft.y + ButtonPaddingTop, Text.c_str()); 96 | 97 | return Button; 98 | }; 99 | 100 | static map ResetAllVelButtons(map Data) { 101 | Data[BUTTON_VEL1] = false; Data[BUTTON_VEL2] = false; Data[BUTTON_VEL4] = false; Data[BUTTON_VEL8] = false; 102 | return Data; 103 | } 104 | 105 | static int GetVelValueButtonPressed(map Data) { 106 | if (Data[BUTTON_VEL1]) 107 | return 60; 108 | if (Data[BUTTON_VEL2]) 109 | return 60*2; 110 | if (Data[BUTTON_VEL4]) 111 | return 60*4; 112 | if (Data[BUTTON_VEL8]) 113 | return 60*8; 114 | return 0; 115 | } 116 | 117 | static map LoadVelValueToButtons(int value, map Data) { 118 | Data = ResetAllVelButtons(Data); 119 | if (value == 60) 120 | Data[BUTTON_VEL1] = true; 121 | if (value == 60*2) 122 | Data[BUTTON_VEL2] = true; 123 | if (value == 60*4) 124 | Data[BUTTON_VEL4] = true; 125 | if (value == 60*8) 126 | Data[BUTTON_VEL8] = true; 127 | 128 | return Data; 129 | } 130 | }; -------------------------------------------------------------------------------- /MUAC/PopoutMenu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "Constants.h" 5 | #include "Colours.h" 6 | #include 7 | #include 8 | #include 9 | #include "EuroScopePlugIn.h" 10 | 11 | using namespace std; 12 | using namespace EuroScopePlugIn; 13 | 14 | class PopoutMenu 15 | { 16 | private: 17 | string title; 18 | 19 | 20 | map Buttons; 21 | public: 22 | static struct PopoutMenuButtonTypes { 23 | 24 | }; 25 | 26 | PopoutMenu(string title) { 27 | 28 | }; 29 | 30 | void Draw() { 31 | 32 | }; 33 | 34 | } -------------------------------------------------------------------------------- /MUAC/RadarScreen.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "RadarScreen.h" 3 | 4 | //ULONG_PTR m_gdiplusToken; 5 | 6 | RadarScreen::RadarScreen() 7 | { 8 | // Initialize GDI+ 9 | //GdiplusStartupInput gdiplusStartupInput; 10 | //GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, nullptr); 11 | 12 | // Initialize the Menu Bar 13 | MenuButtons = MenuBar::MakeButtonData(); 14 | StcaInstance = new CSTCA(); 15 | MtcdInstance = new CMTCD(); 16 | 17 | MTCDWindow = new CMTCDWindow({ 500, 200 }); 18 | FIMWindow = new CFIMWindow({500, 500}); 19 | 20 | OneSecondTimer = clock(); 21 | HalfSecondTimer = clock(); 22 | LoadAllData(); 23 | } 24 | 25 | RadarScreen::~RadarScreen() 26 | { 27 | //GdiplusShutdown(m_gdiplusToken); 28 | } 29 | 30 | void RadarScreen::LoadAllData() 31 | { 32 | ButtonsPressed[BUTTON_VEL1] = true; 33 | ButtonsPressed[BUTTON_FILTER_ON] = true; 34 | ButtonsPressed[BUTTON_VELOTH] = true; 35 | ButtonsPressed[BUTTON_PRIMARY_TARGETS_ON] = true; 36 | ButtonsPressed[BUTTON_DOTS] = true; 37 | ButtonsPressed[BUTTON_MTCD] = true; 38 | ButtonsPressed[BUTTON_FIM] = true; 39 | 40 | LoadFilterButtonsData(); 41 | } 42 | 43 | void RadarScreen::LoadFilterButtonsData() 44 | { 45 | MenuButtons[BUTTON_FILTER_HARD_LOW] = to_string(RadarFilters.Hard_Low / 100) + string(" ="); 46 | MenuButtons[BUTTON_FILTER_SOFT_LOW] = to_string(RadarFilters.Soft_Low / 100) + string(" ="); 47 | MenuButtons[BUTTON_FILTER_SOFT_HIGH] = to_string(RadarFilters.Soft_High / 100) + string(" ="); 48 | MenuButtons[BUTTON_FILTER_HARD_HIGH] = to_string(RadarFilters.Hard_High / 100) + string(" ="); 49 | } 50 | 51 | void RadarScreen::OnRefresh(HDC hDC, int Phase) 52 | { 53 | if (Phase != REFRESH_PHASE_AFTER_TAGS && Phase != REFRESH_PHASE_BEFORE_TAGS) 54 | return; 55 | 56 | // Mouse Pointer 57 | POINT p; 58 | if (GetCursorPos(&p)) { 59 | if (ScreenToClient(GetActiveWindow(), &p)) { 60 | MousePoint = p; 61 | } 62 | } 63 | 64 | // Setup gdi renderer 65 | CDC dc; 66 | dc.Attach(hDC); 67 | 68 | // Creating the gdi+ graphics 69 | Graphics graphics(hDC); 70 | graphics.SetPageUnit(UnitPixel); 71 | graphics.SetSmoothingMode(SmoothingModeAntiAlias); 72 | 73 | CRect RadarArea(GetRadarArea()); 74 | RadarArea.top = RadarArea.top - 1; 75 | RadarArea.bottom = GetChatArea().bottom; 76 | 77 | if (Phase == REFRESH_PHASE_BEFORE_TAGS) { 78 | 79 | // One second actions 80 | double t = (double)(clock() - OneSecondTimer) / ((double)CLOCKS_PER_SEC); 81 | if (t >= 1) { 82 | //StcaInstance->OnRefresh(GetPlugIn()); 83 | //MtcdInstance->OnRefresh(GetPlugIn()); 84 | OneSecondTimer = clock(); 85 | } 86 | 87 | t = (double)(clock() - HalfSecondTimer) / ((double)CLOCKS_PER_SEC); 88 | if (t >= 0.5) { 89 | Blink = !Blink; 90 | HalfSecondTimer = clock(); 91 | } 92 | // 93 | 94 | int saveTool = dc.SaveDC(); 95 | 96 | TagAreas.clear(); 97 | SoftTagAreas.clear(); 98 | 99 | 100 | 101 | FontManager::SelectStandardFont(&dc); 102 | 103 | // 104 | // Starting with tools 105 | // 106 | 107 | CPen QDMToolPen(PS_SOLID, 1, Colours::BlueTool.ToCOLORREF()); 108 | CPen SepToolColorPen(PS_SOLID, 1, Colours::OrangeTool.ToCOLORREF()); 109 | 110 | // 111 | // Active VERA 112 | // 113 | 114 | if (AcquiringSepTool != "") { 115 | dc.SelectObject(&SepToolColorPen); 116 | dc.SetTextColor(Colours::OrangeTool.ToCOLORREF()); 117 | 118 | CPosition ActivePosition = GetPlugIn()->RadarTargetSelect(AcquiringSepTool.c_str()).GetPosition().GetPosition(); 119 | 120 | if (GetPlugIn()->RadarTargetSelect(AcquiringSepTool.c_str()).GetPosition().IsValid()) { 121 | POINT ActivePositionPoint = ConvertCoordFromPositionToPixel(ActivePosition); 122 | 123 | dc.MoveTo(ActivePositionPoint); 124 | dc.LineTo(MousePoint); 125 | 126 | string headingText = padWithZeros(3, (int)ActivePosition.DirectionTo(ConvertCoordFromPixelToPosition(MousePoint))); 127 | 128 | string distanceText = to_string(ActivePosition.DistanceTo(ConvertCoordFromPixelToPosition(MousePoint))); 129 | size_t decimal_pos = distanceText.find("."); 130 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 131 | 132 | POINT TextPositon = { MousePoint.x + 15, MousePoint.y }; 133 | dc.TextOutA(TextPositon.x, TextPositon.y, string(headingText + "/" + distanceText).c_str()); 134 | 135 | CRect ellipsePointer = { MousePoint.x - 4, MousePoint.y - 4, MousePoint.x + 4, MousePoint.y + 4 }; 136 | graphics.DrawEllipse(&Pen(Color::White), RectToGdiplus(ellipsePointer)); 137 | ellipsePointer.InflateRect(4, 4); 138 | graphics.DrawEllipse(&Pen(Color::White), RectToGdiplus(ellipsePointer)); 139 | } 140 | 141 | RequestRefresh(); 142 | } 143 | 144 | // 145 | // Fixed QDM 146 | // 147 | 148 | if (FixedQDMTool != "") { 149 | dc.SelectObject(&QDMToolPen); 150 | dc.SetTextColor(Colours::BlueTool.ToCOLORREF()); 151 | 152 | CPosition ActivePosition = GetPlugIn()->RadarTargetSelect(FixedQDMTool.c_str()).GetPosition().GetPosition(); 153 | 154 | if (GetPlugIn()->RadarTargetSelect(FixedQDMTool.c_str()).GetPosition().IsValid()) { 155 | POINT ActivePositionPoint = ConvertCoordFromPositionToPixel(ActivePosition); 156 | 157 | dc.MoveTo(ActivePositionPoint); 158 | dc.LineTo(MousePoint); 159 | 160 | string headingText = padWithZeros(3, (int)ActivePosition.DirectionTo(ConvertCoordFromPixelToPosition(MousePoint))); 161 | 162 | string distanceText = to_string(ActivePosition.DistanceTo(ConvertCoordFromPixelToPosition(MousePoint))); 163 | size_t decimal_pos = distanceText.find("."); 164 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 165 | 166 | POINT TextPositon = { MousePoint.x + 15, MousePoint.y }; 167 | dc.TextOutA(TextPositon.x, TextPositon.y, string(headingText + "/" + distanceText).c_str()); 168 | } 169 | 170 | RequestRefresh(); 171 | } 172 | 173 | // 174 | // Variable QDM 175 | // 176 | 177 | if (ButtonsPressed[BUTTON_QDM]) { 178 | dc.SelectObject(&QDMToolPen); 179 | dc.SetTextColor(Colours::BlueTool.ToCOLORREF()); 180 | 181 | // 182 | // Add clickable background area 183 | // 184 | CRect R(GetRadarArea()); 185 | R.top += 50; 186 | R.bottom = GetChatArea().top; 187 | 188 | R.NormalizeRect(); 189 | AddScreenObject(SCREEN_BACKGROUND, "", R, false, ""); 190 | 191 | if (VariableQDMAcquisition.x != 0 && VariableQDMAcquisition.y != 0) { 192 | CPosition SelectedFirstPosition = ConvertCoordFromPixelToPosition(VariableQDMAcquisition); 193 | 194 | dc.MoveTo(VariableQDMAcquisition); 195 | dc.LineTo(MousePoint); 196 | 197 | string headingText = padWithZeros(3, (int)SelectedFirstPosition.DirectionTo(ConvertCoordFromPixelToPosition(MousePoint))); 198 | 199 | string distanceText = to_string(SelectedFirstPosition.DistanceTo(ConvertCoordFromPixelToPosition(MousePoint))); 200 | size_t decimal_pos = distanceText.find("."); 201 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 202 | 203 | POINT TextPositon = { MousePoint.x + 15, MousePoint.y }; 204 | dc.TextOutA(TextPositon.x, TextPositon.y, string(headingText + "/" + distanceText).c_str()); 205 | } 206 | 207 | RequestRefresh(); 208 | } 209 | 210 | 211 | // 212 | // Existing VERA 213 | // 214 | 215 | dc.SelectObject(&SepToolColorPen); 216 | dc.SetTextColor(Colours::OrangeTool.ToCOLORREF()); 217 | 218 | for (auto kv : SepToolPairs) { 219 | CRadarTarget FirstTarget = GetPlugIn()->RadarTargetSelect(kv.first.c_str()); 220 | CRadarTarget SecondTarget = GetPlugIn()->RadarTargetSelect(kv.second.c_str()); 221 | 222 | if (FirstTarget.IsValid() && SecondTarget.IsValid()) { 223 | CPosition FirstTargetPos = FirstTarget.GetPosition().GetPosition(); 224 | CPosition SecondTargetPos = SecondTarget.GetPosition().GetPosition(); 225 | 226 | POINT FirstPos = ConvertCoordFromPositionToPixel(FirstTargetPos); 227 | POINT SecondPos = ConvertCoordFromPositionToPixel(SecondTargetPos); 228 | 229 | dc.MoveTo(FirstPos); 230 | dc.LineTo(SecondPos); 231 | 232 | // First the distance tool 233 | 234 | string headingText = padWithZeros(3, (int)FirstTargetPos.DirectionTo(SecondTargetPos)); 235 | 236 | string distanceText = to_string(FirstTargetPos.DistanceTo(SecondTargetPos)); 237 | size_t decimal_pos = distanceText.find("."); 238 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 239 | 240 | distanceText = headingText + "/" + distanceText; 241 | 242 | POINT MidPointDistance = { (int)((FirstPos.x + SecondPos.x) / 2), (int)((FirstPos.y + SecondPos.y) / 2) }; 243 | 244 | CSize Measure = dc.GetTextExtent(distanceText.c_str()); 245 | 246 | // We have to calculate the text angle 247 | double AdjustedLineHeading = fmod(FirstTargetPos.DirectionTo(SecondTargetPos) - 90.0, 360.0); 248 | double NewAngle = fmod(AdjustedLineHeading + 90, 360); 249 | 250 | if (FirstTargetPos.DirectionTo(SecondTargetPos) > 180.0) { 251 | NewAngle = fmod(AdjustedLineHeading - 90, 360); 252 | } 253 | 254 | POINT TextPositon; 255 | TextPositon.x = long(MidPointDistance.x + float((20+Measure.cx) * cos(DegToRad(NewAngle)))); 256 | TextPositon.y = long(MidPointDistance.y + float((20)* sin(DegToRad(NewAngle)))); 257 | 258 | TextPositon.x -= Measure.cx / 2; 259 | 260 | dc.TextOutA(TextPositon.x, TextPositon.y, distanceText.c_str()); 261 | 262 | CRect AreaRemoveTool = { TextPositon.x, TextPositon.y, TextPositon.x + Measure.cx, TextPositon.y + Measure.cy }; 263 | 264 | VERA::VERADataStruct vera = VERA::Calculate(FirstTarget, SecondTarget); 265 | 266 | if (vera.minDistanceNm != -1) { 267 | CPosition velocity = Extrapolate(vera.predictedFirstPos, FirstTarget.GetTrackHeading(), 268 | FirstTarget.GetPosition().GetReportedGS()*0.514444*MenuBar::GetVelValueButtonPressed(ButtonsPressed)); 269 | DrawHourGlassWithLeader(&dc, ConvertCoordFromPositionToPixel(vera.predictedFirstPos), 270 | ConvertCoordFromPositionToPixel(velocity)); 271 | 272 | velocity = Extrapolate(vera.predictedSecondPos, SecondTarget.GetTrackHeading(), 273 | SecondTarget.GetPosition().GetReportedGS()*0.514444*MenuBar::GetVelValueButtonPressed(ButtonsPressed)); 274 | DrawHourGlassWithLeader(&dc, ConvertCoordFromPositionToPixel(vera.predictedSecondPos), 275 | ConvertCoordFromPositionToPixel(velocity)); 276 | 277 | distanceText = to_string(vera.minDistanceNm); 278 | decimal_pos = distanceText.find("."); 279 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 280 | 281 | distanceText = to_string((int)vera.minDistanceSeconds / 60) + "'" + 282 | to_string((int)vera.minDistanceSeconds % 60) + '"' + "/" + distanceText; 283 | dc.TextOutA(TextPositon.x, TextPositon.y + Measure.cy, distanceText.c_str()); 284 | } 285 | 286 | AreaRemoveTool.right = max(AreaRemoveTool.right, TextPositon.x + Measure.cx); 287 | AreaRemoveTool.bottom = TextPositon.y + Measure.cy * 2; 288 | 289 | POINT ClipFrom, ClipTo; 290 | if (LiangBarsky(AreaRemoveTool, MidPointDistance, AreaRemoveTool.CenterPoint(), ClipFrom, ClipTo)) { 291 | CPen DashedPen(PS_DOT, 1, Colours::OrangeTool.ToCOLORREF()); 292 | dc.SelectObject(&DashedPen); 293 | 294 | dc.MoveTo(MidPointDistance); 295 | dc.LineTo(ClipFrom); 296 | 297 | dc.SelectObject(&SepToolColorPen); 298 | } 299 | 300 | AddScreenObject(SCREEN_SEP_TOOL, string(kv.first + "," + kv.second).c_str(), AreaRemoveTool, false, ""); 301 | } 302 | } 303 | 304 | // 305 | // Existing VariableQDM 306 | // 307 | 308 | dc.SelectObject(&QDMToolPen); 309 | dc.SetTextColor(Colours::BlueTool.ToCOLORREF()); 310 | 311 | for (auto kv : VariableQDMs) { 312 | POINT FirstPositionPix = ConvertCoordFromPositionToPixel(kv.second.first); 313 | POINT SecondPositionPix = ConvertCoordFromPositionToPixel(kv.second.second); 314 | 315 | dc.MoveTo(FirstPositionPix); 316 | dc.LineTo(SecondPositionPix); 317 | 318 | string headingText = padWithZeros(3, (int)kv.second.first.DirectionTo(kv.second.second)); 319 | 320 | string distanceText = to_string(kv.second.first.DistanceTo(kv.second.second)); 321 | size_t decimal_pos = distanceText.find("."); 322 | distanceText = distanceText.substr(0, decimal_pos + 2) + "nm"; 323 | 324 | POINT TextPositon = { SecondPositionPix.x + 15, SecondPositionPix.y }; 325 | dc.TextOutA(TextPositon.x, TextPositon.y, string(headingText + "/" + distanceText).c_str()); 326 | 327 | CSize Measure = dc.GetTextExtent(distanceText.c_str()); 328 | CRect AreaRemoveTool = { TextPositon.x, TextPositon.y, TextPositon.x + Measure.cx, TextPositon.y + Measure.cy }; 329 | 330 | AddScreenObject(SCREEN_QDM_TOOL, to_string(kv.first).c_str(), AreaRemoveTool, false, ""); 331 | } 332 | 333 | 334 | // 335 | // Existing variable QDMs 336 | // 337 | 338 | 339 | dc.RestoreDC(saveTool); 340 | 341 | // 342 | // Here we check to see if there is a detailed tag 343 | // 344 | if (mouseOverTag.size() > 0) { 345 | 346 | // We check the mouse is still in the tag 347 | if (IsInRect(MousePoint, mouseOverArea)) { 348 | clock_t clock_final = clock() - mouseOverTagTimer; 349 | double delta_t = (double)clock_final / ((double)CLOCKS_PER_SEC); 350 | if (delta_t > 0.1) { 351 | DetailedTag = mouseOverTag; 352 | mouseOverTag = ""; 353 | 354 | CRadarTarget rt = GetPlugIn()->RadarTargetSelect(DetailedTag.c_str()); 355 | 356 | if (rt.IsValid() && rt.GetPosition().GetRadarFlags() > RADAR_POSITION_PRIMARY && rt.GetCorrelatedFlightPlan().IsValid()) { 357 | GetPlugIn()->SetASELAircraft(rt.GetCorrelatedFlightPlan()); 358 | } 359 | else if (rt.IsValid()) { 360 | GetPlugIn()->SetASELAircraft(rt); 361 | } 362 | } 363 | } 364 | else { 365 | mouseOverTag = ""; 366 | } 367 | 368 | // If we still have a mouseOverTag to handle, we refresh ASAP to determine it 369 | if (mouseOverTag.size() >0) 370 | RequestRefresh(); 371 | } 372 | } 373 | 374 | for (CRadarTarget radarTarget = GetPlugIn()->RadarTargetSelectFirst(); radarTarget.IsValid(); 375 | radarTarget = GetPlugIn()->RadarTargetSelectNext(radarTarget)) 376 | { 377 | CFlightPlan CorrelatedFlightPlan = radarTarget.GetCorrelatedFlightPlan(); 378 | bool isCorrelated = CorrelatedFlightPlan.IsValid(); 379 | int Altitude = radarTarget.GetPosition().GetFlightLevel(); 380 | POINT radarTargetPoint = ConvertCoordFromPositionToPixel(radarTarget.GetPosition().GetPosition()); 381 | 382 | TagConfiguration::TagStates AcState = TagConfiguration::TagStates::NotConcerned; 383 | 384 | bool IsSoft = false; 385 | bool IsPrimary = !radarTarget.GetPosition().GetTransponderC() && !radarTarget.GetPosition().GetTransponderI(); 386 | 387 | bool HideTarget = false; 388 | 389 | // If is below 60kts, don't show 390 | if (radarTarget.GetPosition().GetReportedGS() < 60) 391 | HideTarget = true; 392 | 393 | // 394 | // Filtering 395 | // 396 | if (ButtonsPressed[BUTTON_FILTER_ON]) { 397 | 398 | // If not in between the hard filters, we don't show it. 399 | if (Altitude <= RadarFilters.Hard_Low && !IsPrimary) 400 | HideTarget = true; 401 | 402 | if (Altitude >= RadarFilters.Hard_High && !IsPrimary) 403 | HideTarget = true; 404 | 405 | // If Primary 406 | if (IsPrimary && !ButtonsPressed[BUTTON_PRIMARY_TARGETS_ON]) 407 | HideTarget = true; 408 | 409 | // If VFR 410 | if (startsWith("7000", radarTarget.GetPosition().GetSquawk()) && !ButtonsPressed[BUTTON_VFR_ON] && !IsPrimary) 411 | HideTarget = true; 412 | 413 | if (isCorrelated && startsWith("V", CorrelatedFlightPlan.GetFlightPlanData().GetPlanType()) && !ButtonsPressed[BUTTON_VFR_ON] && !IsPrimary) 414 | HideTarget = true; 415 | 416 | if (Altitude <= RadarFilters.Soft_Low || Altitude >= RadarFilters.Soft_High) 417 | IsSoft = true; 418 | } 419 | 420 | bool isDetailed = DetailedTag == radarTarget.GetCallsign(); 421 | 422 | // Determining the tag state 423 | if (isCorrelated) { 424 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_NOTIFIED) 425 | AcState = TagConfiguration::TagStates::InSequence; 426 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_COORDINATED) 427 | AcState = TagConfiguration::TagStates::Next; 428 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_TRANSFER_TO_ME_INITIATED) 429 | AcState = TagConfiguration::TagStates::TransferredToMe; 430 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_TRANSFER_FROM_ME_INITIATED) 431 | AcState = TagConfiguration::TagStates::TransferredFromMe; 432 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_ASSUMED) 433 | AcState = TagConfiguration::TagStates::Assumed; 434 | if (CorrelatedFlightPlan.GetState() == FLIGHT_PLAN_STATE_REDUNDANT) 435 | AcState = TagConfiguration::TagStates::Redundant; 436 | } 437 | else{ 438 | AcState = TagConfiguration::TagStates::Uncorrelated; 439 | } 440 | 441 | if (IsPrimary) { 442 | AcState = TagConfiguration::TagStates::NotConcerned; 443 | IsSoft = false; 444 | } 445 | 446 | // if in a state that needs to force filters 447 | if (AcState == TagConfiguration::TagStates::Redundant || AcState == TagConfiguration::TagStates::TransferredFromMe || 448 | AcState == TagConfiguration::TagStates::TransferredToMe) { 449 | IsSoft = false; 450 | HideTarget = false; 451 | } 452 | 453 | // In topdown mode, assumed traffic can be hidden by filters to facilitate topdown control 454 | if (AcState == TagConfiguration::TagStates::Assumed && !ButtonsPressed[BUTTON_TOPDOWN]) { 455 | IsSoft = false; 456 | HideTarget = false; 457 | } 458 | 459 | 460 | // 461 | // Final decision 462 | // 463 | if (HideTarget) 464 | continue; 465 | 466 | #pragma region BeforeTags 467 | 468 | if (Phase == REFRESH_PHASE_BEFORE_TAGS) { 469 | if (!IsPrimary) { 470 | CRect r = AcSymbols::DrawSquareAndTrail(&dc, AcState, this, radarTarget, ButtonsPressed[BUTTON_DOTS], 471 | IsSoft, StcaInstance->IsSTCA(radarTarget.GetCallsign()), Blink, isDetailed); 472 | AddScreenObject(SCREEN_AC_SYMBOL, radarTarget.GetCallsign(), r, true, GetPlugIn()->FlightPlanSelect(radarTarget.GetCallsign()).GetPilotName()); 473 | } 474 | else { 475 | CRect r = AcSymbols::DrawPrimaryTrailAndDiamong(&dc, this, radarTarget, ButtonsPressed[BUTTON_DOTS]); 476 | AddScreenObject(SCREEN_AC_SYMBOL, radarTarget.GetCallsign(), r, true, GetPlugIn()->FlightPlanSelect(radarTarget.GetCallsign()).GetPilotName()); 477 | } 478 | 479 | if ((IsPrimary || !isCorrelated) && ButtonsPressed[BUTTON_VELOTH]) { 480 | AcSymbols::DrawSpeedVector(&dc, AcState, this, radarTarget, IsPrimary, IsSoft, MenuBar::GetVelValueButtonPressed(ButtonsPressed)); 481 | } 482 | else if (!IsPrimary && isCorrelated) { 483 | AcSymbols::DrawSpeedVector(&dc, AcState, this, radarTarget, IsPrimary, IsSoft, MenuBar::GetVelValueButtonPressed(ButtonsPressed)); 484 | } 485 | 486 | 487 | // If final approach help is toggled, display the vectors 488 | if (!IsPrimary && isCorrelated && ButtonsPressed[BUTTON_FIN]) { 489 | if (CorrelatedFlightPlan.GetControllerAssignedData().GetClearedAltitude() == 1) { 490 | bool existsInList = find(ExtendedAppVector.begin(), ExtendedAppVector.end(), string(radarTarget.GetCallsign())) != ExtendedAppVector.end(); 491 | CRect r = AcSymbols::DrawApproachVector(&dc, this, radarTarget, existsInList ? 5 : 3); 492 | AddScreenObject(SCREEN_AC_APP_ARROW, radarTarget.GetCallsign(), r, true, ""); 493 | } 494 | } 495 | } 496 | 497 | #pragma endregion 498 | 499 | #pragma region AfterTags 500 | 501 | if (Phase == REFRESH_PHASE_AFTER_TAGS) { 502 | // Draw the tag 503 | 504 | if (IsPrimary) 505 | continue; 506 | 507 | Tag t = Tag(AcState, isDetailed, IsSoft, ButtonsPressed[BUTTON_MODE_A], 508 | ButtonsPressed[BUTTON_LABEL_V], ButtonsPressed[BUTTON_TOPDOWN], this, MtcdInstance, radarTarget, radarTarget.GetCorrelatedFlightPlan()); 509 | 510 | // Getting the tag center 511 | if (TagOffsets.find(radarTarget.GetCallsign()) == TagOffsets.end()) 512 | TagOffsets[radarTarget.GetCallsign()] = { 25, -50 }; 513 | 514 | map DetailedTagData; 515 | 516 | RECT r = TagRenderer::Render(&dc, MousePoint, TagOffsets[radarTarget.GetCallsign()], radarTargetPoint, 517 | t, isDetailed, StcaInstance->IsSTCA(radarTarget.GetCallsign()), MtcdInstance->IsMTCD(radarTarget.GetCallsign()), 518 | &DetailedTagData); 519 | 520 | RECT SymbolArea = { radarTargetPoint.x - DRAWING_AC_SQUARE_SYMBOL_SIZE, radarTargetPoint.y - DRAWING_AC_SQUARE_SYMBOL_SIZE, 521 | radarTargetPoint.x + DRAWING_AC_SQUARE_SYMBOL_SIZE, radarTargetPoint.y + DRAWING_AC_SQUARE_SYMBOL_SIZE }; 522 | 523 | // We check if the tag is still detailed 524 | if ((!IsInRect(MousePoint, r) && !IsInRect(MousePoint, SymbolArea)) && DetailedTag == radarTarget.GetCallsign()) 525 | DetailedTag = ""; 526 | 527 | // Check if route over is still drawn 528 | if (!IsInRect(MousePoint, RouteDisplayMouseOverArea) && RouteDisplayMouseOver == radarTarget.GetCallsign()) 529 | RouteDisplayMouseOver = ""; 530 | 531 | // Store the tag for tag deconfliction 532 | if (!isDetailed) { 533 | if (IsSoft) 534 | SoftTagAreas[radarTarget.GetCallsign()] = r; 535 | else 536 | TagAreas[radarTarget.GetCallsign()] = r; 537 | } 538 | 539 | 540 | // We add the screen rect 541 | AddScreenObject(SCREEN_TAG, radarTarget.GetCallsign(), r, true, GetPlugIn()->FlightPlanSelect(radarTarget.GetCallsign()).GetPilotName()); 542 | 543 | // If detailed we add the screen objects 544 | if (isDetailed) { 545 | for (auto kv : DetailedTagData) { 546 | const char* callsignToCallActions = radarTarget.GetCallsign(); 547 | if (isCorrelated) 548 | callsignToCallActions = CorrelatedFlightPlan.GetCallsign(); 549 | AddScreenObject(kv.first, callsignToCallActions, kv.second, false, GetPlugIn()->FlightPlanSelect(radarTarget.GetCallsign()).GetPilotName()); 550 | } 551 | } 552 | 553 | // If the route is shown, then we display it 554 | if (find(RouteBeingShown.begin(), RouteBeingShown.end(), radarTarget.GetCallsign()) != RouteBeingShown.end()) { 555 | RouteRenderer::Render(&dc, this, radarTarget, CorrelatedFlightPlan); 556 | } else if (RouteDisplayMouseOver == radarTarget.GetCallsign()) { 557 | RouteRenderer::Render(&dc, this, radarTarget, CorrelatedFlightPlan); 558 | } 559 | } 560 | 561 | #pragma endregion 562 | } 563 | 564 | if (Phase == REFRESH_PHASE_AFTER_TAGS) { 565 | // Update certain menubar values first 566 | CPosition TopLeft, BottomRight; 567 | GetDisplayArea(&TopLeft, &BottomRight); 568 | int range = (int)TopLeft.DistanceTo(BottomRight); 569 | range = ((range + 10 / 2) / 10) * 10; 570 | MenuButtons[BUTTON_RANGE] = to_string(range) + " ="; 571 | 572 | // Menubar 573 | MenuBar::DrawMenuBar(&dc, this, { RadarArea.left, RadarArea.top + 1 }, MousePoint, MenuButtons, ButtonsPressed); 574 | 575 | CRadarTarget fimRt = GetPlugIn()->RadarTargetSelectASEL(); 576 | CFlightPlan fimFp = fimRt.GetCorrelatedFlightPlan(); 577 | 578 | // FIM Window 579 | FIMWindow->Render(&dc, this, MousePoint, fimRt, fimFp, ButtonsPressed[BUTTON_FIM]); 580 | 581 | // MTCD Window 582 | MTCDWindow->Render(&dc, this, MousePoint, MtcdInstance, SepToolPairs, ButtonsPressed[BUTTON_MTCD]); 583 | 584 | // Soft Tag deconfliction 585 | /*for (const auto areas : SoftTagAreas) 586 | { 587 | if (areas.first == DetailedTag) 588 | continue; 589 | 590 | CRadarTarget rt = GetPlugIn()->RadarTargetSelect(areas.first.c_str()); 591 | POINT AcPosition = ConvertCoordFromPositionToPixel(rt.GetPosition().GetPosition()); 592 | 593 | // If the tag has recently been automatically moved, then we don't move it 594 | if (RecentlyAutoMovedTags.find(areas.first) != RecentlyAutoMovedTags.end()) 595 | { 596 | double t = (double)(clock() - RecentlyAutoMovedTags[areas.first]) / ((double)CLOCKS_PER_SEC); 597 | if (t >= 4) 598 | RecentlyAutoMovedTags.erase(areas.first); 599 | else 600 | continue; 601 | } 602 | 603 | CRect OriginalArea = areas.second; 604 | 605 | /POINT newOffset = AntiOverlap::Execute(this, SoftTagAreas, TagOffsets, MenuBar::GetVelValueButtonPressed(ButtonsPressed), rt); 606 | 607 | if (newOffset.x != TagOffsets[rt.GetCallsign()].x && newOffset.y != TagOffsets[rt.GetCallsign()].y) { 608 | TagOffsets[areas.first] = newOffset; 609 | SoftTagAreas[areas.first] = { newOffset.x, newOffset.y, newOffset.x + OriginalArea.Size().cx, newOffset.y + OriginalArea.Size().cy }; 610 | RecentlyAutoMovedTags[areas.first] = clock(); 611 | } 612 | }*/ 613 | 614 | // Tag deconfliction 615 | for (const auto areas : TagAreas) 616 | { 617 | if (areas.first == DetailedTag) 618 | continue; 619 | 620 | CRadarTarget rt = GetPlugIn()->RadarTargetSelect(areas.first.c_str()); 621 | POINT AcPosition = ConvertCoordFromPositionToPixel(rt.GetPosition().GetPosition()); 622 | 623 | // If the tag has recently been automatically moved, then we don't move it 624 | if (RecentlyAutoMovedTags.find(areas.first) != RecentlyAutoMovedTags.end()) 625 | { 626 | double t = (double)(clock() - RecentlyAutoMovedTags[areas.first]) / ((double)CLOCKS_PER_SEC); 627 | if (t >= 4) 628 | RecentlyAutoMovedTags.erase(areas.first); 629 | else 630 | continue; 631 | } 632 | 633 | CRect OriginalArea = areas.second; 634 | // 635 | // TEST 636 | // 637 | 638 | /*int saveTest = dc.SaveDC(); 639 | 640 | CPen PurplePen(PS_SOLID, 1, Colours::PurpleDisplay.ToCOLORREF()); 641 | dc.SelectObject(&PurplePen); 642 | dc.SelectStockObject(NULL_BRUSH); 643 | dc.SetTextColor(Colours::PurpleDisplay.ToCOLORREF()); 644 | 645 | int TileWidth = OriginalArea.Size().cx + (int)(OriginalArea.Size().cx*0.20); 646 | int TileHeight = OriginalArea.Size().cy + (int)(OriginalArea.Size().cy*0.05); 647 | 648 | map testingGrid = AntiOverlap::BuildGrid(AcPosition, TileWidth, TileHeight); 649 | map gridCost = AntiOverlap::CalculateGridCost(this, TagAreas, TagOffsets, testingGrid, MenuBar::GetVelValueButtonPressed(ButtonsPressed), rt); 650 | 651 | for (auto testGridkv : testingGrid) { 652 | dc.Rectangle(testGridkv.second); 653 | string str = to_string(testGridkv.first); 654 | str += " " +to_string(gridCost[testGridkv.first]); 655 | 656 | dc.TextOutA(testGridkv.second.left, testGridkv.second.top, str.c_str()); 657 | } 658 | 659 | dc.RestoreDC(saveTest);*/ 660 | // END TEST 661 | 662 | //POINT newOffset = AntiOverlap::Execute(this, TagAreas, TagOffsets, MenuBar::GetVelValueButtonPressed(ButtonsPressed), rt); 663 | 664 | /*if (newOffset.x != TagOffsets[rt.GetCallsign()].x && newOffset.y != TagOffsets[rt.GetCallsign()].y) { 665 | TagOffsets[areas.first] = newOffset; 666 | TagAreas[areas.first] = { newOffset.x, newOffset.y, newOffset.x + OriginalArea.Size().cx, newOffset.y + OriginalArea.Size().cy }; 667 | RecentlyAutoMovedTags[areas.first] = clock(); 668 | }*/ 669 | } 670 | } 671 | 672 | // Releasing the handle 673 | dc.Detach(); 674 | } 675 | 676 | void RadarScreen::OnMoveScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, bool Released) 677 | { 678 | MousePoint = Pt; 679 | if (ObjectType == SCREEN_TAG) { 680 | POINT AcPosPix = ConvertCoordFromPositionToPixel(GetPlugIn()->RadarTargetSelect(sObjectId).GetPosition().GetPosition()); 681 | POINT CustomTag = { Area.left - AcPosPix.x, Area.top - AcPosPix.y }; 682 | TagOffsets[sObjectId] = CustomTag; 683 | if (!Released) 684 | DetailedTag = sObjectId; 685 | } 686 | 687 | if (ObjectType == SCREEN_AC_SYMBOL) { 688 | FixedQDMTool = sObjectId; 689 | if (Released) 690 | FixedQDMTool = ""; 691 | } 692 | 693 | if (ObjectType == FIM_WINDOW) { 694 | FIMWindow->Move(Area, Released); 695 | } 696 | 697 | if (ObjectType == MTCD_WINDOW) { 698 | MTCDWindow->Move(Area, Released); 699 | } 700 | 701 | RequestRefresh(); 702 | } 703 | 704 | void RadarScreen::OnOverScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area) 705 | { 706 | if (ObjectType == SCREEN_TAG || ObjectType == SCREEN_AC_SYMBOL) { 707 | // We only select the aircraft after waiting for the mouse to be on the tag for a few milliseconds 708 | if (mouseOverTag != string(sObjectId) && sObjectId != DetailedTag) { 709 | mouseOverTag = sObjectId; 710 | mouseOverTagTimer = clock(); 711 | mouseOverArea = Area; 712 | } 713 | } 714 | 715 | if (ObjectType == SCREEN_TAG_ROUTE) { 716 | RouteDisplayMouseOver = sObjectId; 717 | RouteDisplayMouseOverArea = Area; 718 | } 719 | 720 | MousePoint = Pt; 721 | RequestRefresh(); 722 | } 723 | 724 | void RadarScreen::OnFlightPlanControllerAssignedDataUpdate(CFlightPlan FlightPlan, int DataType) 725 | { 726 | } 727 | 728 | void RadarScreen::OnClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button) 729 | { 730 | // Handle button menu click 731 | if (ObjectType >= BUTTON_HIDEMENU && ObjectType <= BUTTON_FIN && Button == BUTTON_LEFT) { 732 | if (ObjectType >= BUTTON_VEL1 && ObjectType <= BUTTON_VEL8 && !ButtonsPressed[ObjectType]) 733 | ButtonsPressed = MenuBar::ResetAllVelButtons(ButtonsPressed); 734 | 735 | if (ButtonsPressed.find(ObjectType) == ButtonsPressed.end()) 736 | ButtonsPressed[ObjectType] = true; 737 | else 738 | ButtonsPressed[ObjectType] = !ButtonsPressed[ObjectType]; 739 | 740 | if (ObjectType >= BUTTON_FILTER_HARD_LOW && ObjectType <= BUTTON_FILTER_HARD_HIGH) { 741 | ButtonsPressed[ObjectType] = false; 742 | 743 | int Current = RadarFilters.Hard_High; 744 | if (ObjectType == BUTTON_FILTER_HARD_LOW) 745 | Current = RadarFilters.Hard_Low; 746 | if (ObjectType == BUTTON_FILTER_SOFT_LOW) 747 | Current = RadarFilters.Soft_Low; 748 | if (ObjectType == BUTTON_FILTER_SOFT_HIGH) 749 | Current = RadarFilters.Soft_High; 750 | 751 | // Show the lists 752 | GetPlugIn()->OpenPopupList(Area, "Filter", 1); 753 | FillInAltitudeList(GetPlugIn(), ObjectType, Current); 754 | } 755 | 756 | if (ObjectType == BUTTON_TOPDOWN) { 757 | ButtonsPressed[BUTTON_LABEL_V] = true; 758 | ButtonsPressed[BUTTON_VFR_ON] = true; 759 | } 760 | 761 | if (ObjectType == BUTTON_DECREASE_RANGE || ObjectType == BUTTON_INCREASE_RANGE) { 762 | ButtonsPressed[ObjectType] = false; 763 | 764 | CPosition TopLeft, BottomRight; 765 | GetDisplayArea(&TopLeft, &BottomRight); 766 | int range = (int)TopLeft.DistanceTo(BottomRight); 767 | range = ((range + 10 / 2) / 10) * 10; 768 | 769 | int bearing = (int)TopLeft.DirectionTo(BottomRight); 770 | 771 | if (ObjectType == BUTTON_DECREASE_RANGE) 772 | range -= 10; 773 | 774 | if (ObjectType == BUTTON_INCREASE_RANGE) 775 | range += 10; 776 | 777 | range = max(0, range); 778 | 779 | CPosition RightUp = Extrapolate(TopLeft, bearing, range * 1852); 780 | 781 | SetDisplayArea(TopLeft, RightUp); 782 | } 783 | } 784 | 785 | if (ObjectType == SCREEN_TAG || ObjectType == SCREEN_AC_SYMBOL || ObjectType >= SCREEN_TAG_CALLSIGN) { 786 | CRadarTarget radarTarget = GetPlugIn()->RadarTargetSelect(sObjectId); 787 | 788 | bool IsPrimary = !radarTarget.GetPosition().GetTransponderC() && !radarTarget.GetPosition().GetTransponderI(); 789 | if (IsPrimary || !radarTarget.GetCorrelatedFlightPlan().IsValid()) 790 | GetPlugIn()->SetASELAircraft(radarTarget); 791 | else 792 | GetPlugIn()->SetASELAircraft(radarTarget.GetCorrelatedFlightPlan()); 793 | DetailedTag = sObjectId; 794 | if (AcquiringSepTool != "" && AcquiringSepTool != sObjectId) { 795 | SepToolPairs.insert(pair(AcquiringSepTool, sObjectId)); 796 | AcquiringSepTool = ""; 797 | 798 | return; 799 | } 800 | } 801 | 802 | if (ObjectType == SCREEN_BACKGROUND) { 803 | if (Button == BUTTON_RIGHT) { 804 | ButtonsPressed[BUTTON_QDM] = false; // Disable QDM 805 | VariableQDMAcquisition = { 0, 0 }; 806 | } 807 | else if (VariableQDMAcquisition.x == 0 && VariableQDMAcquisition.y == 0) 808 | VariableQDMAcquisition = Pt; // Add first selected QDM Point 809 | else { 810 | 811 | // Add QDM to list 812 | CurrentQDMId++; 813 | pair Positions = pair(ConvertCoordFromPixelToPosition(VariableQDMAcquisition), ConvertCoordFromPixelToPosition(Pt)); 814 | VariableQDMs.insert(pair>(CurrentQDMId, Positions)); 815 | VariableQDMAcquisition = { 0, 0 }; 816 | ButtonsPressed[BUTTON_QDM] = false; 817 | } 818 | 819 | } 820 | 821 | if (ObjectType == SCREEN_AC_APP_ARROW) { 822 | if (find(ExtendedAppVector.begin(), ExtendedAppVector.end(), string(sObjectId)) != ExtendedAppVector.end()) 823 | ExtendedAppVector.erase(find(ExtendedAppVector.begin(), ExtendedAppVector.end(), sObjectId)); 824 | else 825 | ExtendedAppVector.push_back(string(sObjectId)); 826 | } 827 | 828 | if (ObjectType == SCREEN_QDM_TOOL) { 829 | map>::iterator it = VariableQDMs.find(atoi(sObjectId)); 830 | if (it != VariableQDMs.end()) 831 | VariableQDMs.erase(it); 832 | } 833 | 834 | if (ObjectType == SCREEN_AC_SYMBOL) { 835 | DetailedTag = sObjectId; 836 | CRadarTarget rt = GetPlugIn()->RadarTargetSelect(sObjectId); 837 | POINT AcPosition = ConvertCoordFromPositionToPixel(rt.GetPosition().GetPosition()); 838 | 839 | int DistanceBetweenTag = (int)sqrt(pow(TagOffsets[sObjectId].x, 2) + 840 | pow(TagOffsets[sObjectId].y, 2)); 841 | 842 | double angle = RadToDeg(atan2(TagOffsets[sObjectId].y, TagOffsets[sObjectId].x)); 843 | 844 | if (Button == BUTTON_LEFT) 845 | angle = fmod(angle - 30, 360); 846 | if (Button == BUTTON_RIGHT) 847 | angle = fmod(angle + 30, 360); 848 | 849 | POINT TopLeftTag; 850 | TopLeftTag.x = long(AcPosition.x + float(DistanceBetweenTag * cos(DegToRad(angle)))); 851 | TopLeftTag.y = long(AcPosition.y + float(DistanceBetweenTag * sin(DegToRad(angle)))); 852 | 853 | TagOffsets[sObjectId] = { TopLeftTag.x-AcPosition.x, TopLeftTag.y - AcPosition.y }; 854 | } 855 | 856 | if (ObjectType == SCREEN_SEP_TOOL) { 857 | vector s = split(sObjectId, ','); 858 | pair toRemove = pair(s.front(), s.back()); 859 | 860 | typedef multimap::iterator iterator; 861 | std::pair iterpair = SepToolPairs.equal_range(toRemove.first); 862 | 863 | iterator it = iterpair.first; 864 | for (; it != iterpair.second; ++it) { 865 | if (it->second == toRemove.second) { 866 | it = SepToolPairs.erase(it); 867 | break; 868 | } 869 | } 870 | } 871 | 872 | if (ObjectType == FIM_STAR || ObjectType == FIM_RWY || ObjectType == FIM_SCRATCHPAD) { 873 | CRadarTarget radarTarget = GetPlugIn()->RadarTargetSelect(sObjectId); 874 | 875 | bool IsPrimary = !radarTarget.GetPosition().GetTransponderC() && !radarTarget.GetPosition().GetTransponderI(); 876 | if (IsPrimary || !radarTarget.GetCorrelatedFlightPlan().IsValid()) 877 | GetPlugIn()->SetASELAircraft(radarTarget); 878 | else 879 | GetPlugIn()->SetASELAircraft(radarTarget.GetCorrelatedFlightPlan()); 880 | } 881 | 882 | if (ObjectType == FIM_STAR) { 883 | StartTagFunction(sObjectId, NULL, EuroScopePlugIn::TAG_ITEM_TYPE_CALLSIGN, sObjectId, NULL, 884 | TAG_ITEM_FUNCTION_ASSIGNED_STAR, Pt, Area); 885 | } 886 | 887 | if (ObjectType == FIM_RWY) { 888 | StartTagFunction(sObjectId, NULL, EuroScopePlugIn::TAG_ITEM_TYPE_CALLSIGN, sObjectId, NULL, 889 | TAG_ITEM_FUNCTION_ASSIGNED_RUNWAY, Pt, Area); 890 | } 891 | 892 | if (ObjectType == MTCD_WINDOW_BUTTONS) { 893 | ButtonsPressed[BUTTON_MTCD] = false; 894 | } 895 | 896 | if (ObjectType == FIM_CLOSE) { 897 | ButtonsPressed[BUTTON_FIM] = false; 898 | } 899 | 900 | if (ObjectType == FIM_SCRATCHPAD) { 901 | StartTagFunction(sObjectId, NULL, EuroScopePlugIn::TAG_ITEM_TYPE_CALLSIGN, sObjectId, NULL, 902 | TAG_ITEM_FUNCTION_EDIT_SCRATCH_PAD, Pt, Area); 903 | } 904 | 905 | // Tag clicks 906 | if (ObjectType >= SCREEN_TAG_CALLSIGN) { 907 | 908 | CFlightPlan fp = GetPlugIn()->FlightPlanSelectASEL(); 909 | 910 | int FunctionId = EuroScopePlugIn::TAG_ITEM_FUNCTION_NO; 911 | 912 | if (ObjectType == SCREEN_TAG_CALLSIGN) { 913 | if (Button == BUTTON_LEFT) 914 | FunctionId = TAG_ITEM_FUNCTION_HANDOFF_POPUP_MENU; 915 | if (Button == BUTTON_RIGHT) 916 | FunctionId = TAG_ITEM_FUNCTION_COMMUNICATION_POPUP; 917 | } 918 | 919 | if (ObjectType == SCREEN_TAG_SECTOR) 920 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_NEXT_CONTROLLER; 921 | 922 | if (ObjectType == SCREEN_TAG_ROUTE) { 923 | if (find(RouteBeingShown.begin(), RouteBeingShown.end(), sObjectId) != RouteBeingShown.end()) { 924 | RouteBeingShown.erase(find(RouteBeingShown.begin(), RouteBeingShown.end(), sObjectId)); 925 | } 926 | else { 927 | RouteBeingShown.push_back(sObjectId); 928 | } 929 | } 930 | 931 | if (ObjectType == SCREEN_TAG_CFL) { 932 | if (Button == BUTTON_LEFT) 933 | FunctionId = TAG_ITEM_FUNCTION_TEMP_ALTITUDE_POPUP; 934 | if (Button == BUTTON_RIGHT) 935 | FunctionId = TAG_ITEM_FUNCTION_OPEN_FP_DIALOG; 936 | } 937 | 938 | if (ObjectType == SCREEN_TAG_HORIZ) { 939 | if (Button == BUTTON_LEFT) 940 | FunctionId = TAG_ITEM_FUNCTION_NEXT_ROUTE_POINTS_POPUP; 941 | if (Button == BUTTON_RIGHT) 942 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_HEADING_POPUP; 943 | } 944 | 945 | if (ObjectType == SCREEN_TAG_RFL) 946 | FunctionId = TAG_ITEM_FUNCTION_RFL_POPUP; 947 | 948 | if (ObjectType == SCREEN_TAG_XFL) { 949 | if (fp.GetTrackingControllerIsMe()) { 950 | FunctionId = TAG_ITEM_FUNCTION_COPX_ALTITUDE; 951 | } 952 | else { 953 | FunctionId = TAG_ITEM_FUNCTION_COPN_ALTITUDE; 954 | } 955 | } 956 | 957 | if (ObjectType == SCREEN_TAG_COP) { 958 | if (Button == BUTTON_LEFT) { 959 | if (fp.GetTrackingControllerIsMe()) { 960 | FunctionId = TAG_ITEM_FUNCTION_COPX_NAME; 961 | } 962 | else { 963 | FunctionId = TAG_ITEM_FUNCTION_COPN_NAME; 964 | } 965 | } 966 | else { 967 | FunctionId = TAG_ITEM_FUNCTION_EDIT_SCRATCH_PAD; 968 | } 969 | 970 | } 971 | 972 | if (ObjectType == SCREEN_TAG_SEP) { 973 | FunctionId = TAG_ITEM_FUNCTION_NO; 974 | 975 | if (AcquiringSepTool == sObjectId) 976 | AcquiringSepTool = ""; 977 | else 978 | AcquiringSepTool = sObjectId; 979 | 980 | } 981 | 982 | if (ObjectType == SCREEN_TAG_SSR) 983 | FunctionId = TAG_ITEM_FUNCTION_SQUAWK_POPUP; 984 | 985 | if (ObjectType == SCREEN_TAG_RWY) 986 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_RUNWAY; 987 | 988 | if (ObjectType == SCREEN_TAG_STAR) 989 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_STAR; 990 | 991 | if (ObjectType == SCREEN_TAG_GSPEED || ObjectType == SCREEN_TAG_ADES) 992 | FunctionId = TAG_ITEM_FUNCTION_OPEN_FP_DIALOG; 993 | 994 | if (ObjectType == SCREEN_TAG_ASPEED) { 995 | if (Button == BUTTON_LEFT) 996 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_SPEED_POPUP; 997 | if (Button == BUTTON_RIGHT) 998 | FunctionId = TAG_ITEM_FUNCTION_ASSIGNED_MACH_POPUP; 999 | } 1000 | 1001 | if (FunctionId != TAG_ITEM_FUNCTION_NO) { 1002 | StartTagFunction(sObjectId, NULL, EuroScopePlugIn::TAG_ITEM_TYPE_CALLSIGN, sObjectId, NULL, 1003 | FunctionId, Pt, Area); 1004 | } 1005 | } 1006 | 1007 | MousePoint = Pt; 1008 | RequestRefresh(); 1009 | } 1010 | 1011 | void RadarScreen::OnFunctionCall(int FunctionId, const char * sItemString, POINT Pt, RECT Area) 1012 | { 1013 | if (FunctionId == FUNC_FILTER_HARD_LOW) { 1014 | RadarFilters.Hard_Low = atoi(sItemString) * 100; 1015 | LoadFilterButtonsData(); 1016 | } 1017 | 1018 | if (FunctionId == FUNC_FILTER_SOFT_LOW) { 1019 | RadarFilters.Soft_Low = atoi(sItemString) * 100; 1020 | LoadFilterButtonsData(); 1021 | } 1022 | 1023 | if (FunctionId == FUNC_FILTER_SOFT_HIGH) { 1024 | RadarFilters.Soft_High = atoi(sItemString) * 100; 1025 | LoadFilterButtonsData(); 1026 | } 1027 | 1028 | if (FunctionId == FUNC_FILTER_HARD_HIGH) { 1029 | RadarFilters.Hard_High = atoi(sItemString) * 100; 1030 | LoadFilterButtonsData(); 1031 | } 1032 | } 1033 | 1034 | void RadarScreen::OnDoubleClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button) 1035 | { 1036 | if (ObjectType == SCREEN_TAG_CALLSIGN && Button == BUTTON_LEFT) { 1037 | StartTagFunction(sObjectId, NULL, TAG_ITEM_TYPE_CALLSIGN, sObjectId, NULL, TAG_ITEM_FUNCTION_TAKE_HANDOFF, Pt, Area); 1038 | } 1039 | } 1040 | 1041 | void RadarScreen::OnAsrContentToBeSaved() { 1042 | // Saving to ASR all radar screen specific settings 1043 | 1044 | SaveDataToAsr(SAVE_MTCD_POSX.c_str(), "Position of the UAC MTCD Window", to_string(MTCDWindow->GetTopLeftPosition().x).c_str()); 1045 | SaveDataToAsr(SAVE_MTCD_POSY.c_str(), "Position of the UAC MTCD Window", to_string(MTCDWindow->GetTopLeftPosition().y).c_str()); 1046 | 1047 | SaveDataToAsr(SAVE_FIM_POSX.c_str(), "Position of the UAC FIM Window", to_string(FIMWindow->GetTopLeftPosition().x).c_str()); 1048 | SaveDataToAsr(SAVE_FIM_POSY.c_str(), "Position of the UAC FIM Window", to_string(FIMWindow->GetTopLeftPosition().y).c_str()); 1049 | 1050 | SaveDataToAsr(SAVE_HARD_FILTER_LOWER.c_str(), "UAC Filter settings", to_string(RadarFilters.Hard_Low).c_str()); 1051 | SaveDataToAsr(SAVE_SOFT_FILTER_LOWER.c_str(), "UAC Filter settings", to_string(RadarFilters.Soft_Low).c_str()); 1052 | SaveDataToAsr(SAVE_HARD_FILTER_UPPER.c_str(), "UAC Filter settings", to_string(RadarFilters.Hard_High).c_str()); 1053 | SaveDataToAsr(SAVE_SOFT_FILTER_UPPER.c_str(), "UAC Filter settings", to_string(RadarFilters.Soft_High).c_str()); 1054 | 1055 | SaveDataToAsr(SAVE_VFR_FILTER.c_str(), "UAC Filter settings", ButtonsPressed[BUTTON_VFR_ON] ? "1" : "0"); 1056 | 1057 | SaveDataToAsr(SAVE_VEL_TIME.c_str(), "UAC Velocity Leader Length", to_string(MenuBar::GetVelValueButtonPressed(ButtonsPressed)).c_str()); 1058 | }; 1059 | 1060 | void RadarScreen::OnAsrContentLoaded(bool Loaded) { 1061 | if (!Loaded) 1062 | return; 1063 | 1064 | const char *j_value, *k_value; 1065 | // Loading position of the MTCD window 1066 | if ((j_value = GetDataFromAsr(SAVE_MTCD_POSX.c_str())) != NULL && (k_value = GetDataFromAsr(SAVE_MTCD_POSY.c_str())) != NULL) 1067 | MTCDWindow->Move(CRect(atoi(j_value), atoi(k_value), 0, 0), true); 1068 | 1069 | // Loading position of the FIM window 1070 | if ((j_value = GetDataFromAsr(SAVE_FIM_POSX.c_str())) != NULL && (k_value = GetDataFromAsr(SAVE_FIM_POSY.c_str())) != NULL) 1071 | FIMWindow->Move(CRect(atoi(j_value), atoi(k_value), 0, 0), true); 1072 | 1073 | // Loading filter settings 1074 | if ((j_value = GetDataFromAsr(SAVE_HARD_FILTER_LOWER.c_str())) != NULL) 1075 | RadarFilters.Hard_Low = atoi(j_value); 1076 | if ((j_value = GetDataFromAsr(SAVE_SOFT_FILTER_LOWER.c_str())) != NULL) 1077 | RadarFilters.Soft_Low = atoi(j_value); 1078 | if ((j_value = GetDataFromAsr(SAVE_HARD_FILTER_UPPER.c_str())) != NULL) 1079 | RadarFilters.Hard_High = atoi(j_value); 1080 | if ((j_value = GetDataFromAsr(SAVE_SOFT_FILTER_UPPER.c_str())) != NULL) 1081 | RadarFilters.Soft_High = atoi(j_value); 1082 | 1083 | // Displayed the loaded values 1084 | LoadFilterButtonsData(); 1085 | 1086 | // Loading vel value 1087 | if ((j_value = GetDataFromAsr(SAVE_VEL_TIME.c_str())) != NULL) 1088 | ButtonsPressed = MenuBar::LoadVelValueToButtons(atoi(j_value), ButtonsPressed); 1089 | 1090 | // Loading VFR filter 1091 | if ((j_value = GetDataFromAsr(SAVE_VFR_FILTER.c_str())) != NULL) 1092 | ButtonsPressed[BUTTON_VFR_ON] = (j_value == "1"); 1093 | }; 1094 | -------------------------------------------------------------------------------- /MUAC/RadarScreen.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Colours.h" 5 | #include "Tag.h" 6 | #include "FIMWindow.h" 7 | #include "MTCDWindow.h" 8 | #include "TagRenderer.h" 9 | #include "Constants.h" 10 | #include "AcSymbols.h" 11 | #include "MenuBar.h" 12 | #include "Helper.h" 13 | #include "STCA.h" 14 | #include "MTCD.h" 15 | #include "VERA.h" 16 | #include "AntiOverlap.h" 17 | #include "RouteRenderer.h" 18 | #include "EuroScopePlugIn.h" 19 | 20 | using namespace std; 21 | using namespace Gdiplus; 22 | using namespace EuroScopePlugIn; 23 | 24 | class RadarScreen : public CRadarScreen 25 | { 26 | public: 27 | RadarScreen(); 28 | virtual ~RadarScreen(); 29 | 30 | void LoadAllData(); 31 | void LoadFilterButtonsData(); 32 | 33 | void OnRefresh(HDC hDC, int Phase); 34 | void OnMoveScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, bool Released); 35 | void OnOverScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area); 36 | void OnFlightPlanControllerAssignedDataUpdate(CFlightPlan FlightPlan, int DataType); 37 | void OnClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button); 38 | void OnFunctionCall(int FunctionId, const char * sItemString, POINT Pt, RECT Area); 39 | void OnDoubleClickScreenObject(int ObjectType, const char * sObjectId, POINT Pt, RECT Area, int Button); 40 | void OnAsrContentToBeSaved(void); 41 | void OnAsrContentLoaded(bool Loaded); 42 | 43 | inline void OnAsrContentToBeClosed(void) 44 | { 45 | delete this; 46 | }; 47 | 48 | private: 49 | map TagOffsets; 50 | map MenuButtons; 51 | map ButtonsPressed; 52 | multimap SepToolPairs; 53 | map> VariableQDMs; 54 | int CurrentQDMId = 1; 55 | POINT VariableQDMAcquisition = { 0, 0 }; 56 | map TagAreas; 57 | map SoftTagAreas; 58 | map RecentlyAutoMovedTags; 59 | vector RouteBeingShown; 60 | vector ExtendedAppVector; 61 | POINT MousePoint = { 0, 0 }; 62 | CSTCA * StcaInstance; 63 | CMTCD * MtcdInstance; 64 | CMTCDWindow* MTCDWindow; 65 | CFIMWindow* FIMWindow; 66 | string DetailedTag = ""; 67 | string mouseOverTag = ""; 68 | clock_t mouseOverTagTimer; 69 | CRect mouseOverArea; 70 | clock_t OneSecondTimer; 71 | clock_t HalfSecondTimer; 72 | bool Blink = false; 73 | 74 | string AcquiringSepTool = ""; 75 | string FixedQDMTool = ""; 76 | string RouteDisplayMouseOver = ""; 77 | CRect RouteDisplayMouseOverArea; 78 | 79 | struct RadarFiltersStruct { 80 | int Hard_Low = 0; 81 | int Soft_Low = 20000; 82 | int Soft_High = 99999; 83 | int Hard_High = 99999; 84 | } RadarFilters; 85 | 86 | }; 87 | 88 | -------------------------------------------------------------------------------- /MUAC/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | DYNAMIC LINK LIBRARY : MUAC Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this MUAC DLL for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your MUAC application. 9 | 10 | 11 | MUAC.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | MUAC.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | MUAC.cpp 25 | This is the main DLL source file. 26 | 27 | When created, this DLL does not export any symbols. As a result, it 28 | will not produce a .lib file when it is built. If you wish this project 29 | to be a project dependency of some other project, you will either need to 30 | add code to export some symbols from the DLL so that an export library 31 | will be produced, or you can set the Ignore Input Library property to Yes 32 | on the General propert page of the Linker folder in the project's Property 33 | Pages dialog box. 34 | 35 | ///////////////////////////////////////////////////////////////////////////// 36 | Other standard files: 37 | 38 | StdAfx.h, StdAfx.cpp 39 | These files are used to build a precompiled header (PCH) file 40 | named MUAC.pch and a precompiled types file named StdAfx.obj. 41 | 42 | ///////////////////////////////////////////////////////////////////////////// 43 | Other notes: 44 | 45 | AppWizard uses "TODO:" comments to indicate parts of the source code you 46 | should add to or customize. 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | -------------------------------------------------------------------------------- /MUAC/RouteRenderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "Helper.h" 6 | #include "Constants.h" 7 | #include "EuroScopePlugIn.h" 8 | 9 | using namespace std; 10 | using namespace EuroScopePlugIn; 11 | 12 | class RouteRenderer 13 | { 14 | public: 15 | static void Render(CDC* dc, CRadarScreen* instance, CRadarTarget rt, CFlightPlan CorrFp) { 16 | int saveRouteDc = dc->SaveDC(); 17 | 18 | POINT AcPosPix = instance->ConvertCoordFromPositionToPixel(rt.GetPosition().GetPosition()); 19 | if (CorrFp.IsValid()) 20 | { 21 | CFlightPlanExtractedRoute exR = CorrFp.GetExtractedRoute(); 22 | int index = exR.GetPointsAssignedIndex(); 23 | if (index < 0) 24 | index = exR.GetPointsCalculatedIndex(); 25 | 26 | // We do a quick loop to remove any -1 minute estimates 27 | for (int i = index; i < exR.GetPointsNumber(); i++) { 28 | index = i; 29 | 30 | if (exR.GetPointDistanceInMinutes(i) != -1) 31 | break; 32 | } 33 | 34 | FontManager::SelectStandardFont(dc); 35 | 36 | CPen routePen(PS_SOLID, 1, Colours::AirwayBlue.ToCOLORREF()); 37 | CPen* oldPen = dc->SelectObject(&routePen); 38 | 39 | // Use predicted routed to display more information 40 | bool reachToC = false; 41 | bool reachToD = false; 42 | 43 | CFlightPlanPositionPredictions PosPred = CorrFp.GetPositionPredictions(); 44 | for (int i = 0; i < PosPred.GetPointsNumber(); i++) { 45 | // Every three minutes, we show a tick 46 | if (i % 3 == 0) { 47 | POINT markerPosition = instance->ConvertCoordFromPositionToPixel(PosPred.GetPosition(i)); 48 | dc->MoveTo(markerPosition.x, markerPosition.y - 2); 49 | dc->LineTo(markerPosition.x, markerPosition.y + 2); 50 | dc->MoveTo(markerPosition.x - 2, markerPosition.y); 51 | dc->LineTo(markerPosition.x + 2, markerPosition.y); 52 | } 53 | 54 | 55 | } 56 | 57 | dc->SelectObject(&oldPen); 58 | 59 | 60 | // Use the calculated route first to display the waypoints 61 | for (int i = index; i < exR.GetPointsNumber(); i++) 62 | { 63 | POINT exRPos = instance->ConvertCoordFromPositionToPixel(exR.GetPointPosition(i)); 64 | 65 | Color routeColor = Colours::AirwayBlue; 66 | 67 | if (exR.GetPointAirwayClassification(i) == AIRWAY_CLASS_DIRECTION_ERROR || 68 | exR.GetPointAirwayClassification(i) == AIRWAY_CLASS_UNCONNECTED) { 69 | routeColor = Colours::RedWarning; 70 | } 71 | 72 | CPen routePen(PS_SOLID, 1, routeColor.ToCOLORREF()); 73 | CPen* oldPen = dc->SelectObject(&routePen); 74 | 75 | 76 | // Draw the line 77 | 78 | if (i == index) 79 | dc->MoveTo(AcPosPix); 80 | else 81 | dc->MoveTo(instance->ConvertCoordFromPositionToPixel(exR.GetPointPosition(i - 1))); 82 | 83 | dc->LineTo(exRPos); 84 | 85 | string pointName = exR.GetPointName(i); 86 | string pointTime = getUtcTimePlusMinutes(exR.GetPointDistanceInMinutes(i), "%H:%M"); 87 | string pointAltitude = padWithZeros(5, exR.GetPointCalculatedProfileAltitude(i)).substr(0, 3); 88 | 89 | string FinalString = pointName + "|" + pointTime + " " + pointAltitude; 90 | 91 | dc->SetTextColor(Colours::AircraftLightGrey.ToCOLORREF()); 92 | dc->SetTextAlign(TA_CENTER | TA_BASELINE); 93 | 94 | DrawTextMultiline(dc, FinalString, exRPos); 95 | 96 | dc->SelectObject(&oldPen); 97 | 98 | } 99 | 100 | 101 | 102 | } 103 | 104 | dc->RestoreDC(saveRouteDc); 105 | }; 106 | }; -------------------------------------------------------------------------------- /MUAC/STCA.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "STCA.h" 3 | #include "Helper.h" 4 | 5 | CSTCA::CSTCA() 6 | { 7 | 8 | } 9 | 10 | 11 | CSTCA::~CSTCA() 12 | { 13 | 14 | } 15 | 16 | bool CSTCA::IsSTCA(string cs) 17 | { 18 | if (std::find(Alerts.begin(), Alerts.end(), cs) != Alerts.end()) 19 | { 20 | return true; 21 | } 22 | return false; 23 | }; 24 | 25 | void CSTCA::OnRefresh(CPlugIn * pl) 26 | { 27 | Alerts.clear(); 28 | 29 | CRadarTarget rt; 30 | for (rt = pl->RadarTargetSelectFirst(); 31 | rt.IsValid(); 32 | rt = pl->RadarTargetSelectNext(rt)) 33 | { 34 | if (rt.GetPosition().GetRadarFlags() == EuroScopePlugIn::RADAR_POSITION_PRIMARY) 35 | continue; 36 | 37 | if (rt.GetPosition().GetPressureAltitude() < disable_level) 38 | continue; 39 | 40 | if (strcmp(rt.GetPosition().GetSquawk(), "7000") == 0) 41 | continue; 42 | 43 | if (rt.GetCorrelatedFlightPlan().IsValid()) 44 | { 45 | if (rt.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType() == "V") 46 | continue; 47 | } 48 | 49 | CRadarTarget conflicting; 50 | for (conflicting = pl->RadarTargetSelectFirst(); 51 | conflicting.IsValid(); 52 | conflicting = pl->RadarTargetSelectNext(conflicting)) 53 | { 54 | int separation_distance = high_level_sep; 55 | int extrapolationTime = time_to_extrapolate; 56 | 57 | if (rt.GetCallsign() == conflicting.GetCallsign()) 58 | continue; 59 | 60 | if (rt.GetPosition().GetPressureAltitude() <= level_reduced_sep 61 | && conflicting.GetPosition().GetPressureAltitude() <= level_reduced_sep) 62 | { 63 | separation_distance = low_level_sep; 64 | extrapolationTime = 120; 65 | } 66 | 67 | if (conflicting.GetPosition().GetRadarFlags() == EuroScopePlugIn::RADAR_POSITION_PRIMARY) 68 | continue; 69 | 70 | if (conflicting.GetPosition().GetPressureAltitude() < disable_level) 71 | continue; 72 | 73 | if (strcmp(conflicting.GetPosition().GetSquawk(), "7000") == 0) 74 | continue; 75 | 76 | if (conflicting.GetCorrelatedFlightPlan().IsValid()) 77 | { 78 | if (conflicting.GetCorrelatedFlightPlan().GetFlightPlanData().GetPlanType() == "V") 79 | continue; 80 | } 81 | 82 | if (rt.GetPosition().GetPosition().DistanceTo(conflicting.GetPosition().GetPosition()) < separation_distance && 83 | abs(rt.GetPosition().GetPressureAltitude()-conflicting.GetPosition().GetPressureAltitude()) < altitude_sep) 84 | { 85 | if (std::find(Alerts.begin(), Alerts.end(), rt.GetCallsign()) == Alerts.end()) 86 | Alerts.push_back(rt.GetCallsign()); 87 | if (std::find(Alerts.begin(), Alerts.end(), conflicting.GetCallsign()) == Alerts.end()) 88 | Alerts.push_back(conflicting.GetCallsign()); 89 | continue; 90 | } 91 | 92 | for (int i = 30; i <= time_to_extrapolate; i += 30) 93 | { 94 | CPosition ex1 = Extrapolate(rt.GetPosition().GetPosition(), rt.GetTrackHeading(), double(rt.GetPosition().GetReportedGS()*0.514444)*(i)); 95 | CPosition ex2 = Extrapolate(conflicting.GetPosition().GetPosition(), conflicting.GetTrackHeading(), double(conflicting.GetPosition().GetReportedGS()*0.514444)*(i)); 96 | 97 | int alt1 = rt.GetPosition().GetPressureAltitude(); 98 | int alt2 = conflicting.GetPosition().GetPressureAltitude(); 99 | 100 | if (rt.GetPreviousPosition(rt.GetPosition()).IsValid() && 101 | conflicting.GetPreviousPosition(conflicting.GetPosition()).IsValid()) 102 | { 103 | int dalt1 = alt1 - rt.GetPreviousPosition(rt.GetPosition()).GetPressureAltitude(); 104 | int dalt2 = alt2 - conflicting.GetPreviousPosition(conflicting.GetPosition()).GetPressureAltitude(); 105 | 106 | int dt1 = rt.GetPreviousPosition(rt.GetPosition()).GetReceivedTime() - rt.GetPosition().GetReceivedTime(); 107 | int dt2 = conflicting.GetPreviousPosition(conflicting.GetPosition()).GetReceivedTime() - conflicting.GetPosition().GetReceivedTime(); 108 | 109 | int vz1 = 0; 110 | int vz2 = 0; 111 | 112 | if (dt1 > 0 && dt2 > 0) 113 | { 114 | vz1 = dalt1 * (i / dt1); 115 | vz2 = dalt2 * (i / dt2); 116 | } 117 | 118 | alt1 += (vz1/60)*i; 119 | alt2 += (vz2/60)*i; 120 | } 121 | 122 | if (ex1.DistanceTo(ex2) < separation_distance && 123 | abs(alt1 - alt2) < altitude_sep) 124 | { 125 | if (std::find(Alerts.begin(), Alerts.end(), rt.GetCallsign()) == Alerts.end()) 126 | Alerts.push_back(rt.GetCallsign()); 127 | if (std::find(Alerts.begin(), Alerts.end(), conflicting.GetCallsign()) == Alerts.end()) 128 | Alerts.push_back(conflicting.GetCallsign()); 129 | break; 130 | } 131 | } 132 | 133 | 134 | } 135 | 136 | } 137 | 138 | } -------------------------------------------------------------------------------- /MUAC/STCA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | using namespace EuroScopePlugIn; 9 | 10 | 11 | class CSTCA 12 | { 13 | public: 14 | CSTCA(); 15 | virtual ~CSTCA(); 16 | 17 | vector Alerts; 18 | 19 | int high_level_sep = 5; 20 | int low_level_sep = 3; 21 | int disable_level = 3000; 22 | int level_reduced_sep = 14500; 23 | const static int time_to_extrapolate = 120; 24 | int altitude_sep = 950; 25 | 26 | void OnRefresh(CPlugIn * pl); 27 | bool IsSTCA(string cs); 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /MUAC/Tag.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/MUAC/Tag.h -------------------------------------------------------------------------------- /MUAC/TagItem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "EuroScopePlugIn.h" 4 | 5 | using namespace std; 6 | using namespace EuroScopePlugIn; 7 | 8 | class TagItem 9 | { 10 | public: 11 | const enum TagColourTypes { StateColor, Information, Highlight, Important }; 12 | 13 | TagItem() {}; 14 | ~TagItem() {}; 15 | 16 | static TagItem CreatePassive(string text, int ClickId = 0, TagColourTypes ColourType = TagColourTypes::StateColor) { 17 | TagItem i; i.Text = text; i.ColourType = ColourType; i.TagType = text; i.ClickId = ClickId; 18 | return i; 19 | }; 20 | 21 | wstring TextToWString() { 22 | return wstring(Text.begin(), Text.end()); 23 | } 24 | 25 | string Text; 26 | TagColourTypes ColourType; 27 | string TagType; 28 | int ClickId; 29 | }; -------------------------------------------------------------------------------- /MUAC/TagRenderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include 4 | #include "Constants.h" 5 | #include "Colours.h" 6 | #include "FontManager.h" 7 | #include "TagItem.h" 8 | #include "EuroScopePlugIn.h" 9 | 10 | using namespace std; 11 | using namespace EuroScopePlugIn; 12 | using namespace Gdiplus; 13 | 14 | class TagRenderer { 15 | public: 16 | static RECT Render(CDC* dc, POINT MousePt, POINT TagOffset, POINT AcPosition, Tag tag, bool isDetailed, bool isStca, bool isMtcd, map* DetailedTagClicks) { 17 | 18 | int save = dc->SaveDC(); 19 | 20 | FontManager::SelectStandardFont(dc); 21 | 22 | int leftOffset = 0; 23 | int topOffset = 0; 24 | 25 | int TagWidth = 0; 26 | 27 | POINT TagTopLeft = { AcPosition.x + TagOffset.x, AcPosition.y + TagOffset.y }; 28 | 29 | bool NeedPrimaryAreaSet = true; 30 | CRect PrimaryArea; 31 | map LineAreas; 32 | 33 | // Used for the rest 34 | COLORREF PrimaryColor = Colours::AircraftDarkGrey.ToCOLORREF(); 35 | 36 | // Used for callsign 37 | COLORREF SecondaryColor = Colours::AircraftDarkGrey.ToCOLORREF(); 38 | 39 | if (!tag.IsSoft) { 40 | PrimaryColor = Colours::AircraftLightGrey.ToCOLORREF(); 41 | SecondaryColor = Colours::AircraftLightGrey.ToCOLORREF(); 42 | } 43 | 44 | if (tag.TagState == TagConfiguration::TagStates::Redundant) { 45 | SecondaryColor = Colours::AircraftBlue.ToCOLORREF(); 46 | } 47 | 48 | if (tag.TagState == TagConfiguration::TagStates::Assumed) { 49 | PrimaryColor = Colours::AircraftGreen.ToCOLORREF(); 50 | SecondaryColor = Colours::AircraftGreen.ToCOLORREF(); 51 | } 52 | 53 | if (tag.TagState == TagConfiguration::TagStates::Next || 54 | tag.TagState == TagConfiguration::TagStates::InSequence) { 55 | SecondaryColor = Colours::AircraftGreen.ToCOLORREF(); 56 | } 57 | 58 | if (tag.TagState == TagConfiguration::TagStates::TransferredToMe) { 59 | SecondaryColor = Colours::AircraftBlue.ToCOLORREF(); 60 | } 61 | 62 | if (tag.TagState == TagConfiguration::TagStates::TransferredFromMe) { 63 | PrimaryColor = Colours::AircraftGreen.ToCOLORREF(); 64 | } 65 | 66 | dc->SetTextColor(PrimaryColor); 67 | 68 | if (isDetailed) 69 | FontManager::SelectBoldBigFont(dc); 70 | 71 | int i = 0; 72 | for (auto TagLine : tag.Definition) { 73 | // For each item 74 | CSize MeasureRect = { 0, 0 }; 75 | for (auto TagItem : TagLine) { 76 | 77 | if (TagItem.Text.length() == 0) 78 | continue; 79 | 80 | if (TagItem.ColourType == TagItem::TagColourTypes::Highlight) { 81 | dc->SetTextColor(SecondaryColor); 82 | } 83 | 84 | if (TagItem.ColourType == TagItem::TagColourTypes::Information) { 85 | dc->SetTextColor(Colours::YellowWarning.ToCOLORREF()); 86 | } 87 | 88 | if (TagItem.ColourType == TagItem::TagColourTypes::Important) { 89 | dc->SetTextColor(Colours::LightOrange.ToCOLORREF()); 90 | } 91 | 92 | bool needBacktick = false; 93 | bool needYellowUnderline = false; 94 | if (TagItem.Text.compare(0, PREFIX_BACKSTEP.length(), PREFIX_BACKSTEP) == 0) { 95 | needBacktick = true; 96 | TagItem.Text.erase(0, PREFIX_BACKSTEP.length()); 97 | } 98 | 99 | if (TagItem.Text.compare(0, PREFIX_PURPLE_COLOR.length(), PREFIX_PURPLE_COLOR) == 0) { 100 | dc->SetTextColor(Colours::PurpleDisplay.ToCOLORREF()); 101 | TagItem.Text.erase(0, PREFIX_PURPLE_COLOR.length()); 102 | } 103 | 104 | if (TagItem.Text.compare(0, PREFIX_ORANGE_COLOR.length(), PREFIX_ORANGE_COLOR) == 0) { 105 | dc->SetTextColor(Colours::OrangeTool.ToCOLORREF()); 106 | TagItem.Text.erase(0, PREFIX_ORANGE_COLOR.length()); 107 | } 108 | 109 | if (TagItem.Text.compare(0, PREFIX_GREY_COLOR.length(), PREFIX_GREY_COLOR) == 0) { 110 | dc->SetTextColor(Colours::AircraftDarkGrey.ToCOLORREF()); 111 | TagItem.Text.erase(0, PREFIX_GREY_COLOR.length()); 112 | } 113 | 114 | if (TagItem.Text.compare(0, PREFIX_BLUE_COLOR.length(), PREFIX_BLUE_COLOR) == 0) { 115 | dc->SetTextColor(Colours::BlueTool.ToCOLORREF()); 116 | TagItem.Text.erase(0, PREFIX_BLUE_COLOR.length()); 117 | } 118 | 119 | if (TagItem.Text.compare(0, PREFIX_YELLOW_UNDERLINE.length(), PREFIX_YELLOW_UNDERLINE) == 0) { 120 | needYellowUnderline = true; 121 | TagItem.Text.erase(0, PREFIX_YELLOW_UNDERLINE.length()); 122 | } 123 | 124 | MeasureRect = dc->GetTextExtent(TagItem.Text.c_str()); 125 | 126 | if (needBacktick) 127 | leftOffset -= MeasureRect.cx; 128 | 129 | dc->TextOutA(TagTopLeft.x + leftOffset, TagTopLeft.y + topOffset, TagItem.Text.c_str()); 130 | 131 | CRect TextBox(TagTopLeft.x + leftOffset, TagTopLeft.y + topOffset, 132 | TagTopLeft.x + leftOffset + MeasureRect.cx, TagTopLeft.y + topOffset + MeasureRect.cy); 133 | 134 | // Here we also dispaly the rectangle if the mouse cursor is in it 135 | if (((IsInRect(MousePt, TextBox) && isDetailed) || ((isStca || isMtcd) && TagItem.TagType == "Callsign")) && TagItem.TagType != " ") { 136 | CPen YellowPen(PS_SOLID, 1, Colours::YellowWarning.ToCOLORREF()); 137 | dc->SelectObject(&YellowPen); 138 | dc->SelectStockObject(NULL_BRUSH); 139 | dc->Rectangle(TextBox); 140 | } 141 | 142 | if (needYellowUnderline) { 143 | CPen YellowPen(PS_SOLID, 1, Colours::YellowWarning.ToCOLORREF()); 144 | dc->SelectObject(&YellowPen); 145 | dc->SelectStockObject(NULL_BRUSH); 146 | dc->MoveTo(TextBox.left, TextBox.bottom); 147 | dc->LineTo(TextBox.right, TextBox.bottom); 148 | } 149 | 150 | // if Detailed, then we store the area for click 151 | if (isDetailed && TagItem.ClickId != 0) 152 | DetailedTagClicks->insert(pair(TagItem.ClickId, TextBox)); 153 | 154 | if (NeedPrimaryAreaSet && TagItem.Text != " " && TagItem.TagType != "FPM" && TagItem.TagType != "RTEM" && TagItem.TagType != "V") { 155 | PrimaryArea = TextBox; 156 | NeedPrimaryAreaSet = false; 157 | } 158 | 159 | leftOffset += (int)MeasureRect.cx; 160 | dc->SetTextColor(PrimaryColor); 161 | 162 | // We don't need a blank space if it's one of the empty items 163 | if (TagItem.Text != " " && TagItem.TagType != "V") 164 | leftOffset += 5; 165 | 166 | // See if we don't have an empty tag, if not we add it to the detection list 167 | //if (TagItem.Text != " ") { 168 | if (LineAreas.find(i) != LineAreas.end()) { 169 | LineAreas[i].right = TextBox.right; 170 | } 171 | else { 172 | LineAreas.insert(pair(i, TextBox)); 173 | } 174 | //} 175 | 176 | } 177 | topOffset += (int)MeasureRect.cy; 178 | 179 | // Store the greatest width for the tag 180 | if (leftOffset > TagWidth) 181 | TagWidth = leftOffset; 182 | 183 | leftOffset = 0; 184 | 185 | i++; 186 | } 187 | 188 | // Rendering the leaderline 189 | 190 | RECT Area = { TagTopLeft.x , TagTopLeft.y, TagTopLeft.x + TagWidth, TagTopLeft.y + topOffset }; 191 | POINT Center = { (Area.left + Area.right) /2, (Area.top + Area.bottom) / 2 }; 192 | int Size = DRAWING_AC_SQUARE_SYMBOL_SIZE + DRAWING_PADDING; 193 | CRect SymbolArea(AcPosition.x - Size, AcPosition.y - Size, AcPosition.x + Size, AcPosition.y + Size); 194 | 195 | COLORREF leaderLineColor = tag.IsSoft ? Colours::AircraftDarkGrey.ToCOLORREF() : Colours::AircraftLightGrey.ToCOLORREF(); 196 | 197 | if (isStca) 198 | leaderLineColor = Colours::YellowHighlight.ToCOLORREF(); 199 | 200 | CPen leaderLinePen(PS_SOLID, 1, leaderLineColor); 201 | 202 | CPen leaderLineYellow(PS_SOLID, 1, Colours::YellowHighlight.ToCOLORREF()); 203 | CPen leaderLineRed(PS_SOLID, 1, Colours::RedWarning.ToCOLORREF()); 204 | 205 | dc->SelectStockObject(NULL_BRUSH); 206 | 207 | // First we get the starting point next to the Target 208 | POINT liangOrigin, liangEnd, lastPointRecorded; 209 | if (LiangBarsky(SymbolArea, AcPosition, Center, liangOrigin, liangEnd)) { 210 | // Point next to AC symbol 211 | lastPointRecorded = liangEnd; 212 | 213 | dc->SelectObject(leaderLinePen); 214 | 215 | // Add any points that are in between 216 | for (auto lineArea : LineAreas) { 217 | 218 | liangOrigin = { 0, 0 }; liangEnd = { 0, 0 }; 219 | if (LiangBarsky(lineArea.second, lastPointRecorded, Center, liangOrigin, liangEnd)) { 220 | dc->MoveTo(lastPointRecorded); 221 | dc->LineTo(liangOrigin); 222 | lastPointRecorded = liangEnd; 223 | } 224 | } 225 | 226 | dc->MoveTo(Center); 227 | } 228 | 229 | // We now draw the leaderline, only if even number 230 | 231 | 232 | dc->RestoreDC(save); 233 | 234 | return Area; 235 | } 236 | }; -------------------------------------------------------------------------------- /MUAC/VERA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include "Helper.h" 4 | #include "Constants.h" 5 | #include 6 | 7 | using namespace std; 8 | using namespace EuroScopePlugIn; 9 | 10 | class VERA 11 | { 12 | public: 13 | const static int time_to_extrapolate = 30; 14 | 15 | struct VERADataStruct { 16 | int minDistanceSeconds = -1; 17 | double minDistanceNm = -1; 18 | CPosition predictedFirstPos, predictedSecondPos; 19 | }; 20 | 21 | static VERADataStruct Calculate(CRadarTarget FirstTarget, CRadarTarget SecondTarget) { 22 | CPosition Prediction; 23 | CPosition PredictionOther; 24 | CPosition FirstTargetPos = FirstTarget.GetPosition().GetPosition(); 25 | CPosition SecondTargetPos = SecondTarget.GetPosition().GetPosition(); 26 | 27 | VERADataStruct defaultOut; 28 | VERADataStruct out; 29 | 30 | double lastDistance = FirstTargetPos.DistanceTo(SecondTargetPos); 31 | 32 | for (int i = 30; i <= 60 * VERA::time_to_extrapolate; i += 10) { 33 | Prediction = Extrapolate(FirstTargetPos, FirstTarget.GetTrackHeading(), 34 | FirstTarget.GetPosition().GetReportedGS()*0.514444*i); 35 | PredictionOther = Extrapolate(SecondTargetPos, SecondTarget.GetTrackHeading(), 36 | SecondTarget.GetPosition().GetReportedGS()*0.514444*i); 37 | 38 | // The distance started to increase, we passed the minimum point 39 | if (Prediction.DistanceTo(PredictionOther) > lastDistance) { 40 | if (lastDistance == FirstTargetPos.DistanceTo(SecondTargetPos)) 41 | return defaultOut; 42 | 43 | out.minDistanceSeconds = i; 44 | out.minDistanceNm = Prediction.DistanceTo(PredictionOther); 45 | out.predictedFirstPos = Prediction; 46 | out.predictedSecondPos = PredictionOther; 47 | 48 | return out; 49 | } 50 | 51 | lastDistance = Prediction.DistanceTo(PredictionOther); 52 | } 53 | 54 | return defaultOut; 55 | }; 56 | }; -------------------------------------------------------------------------------- /MUAC/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | #include "stdafx.h" 3 | #include "EuroScopePlugIn.h" 4 | #include "MUAC.h" 5 | 6 | using namespace Gdiplus; 7 | 8 | ULONG_PTR m_gdiplusToken; 9 | 10 | //---EuroScopePlugInInit----------------------------------------------- 11 | 12 | void __declspec (dllexport) EuroScopePlugInInit(EuroScopePlugIn::CPlugIn ** ppPlugInInstance) 13 | { 14 | // Initialize GDI+ 15 | GdiplusStartupInput gdiplusStartupInput; 16 | GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, nullptr); 17 | 18 | // create the instance 19 | * ppPlugInInstance = (CPlugIn*)new MUAC(); 20 | } 21 | 22 | //---EuroScopePlugInExit----------------------------------------------- 23 | 24 | void __declspec (dllexport) EuroScopePlugInExit(void) 25 | { 26 | GdiplusShutdown(m_gdiplusToken); 27 | } -------------------------------------------------------------------------------- /MUAC/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by MUAC.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /MUAC/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // MUAC.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /MUAC/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | #include 14 | #include 15 | #include 16 | #define _USE_MATH_DEFINES 17 | #include 18 | #include 19 | #pragma comment (lib,"Gdiplus.lib") 20 | #pragma comment(lib, "Wininet") 21 | #define _AFXDLL 22 | 23 | // TODO: reference additional headers your program requires here 24 | -------------------------------------------------------------------------------- /MUAC/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Upper Area Control PlugIn [![Build status](https://ci.appveyor.com/api/projects/status/w0v23weq4dw9e9t7?svg=true)](https://ci.appveyor.com/project/pierr3/UACPlugin) 2 | 3 |

4 | UAC PlugIn header 5 |

6 | 7 | This plugin simulates an ATC HMI resembling systems using by large European Air Traffic Control providers, specially en route. The plugin supports an en route mode and an approach mode, allowing for full topdown control (excluding ground control). It features a number of advanced systems, while still being light and usable: 8 | * En route control & approach control mode 9 | * Custom drawn tags, with custom realistic behaviour 10 | * Realistic filtering (by levels, VFRs, Primary) 11 | * Precise separation tool (min distance), custom STCA (no alert sound), cutom MTCD 12 | * Anti-overlap algorithm based on weighted grid system, meaning tags automatically move to not overlap 13 | * Full support for coordination mechanisms from EuroScope 14 | * Display of max and minimum speeds 15 | * Display of mode S reported heading 16 | 17 | Download the most recent development (nightly) build here: 18 | 19 | 20 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # Notes: 2 | # - Minimal appveyor.yml file is an empty file. All sections are optional. 3 | # - Indent each level of configuration with 2 spaces. Do not use tabs! 4 | # - All section names are case-sensitive. 5 | # - Section names should be unique on each level. 6 | 7 | #---------------------------------# 8 | # general configuration # 9 | #---------------------------------# 10 | 11 | # version format 12 | version: 1.1.{build} 13 | 14 | # branches to build 15 | branches: 16 | # whitelist 17 | only: 18 | - master 19 | 20 | # blacklist 21 | except: 22 | - gh-pages 23 | 24 | # Maximum number of concurrent jobs for the project 25 | max_jobs: 1 26 | 27 | #---------------------------------# 28 | # environment configuration # 29 | #---------------------------------# 30 | 31 | # Build worker image (VM template) 32 | os: Visual Studio 2019 33 | 34 | platform: 35 | - x86 36 | 37 | #---------------------------------# 38 | # build configuration # 39 | #---------------------------------# 40 | 41 | install: 42 | - cmd: git submodule update --init --recursive 43 | - cmd: msbuild /version 44 | 45 | # build Configuration, i.e. Debug, Release, etc. 46 | configuration: Release 47 | 48 | build_script: 49 | - ps: (Get-Content C:\projects\uacplugin\MUAC\Constants.h).replace('@appveyor_build', $Env:appveyor_build_version) | Set-Content C:\projects\uacplugin\MUAC\Constants.h 50 | - cmd: msbuild "C:\projects\uacplugin\MUAC.sln" /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" 51 | 52 | after_build: 53 | - cmd: mkdir UAC-nightly 54 | - cmd: cp Release\MUAC.dll UAC-nightly\ 55 | - cmd: 7z a UAC-nightly.zip %APPVEYOR_BUILD_FOLDER%\UAC-nightly\ 56 | 57 | #---------------------------------# 58 | # artifacts configuration # 59 | #---------------------------------# 60 | 61 | artifacts: 62 | - path: UAC-nightly.zip 63 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /docs/img/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/docs/img/header.png -------------------------------------------------------------------------------- /docs/keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/docs/keep -------------------------------------------------------------------------------- /lib/EuroScopePlugInDll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierr3/UACPlugin/7bb7acfc036e99ad868db8b8c0697400c6a144e7/lib/EuroScopePlugInDll.lib --------------------------------------------------------------------------------