summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-17 05:21:57 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-17 05:21:57 (GMT)
commit4148ddf859057d9eefb83c2b837ee0313fdc41f9 (patch)
treefb3ac088f591d0aa93e3c212d93a5d7ed7789b94
parentb43e6ecead87fac98e9fb5a494bafd6668c8bde9 (diff)
Prevent showing _Internet_Resolved # names for internet-resolved objects
-rw-r--r--kstars/skycomponents/syncedcatalogcomponent.cpp17
-rw-r--r--kstars/skyobjects/deepskyobject.cpp8
2 files changed, 13 insertions, 12 deletions
diff --git a/kstars/skycomponents/syncedcatalogcomponent.cpp b/kstars/skycomponents/syncedcatalogcomponent.cpp
index be02db0..5870e46 100644
--- a/kstars/skycomponents/syncedcatalogcomponent.cpp
+++ b/kstars/skycomponents/syncedcatalogcomponent.cpp
@@ -74,19 +74,14 @@ DeepSkyObject *SyncedCatalogComponent::addObject( CatalogEntryData catalogEntry
catalogEntry.major_axis = 0.0;
if( std::isnan( catalogEntry.minor_axis ) )
catalogEntry.minor_axis = 0.0;
- if( catalogEntry.catalog_name != m_catName ) {
- qWarning() << "Trying to add object with catalog name = " << catalogEntry.catalog_name << " to catalog " << m_catName << "! Will over-write catalog name with " << m_catName;
- catalogEntry.catalog_name = m_catName;
- // NOTE: We must fix the following before we can proceed with
- // debugging: 1. CatalogEntryData doesn't come fully filled
- // for us. We need to fill in catalog_name and
- // ID. catalog_name is easy. For ID, we must maintain a
- // running ocunter like was done in AddEntry() for
- // "Misc". Please implement this.
+ CatalogEntryData dbEntry = catalogEntry;
+ if( dbEntry.catalog_name != m_catName ) {
+ qWarning() << "Trying to add object " << catalogEntry.catalog_name << catalogEntry.ID << " to catalog " << m_catName << " will over-write catalog name with " << m_catName << " in the database and assign an arbitrary ID";
+ dbEntry.catalog_name = m_catName;
}
- catalogEntry.ID = m_catCount;
+ dbEntry.ID = m_catCount;
CatalogDB *db = KStarsData::Instance()->catalogdb();
- if( !( db->AddEntry( catalogEntry, m_catId ) ) )
+ if( !( db->AddEntry( dbEntry, m_catId ) ) )
return 0;
m_catCount++;
qDebug() << "Added object " << catalogEntry.long_name << " into database!";
diff --git a/kstars/skyobjects/deepskyobject.cpp b/kstars/skyobjects/deepskyobject.cpp
index c5dd8fb..5d660a3 100644
--- a/kstars/skyobjects/deepskyobject.cpp
+++ b/kstars/skyobjects/deepskyobject.cpp
@@ -75,11 +75,17 @@ DeepSkyObject::DeepSkyObject( const CatalogEntryData &data )
{
// FIXME: This assumes that CatalogEntryData coordinates have
// J2000.0 as epoch as opposed to the catalog's epoch!!! -- asimha
+ qWarning() << "Creating a DeepSkyObject from CatalogEntryData assumes that coordinates are J2000.0";
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 ) );
+ if( ! data.catalog_name.isEmpty() )
+ setName( data.catalog_name + ' ' + QString::number( data.ID ) );
+ else {
+ setName( data.long_name );
+ setLongName( QString() );
+ }
MajorAxis = data.major_axis;
MinorAxis = data.minor_axis;
PositionAngle = data.position_angle;