diff --git a/src/mvc/LiveMapsElementsWidget.cpp b/src/mvc/LiveMapsElementsWidget.cpp index 058bb7c..da63978 100644 --- a/src/mvc/LiveMapsElementsWidget.cpp +++ b/src/mvc/LiveMapsElementsWidget.cpp @@ -144,6 +144,7 @@ void LiveMapsElementsWidget::createLayout() _vlm_widget->setAvailScans(&_avail_scans); gstar::CoordinateModel *coord_model = new gstar::CoordinateModel(&_linear_trans); _vlm_widget->setCoordinateModel(coord_model); + _vlm_widget->load_live_coord_settings(); connect(_vlm_widget, &VLM_Widget::onScanUpdated, this, &LiveMapsElementsWidget::callQueueScan); _scan_queue_widget = new ScanQueueWidget(); diff --git a/src/mvc/VLM_Widget.cpp b/src/mvc/VLM_Widget.cpp index 6da23f8..2fd6d54 100644 --- a/src/mvc/VLM_Widget.cpp +++ b/src/mvc/VLM_Widget.cpp @@ -2423,13 +2423,41 @@ void VLM_Widget::updatedPixelToLight(double x, double y, double z) } -/*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- + +void VLM_Widget::load_live_coord_settings() +{ + QMap vars; + QStringList names = Preferences::inst()->getValue(STR_PRF_LiveCoefficientNames).toStringList(); + QStringList values = Preferences::inst()->getValue(STR_PRF_LiveCoefficientVals).toStringList(); + if(names.size() == values.size()) + { + for (int i = 0; i < names.size(); i++) + { + vars.insert(names.at(i), values.at(i).toDouble()); + } + } + m_lightToMicroCoordModel->getTransformer()->Init(vars); + +} + +//-------------------------------------------------------------------------- void VLM_Widget::useUpdatedSolverVariables(const QMap vars) { m_lightToMicroCoordModel->getTransformer()->Init(vars); + QStringList names; + QStringList values; + for (auto name : vars.keys()) + { + names.append(name); + values.append(QString::number(vars.value(name))); + } + Preferences::inst()->setValue(STR_PRF_LiveCoefficientNames, names); + Preferences::inst()->setValue(STR_PRF_LiveCoefficientVals, values); + } /*--------------------------------------------------------------------------*/ diff --git a/src/mvc/VLM_Widget.h b/src/mvc/VLM_Widget.h index 8d07ab1..2d3b4cd 100644 --- a/src/mvc/VLM_Widget.h +++ b/src/mvc/VLM_Widget.h @@ -162,7 +162,7 @@ class VLM_Widget // TODO: make sure to update all ScansRegionGraphicsItems with new pointer void setAvailScans(std::map * avail_scans) { _avail_scans = avail_scans;} - + void load_live_coord_settings(); public slots: diff --git a/src/preferences/Preferences.cpp b/src/preferences/Preferences.cpp index 3556370..0112a3c 100644 --- a/src/preferences/Preferences.cpp +++ b/src/preferences/Preferences.cpp @@ -93,6 +93,8 @@ Preferences::Preferences() {STR_PRF_SHOW_DATASET_ON_LOAD, QVariant()}, {STR_PREF_RADIO_LOAD_SELECTED_OPTION, QVariant()}, {STR_PREF_SPRECTRA_CONTROLS_HORIZONTAL_OPTION, QVariant()}, + {STR_PRF_LiveCoefficientNames, QVariant()}, + {STR_PRF_LiveCoefficientVals, QVariant()}, {STR_SAVE_QSERVER_HISTORY_LOCATION, QVariant()} }; load(); diff --git a/src/preferences/Preferences.h b/src/preferences/Preferences.h index cd71a3a..6206ed9 100644 --- a/src/preferences/Preferences.h +++ b/src/preferences/Preferences.h @@ -88,6 +88,8 @@ #define STR_PREF_RADIO_LOAD_SELECTED_OPTION "Load_Selected_Opt" #define STR_PREF_SPRECTRA_CONTROLS_HORIZONTAL_OPTION "Spectra_Controls_Horizontal" #define STR_SAVE_QSERVER_HISTORY_LOCATION "Save_Qserver_History_Location" +#define STR_PRF_LiveCoefficientNames "LiveCoefficientName" +#define STR_PRF_LiveCoefficientVals "LiveCoefficientVals" /** * @brief Read and save preferences between application restarts, the vaule key