Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON based Mapper configuration #2157

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dl3sdo
Copy link
Member

@dl3sdo dl3sdo commented May 22, 2023

In addition to the configuration of Mapper through the 'Settings' GUI where a dedicated control element is needed for each setting, this commit implements a lightweight mechanism by using a JSON configuration file that allows to easily configure a variety of settings.
The 'Settings' GUI is extended by the possibility to select and remember the JSON configuration to be used as default configuration.
An additional dialog allows to load and save JSON configuration and provides a simple, i.e., not context-sensitive, text editor.
The validity of the JSON format is checked and deviations to Mapper's default JSON configuration can be shown and resolved.

As examples for its usage it closes #2087 and closes #1961, thus superseding #2088 and #2154.

JSON_Configuration_Dialog

Note: this is currently just a POC and there are some TODOs:

  • when the 'Settings' dialog is reset or canceled, also the JSON settings should be reset
  • the code needs proper comments and maybe some refactoring
  • a test should be added

However, before continuing I need feedback whether this kind of JSON based configuration is desired at all.

In addition to the configuration of Mapper through the 'Settings' GUI
where a dedicated control element is needed for each setting, this
commit implements a lightweight mechanism by using a JSON configuration
file that allows to easily configure a variety of settings.
The 'Settings' GUI is extended by the possibility to select and
remember the JSON configuration to be used as default configuration.
An additional dialog allows to load and save JSON configuration and
provides a simple, i.e., not context-sensitive, text editor.
The validity of the JSON format is checked and deviations to Mapper's
default JSON configuration can be shown and resolved.
The declination lookup at www.ngdc.noaa.gov now requests the additional
parameter 'key'.
This commit uses the JSON configuration mechanism which provides the
default value for the 'key' parameter while allowing to change the
value by the user.
It supersedes OpenOrienteering#2088 and closes OpenOrienteering#2087.
This commit adds a helper function that analyzes a given symbol
whether it is either a line symbol or a combined symbol containing
line symbols and if any of the line symbols contains a dash symbol.
When drawing line objects for symbols with dash symbols, no dash
points were set automatically if the symbol was a combined symbol.
When editing line objects for symbols with dash symbols, additional
points were not added as dash points if the symbol was a combined
symbol.
These deviations were known and marked as TODO.
This commit treats line symbols with dash symbols and combined symbols
containing line symbols with dash symbols equally.
Use JSON configuration to enable or disable the automatic setting
of dash points for symbols with dash symbols.
Closes OpenOrienteering#1961
@dl3sdo dl3sdo marked this pull request as draft May 22, 2023 20:10
Arrange class forward declarations and include files in alphabetical
order and add missing include files.
@jmacura
Copy link
Contributor

jmacura commented Jun 13, 2023

I think this is just great. If more config options can find its way down here, that would be awesome. Also custom colors for scribbling might perhaps be stored in here (#1738)?
That way you can switch to another OO Mapper instance / device and keep all your preferences in a single file 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Magnetic declination lookup button does not work (NOAA added a key) Dash point by on default
2 participants