Added body string to renderable to be able to search for target in scenegraph

This commit is contained in:
Anton Arbring
2015-04-21 20:31:33 -04:00
parent 641107a106
commit 97cbf977c5
4 changed files with 32 additions and 5 deletions

View File

@@ -69,8 +69,13 @@ public:
virtual void update(const UpdateData& data);
bool isVisible() const;
bool hasTimeInterval();
bool getInterval(double& start, double& end);
bool hasBody();
bool getBody(std::string& body);
void setBody(std::string& body);
protected:
std::string findPath(const std::string& path);
@@ -83,6 +88,8 @@ private:
std::string _relativePath;
std::string _startTime;
std::string _endTime;
std::string _targetBody;
bool _hasBody;
bool _hasTimeInterval;
};

View File

@@ -84,9 +84,9 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
}
dictionary.getValue(keyFrame, _frame);
dictionary.getValue(keyBody, _target);
//assert(b1 == true);
if (_target != "")
setBody(_target);
// TODO: textures need to be replaced by a good system similar to the geometry as soon
// as the requirements are fixed (ab)

View File

@@ -105,9 +105,10 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
_geometry = planetgeometryprojection::PlanetGeometryProjection::createFromDictionary(geometryDictionary);
}
dictionary.getValue(keyBody, _target);
dictionary.getValue(keyFrame, _frame);
dictionary.getValue(keyBody, _target);
if (_target != "")
setBody(_target);
bool b1 = dictionary.getValue(keyInstrument, _instrumentID);
bool b2 = dictionary.getValue(keyProjObserver, _projectorID);

View File

@@ -74,7 +74,8 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
: _enabled("enabled", "Is Enabled", true),
_hasTimeInterval(false),
_startTime(""),
_endTime("")
_endTime(""),
_targetBody("")
{
setName("renderable");
#ifndef NDEBUG
@@ -152,6 +153,10 @@ bool Renderable::hasTimeInterval() {
return _hasTimeInterval;
}
bool Renderable::hasBody() {
return _hasBody;
}
bool Renderable::getInterval(double& start, double& end) {
if (_startTime != "" && _endTime != "") {
bool successStart = openspace::SpiceManager::ref().getETfromDate(_startTime, start);
@@ -162,6 +167,20 @@ bool Renderable::getInterval(double& start, double& end) {
return false;
}
bool Renderable::getBody(std::string& body) {
if (_hasBody) {
body = _targetBody;
return true;
}
else
return false;
}
void Renderable::setBody(std::string& body) {
_targetBody = body;
_hasBody = true;
}
bool Renderable::isReady() const {
return true;
}