Skip to content

Commit

Permalink
Add icon for vector tiles (base maps) items, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor committed May 13, 2024
1 parent 320b898 commit 5b6f4cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion swiss_locator/core/filters/swiss_locator_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def triggerResult(self, result: QgsLocatorResult):
level = Qgis.Info
self.info(msg, level)

# Load basemap layers at the bottom of the layer tree
root = QgsProject.instance().layerTreeRoot()
if sublayers:
# Sublayers should load on top of the vector tiles layer
Expand All @@ -503,7 +504,6 @@ def triggerResult(self, result: QgsLocatorResult):
QgsProject.instance().addMapLayer(vt_layer, False)
root.insertLayer(-1, vt_layer)


# Location
else:
point = QgsGeometry.fromPointXY(swiss_result.point)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from qgis.PyQt.QtCore import QUrl
from qgis.PyQt.QtNetwork import QNetworkRequest

from qgis.gui import QgisInterface
from qgis.core import (
QgsApplication,
Expand All @@ -15,9 +12,6 @@
from swiss_locator.core.filters.filter_type import FilterType
from swiss_locator.core.results import VectorTilesLayerResult

import xml.etree.ElementTree as ET
import urllib.parse


class SwissLocatorFilterVectorTiles(SwissLocatorFilter):
def __init__(self, iface: QgisInterface = None, crs: str = None):
Expand Down Expand Up @@ -71,7 +65,7 @@ def perform_fetch_results(self, search: str, feedback: QgsFeedback):
if search in keyword:
result = QgsLocatorResult()
result.filter = self
#result.icon = QgsApplication.getThemeIcon("/mActionAddWmsLayer.svg")
result.icon = QgsApplication.getThemeIcon("/mActionAddVectorTileLayer.svg")

result.displayString = data[keyword]["title"]
result.description = data[keyword]["description"]
Expand Down

0 comments on commit 5b6f4cb

Please sign in to comment.