示例#1
0
 def draw_event(self, event):
     coords = event.coords
     stddraw.setPenRadius(0.0055)
     stddraw.setPenColor(c=stddraw.RED)
     stddraw.point(coords[0], coords[1])
     stddraw.setPenColor()
     self.__reset_pen()
示例#2
0
    def __draw_next_target(self, drone_coo, target):
        stddraw.setPenRadius(0.0055)
        stddraw.setPenColor(c=stddraw.BLUE)
        stddraw.point(target[0], target[1])
        stddraw.setPenColor()
        self.__reset_pen()

        stddraw.setPenColor(c=stddraw.BLUE)
        stddraw.setPenRadius(0.0025)
        stddraw.line(drone_coo[0], drone_coo[1], target[0], target[1])
        self.__reset_pen()
示例#3
0
    def draw_depot(self, depot):
        coords = depot.coords
        stddraw.setPenRadius(0.0100)
        stddraw.setPenColor(c=stddraw.BLUE)
        stddraw.point(coords[0], coords[1])
        self.__draw_communication_range(depot)
        self.__reset_pen()

        # draw the buffer size
        stddraw.setPenRadius(0.0125)
        stddraw.setPenColor(c=stddraw.BLACK)
        stddraw.text(depot.coords[0], depot.coords[1] + 100,
                     "pk: " + str(len(depot.buffer)))
示例#4
0
    def draw_drone(self, drone, cur_step):
        coords = drone.coords
        if drone.buffer_length() > 0:  # change color when find a packet
            stddraw.setPenColor(c=stddraw.GREEN)
        else:
            stddraw.setPenColor(c=stddraw.BLACK)
        stddraw.setPenRadius(0.0055)
        stddraw.point(coords[0], coords[1])

        self.__draw_drone_info(drone, cur_step)
        self.__draw_communication_range(drone)
        self.__draw_sensing_range(drone)
        self.__reset_pen()

        if config.IS_SHOW_NEXT_TARGET_VEC:
            self.__draw_next_target(drone.coords, drone.next_target())
示例#5
0
    def draw_drone(self, drone, cur_step):
        coords = drone.coords
        if drone.buffer_length() > 0:  # change color when find a packet
            stddraw.setPenColor(c=stddraw.GREEN)
        else:
            stddraw.setPenColor(c=stddraw.BLACK)
        stddraw.setPenRadius(0.0055)
        stddraw.point(coords[0], coords[1])

        self.__draw_drone_info(drone, cur_step)
        self.__draw_communication_range(drone)
        self.__draw_sensing_range(drone)

        # the radar distance
        self.__draw_distance_radar(coords[0], coords[1], drone.radar_range)

        self.__reset_pen()

        if config.PLOT_TRAJECTORY_NEXT_TARGET and not self.simulator.is_free_movement(
        ):
            self.__draw_next_target(drone.coords, drone.next_target())