Opened 9 years ago

Last modified 6 years ago

#548 new enhancement/feature request

Dynamically enable/disable navit.xml items

Reported by: mvglasow Owned by: KaZeR
Priority: minor Milestone: version 0.6.0
Component: core Version: git master
Severity: Keywords:
Cc:

Description

It would be nice to have the possibility to enable/disable items defined in navit.xml dynamically while navit is running.

This could be done through a condition attribute, similar to the menu items in the internal GUI. Conditions could be based on variables (e.g. as used in OSD text labels); support for expressions would be helpful.

This would open up a host of possibilities:

  • Showing OSD items only when meaningful: The next maneuver, ETA and other navigation-related items are empty and thus useless in tracking mode; a condition could be defined to make them visible only when a route is planned. Similarly, the speed and compass make sense only when a valid GPS position is received.
  • Logging could be enabled/disabled within Navit, e.g. through an OSD button, through the internal GUI menu or event-driven.
  • Maps could be enabled/disabled at run-time; this would allow the user to switch between different maps for the same area.
  • Tracked vehicles could be enabled or disabled

Variables should include:

  • Navigation active (boolean) or route_status
  • GPS data available (boolean) or position_sats_used
  • User-defined variables (to be defined in navit.xml) that can be changed through OSD buttons or the internal GUI menu, preferably both (e.g. to switch logging on/off, switch between maps or enable/disable tracked vehicles)
  • Tracking data (following a road, off-road in map area, outside of map area)
  • osd_configuration, in which case the related attribute would become obsolete and identical functionality could be implemented through the condition attribute

A possible application of this would be to start logging vehicle position as soon as the vehicle is no longer on a known road - which would be very useful for OSM mapping.

A problem might be how to update the items whenever their condition changes between true and false. Maybe this can be done in a similar way text labels in OSD get updated (I haven't looked in the code how this is done) or create a hook for each variable used in a condition which causes the condition to be re-evaluated as soon as the variable changes.

Change History (3)

comment:1 Changed 9 years ago by mvglasow (2)

Having familiarized myself with the code I would now suggest the following:

  • Implement commands to enable or disable items (I see some work is being done for OSD items, and I am working on a command that will turn logging on and off, others may be done in a similar way).
  • Introduce user-defined callbacks to the config file. Each callback consists of a condition (format similar to text attribute of OSD text item) and a command (similar to those used in OSD buttons and menu items.

For example:

<callback cond="${!tracking.item}" command="vehicle.start_log()">

which would start logging as soon as the vehicle is no longer on a known road.

The basic structure for the condition can probably be copied from the OSD text labels (or maybe we can move the related code to a new component which can be used by all and extend it to fit our needs).

comment:2 Changed 9 years ago by kazer

  • Milestone set to want patch / contribution

comment:3 Changed 6 years ago by usul

  • Milestone changed from want patch / contribution to version 0.6.0
  • Priority changed from major to minor

This mixes a lot of requests, some are already implemented:

  • Android port can enable/disable POI layers
  • osd items have speed conditions
  • some routing related OSD items appear only if navit is in routing mode

What remains is:

  • Can logging already be toggled from the OSD?
  • Can (and should?) map styles switched from OSD?
  • Can (and should?) vehicles switched from OSD?
Note: See TracTickets for help on using tickets.