Skip to content

Commit

Permalink
Merge branch 'dev_Patryk_style' into 'dev'
Browse files Browse the repository at this point in the history
Nadanie styli warstwom dodanym w z wyszukiwarki przy pomocy pliku qml.

See merge request polamap/giap_layout!33
  • Loading branch information
przemyslawmomot9 committed Jun 30, 2021
2 parents 0047354 + a003f50 commit 2b1e137
Show file tree
Hide file tree
Showing 6 changed files with 2,463 additions and 0 deletions.
561 changes: 561 additions & 0 deletions Searcher/layer_style/PUNKT_ADRESOWY.qml

Large diffs are not rendered by default.

724 changes: 724 additions & 0 deletions Searcher/layer_style/ULICE.qml

Large diffs are not rendered by default.

1,157 changes: 1,157 additions & 0 deletions Searcher/layer_style/dzialki.qml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Searcher/searchAddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
QgsProject, QgsVectorLayer, QgsMessageLog, Qgis
from qgis.PyQt.QtCore import QVariant

import os


from urllib.error import HTTPError, URLError
Expand Down Expand Up @@ -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),
Expand All @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions Searcher/searchParcel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os.path
from urllib.error import HTTPError, URLError
from urllib.request import urlopen

Expand Down Expand Up @@ -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 = []
Expand Down
13 changes: 13 additions & 0 deletions Searcher/searchTool.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from qgis.PyQt.QtCore import QTimer
from qgis.utils import iface

from .searchAddress import SearchAddress

import json
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 2b1e137

Please sign in to comment.