;+
;PROJECT:
;               SolarB EIS
;
;NAME:
;               EIS_READ_TIMELINE_DATABASE_TABLES
;
;PURPOSE:
;               Function to read timeline database tables
;CATEGORY:
;               EIS planning
;
;WRITTEN:
;               Chunkey Lepine, RAL, d.r.lepine@rl.ac.uk, 0044-1235-44-6515
;
;VERSION:
;               V0 September 2005
;               V1 May 2005 JAR
;-
;************************************************************************
PRO eis_read_timeline_database_tables, start_time , end_time , tlc , axes

axes_start_time = axes.x_axis_day_tai
duration        = axes.x_axis_length
axes_stop_time  = axes.x_axis_day_tai+(duration*3600)

; Read database
timeline = eis_get_timeline_entries(start_time, end_time, /ALL)



; OK, if there are no entries, then bail out
IF (N_TAGS(timeline) EQ 0) THEN RETURN

IF (N_ELEMENTS(timeline) EQ 0) THEN stop

FOR i = 0, N_ELEMENTS(timeline) - 1 DO BEGIN

    tl                = {eis_timeline_entry}
    tl.time_component = timeline[i]
    ;seq_id            = tl.time_component.sequence_id

    ; This is where we check studies
    IF (tl.time_component.start_time LE axes_stop_time)  AND                $
       (tl.time_component.end_time   GE axes_start_time) THEN BEGIN

        tl.time_component.visible = 1

    ENDIF

    IF (tl.time_component.entry_type NE 'D') THEN BEGIN

        ; Create a new "eis_structure_container" object
        temp = OBJ_NEW('eis_structure_container' , tl )
        tlc->add , temp

    ENDIF

ENDFOR


END
