Skip to content

Commit

Permalink
#437 Add BBOX display to QA version
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSAMPERE committed Dec 18, 2023
1 parent 2500d14 commit 8675dce
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions modules/search_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,21 +625,25 @@ def get_coords(self, filter: str):
# message="{}".format(coord_currentCrs), tag="Isogeo", level=0
# )

# from qgis.core import QgsGeometry, QgsFeature, QgsRenderContext, QgsVectorLayer
# from qgis.PyQt.QtGui import QColor
from qgis.core import QgsGeometry, QgsFeature, QgsRenderContext, QgsVectorLayer
from qgis.PyQt.QtGui import QColor

# bbox_polygon = QgsFeature()
# bbox_polygon.setGeometry(QgsGeometry.fromRect(extent_wgs84))
# bbox_layer = QgsVectorLayer("Polygon?crs=epsg:4326", "BoundingBox", "memory")
# bbox_layer.dataProvider().addFeatures([bbox_polygon])

# symbols = bbox_layer.renderer().symbols(QgsRenderContext())
# symbol = symbols[0]
# symbol.setColor(QColor.fromRgb(255, 20, 147))
# symbol.setOpacity(0.25)

# qgs_prj.addMapLayer(bbox_layer)
# iface.mapCanvas().refresh()
bbox_layer_name = "BoundingBox {}".format(coord)
if any(lyr.name() == bbox_layer_name for lyr in qgs_prj.mapLayers().values()):
pass
else:
bbox_polygon = QgsFeature()
bbox_polygon.setGeometry(QgsGeometry.fromRect(extent_wgs84))
bbox_layer = QgsVectorLayer("Polygon?crs=epsg:4326", bbox_layer_name, "memory")
bbox_layer.dataProvider().addFeatures([bbox_polygon])

symbols = bbox_layer.renderer().symbols(QgsRenderContext())
symbol = symbols[0]
symbol.setColor(QColor.fromRgb(255, 20, 147))
symbol.setOpacity(0.25)

qgs_prj.addMapLayer(bbox_layer)
iface.mapCanvas().refresh()

return coord

Expand Down

0 comments on commit 8675dce

Please sign in to comment.