Skip to content

Commit

Permalink
mavpicviewer: display POI on mosaic
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Sep 9, 2024
1 parent 2d6dfdb commit 918e233
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 10 additions & 5 deletions MAVProxy/tools/mavpicviewer/mosaic_window2.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ def __init__(self, filelist, image_select_cb):
#self.frame.Bind(wx.EVT_MENU, self.menu_set_api_key_show, id=1)

# add settings input window
self.settings_frame = wx.Frame(None, title="Input Settings", size=(560, 50))
self.settings_text_input = wx.TextCtrl(self.settings_frame, id=-1, pos=(10, 10), size=(450, -1),
style=wx.TE_PROCESS_ENTER, value="hello")
self.settings_set_button = wx.Button(self.settings_frame, id=-1, label="Set", pos=(470, 10), size=(75, 25))
#self.settings_frame = wx.Frame(None, title="Input Settings", size=(560, 50))
#self.settings_text_input = wx.TextCtrl(self.settings_frame, id=-1, pos=(10, 10), size=(450, -1),
# style=wx.TE_PROCESS_ENTER, value="hello")
#self.settings_set_button = wx.Button(self.settings_frame, id=-1, label="Set", pos=(470, 10), size=(75, 25))
#self.settings_frame.Bind(wx.EVT_BUTTON, self.settings_set_button_click, self.settings_set_button)
#self.settings_frame.Bind(wx.EVT_TEXT_ENTER, self.settings_set_button_click, self.settings_text_input)
#self.settings_frame.Bind(wx.EVT_CLOSE, self.apikey_close_button_click)

# add a read-only status text box
self.text_status = wx.TextCtrl(self.frame, id=-1, size=(600, 60), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH)
self.text_status.value = "POI lat: 0.0 lon: 0.0"
self.text_status.SetValue("POI lat: 0.0 lon: 0.0")

# add a scrolled panel
self.scrolled_panel = scrolled.ScrolledPanel(self.frame, -1, size=(600, 600), style=wx.TAB_TRAVERSAL)
Expand Down Expand Up @@ -133,6 +133,11 @@ def update_title(self):
title_str = f"PicViewer Mosaic ({self.filenumber+1} of {len(self.filelist)})"
self.set_title(title_str)

# set status text
def set_status_text(self, status_text):
"""set status text"""
self.text_status.SetValue(status_text)

# process window events
def on_image_click(self, event):
"""process image click event"""
Expand Down
6 changes: 5 additions & 1 deletion MAVProxy/tools/mavpicviewer/picviewer_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from MAVProxy.modules.lib import mp_elevation

if mp_util.has_wxpython:
from MAVProxy.modules.lib.wx_loader import wx
from MAVProxy.modules.lib.mp_menu import MPMenuTop
from MAVProxy.modules.lib.mp_menu import MPMenuItem
from MAVProxy.modules.lib.mp_menu import MPMenuSubMenu
Expand Down Expand Up @@ -211,7 +212,10 @@ def poi_capture_done(self, X, Y):
lat_avg = (lat1 + lat2) / 2.0
lon_avg = (lon1 + lon2) / 2.0
alt_avg = (alt1 + alt2) / 2.0
print("POI capture lat:%f lon:%f alt:%f" % (lat_avg, lon_avg, alt_avg))
filename = os.path.basename(self.filelist[self.filenumber])
poi_str = "POI image:%d %s lat:%.7f lon:%.7f alt:%.2f" % (self.filenumber+1, filename, lat_avg, lon_avg, alt_avg)
print(poi_str)
wx.CallAfter(self.mosaic.set_status_text, poi_str)
self.poi_start_pos = None
# update image
self.update_image()
Expand Down

0 comments on commit 918e233

Please sign in to comment.