Introduction

This documentation concerns the inner workings of Stellarium. This documentation is targetted at developers of scripts, plugins and the core program.

Program Architecture

The code of Stellarium is split into several main blocks:

the main loop and main widget classes StelMainWindow, StelMainGraphicsView and StelAppGraphicsWidget. Those classes have a single instance created at startup by the ::main() function. They perform tasks such as creating of the main window and renderer, creating the stellarium core, creating the GUI. After initialization, they manage user's input event propagation and event loop. They are heavily based on Qt features.

the core which provides generic services and features to the other components. The main class is the StelApp singleton which is used everywhere in the code to access other elements. The StelApp instance creates all the main core services and modules at initialization. Example services are sky layer management (e.g. images which have a fixed position in the sky) with the StelSkyLayerMgr, drawing with StelRenderer etc. . Two especially important manager classes are the StelModuleMgr and StelCore: the former manages the collection of StelModule instances registered in the program (see next point for more info on what a StelModule is). The latter provides performance critical features for computing coordinate transformation and other mathematical services.

a collection of StelModule instances which display the main elements of the program such as planets and stars. Each StelModule should be registered to the StelModuleMgr. Because many Stellarium components derive from the StelModule class, the main loop is able to treat them generically by calling their standard methods such StelModule::update() and StelModule::draw() at each program iteration. This also allows other program components to access them by name. StelModule can also be loaded dynamically by Stellarium, which is the standard way of creating Plugins.

the Graphical User Interface (StelGui). It is based on styled Qt widgets which are rendered directly in the graphics window. User actions trigger signals connected to core and StelModules slots.