Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using the plugin Timemanager which works really great but there is one thing I'd like to improve.

Instead of displaying the date and time on each frame, I would like to display a timeline stretching from *date_start* to *date_end* which shows the current frame time within this timespan.

I understand this possibility is not (yet?) offered by the plugin and therefore I am looking for an amazing idea on how to implement this. A core Qgis functionality that could be a workaround? An already existing plugin that I have missed? A small python script?

Obviously, in order for this to work nicely with the timemanager plugin, this timeline should be displayed in the map canvas, not in the composer.

A solution for Qgis 2.0 would be nice but I could also live with something for 1.8.

If someone has an idea or (even better) has already implemented something similar, please raise your hand!

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted
+50

I'm not aware of an already existing solution. But if you want to get started on your own, you can add your own graphics items onto the map canvas.

Normally, such things would derive from QgsMapCanvasItem but in your case, as you probably don't want to place your item in map coordinates, but rather in screen coordinates, you should derive it from QGraphicsItem and assign that item to the mapCanvas.scene().

The following script should get you started. Just expand the paint method to your needs.

from PyQt4.QtGui import QGraphicsItem
from PyQt4.QtCore import QRectF

class TimelineItem( QGraphicsItem ):
    def __init__( self ):
        QGraphicsItem.__init__( self, None, iface.mapCanvas().scene() )

    def boundingRect( self ):
        penWidth = 1
        return QRectF( 10 - penWidth / 2, 10 - penWidth / 2, 200 + penWidth, 20 + penWidth )

    def paint( self, painter, option, widget ):
        painter.drawRoundedRect( 10, 10, 200, 20, 5, 5)

timelineItem = TimelineItem()

To get access to the timemanager information you can use code like this:

import TimeManager
ctrl = TimeManager.timemanager.control

ctrl.timeLayerManager.timeRestrictionsRefreshed( yourhandlermethodhere )
ctrl.timeLayerManager.getProjectTimeExtents()
share|improve this answer
    
This looks like a good direction, thanks! –  Stéphane Henriod Aug 28 '13 at 8:51
    
If you have something useful, it would be much appreciated if you can share your results. Maybe it will even be included upstream. –  Matthias Kuhn Aug 28 '13 at 9:53
    
I don't promise anything on the short-term but if I manage to ge something working I'll definitely share. Thanks again –  Stéphane Henriod Aug 28 '13 at 13:26
add comment

Just a strategy,

QGIS supports graphs which can be attached to objects. Could you display your timeline in a pie graph for example. The pie graph could be associated with a point and could be based on an attribute table which supplies the data. A function could be written to update the attributes in the table and to regenerate the pie graph. Alternatively, a pie graph could be generated for one selected record in your data table and as the selected record changes, the pie graph updates.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.