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

fix: LinearView and SideView plot to display operation name #2592

Merged
merged 6 commits into from
Jan 13, 2025
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
10 changes: 4 additions & 6 deletions mslib/msui/mpl_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def __init__(self, identifier=None, CRS=None, BBOX_UNITS=None, OPERATION_NAME=No
# Print project name and CRS identifier into figure.
if not hasattr(self, "_info_text"):
self._info_text = self.ax.figure.text(0, 0, "")
self._infos = [None] * 4
self.update_info_text(name=self.operation_name, crs=self.crs)
self._infos = [None] * 3
self.update_info_text(crs=self.crs)

if self.appearance["draw_graticule"]:
pass
Expand All @@ -170,15 +170,13 @@ def __init__(self, identifier=None, CRS=None, BBOX_UNITS=None, OPERATION_NAME=No
self.airspaces = None
self.airspacetext = None

def update_info_text(self, openaip=None, ourairports=None, name=None, crs=None):
def update_info_text(self, openaip=None, ourairports=None, crs=None):
if openaip is not None:
self._infos[0] = openaip
if ourairports is not None:
self._infos[1] = ourairports
if name is not None:
self._infos[2] = name
if crs is not None:
self._infos[3] = crs
self._infos[2] = crs
self._info_text.set_text(
"\n".join([_i for _i in self._infos if _i])) # both None and ""

Expand Down
3 changes: 3 additions & 0 deletions mslib/msui/mpl_qtwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def __init__(self, fig=None, ax=None, settings_tag=None, settings=None):

def draw_metadata(self, title="", init_time=None, valid_time=None,
level=None, style=None):

if style:
title += f" ({style})"
if level:
Expand Down Expand Up @@ -733,7 +734,9 @@ def draw_legend(self, img):
raise NotImplementedError

def draw_image(self, xmls, colors=None, scales=None):
title = self.fig._suptitle.get_text()
self.clear_figure()
self.fig.suptitle(title, x=0.95, ha='right')
offset = 40
self.ax.patch.set_visible(False)

Expand Down
7 changes: 5 additions & 2 deletions mslib/msui/viewwindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,13 @@ def setFlightTrackModel(self, model):

# Update Top View flighttrack name
if hasattr(self.mpl.canvas, "map"):
self.mpl.canvas.map.operation_name = model.name
self.mpl.canvas.map.update_info_text(name=model.name)
self.mpl.canvas.map.ax.figure.suptitle(f"{model.name}", x=0.95, ha='right')
self.mpl.canvas.map.ax.figure.canvas.draw()

elif hasattr(self.mpl.canvas, 'plotter'):
self.mpl.canvas.plotter.fig.suptitle(f"{model.name}", x=0.95, ha='right')
self.mpl.canvas.plotter.fig.canvas.draw()

def getView(self):
"""
Return the MplCanvas instance of the window.
Expand Down
Loading