mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
More work towards a unified interface for accessing properties
This commit is contained in:
@@ -35,27 +35,42 @@ namespace properties {
|
||||
|
||||
class PropertyOwner {
|
||||
public:
|
||||
static const char URISeparator = '.';
|
||||
|
||||
PropertyOwner();
|
||||
virtual ~PropertyOwner();
|
||||
|
||||
void setName(std::string name);
|
||||
virtual const std::string& name() const;
|
||||
|
||||
const std::vector<Property*>& properties() const;
|
||||
Property* property(const std::string& id) const;
|
||||
bool hasProperty(const std::string& id) const;
|
||||
|
||||
const std::vector<PropertyOwner*>& subOwners() const;
|
||||
PropertyOwner* subOwner(const std::string& name) const;
|
||||
bool hasSubOwner(const std::string& name) const;
|
||||
|
||||
void setPropertyGroupName(std::string groupID, std::string name);
|
||||
const std::string& propertyGroupName(const std::string& groupID) const;
|
||||
|
||||
|
||||
protected:
|
||||
void addProperty(Property* prop);
|
||||
void addProperty(Property& prop);
|
||||
|
||||
void addPropertySubOwner(PropertyOwner* owner);
|
||||
void addPropertySubOwner(PropertyOwner& owner);
|
||||
|
||||
void removeProperty(Property* prop);
|
||||
void removeProperty(Property& prop);
|
||||
|
||||
void removePropertySubOwner(PropertyOwner* owner);
|
||||
void removePropertySubOwner(PropertyOwner& owner);
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
std::vector<Property*> _properties;
|
||||
std::vector<PropertyOwner*> _subOwners;
|
||||
std::map<std::string, std::string> _groupNames;
|
||||
};
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ class SceneGraphNode;
|
||||
SceneGraph* sceneGraph();
|
||||
SceneGraphNode* sceneGraphNode(const std::string& name);
|
||||
properties::Property* property(const std::string& uri);
|
||||
properties::Property* property(const std::string& nodeName, const std::string& propertyName);
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/scenegraph/ephemeris.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <openspace/scenegraph/scenegraph.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
@@ -40,7 +41,7 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class SceneGraphNode {
|
||||
class SceneGraphNode : public properties::PropertyOwner {
|
||||
public:
|
||||
static std::string RootNodeName;
|
||||
|
||||
@@ -61,11 +62,9 @@ public:
|
||||
// set & get
|
||||
void addNode(SceneGraphNode* child);
|
||||
|
||||
void setName(const std::string& name);
|
||||
void setParent(SceneGraphNode* parent);
|
||||
const psc& position() const;
|
||||
psc worldPosition() const;
|
||||
std::string nodeName() const;
|
||||
|
||||
SceneGraphNode* parent() const;
|
||||
const std::vector<SceneGraphNode*>& children() const;
|
||||
@@ -86,7 +85,6 @@ private:
|
||||
// essential
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
SceneGraphNode* _parent;
|
||||
std::string _nodeName;
|
||||
Ephemeris* _ephemeris;
|
||||
|
||||
// renderable
|
||||
|
||||
Reference in New Issue
Block a user