Marble has got something called “Tours”. It can be used to take a virtual tour of the world by visiting different places according to a defined playlist. These tours, when they are played from the playlist that is contained in the kml file containing the tour, they follow an order shown as given below. That is, there are basically two types of items that are being played here, just like a “track” is played:
- Serial Tracks: These consist of the FlyTo items, the TourControl Items, and the Wait items. These play serially one after the other according to the order in which they are present in the playlist, and run for its respective duration. No two of items can run parallely.
- Parallel Tracks: These consist of the SoundCue items, and the AnimatedUpdate items. That is, as you can see below, these items can run parallely, which means, if a sound cue starts at some point, it can keep playing in the background at the same time when the camera hovers on to some location’s coordinates there in the map. In fact, more than one parallel tracks can also play at the same time.
So, we needed to refactor our existing code keeping in mind the above design of kml as our goal, so that any type of kml files could be played without any type exceptions. So, I created two new classes, SerialTrack, and ParallelTrack, and further created separate classes for each of the 5 types of items I mentioned above. And then, handled these accordingly in the *Track classes. So, the code looks much cleaner, and clearer (easier to understand) now.
As far as the user-interface is concerned, we made some changes in that as well. So, apart from the previously existing Tour Widget showing the details of the items in the playlist, with an Edit button against each, and a Play, a Pause and a Stop button below it, we added to it a horizontal progress bar as well, so that the user is able to understand how much of the tour has finished and how much remaining. Also, the Play and Pause buttons, instead of making them separate buttons, we fused them into one togglable button that will act as both Play and Pause. Not to mention, the progress bar has also been made seekable, so that, now you can actually drag the slider as desired, and be able to enjoy it from any point of the tour as you want. Here is how the slider looks like now, with the togglable Play/Pause button:
Also, in the tour playback, previously when the map’s focus shifted from one coordinate to another coordinate in the map (when proceeding from one FlyTo item to another in the playlist), the camera didn’t actually move along the path joining those two points. So this also had to be implemented. Also, not only should the camera just move, it should move in a way that is not a straight line, so that turnings are smooth. That is, there should not be any pointy edges in the virtual path that the camera should take. So, thanks to my mentor Dennis, with whose help we could be able to implement squad interpolation for smooth playback of tours in Marble, by using some sort of Spline interpolation of three or more points. You are free to go through my code here in case you want 🙂
I have embedded a very short video below, of how it looks like when the tour is played now. I just added a few cities in its playlist and tried to take them from as much around the globe as possible. There are 10 cities in it, each with a duration of 5 seconds, and a Wait element each of one second in between each of those ten FlyTo’s (to keep the tour uniform and unbiased):
(my embedded video is not showing up in Planet KDE, so if you’re reading this post from there, then please open this post separately instead, by clicking on its title, in order to be able to watch the embedded video (which is the main thing in this post really). Thank you!)
Thanks to Dennis Nienhüser, my mentor, without whose help, none of this would have been possible! Thanks again! 🙂