diff --git a/InfoTools.py b/InfoTools.py
new file mode 100644
index 0000000..1b58b7d
--- /dev/null
+++ b/InfoTools.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+import os
+import subprocess
+import sys
+import tempfile
+from qgis.PyQt import QtWidgets
+from qgis.PyQt.QtCore import QRectF, QDateTime, QSettings
+from qgis.PyQt.QtGui import QColor, QFont
+from qgis.PyQt.QtWidgets import QFileDialog, QApplication
+from qgis._core import QgsLayoutExporter, QgsWkbTypes, QgsLayoutItemMap, \
+ QgsLayout, QgsProject, QgsUnitTypes, QgsLayoutSize, QgsGeometry, \
+ QgsVectorLayer, QgsFeature, QgsSymbol, QgsSimpleFillSymbolLayer, \
+ QgsLayoutItemLegend, QgsLayerTreeGroup, QgsLegendStyle, QgsLayoutItem, \
+ QgsLayoutItemLabel, QgsLayoutItemScaleBar, QgsRectangle, QgsPointXY, QgsIdentifyContext
+from qgis._gui import QgsRubberBand, QgisInterface, QgsMapToolIdentifyFeature, QgsMapCanvas, QgsMapToolIdentify
+from qgis.utils import iface
+from typing import Union
+
+from .InfoToolsDialog import InfoToolsDialog
+from .utils import tr, CustomMessageBox, normalize_path
+from .config import Config
+
+class InfoTool:
+ def __init__(self, iface: QgisInterface, parent: QtWidgets = None) -> None:
+ self.iface = iface
+ self.dialog = InfoToolsDialog()
+ self.canvas = self.iface.mapCanvas()
+ self.dialog.identify_feature.triggered.connect(self.activate_identify_tool)
+ def run(self) -> None:
+ self.dialog.show()
+
+ def activate_identify_tool(self):
+ self.tool = IdentifyFeatureTool(self.canvas)
+ self.canvas.setMapTool(self.tool)
+
+
+class IdentifyFeatureTool(QgsMapToolIdentifyFeature):
+
+ def __init__(self, canvas: QgsMapCanvas):
+ super().__init__(canvas)
+ self.canvas = canvas
+
+ def canvasReleaseEvent(self, event):
+ point = self.toMapCoordinates(event.pos())
+ print(point[0],"elo",point[1])
+ self.identify_features(point)
+ def identify_features(self, point: QgsPointXY):
+ identify_result = QgsMapToolIdentifyFeature.identify(int(point[0]), int(point[1]),self.canvas.layers(True),
+ QgsMapToolIdentify.DefaultQgsSetting,
+ QgsIdentifyContext())
+
+
+ for result in identify_result:
+ layer = result.layerId()
+ feature = result.feature()
+ print(f"Warstwa: {layer}, ID: {feature.id()}, Atrybuty: {feature.attributes()}")
diff --git a/InfoToolsDialog.py b/InfoToolsDialog.py
new file mode 100644
index 0000000..5080351
--- /dev/null
+++ b/InfoToolsDialog.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+import os
+
+from PyQt5.QtWidgets import QMenu
+from qgis.PyQt import QtWidgets, uic, QtCore
+
+
+FORM_CLASS, _ = uic.loadUiType(os.path.join(
+ os.path.dirname(__file__), 'karta_informacjna_dialog.ui'))
+
+
+class InfoToolsDialog(QtWidgets.QDialog, FORM_CLASS):
+ def __init__(self, parent : QtWidgets=None) -> None:
+ """Constructor."""
+ super(InfoToolsDialog, self).__init__(parent)
+ self.setupUi(self)
+
+ self.menu = QMenu(self)
+
+ self.identify_feature = self.menu.addAction("Identify Feature(s)")
+
+ self.selectObjectPushButton.setMenu(self.menu)
+ # self.menu.addAction("Identify Feature(s) on Mouse Over")
+ # self.selectObjectPushButton.setMenu(self.menu)
+ #
+ # self.menu.addAction("Identify Features by Polygon")
+ # self.selectObjectPushButton.setMenu(self.menu)
+ #
+ # self.menu.addAction("Identify Features Freehand ")
+ # self.selectObjectPushButton.setMenu(self.menu)
+ #
+ # self.menu.addAction("Identify Features by Radius")
+ # self.selectObjectPushButton.setMenu(self.menu)
diff --git a/giap_dynamic_layout.py b/giap_dynamic_layout.py
index 7ea2920..83d3a59 100644
--- a/giap_dynamic_layout.py
+++ b/giap_dynamic_layout.py
@@ -15,6 +15,7 @@
from qgis.utils import iface
from qgis.gui import QgsMapTool
+from .InfoTools import InfoTool
from .OrtoTools import OrtoAddingTool
from .QuickPrint import PrintMapTool
from .SectionManager.CustomSectionManager import CustomSectionManager
@@ -857,6 +858,10 @@ def set_custom_action(self) -> None:
self.tbut.setToolTip(tr("Map quick print"))
if oname == "giapMyPrints":
self.tbut.setToolTip(tr("My Prints"))
+ if oname == 'giapInfoCard':
+ self.info_card = InfoTool(iface)
+ self.tbut.setToolTip(tr("Info card"))
+ self.tbut.clicked.connect(self.info_card.run)
if oname == "giapAreaLength":
giap_tool_bar = iface.mainWindow().findChildren(QToolBar, 'GiapToolBar')[0]
main_widget = giap_tool_bar.findChildren(MainWidget)[0]
diff --git a/giap_dynamic_layout.ui b/giap_dynamic_layout.ui
index 2c93ecc..89842ad 100644
--- a/giap_dynamic_layout.ui
+++ b/giap_dynamic_layout.ui
@@ -7,7 +7,7 @@
0
0
1291
- 178
+ 171
@@ -308,6 +308,13 @@ for the street: Warszawa, Pasaż Ursynowski
+ -
+
+
+ ...
+
+
+
diff --git a/giap_layout.py b/giap_layout.py
index 8efc599..772eafa 100644
--- a/giap_layout.py
+++ b/giap_layout.py
@@ -219,10 +219,19 @@ def initGui(self) -> None:
area_length_tool.setAction(self.main_widget.area_length_action)
self.main_widget.runArea.setDefaultAction(self.main_widget.area_length_action)
+ info_card_tool = QgsMapTool(self.iface.mapCanvas())
+ info_card_tool.setAction(self.main_widget.area_length_action)
+ self.main_widget.runArea.setDefaultAction(self.main_widget.area_length_action)
+
orto_button = self.main_widget.runOrtoTool
orto_button.setIcon(QIcon(os.path.join(self.plugin_dir, 'icons', 'orto_icon2.png')))
self.orto = OrtoAddingTool(self.main_widget, orto_button)
+ # self.main_widget.infoCardButton.clicked.connect(
+ # lambda: self.off_on_search_tool(self.visibility_search_tool))
+ # self.main_widget.infoCardButton.setIcon(
+ # QIcon(os.path.join(self.plugin_dir, 'icons', 'karta_info.png')))
+
self.visibility_search_tool = False
self.main_widget.offOnSearchButton.clicked.connect(
lambda: self.off_on_search_tool(self.visibility_search_tool))
@@ -266,6 +275,7 @@ def load_ribbons(self) -> None:
if not ribbon_conf:
ribbon_conf = RIBBON_DEFAULT
for dtab in ribbon_conf:
+ # raise
itab, tab = self.main_widget.add_tab(dtab['tab_name'])
for dsec in dtab['sections']:
sec = self.main_widget.add_section(
diff --git a/i18n/giap_pl.ts b/i18n/giap_pl.ts
index 7cabbdd..b684f9e 100644
--- a/i18n/giap_pl.ts
+++ b/i18n/giap_pl.ts
@@ -512,6 +512,11 @@ Proszę czekać...
Area and length
Powierzchnia i długość
+
+
+ Info card
+ info card
+
Do you want to save your changes?
diff --git a/icons/karta_info.png b/icons/karta_info.png
new file mode 100644
index 0000000..05e6c11
Binary files /dev/null and b/icons/karta_info.png differ
diff --git a/karta_informacjna_dialog.ui b/karta_informacjna_dialog.ui
new file mode 100644
index 0000000..ac8bede
--- /dev/null
+++ b/karta_informacjna_dialog.ui
@@ -0,0 +1,318 @@
+
+
+ KompozycjeDialog
+
+
+ Qt::ApplicationModal
+
+
+ true
+
+
+
+ 0
+ 0
+ 521
+ 734
+
+
+
+
+ 1
+ 1
+
+
+
+
+ 521
+ 734
+
+
+
+
+ Segoe UI
+ 10
+ 50
+ false
+ false
+
+
+
+ Karta informacyjna
+
+
+
+ :/plugins/GIAP-giap_layout/icons/giap_logo.png:/plugins/GIAP-giap_layout/icons/giap_logo.png
+
+
+
+QAbstractItemView
+{
+ alternate-background-color: #e6e6e6;
+}
+QComboBox
+{
+ selection-background-color: #b7d3e8;
+ background-color: #4f5a63;
+ border-style: solid;
+ border: 1px solid #5689b0;
+ border-radius: 3px;
+ padding: 2px;
+ font: 9pt "Segoe UI";
+ height: 20px;
+}
+
+QComboBox:on
+{
+ background-color: #4f5a63;
+ padding-top: 3px;
+ padding-left: 1px;
+ selection-background-color: #4a4a4a;
+}
+
+QComboBox QAbstractItemView
+{
+ background-color: #4f5a63;
+ border-radius: 4px;
+ border: 1px solid #6fb1e3;
+ selection-background-color: #4f5a63;
+ padding: 4px 10px 4px 10px;
+ width: 1.9em;
+}
+
+QComboBox::drop-down
+{
+ subcontrol-origin: padding;
+ subcontrol-position: top right;
+ width: 15px;
+ background-color: #5689b0;
+ border-left-width: 0;
+ border-left-color: #1a2936;
+ border-left-style: solid;
+ border-top-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+}
+
+QComboBox::down-arrow
+{
+ image: url(icons/down_arrow_disabled.png);
+}
+
+QComboBox::down-arrow:on,
+QComboBox::down-arrow:hover,
+QComboBox::down-arrow:focus
+{
+ image: url(icons/down_arrow.png);
+}
+
+QLineEdit
+{
+ border: 1px solid #5689b0;
+ border-radius: 3px;
+ background-color: #4f5a63;
+}
+
+QGroupBox {
+border: 1px solid #5689b0;
+}
+
+QToolButton {
+ border: 0px solid transparent;
+ color: #EDF6FC;
+
+}
+
+QToolButton:hover {
+ background-color: #b7d3e8;
+ border: 1px solid #0A0C0D;
+}
+
+QToolButton:pressed {
+ background-color: #b7d3e8;
+ border: 1px solid #0A0C0D;
+}
+
+QTableView:item:selected {
+ background-color: #6fb1e3;
+}
+
+QTableView:item:hover {
+ background-color: #6fb1e3;
+}
+
+
+
+
+
+
+ false
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+ Identyfikuj obiekt
+
+
+
+ -
+
+
+ -
+
+
+ Wskaż z mapy
+
+
+
+ -
+
+
+ Tryb
+
+
+
+ -
+
+
-
+
+ Identyfikuj obiekty
+
+
+ -
+
+ 2
+
+
+ -
+
+ 3
+
+
+
+
+ -
+
+
+
+ Obiekt
+
+
+
+
+ Wartość
+
+
+
+
+ -
+
+
+ Dodaj załącznik graficzny
+
+
+
+ -
+
+
+ Wybór formatu
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ PDF
+
+
+
+ -
+
+
+ XLS
+
+
+
+ -
+
+
+ CSV
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Podgląd karty
+
+
+
+ -
+
+
+ Zapisz...
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ribbon_config.py b/ribbon_config.py
index 56688aa..1e067b2 100644
--- a/ribbon_config.py
+++ b/ribbon_config.py
@@ -111,6 +111,7 @@
['giapWMS', 0, 1],
['giapQuickPrint', 0, 2],
['giapAreaLength', 0, 3],
+ ['giapInfoCard', 0, 4],
]
},
diff --git a/utils.py b/utils.py
index 593f277..cc924d0 100644
--- a/utils.py
+++ b/utils.py
@@ -532,6 +532,7 @@ def paint(self, painter, option, index):
['giapWMS', 0, 1],
['giapQuickPrint', 0, 2],
['giapAreaLength', 0, 3],
+ ['giapInfoCard', 0, 4],
]
},
@@ -1234,6 +1235,7 @@ def paint(self, painter, option, index):
"giapQuickPrint": 'quick_print.png',
"giapMyPrints": 'my_prints.png',
"giapAreaLength": 'measuring.png',
+ "giapInfoCard": 'karta_info.png',
'mActionShowAlignRasterTool': 'mActionShowAlignRasterTool.png',
'mActionNewMemoryLayer': 'mActionNewMemoryLayer.png',
'mActionSaveProjectAs': 'mActionSaveProjectAs.png',
@@ -1245,10 +1247,11 @@ def paint(self, painter, option, index):
'giapCompositions': "Composition settings",
"giapQuickPrint": "Map quick print",
"giapMyPrints": "My Prints",
- "giapAreaLength": 'Area and length'
+ "giapAreaLength": 'Area and length',
+ "giapInfoCard": 'Info card'
}
-max_ele_nazwy = 4
+max_ele_nazwy = 5
def icon_manager(tool_list: List[str], main_qgs_widget: QObject = None) -> \