From a003f509e4e9d370ed0d181c2fc2989bc6ba4206 Mon Sep 17 00:00:00 2001 From: Patryk Janczarek Date: Wed, 30 Jun 2021 07:50:16 +0000 Subject: [PATCH] =?UTF-8?q?Nadanie=20styli=20warstwom=20dodanym=20w=20zwys?= =?UTF-8?q?zukiwarki=20przy=20pomocy=20pliku=20qml.=20Ustawinie=20skali=20?= =?UTF-8?q?domy=C5=9Blnej.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Searcher/layer_style/PUNKT_ADRESOWY.qml | 561 +++++++++++ Searcher/layer_style/ULICE.qml | 724 ++++++++++++++ Searcher/layer_style/dzialki.qml | 1157 +++++++++++++++++++++++ Searcher/searchAddress.py | 5 + Searcher/searchParcel.py | 3 + Searcher/searchTool.py | 13 + 6 files changed, 2463 insertions(+) create mode 100644 Searcher/layer_style/PUNKT_ADRESOWY.qml create mode 100644 Searcher/layer_style/ULICE.qml create mode 100644 Searcher/layer_style/dzialki.qml diff --git a/Searcher/layer_style/PUNKT_ADRESOWY.qml b/Searcher/layer_style/PUNKT_ADRESOWY.qml new file mode 100644 index 0000000..0bfbbfe --- /dev/null +++ b/Searcher/layer_style/PUNKT_ADRESOWY.qml @@ -0,0 +1,561 @@ + + + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "street" + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "street" + + 0 + diff --git a/Searcher/layer_style/ULICE.qml b/Searcher/layer_style/ULICE.qml new file mode 100644 index 0000000..41583b7 --- /dev/null +++ b/Searcher/layer_style/ULICE.qml @@ -0,0 +1,724 @@ + + + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + COALESCE( "nazwaGlownaCzesc", '<NULL>' ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D:/__DOMINIKA/BOLESLAWIEC_UM_SPDP_lite_03_2021/PLIKI_WEKTOROWE + + 0 + D:/__DOMINIKA/BOLESLAWIEC_UM_SPDP_lite_03_2021/PLIKI_WEKTOROWE + + 1 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + COALESCE( "nazwaGlownaCzesc", '<NULL>' ) + + 1 + diff --git a/Searcher/layer_style/dzialki.qml b/Searcher/layer_style/dzialki.qml new file mode 100644 index 0000000..8c87fb0 --- /dev/null +++ b/Searcher/layer_style/dzialki.qml @@ -0,0 +1,1157 @@ + + + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + COALESCE("NUMER", '<NULL>') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + ../../../Emilka/ZAWIERCIE/ZAWIERCIE_dociąganie/PROJEKTY + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + COALESCE("NUMER", '<NULL>') + + 2 + diff --git a/Searcher/searchAddress.py b/Searcher/searchAddress.py index 9b2156a..63201d4 100644 --- a/Searcher/searchAddress.py +++ b/Searcher/searchAddress.py @@ -7,6 +7,7 @@ QgsProject, QgsVectorLayer, QgsMessageLog, Qgis from qgis.PyQt.QtCore import QVariant +import os from urllib.error import HTTPError, URLError @@ -65,9 +66,11 @@ def get_layer(self): if req_type in ['city', 'address']: org = 'MultiPoint?crs=epsg:2180&index=yes' obj_type = 'UUG_pkt' + qml = os.path.join('layer_style', 'PUNKT_ADRESOWY.qml') elif self.jres['type'] == 'street': org = 'MultiLineString?crs=epsg:2180&index=yes' obj_type = 'UUG_ulice' + qml = os.path.join('layer_style', 'ULICE.qml') else: QgsMessageLog.logMessage( 'Fetched unknown object: ' + str(req_type), @@ -87,6 +90,8 @@ def get_layer(self): lyr.dataProvider().addAttributes(flds) lyr.updateFields() QgsProject.instance().addMapLayer(lyr) + direc = os.path.dirname(__file__) + lyr.loadNamedStyle(os.path.join(direc, qml)) return lyr def process_results(self): diff --git a/Searcher/searchParcel.py b/Searcher/searchParcel.py index 6777cf3..2347f36 100644 --- a/Searcher/searchParcel.py +++ b/Searcher/searchParcel.py @@ -1,3 +1,4 @@ +import os.path from urllib.error import HTTPError, URLError from urllib.request import urlopen @@ -93,6 +94,8 @@ def get_layer(self): self.lyr = lyr[0] return QgsProject.instance().addMapLayer(self.lyr) + direc = os.path.dirname(__file__) + self.lyr.loadNamedStyle(os.path.join(direc, 'layer_style', 'dzialki.qml')) def parse_responce(self, resp): feats = [] diff --git a/Searcher/searchTool.py b/Searcher/searchTool.py index 309b1df..4513e4b 100644 --- a/Searcher/searchTool.py +++ b/Searcher/searchTool.py @@ -1,3 +1,6 @@ +from qgis.PyQt.QtCore import QTimer +from qgis.utils import iface + from .searchAddress import SearchAddress import json @@ -126,6 +129,16 @@ def search_address(self): self.iface.messageBar().pushWarning( tr('Warning'), res) self.searchaddress_call.add_feats(res) + + def change_scale(): + if iface.mapCanvas().scale() < 500: + iface.mapCanvas().zoomScale(500) + + self.timer = QTimer() + self.timer.setSingleShot(True) + self.timer.timeout.connect(change_scale) + self.timer.start(10) + return def validate_lineedit(self):