map beautification

This commit is contained in:
Marcel Paffrath 2017-05-22 15:34:07 +02:00
parent ba56bfbd25
commit 22eb46999c
3 changed files with 27 additions and 10 deletions

View File

@ -1496,6 +1496,14 @@ class MainWindow(QMainWindow):
self.get_data().applyEVTData(self.calc_magnitude(), type='event') self.get_data().applyEVTData(self.calc_magnitude(), type='event')
def init_array_tab(self): def init_array_tab(self):
if hasattr(self, 'metadata_widget'):
if self.metadata_widget:
self.metadata_widget.setParent(None)
self.array_layout.removeWidget(self.metadata_widget)
if hasattr(self, 'array_map'):
if self.array_map:
self.array_map.setParent(None)
self.array_layout.removeWidget(self.array_map)
self.metadata_widget = QWidget(self) self.metadata_widget = QWidget(self)
grid_layout = QGridLayout() grid_layout = QGridLayout()
grid_layout.setColumnStretch(0, 1) grid_layout.setColumnStretch(0, 1)
@ -1510,6 +1518,7 @@ class MainWindow(QMainWindow):
grid_layout.addWidget(label, 1, 1) grid_layout.addWidget(label, 1, 1)
grid_layout.addWidget(new_inv_button, 2, 1) grid_layout.addWidget(new_inv_button, 2, 1)
self.metadata = None
self.metadata_widget.setLayout(grid_layout) self.metadata_widget.setLayout(grid_layout)
self.array_layout.addWidget(self.metadata_widget) self.array_layout.addWidget(self.metadata_widget)
@ -1823,6 +1832,8 @@ class MainWindow(QMainWindow):
self.init_events(new=True) self.init_events(new=True)
if hasattr(self.project, 'metadata'): if hasattr(self.project, 'metadata'):
self.init_array_map(index=0) self.init_array_map(index=0)
else:
self.init_array_tab()
def saveProject(self): def saveProject(self):
if self.project: if self.project:

View File

@ -1 +1 @@
a3fbe-dirty ba56b-dirty

View File

@ -24,12 +24,12 @@ class map_projection(QtGui.QWidget):
self.picks_dict = None self.picks_dict = None
self.figure = figure self.figure = figure
self.init_graphics() self.init_graphics()
self.init_basemap(projection='mill', resolution='l') self.init_stations()
self.init_basemap(resolution='l')
self.init_map() self.init_map()
#self.show() #self.show()
def init_map(self): def init_map(self):
self.init_stations()
self.init_lat_lon_dimensions() self.init_lat_lon_dimensions()
self.init_lat_lon_grid() self.init_lat_lon_grid()
self.init_x_y_dimensions() self.init_x_y_dimensions()
@ -196,13 +196,19 @@ class map_projection(QtGui.QWidget):
self.x, self.y = self.basemap(self.lon, self.lat) self.x, self.y = self.basemap(self.lon, self.lat)
self.xdim, self.ydim = get_x_y_dim(self.x, self.y) self.xdim, self.ydim = get_x_y_dim(self.x, self.y)
def init_basemap(self, projection, resolution='l'): def init_basemap(self, resolution='l'):
basemap = Basemap(projection=projection, resolution = resolution, ax=self.main_ax) #basemap = Basemap(projection=projection, resolution = resolution, ax=self.main_ax)
basemap.drawmapboundary(fill_color='darkblue') basemap = Basemap(projection='lcc', resolution = resolution, ax=self.main_ax,
basemap.drawcountries() width=5e6, height=2e6,
basemap.drawstates() lat_0=(min(self.lat)+max(self.lat))/2.,
basemap.fillcontinents(color='grey', lake_color='aqua') lon_0=(min(self.lon)+max(self.lon))/2.)
basemap.drawcoastlines()
#basemap.fillcontinents(color=None, lake_color='aqua',zorder=1)
basemap.drawmapboundary(zorder=2)#fill_color='darkblue')
basemap.shadedrelief(zorder=3)
basemap.drawcountries(zorder=4)
basemap.drawstates(zorder=5)
basemap.drawcoastlines(zorder=6)
self.basemap = basemap self.basemap = basemap
self.figure.tight_layout() self.figure.tight_layout()