Board index FlightGear Development Canvas

Canvas Map Airport display

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Canvas Map Airport display

Postby Avionyx » Sun Aug 24, 2014 7:27 pm

Hi Guys,

I was just wondering if the Canvas Map could be made to display ALL airports?
At the moment it only seems to be displaying ones over a certain size.

Many thanks,

Alex
Avionyx
 
Posts: 436
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGKA
Callsign: G-AVYX
Version: GIT
OS: Arch

Re: Canvas Map Airport display

Postby Hooray » Sun Aug 24, 2014 9:11 pm

Yeah, it certainly can be told to do so - there's a quick hack that you could use currently - but the better, more future-proof, method would entail porting the whole thing to use Philosopher's MapStructure framework - which is something we're planning to do anyway, i.e. for the sake of performance and better code reuse. In this case, we basically only need to use the so called APT layer (APT=Airports).
For a list of available MapStructure layers, see: http://wiki.flightgear.org/Canvas_MapStructure_Layers

The necessary Nasal steps are detailed at: http://wiki.flightgear.org/MapStructure ... xml_dialog

I think it was omega95 who recently mentioned that he was also interested in this, i.e. to reuse the taxiways layers for his aircraft instruments (which is implicitly supported for all MapStructure-based layers).

If this is something you'd like to pursue, just get in touch so that we can provide more specific advice - airports should be fairly simple actually (especially in comparison to taxiways ...) - but currently, the Nasal code is using a completely different approach, while it does use Canvas, it all predates the MapStructure framework, so is not yet sufficiently generic.

Overall, the steps are fairly simple actually - adapting the dialog to JUST show airports should take ~5-10 minutes only - the real work is in porting existing functionality (i.e. taxiways) to use the MapStructure framework, and to optionally also show runways for each airport. We haven't really prioritized any of this because 3.2 was coming up - but it's not exactly rocket science, it's mostly about porting "old" Nasal/Canvas code to use a more generic approach, i.e. MapStructure.

BTW: Here's a screen shot of a pure MapStructure-based airport selection dialog, including the functionality you're looking for:
Image

As can be seen, multiple airports are shown - as well as quite a few other details - and check boxes for each detail/layer are also shown.
So there's code doing this sort of thing - the main thing missing ATM is porting the taxiway stuff - i.e. existing functionality.
But omega95 was interested in doing that anyway - so you two could also team up - we can hook you up with commit access to the canvas-hacker team clone.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby Avionyx » Mon Aug 25, 2014 8:19 am

Hooray,

First of all I just wanted to say thank you for taking the time to put together such a detailed reply - it's very much appreciated.

Canvas is something I've been wanting to get into for some time now but have never really had anything of any interest to me to get my teeth stuck into to kickstart it, this seems like the perfect opportunity.
I'd really love to get involved and contribute to help porting things over. Perhaps we should continue this discussion over PM/Email when you get a minute?

All the best,

Alex
Avionyx
 
Posts: 436
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGKA
Callsign: G-AVYX
Version: GIT
OS: Arch

Re: Canvas Map Airport display

Postby Gijs » Mon Aug 25, 2014 9:41 am

If I understand the question well, it's about displaying all airports. I think Hooray used the ND code for the map, which only displays airports whose longest runway is over X feet (to prevent displaying grass 200m runways in the cockpit of a 747). To display all airports, you'd only have to remove that check...
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas Map Airport display

Postby Hooray » Mon Aug 25, 2014 9:55 am

@Gijs: Actually - it doesn't use the ND code at all currently (it's still using the original *.draw helpers NOT MapStructure! This all predates ND/MapStructure stuff). The screen shot I added does use MapStructure though (which is what the ND is using now).

And no: please don't just "remove" such a check - these things are all sufficiently encapsulated meanwhile, so it's just about passsing a custom callback to disable such conditionals.
There's a reason why we've been moving this to a MVC-based design, so that people don't need to use "copy/paste & adapt" to come up with their own features - conditionals (like styling) are encapsulated in hashes, and can be easily overridden this way. APT.lcontroller should have all the logic in place - and making the check customizable should be only a matter of 5 minutes.

