Commit eff0e531 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

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.
parent ad55f21c
......@@ -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
......
......@@ -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"
......
......@@ -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 );
......@@ -364,6 +368,14 @@ SkyObject* SkyMapComposite::objectNearest( SkyPoint *p, double &maxrad ) {
oBest = oTry;
}
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
......@@ -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);
......
......@@ -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;
......
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