From 8e6c4d06ce13d4bcfe75eddffbe12a29a52ab2b9 Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Fri, 23 Jun 2017 15:40:13 +0200 Subject: [PATCH] [add] array_map now plotting event location if given --- QtPyLoT.py | 6 ++++++ pylot/RELEASE-VERSION | 2 +- pylot/core/util/map_projection.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 6303e78e..f70573ae 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -1996,6 +1996,12 @@ class MainWindow(QMainWindow): if not self.array_map: return # refresh with new picks here!!! + event = self.get_current_event() + if hasattr(event, 'origins'): + if event.origins: + lat = event.origins[0].latitude + lon = event.origins[0].longitude + self.array_map.eventLoc = (lat, lon) self.array_map.refresh_drawings(self.get_current_event().getPicks()) self._eventChanged[1] = False diff --git a/pylot/RELEASE-VERSION b/pylot/RELEASE-VERSION index cabd06a0..d7691880 100644 --- a/pylot/RELEASE-VERSION +++ b/pylot/RELEASE-VERSION @@ -1 +1 @@ -f409-dirty +ed4c1-dirty diff --git a/pylot/core/util/map_projection.py b/pylot/core/util/map_projection.py index 64fd0444..8a577c83 100644 --- a/pylot/core/util/map_projection.py +++ b/pylot/core/util/map_projection.py @@ -22,6 +22,7 @@ class map_projection(QtGui.QWidget): self.parser = parent.metadata[1] self.picks = None self.picks_dict = None + self.eventLoc = None self.figure = figure self.init_graphics() self.init_stations() @@ -244,6 +245,10 @@ class map_projection(QtGui.QWidget): self.sc = self.basemap.scatter(self.lon, self.lat, s=50, facecolor='none', latlon=True, zorder=10, picker=True, edgecolor='m', label='Not Picked') self.cid = self.canvas.mpl_connect('pick_event', self.onpick) + if self.eventLoc: + lat, lon = self.eventLoc + self.sc_event = self.basemap.scatter(lon, lat, s=100, facecolor='red', + latlon=True, zorder=11, label='Event (might be outside map region)') def scatter_picked_stations(self): lon = self.lon_no_nan @@ -274,8 +279,7 @@ class map_projection(QtGui.QWidget): def refresh_drawings(self, picks=None): self.picks_dict = picks - self.remove_drawings() - self.draw_everything() + self._refresh_drawings() def _refresh_drawings(self): self.remove_drawings() @@ -303,6 +307,9 @@ class map_projection(QtGui.QWidget): if hasattr(self, 'sc_picked'): self.sc_picked.remove() del(self.sc_picked) + if hasattr(self, 'sc_event'): + self.sc_event.remove() + del(self.sc_event) if hasattr(self, 'cbar'): self.cbar.remove() del(self.cbar)