summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-16 23:38:40 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-16 23:39:05 (GMT)
commiteff0e53162bbcf17b56976cd7c2356a4615727ca (patch)
tree431ae034de425ed1f41e77f28749456e821317f9
parentad55f21c5a4f7b64dcc77f5fdc677e71536607b2 (diff)
Add a SyncedCatalogComponent called miscObjectComponent to SkyComposite
The purpose of this new component is to store and manage the objects we have resolved using the online services, or retrived otherwise.
-rw-r--r--kstars/CMakeLists.txt1
-rw-r--r--kstars/dialogs/finddialog.cpp1
-rw-r--r--kstars/skycomponents/skymapcomposite.cpp16
-rw-r--r--kstars/skycomponents/skymapcomposite.h3
4 files changed, 21 insertions, 0 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 6dc8cc2..6ef896d 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -295,6 +295,7 @@ set(libkstarscomponents_SRCS
skycomponents/deepstarcomponent.cpp
skycomponents/deepskycomponent.cpp
skycomponents/catalogcomponent.cpp
+ skycomponents/syncedcatalogcomponent.cpp
skycomponents/constellationartcomponent.cpp
skycomponents/constellationboundarylines.cpp
skycomponents/constellationlines.cpp
diff --git a/kstars/dialogs/finddialog.cpp b/kstars/dialogs/finddialog.cpp
index 35083aa..e8fb152 100644
--- a/kstars/dialogs/finddialog.cpp
+++ b/kstars/dialogs/finddialog.cpp
@@ -22,6 +22,7 @@
#include "detaildialog.h"
#include "skyobjects/skyobject.h"
#include "skycomponents/starcomponent.h"
+#include "skycomponents/syncedcatalogcomponent.h"
#include "skycomponents/skymapcomposite.h"
#include "tools/nameresolver.h"
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 48fa600..5df7bad 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -36,6 +36,7 @@
#include "equatorialcoordinategrid.h"
#include "horizontalcoordinategrid.h"
#include "catalogcomponent.h"
+#include "syncedcatalogcomponent.h"
#include "deepskycomponent.h"
#include "equator.h"
#include "artificialhorizoncomponent.h"
@@ -99,6 +100,7 @@ SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
new CatalogComponent( this, allcatalogs.at(i), false, i ), 6
);
}
+ addComponent( m_miscObjectComponent = new SyncedCatalogComponent( this, "Misc", true, 0 ), 6 );
addComponent( m_SolarSystem = new SolarSystemComposite( this ), 2);
addComponent( m_Flags = new FlagComponent( this ), 4);
@@ -144,6 +146,7 @@ void SkyMapComposite::update(KSNumbers *num )
//m_DeepSky->update( data, num );
//9. Custom catalogs
m_CustomCatalogs->update( num );
+ m_miscObjectComponent->update( num );
//10. Stars
//m_Stars->update( data, num );
//m_CLines->update( data, num ); // MUST follow stars.
@@ -254,6 +257,7 @@ void SkyMapComposite::draw( SkyPainter *skyp )
m_DeepSky->draw( skyp );
m_CustomCatalogs->draw( skyp );
+ m_miscObjectComponent->draw( skyp );
m_Stars->draw( skyp );
@@ -365,6 +369,14 @@ SkyObject* SkyMapComposite::objectNearest( SkyPoint *p, double &maxrad ) {
}
rTry = maxrad;
+ oTry = m_miscObjectComponent->objectNearest( p, rTry );
+ rTry *= 0.5;
+ if ( rTry < rBest ) {
+ rBest = rTry;
+ oBest = oTry;
+ }
+
+ rTry = maxrad;
oTry = m_SolarSystem->objectNearest( p, rTry );
if( !dynamic_cast<KSComet *>( oTry ) && !dynamic_cast<KSAsteroid *>( oTry ) ) { // There are gazillions of faint asteroids and comets; we want to prevent them from getting precedence
rTry *= 0.25; // this is either sun, moon, or one of the major planets or their moons.
@@ -460,6 +472,8 @@ SkyObject* SkyMapComposite::findByName( const QString &name ) {
if ( o ) return o;
o = m_CustomCatalogs->findByName( name );
if ( o ) return o;
+ o = m_miscObjectComponent->findByName( name );
+ if ( o ) return o;
o = m_CNames->findByName( name );
if ( o ) return o;
o = m_Stars->findByName( name );
@@ -572,6 +586,8 @@ void SkyMapComposite::reloadDeepSky() {
new CatalogComponent( this, allcatalogs.at(i), false, i ), 5
);
}
+ delete m_miscObjectComponent;
+ addComponent( m_miscObjectComponent = new SyncedCatalogComponent( this, "Misc", true, 0 ), 6 );
SkyMapDrawAbstract::setDrawLock(false);
diff --git a/kstars/skycomponents/skymapcomposite.h b/kstars/skycomponents/skymapcomposite.h
index 5561e9e..b02e9f0 100644
--- a/kstars/skycomponents/skymapcomposite.h
+++ b/kstars/skycomponents/skymapcomposite.h
@@ -55,6 +55,7 @@ class DeepSkyObject;
class KSPlanetBase;
class KSPlanet;
class ConstellationsArt;
+class SyncedCatalogComponent;
/** @class SkyMapComposite
*SkyMapComposite is the root object in the object hierarchy of the sky map.
@@ -173,6 +174,7 @@ public:
SatellitesComponent* satellites();
SupernovaeComponent* supernovaeComponent();
ArtificialHorizonComponent* artificialHorizon();
+ inline SyncedCatalogComponent* miscObjectComponent() { return m_miscObjectComponent; }
//Accessors for StarComponent
SkyObject* findStarByGenetiveName( const QString name );
@@ -228,6 +230,7 @@ private:
TargetListComponent *m_StarHopRouteList;
SatellitesComponent *m_Satellites;
SupernovaeComponent *m_Supernovae;
+ SyncedCatalogComponent *m_miscObjectComponent;
SkyMesh* m_skyMesh;
SkyLabeler* m_skyLabeler;