Commit 39fc1940 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

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)
parent 0b725a0e
......@@ -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
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment