Added InfoURL field, as for solar system objects.

ver1_5_1
Chris Laurel 2003-02-20 08:34:19 +00:00
parent 5af8e6d06e
commit c8771b0168
2 changed files with 27 additions and 2 deletions

View File

@ -26,7 +26,8 @@ DeepSkyObject::DeepSkyObject() :
name(""),
position(0, 0, 0),
orientation(1),
radius(1)
radius(1),
infoURL(NULL)
{
}
@ -75,6 +76,22 @@ void DeepSkyObject::setRadius(float r)
radius = r;
}
string DeepSkyObject::getInfoURL() const
{
if (infoURL == NULL)
return "";
else
return *infoURL;
}
void DeepSkyObject::setInfoURL(const std::string& s)
{
if (infoURL == NULL)
infoURL = new string(s);
else
*infoURL = s;
}
bool DeepSkyObject::load(AssociativeArray* params)
{
// Get position
@ -105,10 +122,14 @@ bool DeepSkyObject::load(AssociativeArray* params)
(float) degToRad(angle));
setOrientation(q);
double radius = 0.0;
double radius = 1.0;
params->getNumber("Radius", radius);
setRadius((float) radius);
string infoURL;
if (params->getString("InfoURL", infoURL))
setInfoURL(infoURL);
return true;
}

View File

@ -36,6 +36,9 @@ class DeepSkyObject
float getRadius() const;
void setRadius(float);
std::string getInfoURL() const;
void setInfoURL(const std::string&);
virtual bool load(AssociativeArray*);
virtual void render(const Vec3f& offset,
@ -48,6 +51,7 @@ class DeepSkyObject
Point3d position;
Quatf orientation;
float radius;
std::string* infoURL;
};
typedef std::vector<DeepSkyObject*> DeepSkyCatalog;