Merge branch 'master' into thesis/2019/camera-paths and resolve conflicts

# Conflicts:
#	modules/globebrowsing/globebrowsingmodule.cpp
#	modules/globebrowsing/globebrowsingmodule_lua.inl
This commit is contained in:
Emma Broman
2021-07-09 15:43:17 +02:00
92 changed files with 1015 additions and 490 deletions
@@ -575,6 +575,7 @@ public:
protected:
properties::BoolProperty _renderPlaybackInformation;
properties::BoolProperty _ignoreRecordedScale;
enum class RecordedType {
Camera = 0,
@@ -23,9 +23,11 @@
****************************************************************************************/
#include <openspace/util/json_helper.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/lua/ghoul_lua.h>
#include <glm/ext/matrix_common.hpp>
#include <cmath>
#include <type_traits>
namespace openspace::properties {
@@ -90,6 +92,35 @@ float NumericalProperty<T>::exponent() const {
template <typename T>
void NumericalProperty<T>::setExponent(float exponent) {
ghoul_assert(std::abs(exponent) > 0.f, "Exponent for property input cannot be zero");
auto isValidRange = [](const T& minValue, const T& maxValue) {
if constexpr (ghoul::isGlmVector<T>() || ghoul::isGlmMatrix<T>()) {
return glm::all(glm::greaterThanEqual(minValue, T(0))) &&
glm::all(glm::greaterThanEqual(maxValue, T(0)));
}
else {
return (minValue >= T(0) && maxValue >= T(0));
}
};
// While the exponential slider does not support ranges with negative values,
// prevent setting the exponent for such ranges
// @ TODO (2021-06-30, emmbr), remove this check when no longer needed
if (!std::is_unsigned<T>::value) {
if (!isValidRange(_minimumValue, _maximumValue)) {
LWARNINGC(
"NumericalProperty: setExponent",
fmt::format(
"Setting exponent for properties with negative values in "
"[min, max] range is not yet supported. Property: {}",
this->fullyQualifiedIdentifier()
)
);
_exponent = 1.f;
return;
}
}
_exponent = exponent;
}
+3 -2
View File
@@ -31,9 +31,10 @@
#include <openspace/scripting/lualibrary.h>
#include <ghoul/lua/luastate.h>
#include <ghoul/misc/boolean.h>
#include <filesystem>
#include <mutex>
#include <queue>
#include <optional>
#include <queue>
#include <functional>
namespace openspace { class SyncBuffer; }
@@ -82,7 +83,7 @@ public:
bool hasLibrary(const std::string& name);
bool runScript(const std::string& script, ScriptCallback callback = ScriptCallback());
bool runScriptFile(const std::string& filename);
bool runScriptFile(const std::filesystem::path& filename);
bool writeLog(const std::string& script);
+29 -2
View File
@@ -26,18 +26,45 @@
#define __OPENSPACE_CORE___COORDINATECONVERSION___H__
#include <ghoul/glm.h>
#include <string>
namespace openspace {
/**
* Converts from ICRS coordinates to galactic cartesian coordinates.
* Converts from ICRS decimal degrees coordinates to galactic cartesian coordinates.
* \param ra Right ascension, given in decimal degrees
* \param dec Declination, given in decimal degrees
* \param distance The distance, or radius, to the position given in any unit.
* \return A position in galactic cartesian coordinates, given in the same unit as the
* distance parameter.
*/
glm::dvec3 icrsToGalacticCartesian(float ra, float dec, double distance);
glm::dvec3 icrsToGalacticCartesian(double ra, double dec, double distance);
/**
* Converts from ICRS (hms and dms) coordinates to decimal degrees.
* \param ra Right ascension, given as a string in format 'XhYmZs'
* \param dec Declination, given as a string in format 'XdYmZs'
* \return The decimal degrees coordinate in degrees
*/
glm::dvec2 icrsToDecimalDegrees(const std::string& ra, const std::string& dec);
/**
* Converts from galactic cartesian coordinates to ICRS decimal degrees coordinates
* and distance.
* \param x X coordinate
* \param y Y coordinate
* \param z Z coordinate
* \return A vector with the ra and dec decimal degrees in degrees and distance.
*/
glm::dvec3 galacticCartesianToIcrs(double x, double y, double z);
/**
* Converts from ICRS decimal degrees coordinates to ICRS hms and dms coordinates.
* \param ra Right ascension, given in decimal degrees
* \param dec Declination, given in decimal degrees
* \return A pair with the ra and dec strings in hms and dms format.
*/
std::pair<std::string, std::string> decimalDegreesToIcrs(double ra, double dec);
} // namespace openspace