Skip to content

Commit

Permalink
Make UI more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Joonalai committed Oct 7, 2021
1 parent 818a16c commit 9a70aac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 39 deletions.
1 change: 0 additions & 1 deletion GlobeBuilder/core/globe.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def add_halo(self, use_effects, stroke_color, fill_color=None, halo_with_fill=Fa

layer, index = halo.create_halo_layer(use_effects, stroke_color, fill_color)
self.insert_layer_to_group(layer, index)
self.change_project_projection()

def refresh_theme(self):
theme_collection = self.qgis_instance.mapThemeCollection()
Expand Down
2 changes: 1 addition & 1 deletion GlobeBuilder/definitions/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Projections(Enum):
AZIMUTHAL_ORTHOGRAPHIC = Projection(tr(u'Azimuthal Orthographic'),
'+proj=ortho +lat_0={lat} +lon_0={lon} +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs')

# Unfortunately +lon_0={lon} causes nasty rendering artifacts for all projections below (tested with QGIS 3.14.0)
# Unfortunately +lon_0={lon} causes nasty rendering artifacts for all projections below (tested with QGIS 3.14.0 and 3.20.3)

# https://www.gislounge.com/how-to-use-the-equal-earth-projection-using-qgis-on-the-mac/
EQUAL_EARTH = Projection(tr(u'Equal Earth'), '+proj=eqearth +datum=WGS84 +units=m +no_defs', (5, 2))
Expand Down
53 changes: 16 additions & 37 deletions GlobeBuilder/ui/globe_builder_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def __init__(self, iface, parent=None):
self.mColorButtonIntCountries.setColor(DEFAULT_INTERSECTING_COUNTRIES_COLOR)

self.geolocations = {}
self.old_coordinates = DEFAULT_ORIGIN
self.old_projection = Projections.proj_from_id(self.comboBoxProjections.currentText())

# connections
self.layout_mngr.layoutAdded.connect(self.populate_comboBoxLayouts)
Expand Down Expand Up @@ -124,30 +126,6 @@ def on_radioButtonGeocoding_toggled(self, is_checked):
self.listWidgetGeocodingResults.setEnabled(is_checked)
self.spinBoxMaxResults.setEnabled(is_checked)

# @pyqtSlot(bool)
# def on_radioButtonHHalo_toggled(self, is_checked):
# if not self.is_initializing:
# self.add_halo_to_globe()

# @pyqtSlot(bool)
# def on_radioButtonHOutline_toggled(self, is_checked):
# if not self.is_initializing:
# self.add_halo_to_globe()

# @pyqtSlot(QColor)
# def on_mColorButtonBackground_colorChanged(self, color):
# if not self.is_initializing:
# self.globe.change_background_color(color)
#
# @pyqtSlot(QColor)
# def on_mColorButtonHalo_colorChanged(self, color):
# if not self.is_initializing:
# self.add_halo_to_globe()
#
# @pyqtSlot(QColor)
# def on_mColorButtonHFill_colorChanged(self, color):
# if not self.is_initializing:
# self.add_halo_to_globe()

def on_radioButtonHFillWithHalo_toggled(self, is_checked):
self.mColorButtonHFill.setEnabled(is_checked or self.radioButtonHFill.isChecked())
Expand Down Expand Up @@ -181,30 +159,31 @@ def on_pushButtonSearch_clicked(self):
self.geolocations.clear()
self.geocoder.geocode(text, self.spinBoxMaxResults.value())

@pyqtSlot()
def on_pushButtonLoadData_clicked(self):
self.load_data_to_globe(False)

@pyqtSlot()
def on_pushButtonApplyVisualizations_clicked(self):
if not self.is_initializing:
coordinates = self.calculate_origin_coordinates()
if coordinates != self.old_coordinates:
self.old_coordinates = coordinates
self.globe.set_origin(coordinates)
projection = Projections.proj_from_id(self.comboBoxProjections.currentText())
if projection != self.old_projection:
self.old_projection = projection
self.globe.set_projection(projection)
self.globe.change_project_projection()
self.load_data_to_globe()
self.globe.change_background_color(self.mColorButtonBackground.color())
self.mColorButtonBackground.setColor(self.iface.mapCanvas().canvasColor())
self.globe.set_group_visibility(True)
self.add_halo_to_globe()

@pyqtSlot()
def on_pushButtonCenter_clicked(self):
self.globe.set_origin(self.calculate_origin_coordinates())
self.globe.set_projection(Projections.proj_from_id(self.comboBoxProjections.currentText()))
self.globe.change_project_projection()
self.add_halo_to_globe()

@pyqtSlot()
def on_pushButtonRun_clicked(self):
self.load_data_to_globe(False)
self.globe.set_origin(self.calculate_origin_coordinates())
self.globe.set_projection(Projections.proj_from_id(self.comboBoxProjections.currentText()))
self.old_coordinates = self.calculate_origin_coordinates()
self.globe.set_origin(self.old_coordinates)
self.old_projection = Projections.proj_from_id(self.comboBoxProjections.currentText())
self.globe.set_projection(self.old_projection)
self.globe.change_background_color(self.mColorButtonBackground.color())
self.mColorButtonBackground.setColor(self.iface.mapCanvas().canvasColor())
self.globe.change_project_projection()
Expand Down

0 comments on commit 9a70aac

Please sign in to comment.