From 76b2a4e00a700ceefbcabb3d2475e5dbd93136ca Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Sun, 2 Jun 2019 19:51:02 +0300
Subject: [PATCH] Minor temporary changes

---
 applications/gui/src/main.cpp                       | 3 ++-
 components/rgbd-sources/include/ftl/net_source.hpp  | 1 +
 components/rgbd-sources/include/ftl/rgbd_source.hpp | 1 +
 components/rgbd-sources/src/net_source.cpp          | 5 +++++
 components/rgbd-sources/src/rgbd_source.cpp         | 4 ++++
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/applications/gui/src/main.cpp b/applications/gui/src/main.cpp
index 55dff3656..5d428a605 100644
--- a/applications/gui/src/main.cpp
+++ b/applications/gui/src/main.cpp
@@ -183,8 +183,9 @@ class FTLApplication : public nanogui::Screen {
 		new Label(window, "Select source","sans-bold");
 		auto available = net->findAll<string>("list_streams");
 		auto select = new ComboBox(window, available);
-		select->setCallback([this,&available](int ix) {
+		select->setCallback([this,available](int ix) {
 			LOG(INFO) << "Change source: " << ix;
+			
 		});
 
 		setVisible(true);
diff --git a/components/rgbd-sources/include/ftl/net_source.hpp b/components/rgbd-sources/include/ftl/net_source.hpp
index 9730aef15..c95437da8 100644
--- a/components/rgbd-sources/include/ftl/net_source.hpp
+++ b/components/rgbd-sources/include/ftl/net_source.hpp
@@ -29,6 +29,7 @@ class NetSource : public RGBDSource {
 	}
 
 	void setPose(const Eigen::Matrix4f &pose);
+	void setURI(const std::string &uri);
 
 	private:
 	bool has_calibration_;
diff --git a/components/rgbd-sources/include/ftl/rgbd_source.hpp b/components/rgbd-sources/include/ftl/rgbd_source.hpp
index ca7dec6ac..29e0a9fd9 100644
--- a/components/rgbd-sources/include/ftl/rgbd_source.hpp
+++ b/components/rgbd-sources/include/ftl/rgbd_source.hpp
@@ -30,6 +30,7 @@ class RGBDSource : public ftl::Configurable {
 
 	const CameraParameters &getParameters() { return params_; };
 	std::string getURI() const { return config_["uri"].get<std::string>(); }
+	virtual void setURI(const std::string &uri);
 
 	virtual void setPose(const Eigen::Matrix4f &pose) { pose_ = pose; };
 	const Eigen::Matrix4f &getPose() { return pose_; };
diff --git a/components/rgbd-sources/src/net_source.cpp b/components/rgbd-sources/src/net_source.cpp
index ce4e6cc42..5084063f9 100644
--- a/components/rgbd-sources/src/net_source.cpp
+++ b/components/rgbd-sources/src/net_source.cpp
@@ -85,6 +85,11 @@ void NetSource::setPose(const Eigen::Matrix4f &pose) {
 	RGBDSource::setPose(pose);
 }
 
+void NetSource::setURI(const std::string &uri) {
+	RGBDSource::setURI(uri);
+	has_calibration_ = _getCalibration(*net_, peer_, getURI(), params_);
+}
+
 void NetSource::grab() {
 	// net_.broadcast("grab");
 }
diff --git a/components/rgbd-sources/src/rgbd_source.cpp b/components/rgbd-sources/src/rgbd_source.cpp
index df70d4543..0279d9ba5 100644
--- a/components/rgbd-sources/src/rgbd_source.cpp
+++ b/components/rgbd-sources/src/rgbd_source.cpp
@@ -24,6 +24,10 @@ bool RGBDSource::isReady() {
 	return false;
 }
 
+void RGBDSource::setURI(const std::string &uri) {
+	config_["uri"] = uri;
+}
+
 void RGBDSource::getRGBD(cv::Mat &rgb, cv::Mat &depth) {
 	unique_lock<mutex> lk(mutex_);
 	rgb_.copyTo(rgb);
-- 
GitLab