summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-05-19 11:16:01 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-16 06:42:48 (GMT)
commit39fc1940e5cb0f274347d7025cfe4137dead64e6 (patch)
treeecc6331ec3e49940dcee6416ad20294876b43d17
parent0b725a0ec6fee51a37cce9d7e2e08aef76103605 (diff)
Add constructor to construct DeepSkyObject from CatalogEntryData
FIXME: Supply epoch as a parameter for non-J2000.0 constructions (this way the fixme in the code is at least explicit)
-rw-r--r--kstars/skyobjects/deepskyobject.cpp22
-rw-r--r--kstars/skyobjects/deepskyobject.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/kstars/skyobjects/deepskyobject.cpp b/kstars/skyobjects/deepskyobject.cpp
index cb9941a..cae5079 100644
--- a/kstars/skyobjects/deepskyobject.cpp
+++ b/kstars/skyobjects/deepskyobject.cpp
@@ -33,6 +33,7 @@
#include "Options.h"
#include "skymap.h"
#include "texturemanager.h"
+#include "catalogentrydata.h"
#include <QDebug>
#include <KLocalizedString>
@@ -70,6 +71,27 @@ DeepSkyObject::DeepSkyObject( int t, dms r, dms d, float m,
loadImage();
}
+DeepSkyObject::DeepSkyObject( const CatalogEntryData &data )
+{
+ // FIXME: This assumes that CatalogEntryData coordinates have
+ // J2000.0 as epoch as opposed to the catalog's epoch!!! -- asimha
+ setType( data.type );
+ setRA0( data.ra/15.0 ); // NOTE: CatalogEntryData stores RA in degrees, whereas setRA0() wants it in hours.
+ setDec0( data.dec );
+ setLongName( data.long_name );
+ setName( data.catalog_name + ' ' + QString::number( data.ID ) );
+ MajorAxis = data.major_axis;
+ MinorAxis = data.minor_axis;
+ PositionAngle = data.position_angle;
+ PGC = 0;
+ UGC = 0;
+ setCatalog( data.catalog_name );
+ updateID = updateNumID = 0;
+ customCat = NULL; // <-- FIXME!
+ Flux = data.flux;
+ loadImage();
+}
+
DeepSkyObject* DeepSkyObject::clone() const
{
Q_ASSERT( typeid( this ) == typeid( static_cast<const DeepSkyObject *>( this ) ) ); // Ensure we are not slicing a derived class
diff --git a/kstars/skyobjects/deepskyobject.h b/kstars/skyobjects/deepskyobject.h
index d4004d9..2e4d8f0 100644
--- a/kstars/skyobjects/deepskyobject.h
+++ b/kstars/skyobjects/deepskyobject.h
@@ -28,6 +28,7 @@ class QImage;
class QString;
class KSPopupMenu;
class CatalogComponent;
+class CatalogEntryData;
/**
*@class DeepSkyObject
@@ -70,6 +71,8 @@ public:
*/
DeepSkyObject(const DeepSkyObject &o );
+ DeepSkyObject( const CatalogEntryData &data );
+
QString labelString() const;
virtual DeepSkyObject* clone() const;