Opened 9 years ago

Closed 8 years ago

#897 closed enhancement/feature request (fixed)

Support runtime reconfiguration of osd elements

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

Description

Hello All,

Currently I am working on a layout for Navit where the user can switch between several pages (like summary map page, map panning page, data display page, page for POI addition for csv maps etc...). During the work it turned out that it would be useful to use the same osd elements at different positions and with different sizes on the layout pages. Currently we have the possibility to use osd_configuration to control visibility of osd elements, however this can lead to proliferation of OSDs (which can cause high cpu loads) and it will not solve problems for OSDs like odometer that stores some state when it should be displayed on several pages. Therefore I created a little patch that makes this possible. The functionality can be reached using the already existing osd command osd_set_attr . I added the handling of some standard attributes (like w,h,x,y,font_size) that can be used for all osd types. This can be used to set the position,width, height, font size of an osd item runtime.

An example command that switches the width of the osd with the name "my_osd_cmdif" to 300 pixels can be seen below:

osd_set_attr("my_osd_cmdif","w", "300") 

Setting the above mentioned other parameters (w,h,x,y,font_size) is similar. An initial version of the patch is attached. Please try it and let me know your improvement suggestions via this ticket.

Bye, Dandor

Attachments (4)

osd_reconfigure.diff (78.8 KB) - added by tegzed 9 years ago.
Runtime reconfiguration support for OSDs
obj_filter.h (383 bytes) - added by tegzed 8 years ago.
object filter for the command system
navit_command_object_filter.diff (85.3 KB) - added by tegzed 8 years ago.
object filter for the command system and possibility to set std attributes for OSDs
obj_filter.c (20.5 KB) - added by tegzed 8 years ago.
object filter for the command system

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by tegzed

Runtime reconfiguration support for OSDs

Changed 8 years ago by tegzed

object filter for the command system

comment:1 Changed 8 years ago by tegzed

Hello,

The most recent patch(navit_command_object_filter.diff, obj_filter.c and obj_filter.h) enables the command system to select OSDs and possibly other navit objects by filter expressions. The filter expressions can contain the matched object's attribute names, as well as numeric and boolean expressions. In the expressions the operators are similar to C's operators. The expressions can be nested by using parenthesis also (eg: osd[attr1==1 && ( attr2==2 | | (attr3!=3 && attr4<10)] ). If more than one object matches the filter expression one can use an index number to select between the resulted objects (eg: osd[attr1==1][3] this will select all the OSDs with attr1 having the value 1 and the object with index 3 will be selected ). If no index is given the 0th element will be retrieved(the index is 0 based).

The osd_set_attr command function is removed since the same functionality can be achieved by filter expressions. Eg instead of

osd_set_attr("my_osd_cmdif","w", "300") 

one needs to use:

osd[name='my_osd_cmdif'].w=300

To change positional or resize attributes (x,y,w,h) use_overlay="0" should be used. Hopefully this issue will be solved soon.

Please test this patch and let me know if you find some problems or have suggestions.

Changed 8 years ago by tegzed

object filter for the command system and possibility to set std attributes for OSDs

Changed 8 years ago by tegzed

object filter for the command system

comment:2 Changed 8 years ago by tegzed

The patch is committed to svn (r4768) with a small change: the attribute names in the filter expressions should be prefixed with a '@' character. Please note that in the preceeding comments the equality operator is mistyped, it should be '==' instead of '='.

An example:

osd[@name=='my_osd_cmdif'].w=300

comment:3 Changed 8 years ago by tegzed

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.