Skip to content

Commit

Permalink
map: added font size map setting
Browse files Browse the repository at this point in the history
use: map set font_size 1

default size is 0.5
  • Loading branch information
tridge committed Nov 17, 2023
1 parent b8b8472 commit e7f95c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit e7f95c5

Please sign in to comment.