Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map: added font size map setting #1274

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions MAVProxy/modules/mavproxy_map/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def __init__(self, mpstate):
('showclicktime',int, 2),
('showwpnum',bool, True),
('showdirection', bool, False),
('setpos_accuracy', float, 50)])
('setpos_accuracy', float, 50),
('font_size', float, 0.5) ])

service='MicrosoftHyb'
if 'MAP_SERVICE' in os.environ:
Expand Down Expand Up @@ -287,6 +288,7 @@ def display_waypoints(self):
self.map.add_object(mp_slipmap.SlipClearLayer('LoiterCircles'))
if not self.map_settings.showwpnum:
return
font_size = self.map_settings.font_size
for i in range(len(self.mission_list)):
next_list = self.mission_list[i]
for j in range(len(next_list)):
Expand All @@ -295,7 +297,7 @@ def display_waypoints(self):
label = self.label_for_waypoint(next_list[j])
colour = self.colour_for_wp(next_list[j])
self.map.add_object(mp_slipmap.SlipLabel(
'miss_cmd %u/%u' % (i,j), polygons[i][j], label, 'Mission', colour=colour))
'miss_cmd %u/%u' % (i,j), polygons[i][j], label, 'Mission', colour=colour, size=font_size))

if (self.map_settings.loitercircle and
self.module('wp').wploader.wp_is_loiter(next_list[j])):
Expand Down
5 changes: 3 additions & 2 deletions MAVProxy/modules/mavproxy_map/mp_slipmap_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ def set_time_range(self, trange):

class SlipLabel(SlipObject):
'''a text label to display on the map'''
def __init__(self, key, point, label, layer, colour):
def __init__(self, key, point, label, layer, colour, size=0.5):
SlipObject.__init__(self, key, layer)
self.point = point
self.colour = colour
self.label = label
self.size = size

def draw_label(self, img, pixmapper):
pix1 = pixmapper(self.point)
cv2.putText(img, self.label, pix1, cv2.FONT_HERSHEY_SIMPLEX, 0.5, self.colour)
cv2.putText(img, self.label, pix1, cv2.FONT_HERSHEY_SIMPLEX, self.size, self.colour)

def draw(self, img, pixmapper, bounds):
if self.hidden:
Expand Down