Canvas MapStructure: Difference between revisions

Jump to navigation Jump to search
m
Switch to the {{forum url}} and {{forum link}} templates for all forum links.
m (update 4+ year old screenshot)
m (Switch to the {{forum url}} and {{forum link}} templates for all forum links.)
 
Line 12: Line 12:
{{Canvas Navigation}}
{{Canvas Navigation}}


[[File:Gpsmap196-MapStructure.png|thumb|F-JJTH's GPSMap196 in the process of being ported to [[Canvas]] using Philosopher's MapStructure framework for mapping (LOD/scaling not applied here, but available) - see [http://forum.flightgear.org/viewtopic.php?f=71&t=23047] ]]
[[File:Gpsmap196-MapStructure.png|thumb|F-JJTH's GPSMap196 in the process of being ported to [[Canvas]] using Philosopher's MapStructure framework for mapping (LOD/scaling not applied here, but available) - see {{forum link|t=23047}}]]


[[File:Gpsmap196-MapStructure-with-styling-applied.png|thumb|MapStructure layers integrated in GPSMap196 with some custom styling applied]]
[[File:Gpsmap196-MapStructure-with-styling-applied.png|thumb|MapStructure layers integrated in GPSMap196 with some custom styling applied]]
Line 18: Line 18:
[[File:VSD-prototype-by-omega95.png|thumb|Canvas-based VSD prototype (Vertical Situation Display) developed by Omega95]]
[[File:VSD-prototype-by-omega95.png|thumb|Canvas-based VSD prototype (Vertical Situation Display) developed by Omega95]]


[[File:MapStructure-WXR-layer-by-omega95.png|thumb|MapStructure WXR (weather) layer created by omega95's using a web service API to fetch live online imagery[http://forum.flightgear.org/viewtopic.php?f=71&t=23753]]]
[[File:MapStructure-WXR-layer-by-omega95.png|thumb|MapStructure WXR (weather) layer created by omega95's using a web service API to fetch live online imagery {{forum link|t=23753}}]]




Line 43: Line 43:
Thus, the idea was to grow a library of generic building blocks that live in $FG_ROOT and that are sufficiently generic and customizable to basically enable people to collaborate more properly by providing a strong incentive via compelling functionality that can be easily maintained/updated in the future. The thinking was that all aircraft/GUI dialogs using a single back-end would automatically benefit from significant updates to the back-end that way (think performance, features etc).
Thus, the idea was to grow a library of generic building blocks that live in $FG_ROOT and that are sufficiently generic and customizable to basically enable people to collaborate more properly by providing a strong incentive via compelling functionality that can be easily maintained/updated in the future. The thinking was that all aircraft/GUI dialogs using a single back-end would automatically benefit from significant updates to the back-end that way (think performance, features etc).
Our strategy was to adopt a MVC (model/view/controller) approach, where the model would represent what is to be rendered, the view would map the Canvas system and its primitives (elements) and underlying APIs, whereas the controller would usually be use-case specific (think cockpit vs. GUI dialog).<ref>{{cite web
Our strategy was to adopt a MVC (model/view/controller) approach, where the model would represent what is to be rendered, the view would map the Canvas system and its primitives (elements) and underlying APIs, whereas the controller would usually be use-case specific (think cockpit vs. GUI dialog).<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=317039#p317039
   |url    =  {{forum url|p=317039}}
   |title  =  <nowiki> my "2c" ;-) </nowiki>  
   |title  =  <nowiki> my "2c" ;-) </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 125: Line 125:
== Performance Considerations ==
== Performance Considerations ==


[[File:Map-canvas-mapstructure-performance.png|thumb|stress-testing [[MapStructure]] using the ufo @ KSFO circling at 2000 kts in a climb, see [http://forum.flightgear.org/viewtopic.php?f=71&t=21509&p=211611#p211611] ]]
[[File:Map-canvas-mapstructure-performance.png|thumb|stress-testing [[MapStructure]] using the ufo @ KSFO circling at 2000 kts in a climb, see {{forum link|p=211611}}]]


Recently, it has been two years since [[Canvas]], our 2D rendering API, got integrated. And even today, there are people claiming that aircraft using Nasal and Canvas are generally slow and don't provide sufficient performance, suggesting not to adopt Canvas yet, so here are some comments about that, to help put some context around such statements:
Recently, it has been two years since [[Canvas]], our 2D rendering API, got integrated. And even today, there are people claiming that aircraft using Nasal and Canvas are generally slow and don't provide sufficient performance, suggesting not to adopt Canvas yet, so here are some comments about that, to help put some context around such statements:
Line 207: Line 207:


That is exactly why people are working towards more targeted frameworks on top of Nasal/Canvas - but it's a process that is very much still in progress, and probably will be for at least another 2-3 release cycles. Pointing out obvious shortcomings isn't going to help anyone though - certainly not as much as getting involved in one way or another</nowiki>
That is exactly why people are working towards more targeted frameworks on top of Nasal/Canvas - but it's a process that is very much still in progress, and probably will be for at least another 2-3 release cycles. Pointing out obvious shortcomings isn't going to help anyone though - certainly not as much as getting involved in one way or another</nowiki>
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=211169#p211169
   |{{cite web |url={{forum url|p=211169}}
     |title=<nowiki>Re: Does FlightGear has Multiplayer Combat mode?</nowiki>
     |title=<nowiki>Re: Does FlightGear has Multiplayer Combat mode?</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 271: Line 271:
<br/>
<br/>
The other thing is that translation (centered/off center mode) should always be based on the parent group's dimensions (bounding box) and that we really shouldn't be using the top-level canvas, because a MFD very well be split into several screen areas (which also applies to the GPSMap196 and most other modern avionics).
The other thing is that translation (centered/off center mode) should always be based on the parent group's dimensions (bounding box) and that we really shouldn't be using the top-level canvas, because a MFD very well be split into several screen areas (which also applies to the GPSMap196 and most other modern avionics).
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213354#p213354
   |{{cite web |url={{forum url|p=213354}}
     |title=<nowiki>Evolving the MapStructure & NavDisplay Frameworks ...</nowiki>
     |title=<nowiki>Evolving the MapStructure & NavDisplay Frameworks ...</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 286: Line 286:
We're talking here about roughly 50 lines of C++ code, which exist already and which would need to be turned into a Canvas::Map::Projection
We're talking here about roughly 50 lines of C++ code, which exist already and which would need to be turned into a Canvas::Map::Projection
Note that this would benefit any, and all, Canvas-based NavDisplay/Map applications, too - also note that this information is readily available in various places, so there is no need to draw any wrong conclusions or spread any misinformation here.<ref>{{cite web
Note that this would benefit any, and all, Canvas-based NavDisplay/Map applications, too - also note that this information is readily available in various places, so there is no need to draw any wrong conclusions or spread any misinformation here.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=300979#p300979
   |url    =  {{forum url|p=300979}}
   |title  =  <nowiki> Re: Any plans for a new GUI? </nowiki>  
   |title  =  <nowiki> Re: Any plans for a new GUI? </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 298: Line 298:
   |We've already fixed that in the (old) map dialog, by using an azimuthal equidistant projection (see [[images/7/71/Map_north_pole_route.jpg|screenshot]]). Porting the projection to Canvas is on my todo list. Such a projection is much much better for navigational use.
   |We've already fixed that in the (old) map dialog, by using an azimuthal equidistant projection (see [[images/7/71/Map_north_pole_route.jpg|screenshot]]). Porting the projection to Canvas is on my todo list. Such a projection is much much better for navigational use.
Curves in routes are not calculated by Canvas, nor by the ND though. It's the route manager that splits up a route in segments in order to get smooth transitions.
Curves in routes are not calculated by Canvas, nor by the ND though. It's the route manager that splits up a route in segments in order to get smooth transitions.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=227838#p227838
   |{{cite web |url={{forum url|p=227838}}
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |author=<nowiki>Gijs</nowiki>
     |author=<nowiki>Gijs</nowiki>
Line 307: Line 307:
{{FGCquote
{{FGCquote
   |The new ND uses the actual route-manager paths, which allows it to draw holdings, flyby waypoints (thanks to James recent work) etc. But we'll need the azimuthal projection anyway, so I'll bump my todo list
   |The new ND uses the actual route-manager paths, which allows it to draw holdings, flyby waypoints (thanks to James recent work) etc. But we'll need the azimuthal projection anyway, so I'll bump my todo list
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=227845#p227845
   |{{cite web |url={{forum url|p=227845}}
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |author=<nowiki>Gijs</nowiki>
     |author=<nowiki>Gijs</nowiki>
Line 320: Line 320:
<br/>
<br/>
Ideally, we would expose the projection as a property for each Map so that it can be changed dynamically.
Ideally, we would expose the projection as a property for each Map so that it can be changed dynamically.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=227932#p227932
   |{{cite web |url={{forum url|p=227932}}
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |title=<nowiki>Re: Canvas ND performance issues with route-manager</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 340: Line 340:
{{FGCquote
{{FGCquote
   |is anyone working on replacing the map dialog based upon this code? Because that seems like the most important use case to demonstrate that MVC pattern can support, aside from the NavDisplays.
   |is anyone working on replacing the map dialog based upon this code? Because that seems like the most important use case to demonstrate that MVC pattern can support, aside from the NavDisplays.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=193275#p193275
   |{{cite web |url={{forum url|p=193275}}
     |title=<nowiki>Re: How to display Airport Chart?</nowiki>
     |title=<nowiki>Re: How to display Airport Chart?</nowiki>
     |author=<nowiki>zakalawe</nowiki>
     |author=<nowiki>zakalawe</nowiki>
Line 372: Line 372:
</ol>
</ol>


   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=227124#p227124
   |{{cite web |url={{forum url|p=227124}}
     |title=<nowiki>Re: Phasing out MapWidget post 3.2</nowiki>
     |title=<nowiki>Re: Phasing out MapWidget post 3.2</nowiki>
     |author=<nowiki>onox</nowiki>
     |author=<nowiki>onox</nowiki>
Line 397: Line 397:
   |the recent GUI work committed by TheTom means that we can phase out the PUI map-canvas.xml dialog and create the whole dialog procedurally using a native canvas window, because we really only need two types of widgets: buttons and checkboxes, which are both supported now, thanks to the new "Aircraft Center":
   |the recent GUI work committed by TheTom means that we can phase out the PUI map-canvas.xml dialog and create the whole dialog procedurally using a native canvas window, because we really only need two types of widgets: buttons and checkboxes, which are both supported now, thanks to the new "Aircraft Center":


[[File:Native Canvas MapWidget Dialog.png|450px|thumb|Native Canvas MapWidget dialog using just Canvas Widgets, the Map has been turned into a Canvas Widget itself, so that it can be easily embedded in other dialogs (obviously the whole thing still needs to be cleaned up, layouting isn't currently used yet). See [http://forum.flightgear.org/viewtopic.php?f=71&t=23391&p=213435#p213435]]]
[[File:Native Canvas MapWidget Dialog.png|450px|thumb|Native Canvas MapWidget dialog using just Canvas Widgets, the Map has been turned into a Canvas Widget itself, so that it can be easily embedded in other dialogs (obviously the whole thing still needs to be cleaned up, layouting isn't currently used yet). See {{forum link|p=213435}}]]


[[File:Native Canvas MapWidget Dialog Prototyping.png|400px|thumb|More Canvas/MapWidget prototyping. See [http://forum.flightgear.org/viewtopic.php?f=71&t=23391&p=213435#p213435]]]
[[File:Native Canvas MapWidget Dialog Prototyping.png|400px|thumb|More Canvas/MapWidget prototyping. See {{forum link|p=213435}}]]


[[File:MapStructure dialog with clipping and event handling applied.png|400px|thumb|Screen shot showing TheTom's modified demo dialog with a [[MapStructure]] based map that has clipping and event handling applied, i.e. can respond to common mouse events in order to either display tooltips or support drag&drop-style GUI dialogs for editing map-like displays, e.g. for creating an [[Advanced weather]] GUI[http://forum.flightgear.org/viewtopic.php?f=71&t=17642]. Particular care must be taken to formalize z-index handling (rendering priority) for each MapStructure layer, which is something we still need to work out, especially for possibly overlapping symbols...]]
[[File:MapStructure dialog with clipping and event handling applied.png|400px|thumb|Screen shot showing TheTom's modified demo dialog with a [[MapStructure]] based map that has clipping and event handling applied, i.e. can respond to common mouse events in order to either display tooltips or support drag&drop-style GUI dialogs for editing map-like displays, e.g. for creating an [[Advanced weather]] GUI {{forum link|t=17642}}. Particular care must be taken to formalize z-index handling (rendering priority) for each MapStructure layer, which is something we still need to work out, especially for possibly overlapping symbols...]]


[[File:MapStructure-based Weather Editor Widget for Canvas using interactive and editable lcontroller files.png|500px|thumb|This screen shot shows an experimental MapStructure-based Weather Editor Widget for [[Canvas]] using interactive and editable lcontroller files that respond to GUI events so that map symbols can be interactively placed on a map.]]
[[File:MapStructure-based Weather Editor Widget for Canvas using interactive and editable lcontroller files.png|500px|thumb|This screen shot shows an experimental MapStructure-based Weather Editor Widget for [[Canvas]] using interactive and editable lcontroller files that respond to GUI events so that map symbols can be interactively placed on a map.]]


   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213083#p213083
   |{{cite web |url={{forum url|p=213083}}
     |title=<nowiki>Re: NavDisplay & MapStructure discussion (previously via PM)</nowiki>
     |title=<nowiki>Re: NavDisplay & MapStructure discussion (previously via PM)</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 415: Line 415:
{{FGCquote
{{FGCquote
   |The rationale being that we're in the process of turning our map-canvas.xml dialog into a generic, and reusable, widget for $FG_ROOT/Nasal/canvas/gui/widgets - the widget is using the new Layout engine to align other widgets (checkboxes &amp; buttons for now). And one of our goals is to also modernize airports.xml (the airport selection dialog) such that it can use MapStructure. The simplest way would be to simply turn the PUI CanvasWidget into a Canvas.Window() so that layouting etc works as expected, and so that we can simply show the new scripted MapWidget there.
   |The rationale being that we're in the process of turning our map-canvas.xml dialog into a generic, and reusable, widget for $FG_ROOT/Nasal/canvas/gui/widgets - the widget is using the new Layout engine to align other widgets (checkboxes &amp; buttons for now). And one of our goals is to also modernize airports.xml (the airport selection dialog) such that it can use MapStructure. The simplest way would be to simply turn the PUI CanvasWidget into a Canvas.Window() so that layouting etc works as expected, and so that we can simply show the new scripted MapWidget there.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213493#p213493
   |{{cite web |url={{forum url|p=213493}}
     |title=<nowiki>Using a PUI CanvasWidget as a Canvas.Window ?</nowiki>
     |title=<nowiki>Using a PUI CanvasWidget as a Canvas.Window ?</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 507: Line 507:
</ul>
</ul>


   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213215#p213215
   |{{cite web |url={{forum url|p=213215}}
     |title=<nowiki>Re: 777 EFB: initial feedback</nowiki>
     |title=<nowiki>Re: 777 EFB: initial feedback</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 527: Line 527:
=== Framework ===
=== Framework ===
* we should add some helper functions for people to more easily do RAD when developing new layers/controllers, this would include supporting reloading from disk, and creating a simple canvas window to show the corresponding layers, maybe with a "reload" button that suspends and restarts everything after reloading - this would probably even help us {{Not done}}
* we should add some helper functions for people to more easily do RAD when developing new layers/controllers, this would include supporting reloading from disk, and creating a simple canvas window to show the corresponding layers, maybe with a "reload" button that suspends and restarts everything after reloading - this would probably even help us {{Not done}}
* investigate adding a dedicated "Filter" class for positionedSearches, so that things like custom object filters (think ATC/RADAR etc) can be more easily implemented by implementing a corresponding interface (mirage2000) [http://forum.flightgear.org/viewtopic.php?f=30&t=21955#p199555] {{Not done}}
* investigate adding a dedicated "Filter" class for positionedSearches, so that things like custom object filters (think ATC/RADAR etc) can be more easily implemented by implementing a corresponding interface (mirage2000) {{forum link|p=199555}} {{Not done}}
* logging should probably be handled by the framework directly, so that messages can be redirected or stored {{Not done}}
* logging should probably be handled by the framework directly, so that messages can be redirected or stored {{Not done}}
* support benchmarking/profiling of layers via systime() - as mentioned by Philosopher on the forum {{Not done}}
* support benchmarking/profiling of layers via systime() - as mentioned by Philosopher on the forum {{Not done}}
Line 715: Line 715:
Caching is accomplished by a little helper framework called '''SymbolCache''' which sets up an empty Canvas texture for storing required symbols there.  
Caching is accomplished by a little helper framework called '''SymbolCache''' which sets up an empty Canvas texture for storing required symbols there.  


[[File:PropertyBrowser with Canvas Preview.png|thumb|Slightly extended Property Browser to show a preview for each Canvas for troubleshooting/debugging purposes, as per [http://forum.flightgear.org/viewtopic.php?f=71&t=21139&start=75#p195232].]]
[[File:PropertyBrowser with Canvas Preview.png|thumb|Slightly extended Property Browser to show a preview for each Canvas for troubleshooting/debugging purposes, as per {{forum link|p=195232}}.]]


This is where symbols for VORs, DMEs, FIXes and waypoints will be kept.  
This is where symbols for VORs, DMEs, FIXes and waypoints will be kept.  
Line 721: Line 721:
Internally, each *.symbol file will still contain all the logic required to actually render the corresponding symbol, which may include  hard-coded OpenVG drawing commands, but also SVG or raster images.  
Internally, each *.symbol file will still contain all the logic required to actually render the corresponding symbol, which may include  hard-coded OpenVG drawing commands, but also SVG or raster images.  


[[File:Early MapStructure Caching Experiments.png|thumb|MapStructure/SymbolCache experiments for caching symbols and symbol instancing [http://forum.flightgear.org/viewtopic.php?f=71&t=21139&p=193672&hilit=#p193672]]]
[[File:Early MapStructure Caching Experiments.png|thumb|MapStructure/SymbolCache experiments for caching symbols and symbol instancing {{forum link|p=193672}}]]


However, the cache will be dynamically populated according to all the symbols that are required for each layer. This approach proved quite efficient and straightforward so that even the extra500 developers adopted this method on their [[Avidyne Entegra R9]] instrument.  
However, the cache will be dynamically populated according to all the symbols that are required for each layer. This approach proved quite efficient and straightforward so that even the extra500 developers adopted this method on their [[Avidyne Entegra R9]] instrument.  
Line 881: Line 881:
-->
-->


[[File:Canvas-MapStructure-Demo-Layer-with-custom-searchCmd.png|550px|thumb|A simple MapStructure layer called DEMO that renders a circle of NDB symbols (SVGs) in the vicinity of the aircraft using geo.nas and its  helpers like geo.aircraft_position() and the geo.Coord.apply_course_distance(course, dist) method as per [http://forum.flightgear.org/viewtopic.php?f=71&t=23299&p=213177#p213177]. See [[Canvas Radar]] to learn more. ]]
[[File:Canvas-MapStructure-Demo-Layer-with-custom-searchCmd.png|550px|thumb|A simple MapStructure layer called DEMO that renders a circle of NDB symbols (SVGs) in the vicinity of the aircraft using geo.nas and its  helpers like geo.aircraft_position() and the geo.Coord.apply_course_distance(course, dist) method as per {{forum link|p=213177}}. See [[Canvas Radar]] to learn more. ]]




Line 922: Line 922:
<br/>
<br/>
Setting _equals to a "return 0" function simply means that each object will be taken off and recreated on each search. But, when there's a better id to use, MapStructure can remove only the old ones and add only the new ones. How that is done depends on both the model object and the drawing – for instance, if a *.symbol file says to completely redraw the Canvas group based on the model, that means it potentially could be used with different models during its lifetime, whereas if the symbol is only set up once on initialization, it would not reflect changes in it's model object and thus should be removed when it is gone.
Setting _equals to a "return 0" function simply means that each object will be taken off and recreated on each search. But, when there's a better id to use, MapStructure can remove only the old ones and add only the new ones. How that is done depends on both the model object and the drawing – for instance, if a *.symbol file says to completely redraw the Canvas group based on the model, that means it potentially could be used with different models during its lifetime, whereas if the symbol is only set up once on initialization, it would not reflect changes in it's model object and thus should be removed when it is gone.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213308#p213308
   |{{cite web |url={{forum url|p=213308}}
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |author=<nowiki>Philosopher</nowiki>
     |author=<nowiki>Philosopher</nowiki>
Line 931: Line 931:
{{FGCquote
{{FGCquote
   |The other ugly thing about _equals is that it's essentially duplicated by MapStructure {{gitorious source|fg|fgdata|commit=fcf18d70e20ef629d96367cd0907dae6178e1997|path=Nasal/canvas/MapStructure.nas|line=516|text=here}}, and is used {{gitorious source|fg|fgdata|commit=fcf18d70e20ef629d96367cd0907dae6178e1997|path=Nasal/canvas/MapStructure.nas|line=894|text=here}} to find models inside of the Layer's internal list, while the geo search obviously uses a competing approach. I might get around to fixing that ;). Basically MapStructure's whole flow is: layer searchCmd -&gt; models -&gt; symbols -&gt; canvas drawings.
   |The other ugly thing about _equals is that it's essentially duplicated by MapStructure {{gitorious source|fg|fgdata|commit=fcf18d70e20ef629d96367cd0907dae6178e1997|path=Nasal/canvas/MapStructure.nas|line=516|text=here}}, and is used {{gitorious source|fg|fgdata|commit=fcf18d70e20ef629d96367cd0907dae6178e1997|path=Nasal/canvas/MapStructure.nas|line=894|text=here}} to find models inside of the Layer's internal list, while the geo search obviously uses a competing approach. I might get around to fixing that ;). Basically MapStructure's whole flow is: layer searchCmd -&gt; models -&gt; symbols -&gt; canvas drawings.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213308#p213308
   |{{cite web |url={{forum url|p=213308}}
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |title=<nowiki>Re: Get objects to show up on Map/Radar</nowiki>
     |author=<nowiki>Philosopher</nowiki>
     |author=<nowiki>Philosopher</nowiki>
Line 940: Line 940:
{{FGCquote
{{FGCquote
   |The main thing to keep in mind here is that many MapStructure layers deal with positioned objects, i.e. objects that have lat/lon/altitude - internally, the system uses a "diff" (delta) method to compare the current result set against the previous result set to tell how many new/removed items are there - so that things can be selectived updated (added/removed), i.e. to only partially redraw/update things for the sake of efficiency.
   |The main thing to keep in mind here is that many MapStructure layers deal with positioned objects, i.e. objects that have lat/lon/altitude - internally, the system uses a "diff" (delta) method to compare the current result set against the previous result set to tell how many new/removed items are there - so that things can be selectived updated (added/removed), i.e. to only partially redraw/update things for the sake of efficiency.
   |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=216407#p216407
   |{{cite web |url={{forum url|p=216407}}
     |title=<nowiki>Re: Live WXRadar MapStructure Layer Development</nowiki>
     |title=<nowiki>Re: Live WXRadar MapStructure Layer Development</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
Line 986: Line 986:
For a list of MapStructure files (meanwhile incomplete), see: [[Canvas MapStructure Layers]]
For a list of MapStructure files (meanwhile incomplete), see: [[Canvas MapStructure Layers]]
Once you have found a layer that is not yet style-able, you need to encode style-able attributes using the relevant_keys vector.<ref>{{cite web
Once you have found a layer that is not yet style-able, you need to encode style-able attributes using the relevant_keys vector.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=297586#p297586
   |url    =  {{forum url|p=297586}}
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 996: Line 996:
some layers are still missing styling-support - which basically means identifying everything that is currently hard-coded but styling related (think colors, fonts, sie, images/artwork) and replacing that with a variable, the same variable should be added to the df_style (default style) of the symbol, and then you need to set up a cache entry specifiying the symbol specific variables (e.g. color and fontsize), so that the styleable-cache can tell if it has a certain variant of a symbol or not
some layers are still missing styling-support - which basically means identifying everything that is currently hard-coded but styling related (think colors, fonts, sie, images/artwork) and replacing that with a variable, the same variable should be added to the df_style (default style) of the symbol, and then you need to set up a cache entry specifiying the symbol specific variables (e.g. color and fontsize), so that the styleable-cache can tell if it has a certain variant of a symbol or not
map-canvas.xml is a simple example, artix's Airbus style is more sophisticated.<ref>{{cite web
map-canvas.xml is a simple example, artix's Airbus style is more sophisticated.<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=297587#p297587
   |url    =  {{forum url|p=297587}}
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 1,008: Line 1,008:


For example, open the VOR.symbol file and see how it sets up a default style hash (df_style) here: https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Nasal/canvas/map/VOR.symbol<ref>{{cite web
For example, open the VOR.symbol file and see how it sets up a default style hash (df_style) here: https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Nasal/canvas/map/VOR.symbol<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=297586#p297586
   |url    =  {{forum url|p=297586}}
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 1,020: Line 1,020:


<ref>{{cite web
<ref>{{cite web
   |url    =  https://forum.flightgear.org/viewtopic.php?p=297586#p297586
   |url    =  {{forum url|p=297586}}
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |title  =  <nowiki> Re: [SOLVED] How to modify symbols in MapStructure layers </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
   |author =  <nowiki> Hooray </nowiki>  
Line 1,310: Line 1,310:
{{MapStructure lcontroller|layername=TUT}}
{{MapStructure lcontroller|layername=TUT}}


Now, here's some code to actually test the new layer (contributed by ludomotico [http://forum.flightgear.org/viewtopic.php?f=71&t=27591#p259306]):
Now, here's some code to actually test the new layer (contributed by ludomotico {{forum link|p=259306}}):


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">

Navigation menu