Skip to content

Commit

Permalink
v1.0.6
Browse files Browse the repository at this point in the history
* Zmiana wyglądu UI
* Aktualizacja loga EnviroSolutions

---------

Co-authored-by: aglu <[email protected]>
Co-authored-by: Wojciech Sołyga <[email protected]>
  • Loading branch information
wojtek19022 and algluszek authored Jun 3, 2024
2 parents f221808 + 84c522c commit 4124215
Show file tree
Hide file tree
Showing 11 changed files with 3,748 additions and 1,050 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

38 changes: 29 additions & 9 deletions archiwalna_ortofotomapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2020-03-25
copyright : (C) 2020 by Michał Włoga - EnviroSolutions Sp. z o.o.
copyright : (C) 2020 by EnviroSolutions Sp. z o.o.
email : [email protected]
git sha : $Format:%H$
***************************************************************************/
Expand All @@ -22,6 +22,7 @@
***************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""

from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication, Qt
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction, QToolBar, QApplication
Expand All @@ -35,6 +36,7 @@
from . import PLUGIN_VERSION as plugin_version

"""Wersja wtyczki"""
plugin_version = '1.0.6'
plugin_name = 'Archiwalna Ortofotomapa'

class ArchiwalnaOrtofotomapa:
Expand Down Expand Up @@ -105,7 +107,7 @@ def tr(self, message):
"""
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
return QCoreApplication.translate('ArchiwalnaOrtofotomapa', message)


def add_action(
self,
Expand All @@ -118,6 +120,7 @@ def add_action(
status_tip=None,
whats_this=None,
parent=None):

"""Add a toolbar icon to the toolbar.
:param icon_path: Path to the icon for this action. Can be a resource
Expand Down Expand Up @@ -184,18 +187,17 @@ def add_action(
def initGui(self):
"""Create the menu entries and toolbar icons inside the QGIS GUI."""

icon_path = ':/plugins/archiwalna_ortofotomapa/icon_pw2.png'
icon_path = ':/plugins/archiwalna_ortofotomapa/icons/icon_pw2.png'
self.add_action(
icon_path,
text=self.tr(u'Archiwalna Ortofotomapa'),
callback=self.run,
parent=self.iface.mainWindow())


def onClosePlugin(self):
"""Cleanup necessary items here when plugin dockwidget is closed"""

#print "** CLOSING ArchiwalnaOrtofotomapa"

# disconnects
self.dockwidget.closingPlugin.disconnect(self.onClosePlugin)

Expand All @@ -211,8 +213,6 @@ def onClosePlugin(self):
def unload(self):
"""Removes the plugin menu item and icon from QGIS GUI."""

#print "** UNLOAD ArchiwalnaOrtofotomapa"

for action in self.actions:
self.iface.removePluginMenu(
self.tr(u'&EnviroSolutions'),
Expand All @@ -224,6 +224,7 @@ def unload(self):

#--------------------------------------------------------------------------


def run(self):
"""Run method that loads and starts the plugin"""

Expand Down Expand Up @@ -256,6 +257,7 @@ def run(self):
self.dockwidget.closingPlugin.connect(self.onClosePlugin)

# informacje o wersji
self.dockwidget.setWindowTitle('%s %s' % (plugin_name, plugin_version))
self.dockwidget.lbl_pluginVersion.setText('%s %s' % (plugin_name, plugin_version))

# show the dockwidget
Expand All @@ -272,39 +274,57 @@ def run(self):
#reopened
pass


def orto_removal(self):
"""Funkcja wyłączająca okno z wtyczką przy usunięciu warstwy z ortofotomapą"""

self.dockwidget.close()
self.orto = None


def slider_changed(self):
"""Funkcja kontroluje rok jaki ma być wyświetlany przy przesuwaniu paska"""

slider = self.dockwidget.sender()
self.dockwidget.timeLabel.setText(str(slider.value()))
if not self.isSliderPressed:
self.changeOrtoLayer(slider)


def slider_moved(self):
"""Funkcja nic nie robi jeżeli pasek został przesuniętu"""

pass


def slider_pressed(self):
"""Funkcja kontroluje parametr odpowiadający za akcje po wciśnięciu slidera"""

slider = self.dockwidget.sender()
self.isSliderPressed = True


def slider_released(self):
"""Funkcja kontroluje parametr odpowiadający za akcje po puszczeniu slidera"""

slider = self.dockwidget.sender()
self.isSliderPressed = False
self.changeOrtoLayer(slider)


def changeOrtoLayer(self, slider):
# SET DATASOURCE AND RELOAD DATA
"""Funkcja zmienia nazwę warstwy z orto po zmianie roku który ma wyświetlać"""

uri = self.makeDataSourceUri(slider.value())
self.orto.dataProvider().setDataSourceUri(uri)
self.orto.triggerRepaint()
# self.orto.dataProvider().reloadData() #QGIS 3.12 and above
self.orto.setName("Ortofotomapa Archiwalna %d" % slider.value())


def makeDataSourceUri(self, year):
# serviceUrl = "http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO_TIME/MapServer/WMSServer"
"""Funkcja edytuje warstwę z orto i zmienia rok, z którego jest ono opracowane"""

serviceUrl = "https://mapy.geoportal.gov.pl/wss/service/PZGIK/ORTO/WMS/StandardResolutionTime"
return "IgnoreGetFeatureInfoUrl=1&IgnoreGetMapUrl=1&contextualWMSLegend=0&crs=EPSG:2180&format=image/jpeg&layers=Raster&styles=&url=" \
+ serviceUrl + \
Expand Down
5 changes: 4 additions & 1 deletion archiwalna_ortofotomapa_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2020-03-25
copyright : (C) 2020 by Michał Włoga - EnviroSolutions Sp. z o.o.
copyright : (C) 2020 by EnviroSolutions Sp. z o.o.
email : [email protected]
git sha : $Format:%H$
***************************************************************************/
Expand Down Expand Up @@ -38,13 +38,16 @@ class ArchiwalnaOrtofotomapaDockWidget(QtWidgets.QDockWidget, FORM_CLASS):

def __init__(self, parent=None):
"""Constructor."""

super(ArchiwalnaOrtofotomapaDockWidget, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://doc.qt.io/qt-5/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
self.img_main.setMargin(9)


def closeEvent(self, event):
self.closingPlugin.emit()
Expand Down
2 changes: 1 addition & 1 deletion archiwalna_ortofotomapa_dockwidget_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setupUi(self, ArchiwalnaOrtofotomapaDockWidgetBase):
self.label_5 = QtWidgets.QLabel(self.dockWidgetContents)
self.label_5.setMaximumSize(QtCore.QSize(20, 20))
self.label_5.setText("")
self.label_5.setPixmap(QtGui.QPixmap(":/plugins/archiwalna_ortofotomapa/drzewiec.png"))
self.label_5.setPixmap(QtGui.QPixmap(":/plugins/archiwalna_ortofotomapa/icons/drzewiec.png"))
self.label_5.setScaledContents(True)
self.label_5.setObjectName("label_5")
self.horizontalLayout_2.addWidget(self.label_5)
Expand Down
Loading

0 comments on commit 4124215

Please sign in to comment.