From 695c647d71788425b9b41892a9d5f0da2113d07e Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Thu, 27 Jan 2022 17:08:15 -0500 Subject: [PATCH] Added port functionality to source events. Minor bug fixes for path display on FileDialog --- Navigator/src/Navigator/Editor/FileDialog.cpp | 11 ++++------- Navigator/src/Navigator/Events/PhysicsEvent.h | 8 +++++--- Navigator/src/Navigator/Physics/DataSource.cpp | 6 +++--- Navigator/src/Navigator/Physics/DataSource.h | 4 ++-- Navigator/src/Navigator/Physics/PhysicsLayer.cpp | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Navigator/src/Navigator/Editor/FileDialog.cpp b/Navigator/src/Navigator/Editor/FileDialog.cpp index d680f95..64f507c 100644 --- a/Navigator/src/Navigator/Editor/FileDialog.cpp +++ b/Navigator/src/Navigator/Editor/FileDialog.cpp @@ -36,7 +36,7 @@ namespace Navigator { std::string text = ""; if (ImGui::BeginPopupModal(m_openFileName.c_str())) { - ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); + ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str()); ImGui::SameLine(); ImGui::Text("Extension Filter: %s", ext.c_str()); ImGui::InputText("Selected", &m_selectedItem); @@ -60,7 +60,6 @@ namespace Navigator { { m_selectedItem.clear(); m_currentPath.append(".."); - m_currentPath = std::filesystem::absolute(m_currentPath); } ImGui::TableNextColumn(); ImGui::Text("N/A"); @@ -112,7 +111,7 @@ namespace Navigator { std::string text = ""; if (ImGui::BeginPopupModal(m_saveFileName.c_str())) { - ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); + ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str()); ImGui::SameLine(); ImGui::Text("Extension Filter: %s", ext.c_str()); ImGui::InputText("Selected", &m_selectedItem); @@ -136,7 +135,6 @@ namespace Navigator { { m_selectedItem.clear(); m_currentPath.append(".."); - m_currentPath = std::filesystem::absolute(m_currentPath); } ImGui::TableNextColumn(); ImGui::Text("N/A"); @@ -186,7 +184,7 @@ namespace Navigator { std::string text = ""; if (ImGui::BeginPopupModal(m_openDirName.c_str())) { - ImGui::Text("Current Directory: %s", m_currentPath.string().c_str()); + ImGui::Text("Current Directory: %s", m_currentPath.lexically_normal().string().c_str()); ImGui::InputText("Selected", &m_selectedItem); if (ImGui::Button("Ok")) { @@ -206,7 +204,6 @@ namespace Navigator { if (ImGui::Selectable("[DIR] ..", false, select_flags)) { m_currentPath.append(".."); - m_currentPath = std::filesystem::absolute(m_currentPath); m_selectedItem = m_currentPath.string(); } ImGui::TableNextColumn(); @@ -242,4 +239,4 @@ namespace Navigator { return result; } -} \ No newline at end of file +} diff --git a/Navigator/src/Navigator/Events/PhysicsEvent.h b/Navigator/src/Navigator/Events/PhysicsEvent.h index 401c0d5..01c8b36 100644 --- a/Navigator/src/Navigator/Events/PhysicsEvent.h +++ b/Navigator/src/Navigator/Events/PhysicsEvent.h @@ -10,11 +10,12 @@ namespace Navigator { class NAV_API PhysicsStartEvent : public Event { public: - PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window) : - m_sourceLocation(loc), m_sourceType(type), m_coincidenceWindow(window) + PhysicsStartEvent(const std::string& loc, DataSource::SourceType type, uint64_t window, const std::string& port = "51489") : + m_sourceLocation(loc), m_port(port), m_sourceType(type), m_coincidenceWindow(window) {} inline std::string GetSourceLocation() { return m_sourceLocation; } + inline std::string GetSourcePort() { return m_port; } inline DataSource::SourceType GetSourceType() { return m_sourceType; } inline uint64_t GetCoincidenceWindow() { return m_coincidenceWindow; } @@ -28,6 +29,7 @@ namespace Navigator { private: std::string m_sourceLocation; + std::string m_port; DataSource::SourceType m_sourceType; uint64_t m_coincidenceWindow; }; @@ -61,4 +63,4 @@ namespace Navigator { }; } -#endif \ No newline at end of file +#endif diff --git a/Navigator/src/Navigator/Physics/DataSource.cpp b/Navigator/src/Navigator/Physics/DataSource.cpp index 6a5c98b..491acab 100644 --- a/Navigator/src/Navigator/Physics/DataSource.cpp +++ b/Navigator/src/Navigator/Physics/DataSource.cpp @@ -4,12 +4,12 @@ namespace Navigator { - DataSource* CreateDataSource(const std::string& loc, DataSource::SourceType type) + DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type) { switch(type) { case DataSource::SourceType::CompassOffline : return new CompassRun(loc); - case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, "5346"); + case DataSource::SourceType::CompassOnline : return new CompassOnlineSource(loc, port); case DataSource::SourceType::None : return nullptr; } } @@ -23,4 +23,4 @@ namespace Navigator { case DataSource::SourceType::CompassOffline : return "CompassOffline"; } } -} \ No newline at end of file +} diff --git a/Navigator/src/Navigator/Physics/DataSource.h b/Navigator/src/Navigator/Physics/DataSource.h index 6c248f6..68cb39d 100644 --- a/Navigator/src/Navigator/Physics/DataSource.h +++ b/Navigator/src/Navigator/Physics/DataSource.h @@ -29,9 +29,9 @@ namespace Navigator { bool m_validFlag; }; - NAV_API DataSource* CreateDataSource(const std::string& loc, DataSource::SourceType type); + NAV_API DataSource* CreateDataSource(const std::string& loc, const std::string& port, DataSource::SourceType type); NAV_API std::string ConvertDataSourceTypeToString(DataSource::SourceType type); } -#endif \ No newline at end of file +#endif diff --git a/Navigator/src/Navigator/Physics/PhysicsLayer.cpp b/Navigator/src/Navigator/Physics/PhysicsLayer.cpp index 5782a46..a9aafbb 100644 --- a/Navigator/src/Navigator/Physics/PhysicsLayer.cpp +++ b/Navigator/src/Navigator/Physics/PhysicsLayer.cpp @@ -37,7 +37,7 @@ namespace Navigator { bool PhysicsLayer::OnPhysicsStartEvent(PhysicsStartEvent& event) { m_rawSort.SetCoincidenceWindow(event.GetCoincidenceWindow()); - m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourceType())); + m_source.reset(CreateDataSource(event.GetSourceLocation(), event.GetSourcePort(), event.GetSourceType())); if (m_source->IsValid()) { NAV_INFO("Attach successful. Enabling data pull...");