"""

NAVTEX
 - Meldungen anzeigen

"""

import cairo
from .page import Page

class Tide(Page):

    def __init__(self, pageno, cfg, appdata, boatdata):
        super().__init__(pageno, cfg, appdata, boatdata)

        self.station = "f3c6ee73-5561-4068-96ec-364016e7d9ef" # Schulau

    def draw(self, ctx):
        # Title
        ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
        ctx.set_font_size(24)
        ctx.move_to(8, 40)
        ctx.show_text("Tide prediction")

        ctx.set_font_size(16)
        ctx.set_line_width(2)

        x0 = 40 # links unten
        y0 = 250
        x1 = 380 # rechts oben
        y1 = 60

        # X-Achse
        ctx.move_to(x0 + 0.5, y0 + 0.5)
        ctx.line_to(x0 + 0.5, y1 + 0.5)
        # self.draw_text_center(ctx, x0 - 20, y0 + (y1 -y0) / 2, "Höhe, cm", rotate=True)
        self.draw_text_center(ctx, 60, 150, "Höhe, cm", rotate=True)
        #self.draw_text_center(ctx, 100, 100, "Höhe, cm", rotate=False)
        #ctx.move_to(90, 90) # Rotationsursprung
        #ctx.line_to(110, 110)
        #ctx.move_to(90, 110)
        #ctx.line_to(110, 90)
        #ctx.stroke()

        # Y-Achse
        ctx.move_to(x0 + 0.5, y0 + 0.5)
        ctx.line_to(x1 + 0.5, y0 + 0.5)
        self.draw_text_center(ctx, x0 + (x1 - x0) / 2, y0 + 12, "Zeit, h")
        ctx.stroke()

