Skip to content

Commit

Permalink
mavproxy_map: allow 'map icon' to take from current click location
Browse files Browse the repository at this point in the history
so:

"map icon" to drop a flag at the current click location
"map icon barrell.png" to drop a barrell at the current click location
  • Loading branch information
peterbarker authored and tridge committed Sep 28, 2023
1 parent 10983b8 commit 4a0fe54
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions MAVProxy/modules/mavproxy_map/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,31 @@ def cmd_map(self, args):
if len(args) < 1:
print("usage: map <icon|set>")
elif args[0] == "icon":
if len(args) < 3:
print("Usage: map icon <lat> <lon> <icon>")
else:
usage = "Usage: map icon <lat> <lon> <icon>"
flag = 'flag.png'
if len(args) > 2:
lat = args[1]
lon = args[2]
flag = 'flag.png'
if len(args) > 3:
flag = args[3] + '.png'
icon = self.map.icon(flag)
self.map.add_object(mp_slipmap.SlipIcon('icon - %s [%u]' % (str(flag),self.icon_counter),
(float(lat),float(lon)),
icon, layer=3, rotation=0, follow=False))
self.icon_counter += 1
elif self.mpstate.click_location is not None:
if len(args) >= 1:
# i.e. "map icon"
(lat, lon) = self.mpstate.click_location
if len(args) == 2:
# i.e. map icon barrell
flag = args[1]
else:
print(usage)
return

icon = self.map.icon(flag)
self.map.add_object(mp_slipmap.SlipIcon(
'icon - %s [%u]' % (str(flag),self.icon_counter),
(float(lat),float(lon)),
icon, layer=3, rotation=0, follow=False))
self.icon_counter += 1

elif args[0] == "vehicletype":
if len(args) < 3:
print("Usage: map vehicletype SYSID TYPE")
Expand Down

0 comments on commit 4a0fe54

Please sign in to comment.