Canvas Element: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with "Category:Canvas Elements {{Template:Canvas Navigation}} = Properties = == z-index == * '''Format''': <number> (Integer) * '''Default''': 0 Change order in which elemen...")
 
mNo edit summary
Line 1: Line 1:
[[Category:Canvas Elements]]
[[Category:Canvas Elements]]
{{Template:Canvas Navigation}}
{{Template:Canvas Navigation}}
The canvas system is based on a handful of rendering primitives. All new canvas primitives need to implement the Canvas::Element interface, the canvas system currently supports the following primitives (see $SG_SRC/canvas/elements):
* CanvasText (mapped to osgText)
* CanvasPath (mapped to OpenVG, currently also used to render SVGs)
* CanvasImage (mapped to osg::Image)
* CanvasMap (automatic projection of geographic coordinates to screen coordinates)
* CanvasGroup (a group of arbitrary canvas primitives)
These primitives alone can already be used to create very sophisticated avionics and dialogs - however, depending on your needs, you may want to extend the canvas system to support additional primitives. Typically, you'll want to add new primitives in order to optimize performance or simplify the creation of more sophisticated avionics and/or dialogs (e.g. for  mapping/charting purposes).
If you are interested in adding new primitives, please take a look at the sources in $SG_SRC/canvas/elements.
For example, there's been talk about possibly adding the following additional primitives at some point. However, none of these are currently a priority or being worked on by anybody:
* support for a vertical mapping mode (e.g. to create Vertical Situation Displays or flight path evaluation dialogs)
* support for rendering scenery cameras (e.g. for tail cameras or mirrors etc)
* support for ESRI shapefiles
* support for GeoTIFF files or terrain height profiles using the tile cache
* rendering 3D objects
* support for ortographic moving map displays (requires [[CompositeViewer Support]])
If you are interested in working on any of these, please get in touch via the canvas sub forum first.


= Properties =
= Properties =

Revision as of 18:14, 16 October 2013


The canvas system is based on a handful of rendering primitives. All new canvas primitives need to implement the Canvas::Element interface, the canvas system currently supports the following primitives (see $SG_SRC/canvas/elements):

  • CanvasText (mapped to osgText)
  • CanvasPath (mapped to OpenVG, currently also used to render SVGs)
  • CanvasImage (mapped to osg::Image)
  • CanvasMap (automatic projection of geographic coordinates to screen coordinates)
  • CanvasGroup (a group of arbitrary canvas primitives)

These primitives alone can already be used to create very sophisticated avionics and dialogs - however, depending on your needs, you may want to extend the canvas system to support additional primitives. Typically, you'll want to add new primitives in order to optimize performance or simplify the creation of more sophisticated avionics and/or dialogs (e.g. for mapping/charting purposes). If you are interested in adding new primitives, please take a look at the sources in $SG_SRC/canvas/elements.


For example, there's been talk about possibly adding the following additional primitives at some point. However, none of these are currently a priority or being worked on by anybody:

  • support for a vertical mapping mode (e.g. to create Vertical Situation Displays or flight path evaluation dialogs)
  • support for rendering scenery cameras (e.g. for tail cameras or mirrors etc)
  • support for ESRI shapefiles
  • support for GeoTIFF files or terrain height profiles using the tile cache
  • rendering 3D objects
  • support for ortographic moving map displays (requires CompositeViewer Support)

If you are interested in working on any of these, please get in touch via the canvas sub forum first.

Properties

z-index

  • Format: <number> (Integer)
  • Default: 0

Change order in which elements are drawn. Elements with higher z-index are drawn later and cover allready drawn elements on overlapping parts.

# Draw before all elements (if no z-index of the other elements is lower than zero)
el.set("z-index", -1);

# Ensure el2 is drawn before/below el1
el1.set("z-index", 51);
el2.set("z-index", 50);