Collection of a number of changes (#2286)

* Cleanup Property code
* Remove NOLINT statements
* Return Property class types as string_view
* Remove getStringValue function
* Simplify string value retrieval
* Ensure that image paths in the ImageSequenceTileProvider are sorted (closes #2205)
* Some cleanup of OpenSpaceEngine
* Cleanup documentation
* Some more cleanup of engine classes
* Some more cleanup
* Update SGCT repository
* Use new Jenkins node identifiers as the old method broke with update
This commit is contained in:
Alexander Bock
2022-10-30 12:54:14 +01:00
committed by GitHub
parent 3862e1f449
commit 6249fa6d89
129 changed files with 467 additions and 761 deletions

View File

@@ -145,7 +145,7 @@ public:
// [[deprecated("Replaced by Camera::SgctInternal::viewProjectionMatrix()")]]
const glm::mat4& viewProjectionMatrix() const;
std::vector<Syncable*> getSyncables();
std::vector<Syncable*> syncables();
// Static constants
// (2021-07-16, emmbr) Note that this hard coded vector for the view direction is also

View File

@@ -104,7 +104,7 @@ public:
void touchDetectionCallback(TouchInput input);
void touchUpdateCallback(TouchInput input);
void touchExitCallback(TouchInput input);
void handleDragDrop(const std::string& file);
void handleDragDrop(std::filesystem::path file);
std::vector<std::byte> encode();
void decode(std::vector<std::byte> data);
@@ -126,8 +126,7 @@ public:
AssetManager& assetManager();
LoadingScreen* loadingScreen();
void writeSceneDocumentation();
void writeStaticDocumentation();
void writeDocumentation();
void createUserDirectoriesIfNecessary();
/**
@@ -141,7 +140,6 @@ private:
void loadFonts();
void runGlobalCustomizationScripts();
std::string generateFilePath(std::string openspaceRelativePath);
void resetPropertyChangeFlagsOfSubowners(openspace::properties::PropertyOwner* po);
properties::BoolProperty _printEvents;
@@ -156,9 +154,6 @@ private:
glm::vec2 _mousePosition = glm::vec2(0.f);
//grabs json from each module to pass to the documentation engine.
std::string _documentationJson;
std::future<void> _writeDocumentationTask;
ShutdownInformation _shutdown;

View File

@@ -34,7 +34,7 @@ public:
DoubleListProperty(Property::PropertyInfo info,
std::vector<double> values = std::vector<double>());
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<std::vector<double>>::operator std::vector<double>;

View File

@@ -34,7 +34,7 @@ public:
IntListProperty(Property::PropertyInfo info,
std::vector<int> values = std::vector<int>());
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<std::vector<int>>::operator std::vector<int>;

View File

@@ -35,7 +35,7 @@ public:
StringListProperty(Property::PropertyInfo info,
std::vector<std::string> values = std::vector<std::string>());
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<std::vector<std::string>>::operator std::vector<std::string>;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat2x2<double>(std::numeric_limits<double>::max()),
glm::dmat2x2 stepValue = ghoul::createFillMat2x2<double>(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dmat2x2>::operator=;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat3x3<double>(std::numeric_limits<double>::max()),
glm::dmat3x3 stepValue = ghoul::createFillMat3x3<double>(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dmat3x3>::operator=;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat4x4<double>(std::numeric_limits<double>::max()),
glm::dmat4x4 stepValue = ghoul::createFillMat4x4<double>(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dmat4x4>::operator=;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat2x2<float>(std::numeric_limits<float>::max()),
glm::mat2x2 stepValue = ghoul::createFillMat2x2<float>(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::mat2x2>::operator=;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat3x3<float>(std::numeric_limits<float>::max()),
glm::mat3x3 stepValue = ghoul::createFillMat3x3<float>(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::mat3x3>::operator=;

View File

@@ -41,7 +41,7 @@ public:
ghoul::createFillMat4x4<float>(std::numeric_limits<float>::max()),
glm::mat4x4 stepValue = ghoul::createFillMat4x4<float>(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::mat4x4>::operator=;

View File

@@ -35,7 +35,7 @@ public:
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
T maximumValue, T steppingValue, float exponent = 1.f);
virtual std::string className() const override = 0;
virtual std::string_view className() const override = 0;
virtual int typeLua() const override = 0;
T minValue() const;

View File

@@ -82,7 +82,7 @@ public:
*
* \return The name of this class for reflection purposes
*/
std::string className() const override;
std::string_view className() const override;
using IntProperty::operator=;
/**

View File

@@ -30,6 +30,7 @@
#include <any>
#include <functional>
#include <string>
#include <string_view>
struct lua_State;
@@ -114,7 +115,8 @@ public:
/// This OnChangeHandle can be used to remove all onChange callbacks from this
/// Property
static OnChangeHandle OnChangeHandleAll;
constexpr static OnChangeHandle OnChangeHandleAll =
std::numeric_limits<OnChangeHandle>::max();
/**
* The constructor for the property. The \p info (see #PropertyInfo) contains
@@ -145,7 +147,7 @@ public:
*
* \return The class name of the Property
*/
virtual std::string className() const = 0;
virtual std::string_view className() const = 0;
/**
* This method returns the encapsulated value of the Property to the caller. The type
@@ -223,17 +225,7 @@ public:
* \param value The value to which the Property will be encoded
* \return \p true if the encoding succeeded, \p false otherwise
*/
virtual bool getStringValue(std::string& value) const;
/**
* This method encodes the encapsulated value of this Property as a
* <code>std::string</code>.
*
* \return the string value
*
* \throw ghoul::RuntimeError If value could not be fetched
*/
std::string getStringValue() const;
virtual std::string stringValue() const;
/**
* This method registers a \p callback function that will be called every time if
@@ -382,11 +374,11 @@ public:
void setReadOnly(bool state);
/**
* Default view options that can be used in the Property::setViewOption method. The
* values are:
* - Property::ViewOptions::Color = \c Color (Intended for Vec3 and Vec4),
* - Property::ViewOptions::MinMaxRange = \c MinMaxRange (Intended for Vec2)
*/
* Default view options that can be used in the Property::setViewOption method. The
* values are:
* - Property::ViewOptions::Color = \c Color (Intended for Vec3 and Vec4),
* - Property::ViewOptions::MinMaxRange = \c MinMaxRange (Intended for Vec2)
*/
struct ViewOptions {
static const char* Color;
static const char* MinMaxRange;
@@ -426,14 +418,6 @@ public:
*/
const ghoul::Dictionary& metaData() const;
/**
* Convert the Property into a string containing a JSON representation of the
* Property. Includes description of the object.
*
* \return The JSON string
*/
virtual std::string toJson() const;
/**
* Get a valid JSON formatted representation of the Property's value.
*
@@ -457,7 +441,7 @@ public:
*
* \return The base description common to all Property classes
*/
std::string generateBaseJsonDescription() const;
std::string generateJsonDescription() const;
/**
* Creates the information for the \c MetaData key-part of the JSON description for
@@ -496,14 +480,6 @@ public:
void resetToUnchanged();
protected:
static const char* IdentifierKey;
static const char* NameKey;
static const char* TypeKey;
static const char* DescriptionKey;
static const char* JsonValueKey;
static const char* MetaDataKey;
static const char* AdditionalDataKey;
/**
* This method must be called by all subclasses whenever the encapsulated value has
* changed and potential listeners need to be informed.
@@ -547,9 +523,6 @@ private:
#endif
};
/// This function sanitizes an incoming string for JSON control characters
std::string sanitizeString(const std::string& str);
} // namespace openspace::properties
#endif // __OPENSPACE_CORE___PROPERTY___H__

View File

@@ -48,7 +48,7 @@ class BoolProperty : public TemplateProperty<bool> {
public:
BoolProperty(Property::PropertyInfo info, bool value = false);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<bool>::operator=;

View File

@@ -51,7 +51,7 @@ public:
double minValue = std::numeric_limits<double>::lowest(),
double maxValue = std::numeric_limits<double>::max(), double stepValue = 0.01);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<double>::operator=;

View File

@@ -51,7 +51,7 @@ public:
float minValue = std::numeric_limits<float>::lowest(),
float maxValue = std::numeric_limits<float>::max(), float stepValue = 0.01f);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<float>::operator=;

View File

@@ -51,7 +51,7 @@ public:
int minValue = std::numeric_limits<int>::lowest(),
int maxValue = std::numeric_limits<int>::max(), int stepValue = 1);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<int>::operator=;

View File

@@ -52,7 +52,7 @@ public:
long maxValue = std::numeric_limits<long>::max(),
long stepValue = long(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<long>::operator=;

View File

@@ -52,7 +52,7 @@ public:
short maxValue = std::numeric_limits<short>::max(),
short stepValue = short(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<short>::operator=;

View File

@@ -52,7 +52,7 @@ public:
unsigned int maxValue = std::numeric_limits<unsigned int>::max(),
unsigned int stepValue = 1);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<unsigned int>::operator=;

View File

@@ -52,7 +52,7 @@ public:
unsigned long maxValue = std::numeric_limits<unsigned long>::max(),
unsigned long stepValue = 1ul);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<unsigned long>::operator=;

View File

@@ -52,7 +52,7 @@ public:
unsigned short maxValue = std::numeric_limits<unsigned short>::max(),
unsigned short stepValue = 1);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<unsigned short>::operator=;

View File

@@ -37,7 +37,7 @@ class SelectionProperty : public TemplateProperty<std::set<std::string>> {
public:
SelectionProperty(Property::PropertyInfo info);
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
/**

View File

@@ -33,7 +33,7 @@ class StringProperty : public TemplateProperty<std::string> {
public:
StringProperty(Property::PropertyInfo info, std::string value = "");
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<std::string>::operator=;

View File

@@ -71,7 +71,7 @@ public:
*
* \return The class name for the TemplateProperty
*/
virtual std::string className() const override = 0;
virtual std::string_view className() const override = 0;
/**
* Returns the stored value packed into a ghoul::any object.
@@ -127,7 +127,7 @@ public:
* \param value The string object in which to store the resulting encoding
* \return \c true if the encoding succeeded; \c false otherwise
*/
virtual bool getStringValue(std::string& value) const override;
virtual std::string stringValue() const override;
/**
* Returns the description for this TemplateProperty as a Lua script that returns a

View File

@@ -60,12 +60,6 @@ void openspace::properties::TemplateProperty<T>::setValue(T val) {
}
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const TemplateProperty<T>& obj) {
os << obj.value();
return os;
}
template <typename T>
std::any TemplateProperty<T>::get() const {
return std::any(_value);
@@ -99,9 +93,8 @@ bool TemplateProperty<T>::setLuaValue(lua_State* state) {
}
template <typename T>
bool TemplateProperty<T>::getStringValue(std::string& outValue) const {
outValue = toStringConversion();
return true;
std::string TemplateProperty<T>::stringValue() const {
return toStringConversion();
}
} // namespace openspace::properties

View File

@@ -49,7 +49,7 @@ public:
* Returns the class name <code>TriggerProperty</code>.
* \return The class name <code>TriggerProperty</code>
*/
std::string className() const override;
std::string_view className() const override;
/**
* Accepts only the <code>LUA_TNIL</code> type and will notify all the listeners
@@ -66,8 +66,6 @@ public:
*/
void set(std::any value) override;
std::string toJson() const override;
std::string jsonValue() const override;
};

View File

@@ -39,7 +39,7 @@ public:
glm::dvec2 maxValue = glm::dvec2(std::numeric_limits<double>::max()),
glm::dvec2 stepValue = glm::dvec2(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dvec2>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::dvec3 maxValue = glm::dvec3(std::numeric_limits<double>::max()),
glm::dvec3 stepValue = glm::dvec3(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dvec3>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::dvec4 maxValue = glm::dvec4(std::numeric_limits<double>::max()),
glm::dvec4 stepValue = glm::dvec4(0.01));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::dvec4>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::ivec2 maxValue = glm::ivec2(std::numeric_limits<int>::max()),
glm::ivec2 stepValue = glm::ivec2(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::ivec2>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::ivec3 maxValue = glm::ivec3(std::numeric_limits<int>::max()),
glm::ivec3 stepValue = glm::ivec3(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::ivec3>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::ivec4 maxValue = glm::ivec4(std::numeric_limits<int>::max()),
glm::ivec4 stepValue = glm::ivec4(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::ivec4>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::uvec2 maxValue = glm::uvec2(std::numeric_limits<unsigned int>::max()),
glm::uvec2 stepValue = glm::uvec2(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::uvec2>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::uvec3 maxValue = glm::uvec3(std::numeric_limits<unsigned int>::max()),
glm::uvec3 stepValue = glm::uvec3(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::uvec3>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::uvec4 maxValue = glm::uvec4(std::numeric_limits<unsigned int>::max()),
glm::uvec4 stepValue = glm::uvec4(1));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::uvec4>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::vec2 maxValue = glm::vec2(std::numeric_limits<float>::max()),
glm::vec2 stepValue = glm::vec2(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::vec2>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::vec3 maxValue = glm::vec3(std::numeric_limits<float>::max()),
glm::vec3 stepValue = glm::vec3(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::vec3>::operator=;

View File

@@ -39,7 +39,7 @@ public:
glm::vec4 maxValue = glm::vec4(std::numeric_limits<float>::max()),
glm::vec4 stepValue = glm::vec4(0.01f));
std::string className() const override;
std::string_view className() const override;
int typeLua() const override;
using TemplateProperty<glm::vec4>::operator=;

View File

@@ -90,7 +90,7 @@ public:
void renderEndscreen();
void postDraw();
float globalBlackOutFactor();
float globalBlackOutFactor() const;
void setGlobalBlackOutFactor(float opacity);
float hdrExposure() const;

View File

@@ -69,7 +69,7 @@ public:
* \param message The reason that caused this exception to be thrown
* \param component The optional compoment that caused this exception to be thrown
* \pre message may not be empty
*/
*/
explicit InvalidSceneError(std::string msg, std::string comp = "");
};
@@ -100,11 +100,6 @@ public:
*/
ghoul::mm_unique_ptr<SceneGraphNode> detachNode(SceneGraphNode& node);
/**
* Set the camera of the scene
*/
void setCamera(std::unique_ptr<Camera> camera);
/**
* Return the camera
*/
@@ -147,8 +142,8 @@ public:
void unregisterNode(SceneGraphNode* node);
/**
* Mark the node registry as dirty
*/
* Mark the node registry as dirty
*/
void markNodeRegistryDirty();
/**

View File

@@ -178,7 +178,7 @@ private:
properties::StringProperty _guiDisplayName;
properties::StringProperty _guiDescription;
// Transformation defined by ephemeris, rotation and scale
// Transformation defined by translation, rotation and scale
struct {
ghoul::mm_unique_ptr<Translation> translation;
ghoul::mm_unique_ptr<Rotation> rotation;

View File

@@ -85,8 +85,6 @@ public:
bool runScript(const std::string& script, ScriptCallback callback = ScriptCallback());
bool runScriptFile(const std::filesystem::path& filename);
bool writeLog(const std::string& script);
virtual void preSync(bool isMaster) override;
virtual void encode(SyncBuffer* syncBuffer) override;
virtual void decode(SyncBuffer* syncBuffer) override;
@@ -102,13 +100,14 @@ public:
private:
BooleanType(Replace);
void writeLog(const std::string& script);
bool registerLuaLibrary(lua_State* state, LuaLibrary& library);
void addLibraryFunctions(lua_State* state, LuaLibrary& library, Replace replace);
bool isLibraryNameAllowed(lua_State* state, const std::string& name);
void addBaseLibrary();
void remapPrintFunction();
ghoul::lua::LuaState _state;
std::vector<LuaLibrary> _registeredLibraries;

View File

@@ -59,7 +59,7 @@ public:
const Time& integrateFromTime() const;
const Timeline<TimeKeyframeData>& timeline() const;
std::vector<Syncable*> getSyncables();
std::vector<Syncable*> syncables();
void preSynchronization(double dt);
TimeKeyframeData interpolate(double applicationTime);