def paintDisplayBackground(self): with self.static_background: #Air (left) Color(.5, 1, 0, mode='rgb') Line(rectangle=(GRAPH_OFFSET_LEFT_RIGHT, GRAPH_OFFSET_TOP_BOTTOM, GRAPH_WIDTH, GRAPH_MAX_HEIGHT)) #Static Air Label self.static_air_label.refresh() texture = self.static_air_label.texture texture_size = list(texture.size) Rectangle(pos=(BAR_TEXT_OFFSET - 10, GRAPH_OFFSET_TOP_BOTTOM - 20), texture=texture, size=texture_size) #Scope (center) Line(circle=(HUD_WIDTH / 2, HUD_HEIGHT / 2, HUD_HEIGHT / 2)) Line(circle=(HUD_WIDTH / 2, HUD_HEIGHT / 2, (HUD_HEIGHT / 2) - (HUD_HEIGHT / 6))) Line(circle=(HUD_WIDTH / 2, HUD_HEIGHT / 2, (HUD_HEIGHT / 2) - (HUD_HEIGHT / 3))) #Center static icon center_pos = Point2D(HUD_CENTER_X, HUD_CENTER_Y) staticSelfIcon = UserIcon("Self", False, 0, center_pos, 0) staticSelfIcon.drawUserIcon(0, self.static_background, False) #Paint (right) Line(rectangle=(HUD_WIDTH - GRAPH_OFFSET_LEFT_RIGHT - GRAPH_WIDTH, GRAPH_OFFSET_TOP_BOTTOM, GRAPH_WIDTH, GRAPH_MAX_HEIGHT)) #Static Paint Label self.static_paint_label.refresh() texture = self.static_paint_label.texture texture_size = list(texture.size) Rectangle(pos=(HUD_WIDTH - BAR_TEXT_OFFSET - GRAPH_WIDTH, GRAPH_OFFSET_TOP_BOTTOM - 20), texture=texture, size=texture_size)
def _paintDisplayBackground(self): new_display_image = self.display_image draw = ImageDraw.Draw(new_display_image) #Air (left) draw.rectangle([(GRAPH_OFFSET_LEFT_RIGHT, GRAPH_OFFSET_TOP_BOTTOM), (GRAPH_OFFSET_LEFT_RIGHT + GRAPH_WIDTH, GRAPH_OFFSET_TOP_BOTTOM + GRAPH_MAX_HEIGHT)], fill=None, outline=LIME_GREEN) #Scope (center) draw.ellipse([RING_INITIAL_OFFSET, 0, RING_INITIAL_OFFSET + SCOPE_WIDTH, HUD_HEIGHT], outline=LIME_GREEN) draw.ellipse([RING_INITIAL_OFFSET + RING_SUBSEQUENT_OFFSET, RING_SUBSEQUENT_OFFSET, RING_INITIAL_OFFSET + SCOPE_WIDTH - RING_SUBSEQUENT_OFFSET, HUD_HEIGHT - RING_SUBSEQUENT_OFFSET], outline=LIME_GREEN) draw.ellipse([RING_INITIAL_OFFSET + RING_SUBSEQUENT_OFFSET*2, RING_SUBSEQUENT_OFFSET*2, RING_INITIAL_OFFSET + SCOPE_WIDTH - RING_SUBSEQUENT_OFFSET*2, HUD_HEIGHT - RING_SUBSEQUENT_OFFSET*2], outline=LIME_GREEN) draw.ellipse([RING_INITIAL_OFFSET + RING_SUBSEQUENT_OFFSET*3, RING_SUBSEQUENT_OFFSET*3, RING_INITIAL_OFFSET + SCOPE_WIDTH - RING_SUBSEQUENT_OFFSET*3, HUD_HEIGHT - RING_SUBSEQUENT_OFFSET*3], outline=LIME_GREEN) center_pos = Point2D(HUD_CENTER_X, HUD_CENTER_Y) staticSelfIcon = UserIcon("Self", False, 0, center_pos, 0) staticSelfIcon.drawUserIcon(self.camera.rotation, draw, 1) #Paint (right) draw.rectangle([(HUD_WIDTH - GRAPH_OFFSET_LEFT_RIGHT - GRAPH_WIDTH, GRAPH_OFFSET_TOP_BOTTOM), (HUD_WIDTH - GRAPH_OFFSET_LEFT_RIGHT, GRAPH_OFFSET_TOP_BOTTOM + GRAPH_MAX_HEIGHT)], fill=None, outline=LIME_GREEN) filename = "HUD_display.jpg" self.display_image.save(filename) self.display_image = new_display_image
def _paintOtherUsers(self, user_struct): name = user_struct["name"] lat = user_struct["posStruct"]["lat"] long = user_struct["posStruct"]["long"] heading = user_struct["posStruct"]["heading"] #deg_compass_north user_coord = Point2D(lat, long) pixel_point = geodeticToPixel(user_coord, self.camera) userIcon = UserIcon(name, False, 0, pixel_point, heading) userIcon.drawUserIcon(self.camera.rotation, self.static_background, 0)
def _paintUsers(self, users, image): draw = ImageDraw.Draw(image) for user in users: # print user # print users[user][0] # print users[user][1] # print '' user_coord = Point2D(users[user][0], users[user][1]) pixel_point = geodeticToPixel(user_coord, self.camera) #print pixel_point userIcon = UserIcon(str(user), False, 0, pixel_point, users[user][2]) userIcon.drawUserIcon(self.camera.rotation, draw, 0)