[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects
Alexey Khudyakov
alexey.skladnoy at gmail.com
Wed Jul 29 12:55:54 CEST 2009
SVN commit 1004092 by khudyakov:
Implementation of UIDs for Solar System objects (incomplete)
For asteriods and comets UIDs are not implemented yet
CCMAIL: kstars-devel at kde.org
M +5 -0 ksasteroid.cpp
M +2 -1 ksasteroid.h
M +6 -0 kscomet.cpp
M +1 -0 kscomet.h
M +5 -0 ksmoon.cpp
M +2 -1 ksmoon.h
M +25 -0 ksplanet.cpp
M +1 -0 ksplanet.h
M +5 -0 ksplanetbase.cpp
M +10 -1 ksplanetbase.h
M +4 -0 kssun.cpp
M +2 -1 kssun.h
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksasteroid.cpp #1004091:1004092
@@ -142,3 +142,8 @@
//Unused virtual function from KSPlanetBase
bool KSAsteroid::loadData() { return false; }
+SkyObject::UID KSAsteroid::getUID() const
+{
+ // FIXME: return sensible number. Asteriod number required.
+ return SkyObject::invalidUID;
+}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksasteroid.h #1004091:1004092
@@ -66,7 +66,8 @@
long double JD, double a, double e, dms i, dms w, dms N, dms M, double H, double G );
virtual KSAsteroid* clone() const;
-
+ virtual SkyObject::UID getUID() const;
+
/**Destructor (empty)*/
virtual ~KSAsteroid() {}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/kscomet.cpp #1004091:1004092
@@ -187,3 +187,9 @@
//Unused virtual function from KSPlanetBase
bool KSComet::loadData() { return false; }
+
+SkyObject::UID KSComet::getUID() const
+{
+ // FIXME: create sensible algorithm.
+ return SkyObject::invalidUID;
+}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/kscomet.h #1004091:1004092
@@ -65,6 +65,7 @@
long double JD, double q, double e, dms i, dms w, dms N, double Tp, float H, float G );
virtual KSComet* clone() const;
+ virtual SkyObject::UID getUID() const;
/**Destructor (empty)*/
virtual ~KSComet() {}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksmoon.cpp #1004091:1004092
@@ -269,3 +269,8 @@
else return i18n( "unknown" );
}
+
+SkyObject::UID KSMoon::getUID() const
+{
+ return solarsysUID(UID_SOL_BIGOBJ) | 10;
+}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksmoon.h #1004091:1004092
@@ -41,7 +41,8 @@
KSMoon(const KSMoon& o);
virtual KSMoon* clone() const;
-
+ virtual SkyObject::UID getUID() const;
+
/**Destructor (empty). */
~KSMoon();
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanet.cpp #1004091:1004092
@@ -361,3 +361,28 @@
}
setMag(magnitude);
}
+
+SkyObject::UID KSPlanet::getUID() const
+{
+ SkyObject::UID n;
+ if( name() == i18n( "Mercury" ) ) {
+ n = 1;
+ } else if( name() == i18n( "Venus" ) ) {
+ n = 2;
+ } else if( name() == i18n( "Earth" ) ) {
+ n = 3;
+ } else if( name() == i18n( "Mars" ) ) {
+ n = 4;
+ } else if( name() == i18n( "Jupiter" ) ) {
+ n = 5;
+ } else if( name() == i18n( "Saturn" ) ) {
+ n = 6;
+ } else if( name() == i18n( "Uranus" ) ) {
+ n = 7;
+ } else if( name() == i18n( "Neptune" ) ) {
+ n = 8;
+ } else {
+ return SkyObject::invalidUID;
+ }
+ return solarsysUID(UID_SOL_BIGOBJ) | n;
+}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanet.h #1004091:1004092
@@ -58,6 +58,7 @@
KSPlanet( int n );
virtual KSPlanet* clone() const;
+ virtual SkyObject::UID getUID() const;
/**
* Destructor (empty)
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanetbase.cpp #1004091:1004092
@@ -48,6 +48,11 @@
QColor("white"); //Moon
+const SkyObject::UID KSPlanetBase::UID_SOL_BIGOBJ;
+const SkyObject::UID KSPlanetBase::UID_SOL_ASTEROID;
+const SkyObject::UID KSPlanetBase::UID_SOL_COMET;
+
+
KSPlanetBase::KSPlanetBase( const QString &s, const QString &image_file, const QColor &c, double pSize ) :
TrailObject( 2, 0.0, 0.0, 0.0, s ),
Rearth(0.0),
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanetbase.h #1004091:1004092
@@ -63,7 +63,6 @@
*/
class KSPlanetBase : public TrailObject {
public:
-
/**
*Constructor. Calls SkyObject constructor with type=2 (planet),
*coordinates=0.0, mag=0.0, primary name s, and all other QStrings empty.
@@ -286,6 +285,16 @@
virtual double labelOffset() const;
protected:
+ /** Big object. Planet, Moon, Sun. */
+ static const UID UID_SOL_BIGOBJ = 0;
+ /** Asteroids */
+ static const UID UID_SOL_ASTEROID = 1;
+ /** Comets */
+ static const UID UID_SOL_COMET = 2;
+
+ /** Compute high 32-bits of UID. */
+ inline UID solarsysUID(UID type) const { return (SkyObject::UID_SOLARSYS << 60) | (type << 52); }
+
/**
*@short find the object's current geocentric equatorial coordinates (RA and Dec)
*This function is pure virtual; it must be overloaded by subclasses.
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/kssun.cpp #1004091:1004092
@@ -150,3 +150,7 @@
return true;
}
+SkyObject::UID KSSun::getUID() const
+{
+ return solarsysUID(UID_SOL_BIGOBJ) | 0;
+}
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/kssun.h #1004091:1004092
@@ -37,7 +37,8 @@
KSSun();
virtual KSSun* clone() const;
-
+ virtual SkyObject::UID getUID() const;
+
/**Destructor (empty)
*/
virtual ~KSSun() {}
More information about the Kstars-devel
mailing list