mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-28 07:59:37 -06:00
Fix bug with creating a target with an identifier that already exists
This commit is contained in:
@@ -239,6 +239,7 @@ void SkyBrowserModule::addTargetBrowserPair(const std::string& targetId,
|
||||
if (browser && target) {
|
||||
_targetsBrowsers.push_back(std::make_unique<TargetBrowserPair>(target, browser));
|
||||
}
|
||||
_uniqueIdentifierCounter++;
|
||||
}
|
||||
|
||||
void SkyBrowserModule::removeTargetBrowserPair(const std::string& id) {
|
||||
@@ -425,6 +426,10 @@ glm::ivec3 SkyBrowserModule::highlight() const {
|
||||
return _highlightAddition;
|
||||
}
|
||||
|
||||
int SkyBrowserModule::uniqueIdentifierCounter() const {
|
||||
return _uniqueIdentifierCounter;
|
||||
}
|
||||
|
||||
bool SkyBrowserModule::isCameraInSolarSystem() const {
|
||||
return _isCameraInSolarSystem;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
std::string selectedBrowserId() const;
|
||||
std::string selectedTargetId() const;
|
||||
glm::ivec3 highlight() const;
|
||||
int uniqueIdentifierCounter() const;
|
||||
|
||||
void setSelectedBrowser(const std::string& id);
|
||||
void setHoverCircle(SceneGraphNode* circle);
|
||||
@@ -117,6 +118,7 @@ private:
|
||||
TargetBrowserPair* _mouseOnPair = nullptr;
|
||||
SceneGraphNode* _hoverCircle = nullptr;
|
||||
std::string _selectedBrowser = ""; // Currently selected browser
|
||||
int _uniqueIdentifierCounter = 0;
|
||||
|
||||
// Flags
|
||||
bool _isCameraInSolarSystem = true; // Visualization modes
|
||||
|
||||
@@ -422,11 +422,11 @@ namespace {
|
||||
|
||||
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
|
||||
|
||||
int noOfPairs = module->nPairs();
|
||||
std::string nameBrowser = "Sky Browser " + std::to_string(noOfPairs);
|
||||
std::string nameTarget = "Sky Target " + std::to_string(noOfPairs);
|
||||
std::string idBrowser = "SkyBrowser" + std::to_string(noOfPairs);
|
||||
std::string idTarget = "SkyTarget" + std::to_string(noOfPairs);
|
||||
int uniqueIdentifier = module->uniqueIdentifierCounter();
|
||||
std::string nameBrowser = "Sky Browser " + std::to_string(uniqueIdentifier);
|
||||
std::string nameTarget = "Sky Target " + std::to_string(uniqueIdentifier);
|
||||
std::string idBrowser = "SkyBrowser" + std::to_string(uniqueIdentifier);
|
||||
std::string idTarget = "SkyTarget" + std::to_string(uniqueIdentifier);
|
||||
// Determine starting point on screen for the target
|
||||
glm::vec3 positionBrowser = glm::vec3(0.f, 0.f, -2.1f);
|
||||
glm::vec3 positionTarget = glm::vec3(0.9f, 0.4f, -2.1f);
|
||||
|
||||
Reference in New Issue
Block a user