mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-06-19 04:12:55 +02:00
Tidying up
removed unused bits of code
This commit is contained in:
@@ -313,7 +313,6 @@ def load_amcr_data(canvas, bb, filters=None):
|
|||||||
# PIAN attributes
|
# PIAN attributes
|
||||||
pian_presnost = tr_code(str(doc.get('pian_presnost', '')))
|
pian_presnost = tr_code(str(doc.get('pian_presnost', '')))
|
||||||
pian_typ = tr_code(str(doc.get('pian_typ', '')))
|
pian_typ = tr_code(str(doc.get('pian_typ', '')))
|
||||||
# dj_negativni = "Negativní" if pid in negative_dj_pian_ids else "Pozitivní"
|
|
||||||
|
|
||||||
if wkt:
|
if wkt:
|
||||||
geom = QgsGeometry.fromWkt(wkt)
|
geom = QgsGeometry.fromWkt(wkt)
|
||||||
@@ -371,68 +370,3 @@ def load_amcr_data(canvas, bb, filters=None):
|
|||||||
iface.messageBar().pushMessage("Chyba", str(e), level=2)
|
iface.messageBar().pushMessage("Chyba", str(e), level=2)
|
||||||
finally:
|
finally:
|
||||||
QApplication.restoreOverrideCursor()
|
QApplication.restoreOverrideCursor()
|
||||||
|
|
||||||
# class AmcrIdentifyTool(QgsMapToolIdentifyFeature):
|
|
||||||
# def __init__(self, canvas):
|
|
||||||
# super().__init__(canvas)
|
|
||||||
# self.canvas = canvas
|
|
||||||
# self.setCursor(Qt.CrossCursor)
|
|
||||||
|
|
||||||
# def canvasReleaseEvent(self, event):
|
|
||||||
# results = self.identify(event.x(), event.y(), self.IdentifyMode.TopDownStopAtFirst, self.VectorLayer)
|
|
||||||
# if not results: return
|
|
||||||
# feature = results[0].mFeature
|
|
||||||
# akce_id = None
|
|
||||||
# # Změna: hledáme 'ident_cely' (ID akce)
|
|
||||||
# idx = feature.fieldNameIndex('ident_cely')
|
|
||||||
# if idx != -1:
|
|
||||||
# akce_id = feature.attributes()[idx]
|
|
||||||
|
|
||||||
# # Fallback na starší názvy polí, kdyby něco
|
|
||||||
# if not akce_id:
|
|
||||||
# for col in ['akce_id', 'ident_cely', 'pian_id']:
|
|
||||||
# if col in feature.fields().names():
|
|
||||||
# akce_id = feature[col]
|
|
||||||
# break
|
|
||||||
|
|
||||||
# if not akce_id: return
|
|
||||||
|
|
||||||
# full_id = akce_id if "api.aiscr.cz" in str(akce_id) else f"https://api.aiscr.cz/id/{akce_id}"
|
|
||||||
# url = f"https://api.aiscr.cz/2.2/oai?verb=GetRecord&metadataPrefix=oai_amcr&identifier={full_id}"
|
|
||||||
|
|
||||||
# iface.messageBar().pushMessage("AMCR", f"Detail: {akce_id}...", level=1)
|
|
||||||
# QApplication.setOverrideCursor(Qt.WaitCursor)
|
|
||||||
# try:
|
|
||||||
# r = requests.get(url, timeout=5)
|
|
||||||
# if r.status_code == 200: self.show_detail(akce_id, r.text)
|
|
||||||
# except Exception as e:
|
|
||||||
# iface.messageBar().pushMessage("Chyba", str(e), level=2)
|
|
||||||
# finally:
|
|
||||||
# QApplication.restoreOverrideCursor()
|
|
||||||
|
|
||||||
# def show_detail(self, title, raw_xml):
|
|
||||||
# xml = re.sub(r'\sxmlns="[^"]+"', '', raw_xml, count=1)
|
|
||||||
# xml = re.sub(r'<(/?)[a-zA-Z0-9]+:', r'<\1', xml)
|
|
||||||
# info = ""
|
|
||||||
# try:
|
|
||||||
# root = ET.fromstring(xml)
|
|
||||||
# rec = root.find('.//archeologicky_zaznam')
|
|
||||||
# if not rec: info = "Zadna data."
|
|
||||||
# else:
|
|
||||||
# kat = rec.find('.//hlavni_katastr')
|
|
||||||
# info += f"<h3>{kat.text if kat is not None else '?'}</h3>"
|
|
||||||
# for dj in rec.findall('.//dokumentacni_jednotka'):
|
|
||||||
# pn = dj.find('pian')
|
|
||||||
# p_txt = pn.text if pn is not None else ""
|
|
||||||
# info += f"<hr><b>PIAN: {p_txt}</b><ul>"
|
|
||||||
# for k in dj.findall('komponenta'):
|
|
||||||
# ob = k.find('obdobi').text or "?"
|
|
||||||
# ar = k.find('areal').text or "?"
|
|
||||||
# info += f"<li>{ob} ({ar})</li>"
|
|
||||||
# info += "</ul>"
|
|
||||||
# dlg = QMessageBox()
|
|
||||||
# dlg.setWindowTitle(str(title))
|
|
||||||
# dlg.setText(info)
|
|
||||||
# dlg.setTextFormat(Qt.RichText)
|
|
||||||
# dlg.exec_()
|
|
||||||
# except: pass
|
|
||||||
@@ -3,7 +3,7 @@ from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication
|
|||||||
from qgis.PyQt.QtGui import QIcon
|
from qgis.PyQt.QtGui import QIcon
|
||||||
from qgis.PyQt.QtWidgets import QAction
|
from qgis.PyQt.QtWidgets import QAction
|
||||||
|
|
||||||
from .amcr_tools import load_amcr_data#, AmcrIdentifyTool
|
from .amcr_tools import load_amcr_data
|
||||||
from .amcr_dialog import AmcrFilterDialog
|
from .amcr_dialog import AmcrFilterDialog
|
||||||
from .resources import *
|
from .resources import *
|
||||||
import os.path
|
import os.path
|
||||||
@@ -61,7 +61,6 @@ class AmcrViewer:
|
|||||||
|
|
||||||
icon = QIcon(os.path.join(plugin_dir, 'download.png'))
|
icon = QIcon(os.path.join(plugin_dir, 'download.png'))
|
||||||
|
|
||||||
# icon_info = QIcon(os.path.join(plugin_dir, 'info.png'))
|
|
||||||
|
|
||||||
# Download data button
|
# Download data button
|
||||||
self.action_download = self.add_action(
|
self.action_download = self.add_action(
|
||||||
@@ -70,14 +69,6 @@ class AmcrViewer:
|
|||||||
callback=self.run_download,
|
callback=self.run_download,
|
||||||
parent=self.iface.mainWindow())
|
parent=self.iface.mainWindow())
|
||||||
|
|
||||||
# # Info button (Checkable / Toggle)
|
|
||||||
# self.action_tool = self.add_action(
|
|
||||||
# icon_info,
|
|
||||||
# text=self.tr(u'Výpis údajů záznamu'),
|
|
||||||
# callback=self.run_tool,
|
|
||||||
# parent=self.iface.mainWindow())
|
|
||||||
# self.action_tool.setCheckable(True) # Toto tlačítko se zamačkává
|
|
||||||
|
|
||||||
self.first_start = True
|
self.first_start = True
|
||||||
|
|
||||||
def unload(self):
|
def unload(self):
|
||||||
@@ -100,20 +91,3 @@ class AmcrViewer:
|
|||||||
|
|
||||||
canvas = self.iface.mapCanvas()
|
canvas = self.iface.mapCanvas()
|
||||||
load_amcr_data(canvas, bbox, filters)
|
load_amcr_data(canvas, bbox, filters)
|
||||||
|
|
||||||
# --- Info button toggle ---
|
|
||||||
# def run_tool(self):
|
|
||||||
|
|
||||||
# if self.action_tool.isChecked():
|
|
||||||
# canvas = self.iface.mapCanvas()
|
|
||||||
|
|
||||||
# if not hasattr(self, 'tool'):
|
|
||||||
# self.tool = AmcrIdentifyTool(canvas)
|
|
||||||
# self.tool.deactivated.connect(lambda: self.action_tool.setChecked(False))
|
|
||||||
|
|
||||||
# canvas.setMapTool(self.tool)
|
|
||||||
# self.iface.messageBar().pushMessage("AMČR", "Info nástroj aktivní.", level=0)
|
|
||||||
|
|
||||||
# else:
|
|
||||||
# if self.iface.mapCanvas().mapTool() == getattr(self, 'tool', None):
|
|
||||||
# self.iface.mapCanvas().unsetMapTool(self.tool)
|
|
||||||
Reference in New Issue
Block a user