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

Feature/zoom level setting #30

Merged
merged 2 commits into from
Jun 4, 2024
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
2 changes: 2 additions & 0 deletions elevation_tile_for_jp_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from qgis.PyQt import uic
from qgis.PyQt import QtWidgets
from PyQt5.QtCore import Qt

FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'elevation_tile_for_jp_dialog_base.ui'))
Expand All @@ -35,3 +36,4 @@ class ElevationTileforJPDialog(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, parent=None):
super(ElevationTileforJPDialog, self).__init__(parent)
self.setupUi(self)
self.setWindowFlags(Qt.WindowStaysOnTopHint)
20 changes: 15 additions & 5 deletions get_tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ def __init__(self, iface):
self.dlg.mQgsProjectionSelectionWidget_output_crs.setCrs(
self.project.crs())

for i in range(0, 15):
self.dlg.comboBox_zoomlevel.addItem(str(i))

self.dlg.comboBox_zoomlevel.setCurrentText(
str(self.get_current_zoom()))
# コンボボックスにズームレベルを設定
self.setup_zoom_level_combo_box()

# ダイアログのボタンボックスがaccepted(OK)されたらcalcが作動
self.dlg.button_box.accepted.connect(self.calc)
Expand Down Expand Up @@ -150,3 +147,16 @@ def transform(self, src_crs, bbox, dst_crs_id="EPSG:4326"):
upper_right = coord_transform.transform(bbox[2], bbox[3])

return [lower_left.x(), lower_left.y(), upper_right.x(), upper_right.y()]

# コンボボックスにズームレベルを設定するメソッド
def setup_zoom_level_combo_box(self):
max_zoom_level = 14
current_zoom_level = self.get_current_zoom()

for i in range(0, max_zoom_level + 1):
self.dlg.comboBox_zoomlevel.addItem(str(i))

if current_zoom_level > max_zoom_level:
current_zoom_level = max_zoom_level

self.dlg.comboBox_zoomlevel.setCurrentText(str(current_zoom_level))
Loading