@Algernon:
Sure, we can continue by PM - but while I don't mind continuing the discussion in private, I usually prefer to copy "useful" pointers/comments over to the wiki anyway - just for the sake of preserving things - we are all volunteers after all, and it is fairly common for us to get stuck somewhere or be busy with real life - and then, PM discussions are obviously of little use to others interested in similar things - which is why I usually try to either duplicate useful comments in public, or -if possible- let people ask a bunch of questions and then augment existing docs accordingly, or extend/write dedicated tutorials/howtos to cover everything - which kinda allows us to "bootstrap" things without being overly limited by time or manpower, because all the pointers can be easily gathered in a single place, and maintained by fellow contributors.
The other thing is that all of us have our own little "niche" we're familiar with - but we're certainly far from knowing everything, which is why it does make sense to have a public discussion - as you may have noticed, Philosopher is usually a sure-bet when it comes to Nasal questions, and he's also the primary developer/designer and maintainer of the MapStructure framework (I really only prototyped a very simple version of it originally, he did the real work he) - likewise, Gijs has basically written most of the Canvas drawing routines, and we've really just ported them to become more generic. And then there are others who are very familiar with Inkscape etc. And obviously there's TheTom, as the designer of the Canvas system and maintainer of all scripting-space APIs/bindings.

As you can probably tell by now, I firmly believe in having a public discussion (don't worry, there are no embarrassing questions - if something seems unclear, we simply need to take it as feedback and improve our docs accordingly) - and keep in mind that Nasal and Canvas are highly FlightGear-specific technologies, so even professional developers who make a living writing software are likely to have a lot of questions. And like I said initially - the good thing about maintaining progress in public, is that others can track our progress, and maybe even join the effort - omega95 would be one obvious candidate interested in porting taxiways to MapStructure, something which you may not need immediately - while he would not necessarily want to extend the airport-selection dialog accordingly.

Technically, the Nasal side of things is fairly straightforward actually - most people seem to struggle with git more than with Nasal - so the question is if you're sufficiently familiar with git or if you'd prefer to use some other channel, such as the forum or the wiki (or a pastebin) to deal with code snippets.

EDIT: Actually, given the original wording of the question, Gijs may be completely right here - if this is only about NOT excluding smaller airports, it's really just about removing/customizing the logic accordingly - I specifically responded to "showing ALL" (=multiple) airports at the same time. Even though it doesn't make sense to look at (or even maintain) the old code - this whole thing should really be moved to MapStructure...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby Gijs » Mon Aug 25, 2014 11:35 am

Hooray wrote in Mon Aug 25, 2014 9:55 am:Actually - it doesn't use the ND code at all currently (it's still using the original *.draw helpers NOT MapStructure! This all predates ND/MapStructure stuff).

I thought most .draw files were coming from my original ND code? If it still uses that, then it uses ND code... If it doesn't use that, then what prevents it from displaying all airports? I've removed the check from airports-nd.model, to no avail, so it's clearly not using that one.

PS: Yes, it would be nice to get rid of all the files saying "this is deprecated". Can you or Philosopher give me a list of files that can be removed? Or do they still need to be ported?
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas Map Airport display

Postby Hooray » Mon Aug 25, 2014 12:06 pm

See the link that I posted - we cannot yet remove those files because the airport selection dialog is still using those.
The notice at the top of the file is a necessary evil, to prevent others from working with those files - as you have seen, you also started upating/maintaining them, despite them never being used by your code.

I would prefer if Philosopher or I could remove those files once the porting is completed - basically, it doesn't make sense to touch those files until airports.xml uses MapStructure entirely.
At that point, all *.draw, *.layer, *.model files can be removed, including the map.nas helper itself.

And now, those draw files used by the airport selection dialog are not at all based on your code - they predate your work by at least ~12 months - IIRC, it was Stuart who came up with the feature and added all the code directly into airports.xml - which is also where you can still find plenty of Nasal code that doesn't belong there - I'd say, that is also where such conditionals/checks can be found.

If I remember correctly, Stuart specifically wanted to show only a single airport, and only those having a certain "size".

The "airports-nd.model" you've been editing isn't even being used by airports.xml - the -nd suffix would suggest that it hasn't yet been ported to MapStructure and is only used there.

Overall, if we want to get rid of this mess, it makes sense to coordinate how to implement the features Algernon and Omega95 have been discussing, i.e. support for multiple airports and a style-able taxiway layer - once that work is completed, there isn't too much missing to use the code as can be seen above - which would allow us to delete those old files.

Concerning the screen shot I have posted, I think, I've pushed the code to a corresponding canvas-hackers branch back then.

The work isn't too difficult - we've done the same thing with the map-canvas.xml dialog after all:
Porting the map dialog for 3.2
Hooray wrote:Update: Philosopher just committed some major updates:
Image
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby Gijs » Mon Aug 25, 2014 12:10 pm

I thought we were talking about Equipment > Map (canvas), while you keep on mentioning the airport selection dialog. That might explain the confusion.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas Map Airport display

Postby Hooray » Mon Aug 25, 2014 12:13 pm

Indeed, you're right: I've been talking about airports.xml - everything you've said would be 100% correct in the context of map-canvas.xml
Even though it still would not make much sense to manually delete checks there or even introduce duplicated code - because THAT code is already sufficiently generic.

However, regardless of what we've been talking about here: to remove the aforementioned files, we will need to port airports.xml to use MapStructure (which is indeed largely based on your original drawing routines)

But I think you're right: Algernon must have been talking about map-canvas.xml and NOT airports.xml :?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby Gijs » Mon Aug 25, 2014 12:17 pm

So now that that's cleared, I still wonder what hides small airports from map-canvas.xml? The APT.* files don't have any checks on runway length as far as I can see.

When I wrote "remove" I had "disable the check for this particular case" in mind, so don't worry.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas Map Airport display

Postby Hooray » Mon Aug 25, 2014 12:27 pm

You can open/edit the corresponding lcontroller file, navigate to the searchCmd() method and then use debug.dump(results); to see what it gets from the C++ side (i.e. via positioned.findAirportsWithinRange(position, range) )- if that is also missing airports, it's something controlled by the C++ code - but if thee results vector does contain other -smaller- airports, there's Nasal logic removing certain items.

The C++ code is here: https://gitorious.org/fg/flightgear/sou ... .cxx#L1053
But like TheTom once said: additions should only be made to the newer, cppbind-based, version - not the old code...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby Avionyx » Mon Aug 25, 2014 9:06 pm

Looks like I sparked a debate here!

Hooray, you'll have to stop calling me Algernon, Algy will get annoyed he's having a lesser mortal mistaken for him ;)

Yes my initial question was just to try and get ALL airports to show on a map, however I'm very much interested in the idea of getting the old code replaced and converted over to use MapStructure. It seems like a good opportunity for doing so and while we can get the work done it may lead on to more bits being moved over which can only be a good thing.

Of course my first question is going to be why can we not get the airports to show, regardless of size.

From the link you posted above I see this on L1090:
Code: Select all
  FGAirport::TypeRunwayFilter filter;


Which, if my quick research is correct runs the found airports past:
Filter which passes specified port type and in case of airport checks if a runway larger the /sim/navdb/min-runway-lenght-ft exists.


However on checking "/sim/navdb/min-runway-length-ft" (sic) doesn't exist.

Which would mean that's a dead end anyway so I guess I'm looking in entirely the wrong direction?

Avionyx
Avionyx
 
Posts: 436
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGKA
Callsign: G-AVYX
Version: GIT
OS: Arch

Re: Canvas Map Airport display

Postby Hooray » Mon Aug 25, 2014 9:29 pm

Sorry about that ... I am usually just skimming through things, so I may have missed/confused the nick in this case - especially because I seemed to recall that Algernon recently posted mapping related screen shots - so it all made sense to me ...

Regarding your research, that's looking pretty good - the navdb itself (and its helpers) are to be found in in $FG_SRC/Navaids - you'll probably find some SGPropertyNode/fgGet*() call that defaults the property to a certain length (haven't checked yet).
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas Map Airport display

Postby F-JJTH » Mon Aug 25, 2014 10:56 pm

FYI I'm using --prop:/sim/navdb/min-runway-length-ft=200 since long time in order to display all airports with runway > 200ft (i.e all airports in fact).
I know that this tip works for the classic Map, I can't say anyhting about the Map Canvas because I never used it.
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: Canvas Map Airport display

Postby Avionyx » Tue Aug 26, 2014 8:27 am

Hi Guys,

Thanks for all the help so far.
I've now done some experimenting and set the property to both 200ft and 50ft. Although the airfield I am testing from (Deansland / EGKL) has a runway of over 1400ft, in 3.2 it's not showing up in either the classic map or the canvas one.
Image

This makes me think there must be some other filter running on it. I'm not quite able to see with my limited knowledge, but could there be something running against runway surface type or even airport facilities such as lack of SID's available etc?
Avionyx
 
Posts: 436
Joined: Mon Jan 11, 2010 3:07 pm
Location: EGKA
Callsign: G-AVYX
Version: GIT
OS: Arch

Next

Return to Canvas

Who is online

Users browsing this forum: No registered users and 2 guests