コード例 #1
0
ファイル: paint_engine.py プロジェクト: mlabru/visil
    def drawApproach(self, fo_widget, f_anv, f_name):
        """
        DOCUMENT ME!
        """
        # check input
        assert fo_widget

        lf_blip_size = fo_widget.viewport.f_blip_size

        rwy = fo_widget.airspace.runway(f_name)
        l_pos = fo_widget.viewport.translate_pos(rwy.pos)

        lf_x = l_pos.f_x
        lf_y = l_pos.f_y

        l_track = tMath.trackOpposite(rwy.getTrack())
        l_track = 10.

        x1 = int(lf_x + fo_widget.viewport.pPNM() * tMath.dsin(l_track) * 10)
        y1 = int(lf_y - fo_widget.viewport.pPNM() * tMath.dcos(l_track) * 10)

        x2 = int(lf_x +
                 fo_widget.viewport.pPNM() * tMath.dsin(l_track + 4) * 11)
        y2 = int(lf_y -
                 fo_widget.viewport.pPNM() * tMath.dcos(l_track + 4) * 11)

        x3 = int(lf_x +
                 fo_widget.viewport.pPNM() * tMath.dsin(l_track - 4) * 11)
        y3 = int(lf_y -
                 fo_widget.viewport.pPNM() * tMath.dcos(l_track - 4) * 11)

        lo_painter = QtGui.QPainter(fo_widget)
        assert lo_painter is not None

        lo_painter.setPen(gdata.G_DCT_COLORS["instruction"])

        lo_painter.drawLine(x, y, x1, y1)
        lo_painter.drawLine(x, y, x2, y2)
        lo_painter.drawLine(x, y, x3, y3)

        lo_painter.drawLine(x1, y1, x2, y2)
        lo_painter.drawLine(x1, y1, x3, y3)

        l_pos = fo_widget.viewport.translate_pos(f_anv.radarPosition())

        str = "APP-%s" % f_name

        lo_painter.setFont(QtGui.QFont("Arial", int(lf_blip_size * 1.5)))
        lo_painter.drawText(int(l_pos.f_x + lf_blip_size),
                            int(l_pos.f_y + lf_blip_size * 2), str)

        del lo_painter
コード例 #2
0
ファイル: paint_engine.py プロジェクト: mlabru/visil
    def drawRunway(self, fo_widget, f_rwy):
        """
        DOCUMENT ME!
        """
        # check input
        assert fo_widget

        # obtém a posição da runway
        l_pos = fo_widget.viewport.translate_pos(f_rwy.pos)

        # componentes X e Y
        lf_x = l_pos.f_x
        lf_y = l_pos.f_y

        # obtém a direção da runway
        l_track = tMath.trackOpposite(f_rwy.fTrack)

        x_mile = fo_widget.viewport.pPNM() * tMath.dsin(l_track)
        y_mile = -fo_widget.viewport.pPNM() * tMath.dcos(l_track)

        # cria um painter
        lo_painter = QtGui.QPainter(fo_widget)
        assert lo_painter is not None

        # seleciona a caneta
        lo_painter.setPen(gdata.G_DCT_COLORS["runway"])

        for li_ndx in range(1, 25, 2):
            lo_painter.drawLine(int(lf_x + li_ndx * x_mile),
                                int(lf_y + li_ndx * y_mile),
                                int(lf_x + (li_ndx + 1) * x_mile),
                                int(lf_y + (li_ndx + 1) * y_mile))

        lo_painter.drawLine(int(lf_x + 10 * x_mile - y_mile / 2.),
                            int(lf_y + 10 * y_mile + x_mile / 2.),
                            int(lf_x + 10 * x_mile + y_mile / 2.),
                            int(lf_y + 10 * y_mile - x_mile / 2.))
        lo_painter.drawLine(int(lf_x + 25 * x_mile - y_mile / 2.),
                            int(lf_y + 25 * y_mile + x_mile / 2.),
                            int(lf_x + 25 * x_mile + y_mile / 2.),
                            int(lf_y + 25 * y_mile - x_mile / 2.))

        # libera o painter
        del lo_painter