コード例 #1
0
        # Takes the roll in degrees
        # Example input..
        # [
        #     [center_x, center_y - size],
        #     [center_x + size, center_y],
        #     [center_x, center_y + size],
        #     [center_x - size, center_y]
        # ]

        translated_points = []

        int_roll = int(-roll)
        cos_roll = COS_RADIANS_BY_DEGREES[int_roll]
        sin_roll = SIN_RADIANS_BY_DEGREES[int_roll]
        ox, oy = self.__center__

        for x_y in reticle:
            px, py = x_y

            qx = ox + cos_roll * (px - ox) - sin_roll * (py - oy)
            qy = oy + sin_roll * (px - ox) + cos_roll * (py - oy)

            translated_points.append([qx, qy])

        return translated_points


if __name__ == '__main__':
    import hud_elements
    hud_elements.run_adsb_hud_element(AdsbOnScreenReticles)
コード例 #2
0
            pygame.draw.polygon(framebuffer, bug_color, reticle)
        except:
            pass

    def render(self, framebuffer, orientation):
        # Render a heading strip along the top

        self.task_timer.start()
        heading = orientation.get_onscreen_projection_heading()

        # Get the traffic, and bail out of we have none
        traffic_reports = HudDataCache.get_reliable_traffic()

        if traffic_reports is None:
            self.task_timer.stop()
            return

        reports_to_show = filter(lambda x: math.fabs(x.altitude - orientation.alt) < max_altitude_delta, traffic_reports)
        reports_to_show = reports_to_show[:max_target_bugs]

        [self.__render_traffic_heading_bug__(
            traffic_report, heading, orientation, framebuffer) for traffic_report in reports_to_show]

        self.task_timer.stop()


if __name__ == '__main__':
    import hud_elements
    hud_elements.run_adsb_hud_element(AdsbTargetBugsOnly)
コード例 #3
0
        if traffic_reports is None:
            self.task_timer.stop()
            return

        # Render a list of traffic that we have positions
        # for, along with the tail number

        y_pos = self.__listing_text_start_y__
        x_pos = self.__listing_text_start_x__

        padded_traffic_reports = self.__get_padded_traffic_reports__(
            traffic_reports)

        if len(padded_traffic_reports) == 0:
            framebuffer.blit(HudDataCache.get_cached_text_texture("NO TRAFFIC", self.__font__)[0],
                             (x_pos, y_pos))

        for identifier, traffic_report in padded_traffic_reports:
            traffic_text_texture = HudDataCache.get_cached_text_texture(traffic_report,
                                                                        self.__font__)[0]

            framebuffer.blit(traffic_text_texture, (x_pos, y_pos))

            y_pos += self.__next_line_distance__
        self.task_timer.stop()


if __name__ == '__main__':
    import hud_elements
    hud_elements.run_adsb_hud_element(AdsbTrafficListing)
コード例 #4
0
                units.get_meters_from_feet(delta_altitude))
            time_until_drop = time_to_target - time_to_impact
            # target_altitude_for_drop = units.get_feet_from_meters(
            #     norden.get_altitude(time_to_target))
            bearing_to_target = norden.get_bearing(target_position,
                                                   orientation.position)
            # time_to_impact_from_ideal_current_altitude = norden.get_time_to_impact(
            #    target_altitude_for_drop)

            # Render using the Above us bug
            # target_bug_scale = 0.04
            # target_bug_scale = get_reticle_size(distance_miles)

            heading_bug_x = get_heading_bug_x(heading, bearing_to_target,
                                              self.__pixels_per_degree_x__)

            additional_info_text = self.__get_additional_target_text__(
                time_until_drop, delta_altitude,
                units.get_feet_from_miles(distance_miles))

            self.__render_info_card__(
                framebuffer,
                "{0:.1f}".format(utils.apply_declination(bearing_to_target)),
                additional_info_text, heading_bug_x, False)
        self.task_timer.stop()


if __name__ == '__main__':
    import hud_elements
    hud_elements.run_adsb_hud_element(HeadingTargetBugs)