This commit is contained in:
Jonathas Costa
2018-03-16 15:17:13 -04:00
239 changed files with 2935 additions and 1734 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ public:
ModuleSubClass* module() const {
auto it = std::find_if(_modules.begin(), _modules.end(),
[](const std::unique_ptr<OpenSpaceModule>& m) {
return m->name() == ModuleSubClass::Name;
return m->identifier() == ModuleSubClass::Name;
});
if (it != _modules.end()) {
return dynamic_cast<ModuleSubClass*>(it->get());
+55 -16
View File
@@ -55,11 +55,23 @@ public:
static const char URISeparator = '.';
struct PropertyOwnerInfo {
std::string name;
std::string identifier;
std::string guiName = "";
std::string description = "";
};
/// The constructor initializing the PropertyOwner's name to <code>""</code>
/**
* The constructor of PropertyOwner.
*
* \param info the PropertyOwnerInfo struct that contains the
* #PropertyOwnerInfo::identifier, #PropertyOwnerInfo::guiName, and
* #PropertyOwnerInfo::description of this PropertyOwner.
*
* \pre The \p info 's #PropertyOwnerInfo::identifier must not contain any whitespaces
* \pre The \p info 's #PropertyOwnerInfo::identifier must not contain any
* <code>.</code>
*/
PropertyOwner(PropertyOwnerInfo info);
/**
@@ -69,20 +81,40 @@ public:
virtual ~PropertyOwner();
/**
* Sets the name for this PropertyOwner. If the PropertyOwner does not have an owner
* itself, the name must be globally unique. If the PropertyOwner has an owner, the
* name must be unique to the owner (including the owner's properties). No uniqueness
* check will be preformed here, but rather in the PropertyOwner::addProperty and
* PropertyOwner::addPropertySubOwner methods).
* \param name The name of this PropertyOwner. It may not contain any <code>.</code>s
* Sets the identifier for this PropertyOwner. If the PropertyOwner does not have an
* owner itself, the identifier must be globally unique. If the PropertyOwner has an
* owner, the identifier must be unique to the owner (including the owner's
* properties). No uniqueness check will be preformed here, but rather in the
* PropertyOwner::addProperty and PropertyOwner::addPropertySubOwner methods).
*
* \param identifier The identifier of this PropertyOwner. It must not contain any
* <code>.</code>s or whitespaces
*
* \pre \p identifier must not contain any whitespaces
* \pre \p identifier must not contain any <code>.</code>
*/
void setName(std::string name);
void setIdentifier(std::string identifier);
/**
* Returns the name of this PropertyOwner.
* \return The name of this PropertyOwner
* Returns the identifier of this PropertyOwner.
* \return The identifier of this PropertyOwner
*/
std::string name() const;
std::string identifier() const;
/**
* Sets the user-facing name of this PropertyOwner. This name does not have to be
* unique, but it is recommended to be.
*
* \param guiName The new user-facing name for this PropertyOwner
*/
void setGuiName(std::string guiName);
/**
* Returns the current user-facing name for this PropertyOwner.
*
* \return The current user-facing name for this PropertyOwner
*/
const std::string& guiName() const;
void setDescription(std::string description);
@@ -91,12 +123,14 @@ public:
/**
* Returns a list of all Propertys directly owned by this PropertyOwner. This list not
* include Propertys owned by other sub-owners.
*
* \return A list of all Propertys directly owned by this PropertyOwner
*/
std::vector<Property*> properties() const;
/**
* Returns a list of all Propertys directly or indirectly owned by this PropertyOwner.
*
* \return A list of all Propertys directly or indirectly owned by this PropertyOwner
*/
std::vector<Property*> propertiesRecursive() const;
@@ -239,13 +273,18 @@ public:
*/
void removeTag(const std::string& tag);
protected:
/// The unique identifier of this PropertyOwner
std::string _identifier;
/// The user-facing GUI name for this PropertyOwner
std::string _guiName;
/// The description for this PropertyOwner
std::string _description;
private:
std::string generateJson() const override;
/// The name of this PropertyOwner
std::string _name;
/// The description for this PropertyOwner
std::string _description;
/// The owner of this PropertyOwner
PropertyOwner* _owner;
/// A list of all registered Property's
+1 -1
View File
@@ -42,7 +42,7 @@ public:
ghoul::Dictionary dictionary
);
DashboardItem(std::string name);
DashboardItem(std::string identifier, std::string guiName = "");
bool isEnabled() const;
virtual void render(glm::vec2& penPosition) = 0;
+3 -1
View File
@@ -84,7 +84,8 @@ public:
Failed
};
void updateItem(const std::string& itemName, ItemStatus newStatus, float progress);
void updateItem(const std::string& itemIdentifier, const std::string& itemName,
ItemStatus newStatus, float progress);
private:
bool _showMessage;
@@ -122,6 +123,7 @@ private:
std::mutex _messageMutex;
struct Item {
std::string identifier;
std::string name;
ItemStatus status;
float progress;
@@ -167,6 +167,8 @@ public:
std::vector<Syncable*> getSyncables();
properties::PropertyOwner& screenSpaceOwner();
private:
void setRenderer(std::unique_ptr<Renderer> renderer);
RendererImplementation rendererFromString(const std::string& method) const;
@@ -216,6 +218,7 @@ private:
uint64_t _frameNumber;
std::vector<ghoul::opengl::ProgramObject*> _programs;
properties::PropertyOwner _screenSpaceOwner;
std::vector<std::shared_ptr<ScreenSpaceRenderable>> _screenSpaceRenderables;
std::shared_ptr<ghoul::fontrendering::Font> _fontBig = nullptr;
@@ -55,6 +55,9 @@ public:
static std::unique_ptr<ScreenSpaceRenderable> createFromDictionary(
const ghoul::Dictionary& dictionary);
static constexpr const char* KeyName = "Name";
static constexpr const char* KeyIdentifier = "Identifier";
ScreenSpaceRenderable(const ghoul::Dictionary& dictionary);
virtual ~ScreenSpaceRenderable() = default;
+3 -3
View File
@@ -153,9 +153,9 @@ public:
void writeSceneLicenseDocumentation(const std::string& path) const;
/**
* Return a a map from name to scene graph node.
* Returns a map from identifier to scene graph node.
*/
const std::unordered_map<std::string, SceneGraphNode*>& nodesByName() const;
const std::unordered_map<std::string, SceneGraphNode*>& nodesByIdentifier() const;
/**
* Load a scene graph node from a dictionary and return it.
@@ -234,7 +234,7 @@ private:
std::unique_ptr<Camera> _camera;
std::vector<SceneGraphNode*> _topologicallySortedNodes;
std::vector<SceneGraphNode*> _circularNodes;
std::unordered_map<std::string, SceneGraphNode*> _nodesByName;
std::unordered_map<std::string, SceneGraphNode*> _nodesByIdentifier;
bool _dirtyNodeRegistry;
SceneGraphNode _rootDummy;
std::unique_ptr<SceneInitializer> _initializer;
+5 -5
View File
@@ -71,11 +71,11 @@ public:
long long updateTimeScaling; // time in ns
};
static const std::string RootNodeName;
static const std::string KeyName;
static const std::string KeyParentName;
static const std::string KeyDependencies;
static const std::string KeyTag;
static constexpr const char* RootNodeIdentifier = "Root";
static constexpr const char* KeyIdentifier = "Identifier";
static constexpr const char* KeyParentName = "Parent";
static constexpr const char* KeyDependencies = "Dependencies";
static constexpr const char* KeyTag = "Tag";
SceneGraphNode();
~SceneGraphNode();