Setup plots(Create a InitializePlotsFromText(..) method inside jones_plot_app.cpp) through a external document:
Read and parse a text file, in which the specifications for the plots are
- Make it possible to store the current plot configuration in such a file
- Make it possible to load settings from this file inside a method:
InitializePlotsFromText(const std::string& plot_settings_file)
Example format, which I think can be serialized easily(should be discussed) :
// Begin
[PLOT_SETTINGS] // the identifier of a plot settings page
NUM_OF_PLOTS = 2
….
[PLOT0]
…
[POSITION]
TOP_LEFT_X = 10
TOP_LEFT_Y = 20
WIDTH = 400
HEIGHT = 200
[AXES]
MIN_Y = -10
MAX_Y = 10
[PLOT1]
...
[POSITION]
TOP_LEFT_X = ..
TOP_LEFT_Y =..
…
[AXES]
MIN_Y=…
…
// End
- write a class, which can serialize/deserialize(write/read) from or to such a text file:
Serializer::Write(const std::string plot_num,
const std::string category,
const std::string property,
QVariant value);
// example usage:
// write:
Serializer.Open("filepath")
Serializer.Write('0', 'POSITION', 'TOP_LEFT_X', 10)
Serializer.Write('1', 'AXES', 'TOP_LEFT_X', 10)
Serializer.Close();
// read:
auto top_left_x_mm = Serializer.Read('1', 'POSITION', 'TOP_LEFT_X')