Board index FlightGear Development Canvas

Canvas: Label uncluttering

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.

Re: Using a canvas map in the GUI

Postby TheTom » Mon Sep 17, 2012 4:48 pm

Great :) I only see again that we will need to somehow declutter the labeling as most labels are not clearly visible. Seems like a good testing environment for new features and requirements for the Canvas.

Also, it would be very handy to be able to navigate through all the children of a Group - not just retrieve them by name.

Here you are: http://gitorious.org/fg/fgdata/commit/f ... 1aa9fd98f9
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: Using a canvas map in the GUI

Postby Hooray » Mon Sep 17, 2012 5:45 pm

TheTom wrote in Mon Sep 17, 2012 4:48 pm:I only see again that we will need to somehow declutter the labeling as most labels are not clearly visible. Seems like a good testing environment for new features and requirements for the Canvas.


This is true, if you remember, we exchanged some related ideas a while ago, I copied them here: http://wiki.flightgear.org/Canvas_Prope ... t_elements

It would probably make sense to support uncluttering at the "group"-level, or possibly even for multiple groups - so that the code is aware of other groups/layers and all drawables - in its simplest form, one would determine the required bounding box for a text label and then compute the bounding boxes for all other static screen elements (whose position can not be altered) and come up with a vector of available areas matching the required size.

PS: Stuart, that looks great - without having looked at your code (obviously): you don't need to create these symbols/runways procedurally, you can also use a vector (svg) image - that would enable other people to change the appearance/style (just by using an svg editor like inkscape) without having to know anything about Nasal coding.
Last edited by Hooray on Mon Sep 17, 2012 6:30 pm, edited 1 time in total.
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: 11345
Joined: Tue Mar 25, 2008 8:40 am

Re: Using a canvas map in the GUI

Postby TheTom » Mon Sep 17, 2012 6:29 pm

Hooray wrote in Mon Sep 17, 2012 5:45 pm:This is true, if you remember, we exchanged some related ideas a while ago

Yes I know :) But especially maps can also benefit from not only clever placement but also no placements at all. Eg. show different amount of data depending on zoom level, or group parkings with the same name together and only show the individual numbers (maybe only on hover [if we have proper mouse interaction support]) or even leave them away.
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Canvas: Label uncluttering

Postby Hooray » Wed Sep 19, 2012 9:26 pm

zakalawe wrote:Deciding an API for limiting symbols / databoxes is going to be very important - the NavDisplay and MapWidget already have different solutions for that. In particular there's a notion of symbol priority - basically I sort the available symbols by priority, and the display can be limited to the most important 10/50/100. This is also the approach taken by some real world map displays.


After reading through wikipedia and stackoverflow, there's an existing GPL'ed cross-platform library to handle this particular problem (used by QGIS):

Image
http://pal.heig-vd.ch/index.php?page=about-pal
PAL labeling library is a ready-to-use C++ library providing efficient meta-heuristic algorithms for finding good placement solutions for point, line and polygon labeling.
It is released under the conditions of LGPL, GNU Lesser General Public License.
This website represents a platform with the main focus to federate and bring together an opensource community to maintain, offer support and follow innovative new developments in the field of labeling through PAL library.
Designed for multilayers and real-time labeling of maps, PAL provides impressive results, both in terms of execution time and solution quality. It uses combinatorial optimization approaches to maximize number of displayed labels (in opposition to greedy approaches). PAL is useful for polygon, line, point features labeling, and numerous options can be set for each layer to customize the labeling process.


The source tree of the svn repository checkout is ~ 2MB, and uses an autotools based build system.
The configure.ac script is fairly sizable, but most of it seems related to supporting the Java/JNI bindings, which we wouldn't need.
There's an integration guide available at: http://pal.heig-vd.ch/uploads/documenta ... egrate.pdf
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: 11345
Joined: Tue Mar 25, 2008 8:40 am

Re: Using a canvas map in the GUI

Postby TheTom » Wed Sep 19, 2012 9:47 pm

zakalawe wrote in Wed Sep 19, 2012 12:34 pm:Deciding an API for limiting symbols / databoxes is going to be very important - the NavDisplay and MapWidget already have different solutions for that. In particular there's a notion of symbol priority - basically I sort the available symbols by priority, and the display can be limited to the most important 10/50/100. This is also the approach taken by some real world map displays.

I've already had a look at this and seems like it already works not too bad ;) But I'd like also to try oder variants and methods. What I think would improving is grouping together similar items and only split them based on their distance/displayed size. I've also talked to a friend who is developing a new flightmap system and we came up with an idea to preprocess static parts of the map and calculate good placements possibly with a non realtime algorithm and only place the dynamic data (mainly aircraft) during runtime.

Hooray wrote in Wed Sep 19, 2012 12:56 pm:Like we mentioned earlier, the C++ code of the Canvas system would need to be extended such that it also computes bounding box dimensions for each drawable (or just OSGText labels) and writes that info to the tree,

This is already done. Have a look at the bounding-box children of each element (only groups/maps don't expose it, as OSG only provides bounding spheres for them - if it's needed we can also expose the bounding sphere or manually calculate a bounding box).
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: Canvas: Label uncluttering

Postby Hooray » Sun May 11, 2014 11:29 pm

I'd like also to try oder variants and methods. What I think would improving is grouping together similar items and only split them based on their distance/displayed size.

This is still something that we may want to revisit sooner or later, maybe after 3.2 is out. Having some "smart" label placement mode that takes bounding boxes into account (for groups that can be specified, or even just for sub groups) without having to go through Nasal space would be useful to keep the impact on performance low.

http://wiki.flightgear.org/FlightGear_N ... Map_dialog
Image

We haven't yet implemented the "data" mode, but here's the original dialog for comparison:
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: 11345
Joined: Tue Mar 25, 2008 8:40 am


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest