Board index FlightGear Development Canvas

Question about setGeoPosition

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.

Question about setGeoPosition

Postby artix » Thu Jun 26, 2014 2:14 pm

Hello, i'm making an Airbus version of the Canvas Navigation Display and i'm having some issue with the setGeoPosition() method.
When i call this method on an element that was already created and geo-positioned it seems that setGeoPosition() translates the element relatively to its previous geo position and not in an absolute way.
An example: i need to update the "Top of Climb" symbol on my route everytime the V/S changes, but i do not want the redraw the whole route everytime, so i'm trying to update just the "Top of Clib" symbol position (it was already created and positioned with setGeoPosition the first time the route was created). But when I call setGeoPosition on the element it moves relatively to its current position, even if the coordinates didn't change.

I experienced the same issue with the airplane symbol in PLAN mode: i do not want the re-draw the symbol everytime the aircraft moves and rotates (it's ugly and "flickering"). So instead of removing and redrawing it, i just call setGeoPosition on the element, but it moves too much until it disappears completely from the ND display.

Can you help me?
Thanks very much.
artix
 
Posts: 93
Joined: Wed Jun 25, 2014 8:42 pm
OS: Mac OS X

Re: Question about setGeoPosition

Postby Hooray » Thu Jun 26, 2014 2:17 pm

Hi & welcome !
artix wrote in Thu Jun 26, 2014 2:14 pm:Hello, i'm making an Airbus version of the Canvas Navigation Display

Please read & understand this first: http://wiki.flightgear.org/NavDisplay#Custom_ND_Styles
(you shouldn't have to start from scratch, but you also should be aware of the state of the "framework")


and i'm having some issue with the setGeoPosition() method.

The Canvas ND makes use of the so called MapStructure framework, which automatically handles these things usually - so you should normally not have to set up lat/lon for objects, unless you are about to come up with a highly custom MapStructure layer ?

If you are not using the MapStructure framework, you are making this more difficult than it needs to be - please share your code, so that we can take a look and provide better advice.
You can use a pastebin, the forum or gitorious to share your code.

Overall, you'll probably WANT to use the MapStructure framework, and extend the Canvas ND framework - which should mean for most cases that you won't have to handle the nitty gritty details by yourself. :D

An example: i need to update the "Top of Climb" symbol on my route everytime the V/S changes, but i do not want the redraw the whole route everytime, so i'm trying to update just the "Top of Clib" symbol position

Your concerns are valid, and the whole question demonstrates very good thinking - but this is exactly why MapStructure has been created.
See the MapStructure ALT-profile layer: http://wiki.flightgear.org/Canvas_MapStructure_Layers
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: Question about setGeoPosition

Postby artix » Thu Jun 26, 2014 3:06 pm

Thank you very much, i will go to take a look. I guess the main problem is that i'm currently developing my aircraft (a customized version of the A320) on top of the latest stable release (3.0), and maybe the framework wasn't so flexible in that version (it's more Boeing-centered) or maybe i did not correctly understand how to use the MapStructure framework and i'm using a lot of (maybe unnecessary) hacks to customize my ND.
For example i cannot find the ALT-profile layer in the stable release.

I could checkout the latest sources from the git repo and work on top of them, but then i have to wait for the next FG release to release my own aircraft.
What do you recommend?

Thank you again for your help!
artix
 
Posts: 93
Joined: Wed Jun 25, 2014 8:42 pm
OS: Mac OS X

Re: Question about setGeoPosition

Postby Hooray » Thu Jun 26, 2014 3:12 pm

The wiki should contain all the latest links to the corresponding sources.
But yes, it would make sense to either build from source, or simply wait for the upcoming release, which is just a matter of a few weeks.
Overall, building from source would probably be a good idea, especially for people already familiar with git & Linux.

Otherwise, targeting 3.2 is not such a bad idea either, because the degree of Canvas/MapStructure changes that will be a part of this release, is going to simplify ND/glass development tremendously.
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


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest