Board index FlightGear Development Canvas

setDataGeo() and Arcs

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.

setDataGeo() and Arcs

Postby artix » Thu Jul 03, 2014 3:23 pm

Hi, is it possible to draw arcs using the .setDataGeo() method on a Path?
I've tried to append the VG_SCCWARC_TO command to the commands vector, but what coordinates should i pass?

VG_SCCWARC_TO needs 5 params: rx,ry,0, x,y

I used latitude and longitude for x and y, but what for rx and ry?
artix
 
Posts: 93
Joined: Wed Jun 25, 2014 8:42 pm
OS: Mac OS X

Re: setDataGeo() and Arcs

Postby Hooray » Thu Jul 03, 2014 3:27 pm

artix wrote in Thu Jul 03, 2014 3:23 pm:Hi, is it possible to draw arcs using the .setDataGeo() method on a Path?
I've tried to append the VG_SCCWARC_TO command to the commands vector, but what coordinates should i pass?

VG_SCCWARC_TO needs 5 params: rx,ry,0, x,y

I used latitude and longitude for x and y, but what for rx and ry?


Subject: Question about setGeoPosition
Hooray wrote:
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


https://gitorious.org/fg/canvas-hackers ... ile.symbol
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: setDataGeo() and Arcs

Postby artix » Thu Jul 03, 2014 3:48 pm

In this case i need this to draw hold-patterns which usually have curves and i didn't find anything similar in MapStructure
artix
 
Posts: 93
Joined: Wed Jun 25, 2014 8:42 pm
OS: Mac OS X

Re: setDataGeo() and Arcs

Postby Philosopher » Fri Jul 04, 2014 12:14 am

Just use these (or equivalents) with .addSegmentGeo(): https://gitorious.org/fg/fgdata/source/ ... i.nas#L791
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: setDataGeo() and Arcs

Postby artix » Fri Jul 04, 2014 3:35 pm

Philosopher wrote in Fri Jul 04, 2014 12:14 am:Just use these (or equivalents) with .addSegmentGeo(): https://gitorious.org/fg/fgdata/source/ ... i.nas#L791


What kind of parameter should i pass for radius x and radius y? In pixel or meters?
Example: arcSmallCCW takes radius in pixels but if I use addSegmentGeo am i required to pass radius in meters?
artix
 
Posts: 93
Joined: Wed Jun 25, 2014 8:42 pm
OS: Mac OS X


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest