mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 12:39:49 -06:00
Cleanup of pair
This commit is contained in:
@@ -45,55 +45,66 @@ public:
|
||||
// user-defined copy assignment (copy-and-swap idiom)
|
||||
Pair& operator=(Pair other);
|
||||
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
void setImageOrder(int i, int order);
|
||||
void removeHighlight(glm::ivec3 color);
|
||||
// Target & Browser
|
||||
void initialize();
|
||||
// Highlighting
|
||||
void removeHighlight(glm::ivec3 color);
|
||||
void highlight(glm::ivec3 color);
|
||||
void setEnabled(bool enable);
|
||||
void disable();
|
||||
|
||||
// Animation
|
||||
void startAnimation(glm::dvec3 coordsEnd, float fovEnd, bool shouldLockAfter = true);
|
||||
void centerTargetOnScreen();
|
||||
void incrementallyAnimateToCoordinate(double deltaTime);
|
||||
void incrementallyFade(float goalState, float fadeTime, float deltaTime);
|
||||
bool hasFinishedFading(float goalState);
|
||||
bool isCoordOnPair(glm::vec2 mousePosition);
|
||||
bool isEnabled();
|
||||
bool isLocked();
|
||||
|
||||
void initialize();
|
||||
glm::ivec3 borderColor();
|
||||
glm::dvec3 targetDirectionEquatorial();
|
||||
glm::dvec3 targetDirectionGalactic();
|
||||
std::string browserGuiName();
|
||||
const std::string& browserId() const;
|
||||
const std::string& targetId() const;
|
||||
float verticalFov();
|
||||
const std::deque<int>& getSelectedImages();
|
||||
void selectImage(const ImageData& image, const int i);
|
||||
void removeSelectedImage(const int i);
|
||||
void loadImageCollection(std::string collection);
|
||||
void setImageOpacity(const int i, float opacity);
|
||||
// Browser
|
||||
void sendIdToBrowser();
|
||||
void updateBrowserSize();
|
||||
|
||||
// Target
|
||||
void centerTargetOnScreen();
|
||||
void lock();
|
||||
void unlock();
|
||||
|
||||
// Boolean functions
|
||||
bool hasFinishedFading(float goalState) const;
|
||||
bool isCoordOnPair(glm::vec2 mousePosition) const;
|
||||
bool isEnabled() const;
|
||||
bool isLocked() const;
|
||||
|
||||
// Setters
|
||||
void setEnabled(bool enable);
|
||||
void setIsSyncedWithWwt(bool isSynced);
|
||||
|
||||
// Getters by value
|
||||
float verticalFov() const;
|
||||
glm::ivec3 borderColor() const;
|
||||
glm::dvec3 targetDirectionEquatorial() const;
|
||||
glm::dvec3 targetDirectionGalactic() const;
|
||||
std::string browserGuiName() const;
|
||||
std::string browserId() const;
|
||||
std::string targetId() const;
|
||||
|
||||
// Getters by reference
|
||||
ScreenSpaceSkyTarget* getTarget();
|
||||
ScreenSpaceSkyBrowser* getBrowser();
|
||||
const std::deque<int>& getSelectedImages() const;
|
||||
|
||||
// WorldWide Telescope image handling
|
||||
void setImageOrder(int i, int order);
|
||||
void selectImage(const ImageData& image, int i);
|
||||
void removeSelectedImage(int i);
|
||||
void loadImageCollection(const std::string& collection);
|
||||
void setImageOpacity(int i, float opacity);
|
||||
|
||||
// Comparision operators
|
||||
friend bool operator==(const Pair& lhs,
|
||||
const Pair& rhs);
|
||||
friend bool operator!=(const Pair& lhs,
|
||||
const Pair& rhs);
|
||||
|
||||
private:
|
||||
|
||||
static std::string _selected;
|
||||
bool isTargetFadeFinished(float goalState);
|
||||
bool isBrowserFadeFinished(float goalState);
|
||||
bool isTargetFadeFinished(float goalState) const;
|
||||
bool isBrowserFadeFinished(float goalState) const;
|
||||
|
||||
ScreenSpaceSkyTarget* _target{ nullptr };
|
||||
ScreenSpaceSkyBrowser* _browser{ nullptr };
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace openspace {
|
||||
_target->highlight(color);
|
||||
}
|
||||
|
||||
bool Pair::isTargetFadeFinished(float goalState)
|
||||
bool Pair::isTargetFadeFinished(float goalState) const
|
||||
{
|
||||
// Is fading finished?
|
||||
float targetDiff = abs(_target->opacity() - goalState);
|
||||
@@ -138,13 +138,13 @@ namespace openspace {
|
||||
return targetDiff < FadeThreshold;
|
||||
}
|
||||
|
||||
bool Pair::isBrowserFadeFinished(float goalState)
|
||||
bool Pair::isBrowserFadeFinished(float goalState) const
|
||||
{
|
||||
float browserDiff = abs(_browser->opacity() - goalState);
|
||||
return browserDiff < FadeThreshold;
|
||||
}
|
||||
|
||||
bool Pair::isCoordOnPair(glm::vec2 mousePosition)
|
||||
bool Pair::isCoordOnPair(glm::vec2 mousePosition) const
|
||||
{
|
||||
const bool onBrowser = _browser->coordIsInsideCornersScreenSpace(mousePosition);
|
||||
const bool onTarget = _target->coordIsInsideCornersScreenSpace(mousePosition);
|
||||
@@ -164,12 +164,12 @@ namespace openspace {
|
||||
_target->setEnabled(enable);
|
||||
}
|
||||
|
||||
bool Pair::isEnabled()
|
||||
bool Pair::isEnabled() const
|
||||
{
|
||||
return _target->isEnabled() && _browser->isEnabled();
|
||||
}
|
||||
|
||||
bool Pair::isLocked()
|
||||
bool Pair::isLocked() const
|
||||
{
|
||||
return _target->isLocked();
|
||||
}
|
||||
@@ -182,42 +182,42 @@ namespace openspace {
|
||||
_browser->updateBorderColor();
|
||||
}
|
||||
|
||||
glm::ivec3 Pair::borderColor()
|
||||
glm::ivec3 Pair::borderColor() const
|
||||
{
|
||||
return _browser->borderColor();
|
||||
}
|
||||
|
||||
glm::dvec3 Pair::targetDirectionEquatorial()
|
||||
glm::dvec3 Pair::targetDirectionEquatorial() const
|
||||
{
|
||||
return _target->equatorialAim();
|
||||
}
|
||||
|
||||
glm::dvec3 Pair::targetDirectionGalactic()
|
||||
glm::dvec3 Pair::targetDirectionGalactic() const
|
||||
{
|
||||
return _target->directionGalactic();
|
||||
}
|
||||
|
||||
std::string Pair::browserGuiName()
|
||||
std::string Pair::browserGuiName() const
|
||||
{
|
||||
return _browser->guiName();
|
||||
}
|
||||
|
||||
const std::string& Pair::browserId() const
|
||||
std::string Pair::browserId() const
|
||||
{
|
||||
return _browser->identifier();
|
||||
}
|
||||
|
||||
const std::string& Pair::targetId() const
|
||||
std::string Pair::targetId() const
|
||||
{
|
||||
return _target->identifier();
|
||||
}
|
||||
|
||||
float Pair::verticalFov()
|
||||
float Pair::verticalFov() const
|
||||
{
|
||||
return _browser->verticalFov();
|
||||
}
|
||||
|
||||
const std::deque<int>& Pair::getSelectedImages()
|
||||
const std::deque<int>& Pair::getSelectedImages() const
|
||||
{
|
||||
return _browser->getSelectedImages();
|
||||
}
|
||||
@@ -236,17 +236,17 @@ namespace openspace {
|
||||
}
|
||||
}
|
||||
|
||||
void Pair::removeSelectedImage(const int i)
|
||||
void Pair::removeSelectedImage(int i)
|
||||
{
|
||||
_browser->removeSelectedImage(i);
|
||||
}
|
||||
|
||||
void Pair::loadImageCollection(std::string collection)
|
||||
void Pair::loadImageCollection(const std::string& collection)
|
||||
{
|
||||
_browser->loadImageCollection(collection);
|
||||
}
|
||||
|
||||
void Pair::setImageOpacity(const int i, float opacity)
|
||||
void Pair::setImageOpacity(int i, float opacity)
|
||||
{
|
||||
_browser->setImageOpacity(i, opacity);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ namespace openspace {
|
||||
startAnimation(viewDirection, currentFov, false);
|
||||
}
|
||||
|
||||
bool Pair::hasFinishedFading(float goalState)
|
||||
bool Pair::hasFinishedFading(float goalState) const
|
||||
{
|
||||
return isTargetFadeFinished(goalState) && isBrowserFadeFinished(goalState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user