Stellarium Developer guide
v 0.2

Fabien Chéreau

Abstract:

This document is aimed at giving a global vision on the organization of the program source code.

Introduction

Stellarium is almost totally designed in an object oriented way. Its source code is thus quite easy to understand and is well subdivided. The interface with the OS is done using the SDL library which has proven to be powerfull, truly multiplateform and fast. Project managment is done using sourceforge.net services for cvs hosting, bug tracking, forums etc.. Globally, everything usefull for the project is available at the main project page http://sourceforge.net/projects/stellarium/.

I want to contribute in developing stellarium. How to start?

First of all, as stellarium is mainly programmed in C++ you will need some knowledge in object oriented programming. You will then need to use the GNU development tools and utilities that are required for working on free projects.

Stellarium source code is stored on sourceforge.net server using cvs (concurent version system). This enable everybody to download the last changes in the sources. The cvs version of stellarium is usually on development and might not work at all.

Here are the first steps to start working on the sourcecode : (see detailed instructions from sourceforge cvs page) In the stellarium cvs repository, there is only one module called "stellarium" containing all the project files. So, to get the files as anonymous developer, just type (as explained) :

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/stellarium login

and type enter when a password is required.

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/stellarium co stellarium

(co = checkout) And normally all the project files should be downloaded in a new stellarium/ directory. In this directory you will find the script autogen.sh that you need to execute in order to run the automake/autoconf things. After that you can launch the ./configure script which will analyze your system. If everything goes fine, the command make should then compile all the sourcecode.

You can now try to launch the local version by typing ./src/stellarium

Here you are!

You can now have a look at the src/ directory where you will find the source files described below. Edit whatever you want in it and when your new great feature is done you will need to share it with the community of stellarium developers.

At this point, an official developer just have to type cvs commit to update the repository version. But as you are not an official developer (yet!) you will need to create a patch file which will contain all the changes you did on the source code.

cd directory-you-want-to-diff

cvs -z3 diff -u > mypatch.diff

You can now submit mypatch.diff on the sourceforge stellarium page in the patches section with a clear comment on what is the patch doing.

The project administrator will then have a look at it and decide whether the patch is accepted or rejected for integration into stellarium.

Main files description

All the files starting with a s_ are "theoricaly" independent of the main program. They manage textures, font and user interface and could be re-used for any other openGL application.

stel_sdl.h/cpp :
Class handling sdl functions. It contains the main loop intercepting all the system events and send them to the core.
stel_core.h/cpp :
Main stellarium class. It manages all the main components of the program and stores all the attributes of the program. The 3 main functions of the program are methods of his class. They are :
init() :
Initialize the core of the program : creates all the main objects and initialize them.
update() :
Update all the objects : time, viewing, planet positions, moves, user interface etc..
draw() :
Draw everything on the openGL buffer.
update() and draw() are called in the main loop at each iteration. The stel_core class manages all the configuration file reading and saving.

navigator.h/cpp :
Manage all the astronomical navigational functions. Used for frames conversions.

observator.h/cpp :
Manage all the information relative to an observator (position, locales etc..)

projector.h/cpp and fisheye_projector.h/cpp :
One of the class i'm proud of :). Manage various kind of projections : perspective, fisheye.

init_parser.h/cpp :
Wrapper c++ class for the c library initparser.

stel_object.h/cpp :
Abstract mother class for all astronomical objects stars, planets and nebula.

hip_star.h/cpp and hip_star_mgr.h/cpp :
Manage stars from the hipparcos catalog and stars collections respectively.

grid.h/cpp :
Used for optimization with grid structure while displaying the hipparcos star catalog.

planet.h/cpp and solarsystem.h/cpp :
Manage any body which has a defined position inside the solar system.

nebula.h/cpp and nebula_mgr.h/cpp :
Manage nebula and nebula collection repectively.

constellation.h/cpp and constellation_mgr.h/cpp :
Manage constellations and collection of constellations respectively.

landscape.h/cpp :
Manage landscapes.

stel_atmosphere.h/cpp :
Manage atmosphere rendering. Uses the classes sky_bright and sky_light to compute sky color and brightness and display it.

tone_reproductor.h/cpp :
The class which simulate the eye adaptation to luminance.

draw.h/cpp :
Groups some classes used to draw various objects of the program : milky way, grids, astronomical lines, cardinal points.

stel_ui.h/cpp :
manage the user interface for stellarium using s_gui/s_tui widgets.

s_gui.h/cpp :
All the Graphical User Interface (gui) classes. Used in the desktop version only.

s_tui.h/cpp :
All the Text User Interface (tui) classes. Used in planetarium version only.

s_font.h/cpp :
Manage fonts. The font in stellarium are not bitmap but taken from a real grey level texture.

s_texture.h/cpp :
Class which manages textures. Currently uses glpng library to handle png files.

callback.h/cpp :
Handfull class made by the boost library team used to handle callbacks. It's used for the widgets.

External libraries (directories in src/)

glpng :
create openGL textures from .png files. Written in C and used thru the s_texture class.
iniparser :
config files parsing. Used thru the wrapper class init_parser.
stellastro :
miscelaneous astronomical functions.
stellplanet :
compute heliocentric positions of solar system planets.

Stellarium data files format specification

About this document ...

Stellarium Developer guide
v 0.2

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -nonavigation developer_guide.tex

The translation was initiated by fabien on 2003-12-19


fabien 2003-12-19