[add] array_map now plotting event location if given

This commit is contained in:
Marcel Paffrath 2017-06-23 15:40:13 +02:00
parent ed4c112e99
commit 8e6c4d06ce
3 changed files with 16 additions and 3 deletions

View File

@ -1996,6 +1996,12 @@ class MainWindow(QMainWindow):
if not self.array_map: if not self.array_map:
return return
# refresh with new picks here!!! # 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.array_map.refresh_drawings(self.get_current_event().getPicks())
self._eventChanged[1] = False self._eventChanged[1] = False

View File

@ -1 +1 @@
f409-dirty ed4c1-dirty

View File

@ -22,6 +22,7 @@ class map_projection(QtGui.QWidget):
self.parser = parent.metadata[1] self.parser = parent.metadata[1]
self.picks = None self.picks = None
self.picks_dict = None self.picks_dict = None
self.eventLoc = None
self.figure = figure self.figure = figure
self.init_graphics() self.init_graphics()
self.init_stations() 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, self.sc = self.basemap.scatter(self.lon, self.lat, s=50, facecolor='none', latlon=True,
zorder=10, picker=True, edgecolor='m', label='Not Picked') zorder=10, picker=True, edgecolor='m', label='Not Picked')
self.cid = self.canvas.mpl_connect('pick_event', self.onpick) 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): def scatter_picked_stations(self):
lon = self.lon_no_nan lon = self.lon_no_nan
@ -274,8 +279,7 @@ class map_projection(QtGui.QWidget):
def refresh_drawings(self, picks=None): def refresh_drawings(self, picks=None):
self.picks_dict = picks self.picks_dict = picks
self.remove_drawings() self._refresh_drawings()
self.draw_everything()
def _refresh_drawings(self): def _refresh_drawings(self):
self.remove_drawings() self.remove_drawings()
@ -303,6 +307,9 @@ class map_projection(QtGui.QWidget):
if hasattr(self, 'sc_picked'): if hasattr(self, 'sc_picked'):
self.sc_picked.remove() self.sc_picked.remove()
del(self.sc_picked) del(self.sc_picked)
if hasattr(self, 'sc_event'):
self.sc_event.remove()
del(self.sc_event)
if hasattr(self, 'cbar'): if hasattr(self, 'cbar'):
self.cbar.remove() self.cbar.remove()
del(self.cbar) del(self.cbar)