This week I made the first commit to KStars Lite branch (gsoc2016-kstarslite). This commit includes everything that I made during my first week of coding:
- My mentor and I agreed that code for KStars Lite will be included to the main branch using #ifdef KSTARS_LITE macro condition. Though this solution is not beautiful the amount of code duplication is significantly reduced this way. However, some of the functionality still needs separate classes so I created KStarsLite(KStars), SkyMapLite(SkyMap) and a bunch of new classes for handling planets. The only modification to KStarsData was to add parameter name in signal void progressText ( const QString& text ); because in QML you can't handle unnamed signal parameter.
- KStarsLite - It initializes SkyMapLite and KStarsData. Apart from the code for SkyMapLite instantiation most was copied from KStars because of the same functionality.
- SkyMapLite - The pan and zoom functions were copied from SkyMap. Added functionality for displaying and updating SolarSystemSingleComponent on SkyMapLite. Moved cache for star images from SkyQPainter to this class. Currently, only LambertProjector is available because I wait for an answer from KStars community whether I can move Projection enum from SkyMap to Projector class so I can use it in SkyMapLite without including skymap.h
- Added support for displaying planets on SkyMapLite. Like in SkyMap, the planets can be drawn either as stars (using cached star images) or as planet images. Apart from storing star images in the cache, we can cache QSGTexture objects that are created from images. So with my initial approach where each planet has its own QQuickItem derived object I wouldn't be able to use cached QSGTextures for all planets. Finally I ended up with the following:
- PlanetNode that holds an image of star and image of planet
- PlanetItemNode that stores all PlanetNodes, creates QSGTexture objects from cached star images and caches it upon its creation.
- PlanetItem - QQuickItem derived class that holds pointers to SolarSystemSingleComponent objects, displays all nodes and is a visual child of SkyMapLite.
- Every SolarSystemSingleComponent upon its creation calls SkyMapLite::addPlanetItem(SolarSystemSingleComponent* ) to add PlanetNode in PlanetItemNode. Based on zoom level PlanetNode hides and shows picture of planet or star image. It turns out that this approach won't be so complicated as I thought about it. To make some things clear to me I asked a few questions on Qt Interest mailing list.
- Moved Splash screen to QML. Splash screen might be later replaced by full screen version that is more suitable to different screen sizes of mobile devices.
Only planets are currently displayed. (Click to zoom) |
Next thing to do
Right now I struggle to make Options class available for use from QML because for some reason I get an error while compiling config files with support for QML so I wrote an e-mail to one of the developers of KConfig compiler asking how can I solve this problem.
In the upcoming week, I plan to implement clipping polygons for all projection systems, make it possible to display planets as ellipses, introduce asteroids and comets to SkyMapLite and setup CMake project for compilation for Android. Asteroids and comets will bring interesting results as QtQuick version of KStars will show its performance on displaying a lot of objects (not that many as there are stars but still something to measure:) ).
No comments:
Post a Comment