├── LOAD.png ├── Makefile ├── QGISDashboardDialog.py ├── QGIS_Dashboard.py ├── QGIS_Dashboard_dialog_base.ui ├── README.html ├── README.md ├── README.txt ├── __init__.py ├── __pycache__ ├── QGISDashboardDialog.cpython-37.pyc ├── QGIS_Dashboard.cpython-37.pyc ├── QGIS_Dashboard_dialog.cpython-37.pyc ├── __init__.cpython-37.pyc └── register.cpython-37.pyc ├── calculations ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── dataQuery.cpython-37.pyc │ └── spatialQuery.cpython-37.pyc ├── dataQuery.py └── spatialQuery.py ├── decorator ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ └── medirTiempo.cpython-37.pyc └── medirTiempo.py ├── fix.png ├── help ├── Makefile ├── make.bat └── source │ ├── conf.py │ └── index.rst ├── i18n └── af.ts ├── icon.png ├── images ├── b1.png ├── b11.png ├── b1a.png ├── b2.png ├── b2a.png ├── b3.png ├── b3a.png ├── b4.png ├── b4a.png ├── b5.png ├── b5a.png ├── b6.png ├── b6a.png ├── barras.png ├── iconCenter.png ├── iconTop.png ├── indicador.png ├── lserie.png ├── panel.png └── serie.png ├── loadRuta.py ├── log.txt ├── metadata.txt ├── myUtils ├── __pycache__ │ ├── Utils.cpython-37.pyc │ ├── dashColors.cpython-37.pyc │ └── myUtils.cpython-37.pyc ├── dashColors.py └── myUtils.py ├── panels ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ ├── adminPanel.cpython-37.pyc │ ├── barrasPanel.cpython-37.pyc │ ├── groupPanel6.cpython-37.pyc │ ├── indicadorPanel.cpython-37.pyc │ ├── operations.cpython-37.pyc │ ├── seriesPanel.cpython-37.pyc │ ├── stylesBarPanel.cpython-37.pyc │ ├── stylesSeriePanel.cpython-37.pyc │ ├── stylesTextPanel.cpython-37.pyc │ └── textPanel.cpython-37.pyc ├── adminPanel.py ├── barrasPanel.py ├── groupPanel6.py ├── indicadorPanel.py ├── operations.py ├── plotly-latest.min.js ├── seriesPanel.py ├── stylesBarPanel.py ├── stylesIndicadorPanel.py ├── stylesSeriePanel.py ├── stylesTextPanel.py └── textPanel.py ├── pb_tool.cfg ├── plugin_upload.py ├── pylintrc ├── register.py ├── resources ├── __init__.py ├── __pycache__ │ └── __init__.cpython-37.pyc └── resources.qrc ├── save.png ├── scripts ├── compile-strings.sh ├── run-env-linux.sh └── update-strings.sh └── test ├── __init__.py ├── qgis_interface.py ├── tenbytenraster.asc ├── tenbytenraster.asc.aux.xml ├── tenbytenraster.keywords ├── tenbytenraster.lic ├── tenbytenraster.prj ├── tenbytenraster.qml ├── test_QGIS_Dashboard_dialog.py ├── test_init.py ├── test_qgis_environment.py ├── test_resources.py ├── test_translations.py └── utilities.py /LOAD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/LOAD.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # QGISDashboard 3 | # 4 | # This plugin allows the construction and management of Dashboards on screen. 5 | # ------------------- 6 | # begin : 2021-06-14 7 | # git sha : $Format:%H$ 8 | # copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 9 | # email : luis3176@yahoo.com 10 | # ***************************************************************************/ 11 | # 12 | #/*************************************************************************** 13 | # * * 14 | # * This program is free software; you can redistribute it and/or modify * 15 | # * it under the terms of the GNU General Public License as published by * 16 | # * the Free Software Foundation; either version 2 of the License, or * 17 | # * (at your option) any later version. * 18 | # * * 19 | # ***************************************************************************/ 20 | 21 | ################################################# 22 | # Edit the following to match your sources lists 23 | ################################################# 24 | 25 | 26 | #Add iso code for any locales you want to support here (space separated) 27 | # default is no locales 28 | # LOCALES = af 29 | LOCALES = 30 | 31 | # If locales are enabled, set the name of the lrelease binary on your system. If 32 | # you have trouble compiling the translations, you may have to specify the full path to 33 | # lrelease 34 | #LRELEASE = lrelease 35 | #LRELEASE = lrelease-qt4 36 | 37 | 38 | # translation 39 | SOURCES = \ 40 | __init__.py \ 41 | QGIS_Dashboard.py QGIS_Dashboard_dialog.py 42 | 43 | PLUGINNAME = QGIS_Dashboard 44 | 45 | PY_FILES = \ 46 | __init__.py \ 47 | QGIS_Dashboard.py QGIS_Dashboard_dialog.py 48 | 49 | UI_FILES = QGIS_Dashboard_dialog_base.ui 50 | 51 | EXTRAS = metadata.txt icon.png 52 | 53 | EXTRA_DIRS = 54 | 55 | COMPILED_RESOURCE_FILES = resources.py 56 | 57 | PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui 58 | 59 | # QGISDIR points to the location where your plugin should be installed. 60 | # This varies by platform, relative to your HOME directory: 61 | # * Linux: 62 | # .local/share/QGIS/QGIS3/profiles/default/python/plugins/ 63 | # * Mac OS X: 64 | # Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins 65 | # * Windows: 66 | # AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins' 67 | 68 | QGISDIR=C:\Users\Luis Eduardo\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins 69 | 70 | ################################################# 71 | # Normally you would not need to edit below here 72 | ################################################# 73 | 74 | HELP = help/build/html 75 | 76 | PLUGIN_UPLOAD = $(c)/plugin_upload.py 77 | 78 | RESOURCE_SRC=$(shell grep '^ *@@g;s/.*>//g' | tr '\n' ' ') 79 | 80 | .PHONY: default 81 | default: 82 | @echo While you can use make to build and deploy your plugin, pb_tool 83 | @echo is a much better solution. 84 | @echo A Python script, pb_tool provides platform independent management of 85 | @echo your plugins and runs anywhere. 86 | @echo You can install pb_tool using: pip install pb_tool 87 | @echo See https://g-sherman.github.io/plugin_build_tool/ for info. 88 | 89 | compile: $(COMPILED_RESOURCE_FILES) 90 | 91 | %.py : %.qrc $(RESOURCES_SRC) 92 | pyrcc5 -o $*.py $< 93 | 94 | %.qm : %.ts 95 | $(LRELEASE) $< 96 | 97 | test: compile transcompile 98 | @echo 99 | @echo "----------------------" 100 | @echo "Regression Test Suite" 101 | @echo "----------------------" 102 | 103 | @# Preceding dash means that make will continue in case of errors 104 | @-export PYTHONPATH=`pwd`:$(PYTHONPATH); \ 105 | export QGIS_DEBUG=0; \ 106 | export QGIS_LOG_FILE=/dev/null; \ 107 | nosetests -v --with-id --with-coverage --cover-package=. \ 108 | 3>&1 1>&2 2>&3 3>&- || true 109 | @echo "----------------------" 110 | @echo "If you get a 'no module named qgis.core error, try sourcing" 111 | @echo "the helper script we have provided first then run make test." 112 | @echo "e.g. source run-env-linux.sh ; make test" 113 | @echo "----------------------" 114 | 115 | deploy: compile doc transcompile 116 | @echo 117 | @echo "------------------------------------------" 118 | @echo "Deploying plugin to your .qgis2 directory." 119 | @echo "------------------------------------------" 120 | # The deploy target only works on unix like operating system where 121 | # the Python plugin directory is located at: 122 | # $HOME/$(QGISDIR)/python/plugins 123 | mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 124 | cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 125 | cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 126 | cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 127 | cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 128 | cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 129 | cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help 130 | # Copy extra directories if any 131 | (foreach EXTRA_DIR,(EXTRA_DIRS), cp -R (EXTRA_DIR) (HOME)/(QGISDIR)/python/plugins/(PLUGINNAME)/;) 132 | 133 | 134 | # The dclean target removes compiled python files from plugin directory 135 | # also deletes any .git entry 136 | dclean: 137 | @echo 138 | @echo "-----------------------------------" 139 | @echo "Removing any compiled python files." 140 | @echo "-----------------------------------" 141 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete 142 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \; 143 | 144 | 145 | derase: 146 | @echo 147 | @echo "-------------------------" 148 | @echo "Removing deployed plugin." 149 | @echo "-------------------------" 150 | rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 151 | 152 | zip: deploy dclean 153 | @echo 154 | @echo "---------------------------" 155 | @echo "Creating plugin zip bundle." 156 | @echo "---------------------------" 157 | # The zip target deploys the plugin and creates a zip file with the deployed 158 | # content. You can then upload the zip file on http://plugins.qgis.org 159 | rm -f $(PLUGINNAME).zip 160 | cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME) 161 | 162 | package: compile 163 | # Create a zip package of the plugin named $(PLUGINNAME).zip. 164 | # This requires use of git (your plugin development directory must be a 165 | # git repository). 166 | # To use, pass a valid commit or tag as follows: 167 | # make package VERSION=Version_0.3.2 168 | @echo 169 | @echo "------------------------------------" 170 | @echo "Exporting plugin to zip package. " 171 | @echo "------------------------------------" 172 | rm -f $(PLUGINNAME).zip 173 | git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION) 174 | echo "Created package: $(PLUGINNAME).zip" 175 | 176 | upload: zip 177 | @echo 178 | @echo "-------------------------------------" 179 | @echo "Uploading plugin to QGIS Plugin repo." 180 | @echo "-------------------------------------" 181 | $(PLUGIN_UPLOAD) $(PLUGINNAME).zip 182 | 183 | transup: 184 | @echo 185 | @echo "------------------------------------------------" 186 | @echo "Updating translation files with any new strings." 187 | @echo "------------------------------------------------" 188 | @chmod +x scripts/update-strings.sh 189 | @scripts/update-strings.sh $(LOCALES) 190 | 191 | transcompile: 192 | @echo 193 | @echo "----------------------------------------" 194 | @echo "Compiled translation files to .qm files." 195 | @echo "----------------------------------------" 196 | @chmod +x scripts/compile-strings.sh 197 | @scripts/compile-strings.sh $(LRELEASE) $(LOCALES) 198 | 199 | transclean: 200 | @echo 201 | @echo "------------------------------------" 202 | @echo "Removing compiled translation files." 203 | @echo "------------------------------------" 204 | rm -f i18n/*.qm 205 | 206 | clean: 207 | @echo 208 | @echo "------------------------------------" 209 | @echo "Removing uic and rcc generated files" 210 | @echo "------------------------------------" 211 | rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES) 212 | 213 | doc: 214 | @echo 215 | @echo "------------------------------------" 216 | @echo "Building documentation using sphinx." 217 | @echo "------------------------------------" 218 | cd help; make html 219 | 220 | pylint: 221 | @echo 222 | @echo "-----------------" 223 | @echo "Pylint violations" 224 | @echo "-----------------" 225 | @pylint --reports=n --rcfile=pylintrc . || true 226 | @echo 227 | @echo "----------------------" 228 | @echo "If you get a 'no module named qgis.core' error, try sourcing" 229 | @echo "the helper script we have provided first then run make pylint." 230 | @echo "e.g. source run-env-linux.sh ; make pylint" 231 | @echo "----------------------" 232 | 233 | 234 | # Run pep8 style checking 235 | #http://pypi.python.org/pypi/pep8 236 | pep8: 237 | @echo 238 | @echo "-----------" 239 | @echo "PEP8 issues" 240 | @echo "-----------" 241 | @pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true 242 | @echo "-----------" 243 | @echo "Ignored in PEP8 check:" 244 | @echo $(PEP8EXCLUDE) 245 | -------------------------------------------------------------------------------- /README.html: -------------------------------------------------------------------------------- 1 |

QGIS_Dashboard


2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QGIS_Dashboard 2 | 3 | 4 |

5 | LuisGeo 6 | Twitter 7 |

8 |
9 |

Repository of the plugin for building Dashboards in QGIS


. 10 | The purpose of the QGIS Dashboard plugin is to allow the creation of dashboards on the QGIS screen.

11 |
12 |

THIS PLUGIN IS IN DEVELOPMENT (PRODUCTION)

. 13 |
14 |
15 | 16 | ## Table of Contents 17 | 18 | - [Introduction](https://www.linkedin.com/pulse/overview-installation-qgis-dashboard-plugin-perez-graterol) 19 | - [Why does QGIS need a Dashboard](https://www.linkedin.com/pulse/overview-installation-qgis-dashboard-plugin-perez-graterol) 20 | - [Installation of the QGIS Dashboard plugin](https://www.linkedin.com/pulse/overview-installation-qgis-dashboard-plugin-perez-graterol) 21 | - [Procedure for downloading the plugin](https://www.linkedin.com/pulse/overview-installation-qgis-dashboard-plugin-perez-graterol) 22 | - [Procedure for the installation](https://www.linkedin.com/pulse/overview-installation-qgis-dashboard-plugin-perez-graterol) 23 | - [QGIS Dashboard Plugin features](#QGIS-Dashboard-Plugin-features) 24 | - [Fast tutorial](#Fast-tutorial) 25 | - [Tutorial](#tutorial) 26 | - [General functioning of the plugin](#general-functioning-of-plugin) 27 | - [Charts and indicators available](#charts-and-indicators-available) 28 | - [Wizard for creating panels](#wizard-for-creating-panels) 29 | - [Initial configuration](#initial-configuration) 30 | - [Number of panels to build](#Number-of-panels-to-build) 31 | - [Initial size and position](#Initial-size-and-position) 32 | - [Additional options](#Additional-options) 33 | - [Design of charts and indicators](#Design-of-charts-and-indicators) 34 | - [Text panel](#Text-panel) 35 | - [Assigning a style](#Assigning-a-style) 36 | - [Setting colors](#Setting-color-colors) 37 | - [Integrating and configuring an icon](#Integrating-and-configuring-an-icon) 38 | - [Data queries](#Data-queries) 39 | - [Totalize an attribute](#Totalize-an-attribute) 40 | - [Percentage. Proportion](#Percentage.-Proportion) 41 | - [Statistics of an attribute](#Statistics-of-an-attribute) 42 | - [Spatial queries](#Spatial-queries) 43 | - [Contained entities. Polygons](#Contained-entities.-Polygons) 44 | - [Entities at a distance. Lines-points](#Entities-at-a-distance.-Lines-points) 45 | - [Contained entities matching with](#Contained-entities-matching-with) 46 | - [Entities at a distance containing with](#Entities-at-a-distance-containing-with) 47 | - [Indicator Graph](#Indicator-Plot) 48 | - [Bar Chart](#Bar-Chart) 49 | - [Line chart - Series](#Line-charts.-Series) 50 | - [Move, resize and delete panels](#Move-and-resize-panels) 51 | - [Make panels transparent](#Transparent-panels) 52 | - [Save a dashboard](#Save-a-board) 53 | - [Open a board from file](#Open-a-board-from-file) 54 | 55 | ## Tutorial 56 | 57 | ### General functioning of the plugin 58 | The Dashboards are built by creating panels which will contain indicators or graphs, the panels are customizable, the user can move, delete, resize using the QGIS annotation tools. 59 | This plugin takes advantage and extends through Python the Html Annotations of QGIS to give them more functionality, display graphs, respond to events. 60 | 61 | ### Charts and indicators available 62 | 63 | So far the plugin has four types of panels: 64 |
  • Text panels: they display a value or indicator of a dataset or spatial query. This panel although simple, presents the widest variety of styles and configurations. The value displayed can come from a statistical summary of a dataset or a spatial query. The spatial query options will vary depending on the geometry of the layer being queried. If it is a polygon layer you can query the contained entities belonging to another layer, you can also query the entities contained at a specified distance from the selected entities of the polygon layer (buffer). If it is line or point you can only query the contained entities of another layer at a specified distance from the selected entities. 65 |
  • Bullet chart also called 'bullet' or 'speedometer' chart, similarly to the text panel it displays a value or indicator, but in a context that facilitates its interpretation, the user must specify a range within which the value is expected to oscillate, plus a threshold value, after which the condition is considered unfavorable or favorable. 66 |
  • Bar Chart can display a bar chart of a numeric field given the categories of a text field in the attribute table. You can also generate the chart from a set of numeric fields present in the attribute table. As for the style you can configure colors and text sizes, you can also assign a color to the bars or use one of the available color palettes.
  • . 67 |
  • Line chart by means of this chart you can represent a set of data presenting a chronological sequence. It presents similar style configuration options to the bar chart. You can plot only points if you set a line thickness equal to 0, lines of the specified thickness or filled areas.
  • 68 |
69 | 70 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Plugin Builder Results 2 | 3 | Your plugin QGISDashboard was created in: 4 | E:/videoconferencias/Dashboard2/plugin\qgis_dashboard 5 | 6 | Your QGIS plugin directory is located at: 7 | C:/Users/Luis Eduardo/AppData/Roaming/QGIS/QGIS3/profiles/luis2/python/plugins 8 | 9 | What's Next: 10 | 11 | * Copy the entire directory containing your new plugin to the QGIS plugin 12 | directory 13 | 14 | * Compile the resources file using pyrcc5 15 | 16 | * Run the tests (``make test``) 17 | 18 | * Test the plugin by enabling it in the QGIS plugin manager 19 | 20 | * Customize it by editing the implementation file: ``QGIS_Dashboard.py`` 21 | 22 | * Create your own custom icon, replacing the default icon.png 23 | 24 | * Modify your user interface by opening QGISDashboard_dialog_base.ui in Qt Designer 25 | 26 | * You can use the Makefile to compile your Ui and resource files when 27 | you make changes. This requires GNU make (gmake) 28 | 29 | For more information, see the PyQGIS Developer Cookbook at: 30 | http://www.qgis.org/pyqgis-cookbook/index.html 31 | 32 | (C) 2011-2018 GeoApt LLC - geoapt.com 33 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 8 | ------------------- 9 | begin : 2021-06-14 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | git sha : $Format:%H$ 13 | ***************************************************************************/ 14 | 15 | /*************************************************************************** 16 | * * 17 | * This program is free software; you can redistribute it and/or modify * 18 | * it under the terms of the GNU General Public License as published by * 19 | * the Free Software Foundation; either version 2 of the License, or * 20 | * (at your option) any later version. * 21 | * * 22 | ***************************************************************************/ 23 | This script initializes the plugin, making it known to QGIS. 24 | """ 25 | 26 | 27 | # noinspection PyPep8Naming 28 | def classFactory(iface): # pylint: disable=invalid-name 29 | """Load QGISDashboard class from file QGISDashboard. 30 | 31 | :param iface: A QGIS interface instance. 32 | :type iface: QgsInterface 33 | """ 34 | # 35 | from .QGIS_Dashboard import QGISDashboard 36 | return QGISDashboard(iface) 37 | -------------------------------------------------------------------------------- /__pycache__/QGISDashboardDialog.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/__pycache__/QGISDashboardDialog.cpython-37.pyc -------------------------------------------------------------------------------- /__pycache__/QGIS_Dashboard.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/__pycache__/QGIS_Dashboard.cpython-37.pyc -------------------------------------------------------------------------------- /__pycache__/QGIS_Dashboard_dialog.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/__pycache__/QGIS_Dashboard_dialog.cpython-37.pyc -------------------------------------------------------------------------------- /__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /__pycache__/register.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/__pycache__/register.cpython-37.pyc -------------------------------------------------------------------------------- /calculations/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /calculations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/calculations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /calculations/__pycache__/dataQuery.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/calculations/__pycache__/dataQuery.cpython-37.pyc -------------------------------------------------------------------------------- /calculations/__pycache__/spatialQuery.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/calculations/__pycache__/spatialQuery.cpython-37.pyc -------------------------------------------------------------------------------- /calculations/dataQuery.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis.core import QgsProject, QgsVectorLayer, QgsFeature, QgsStatisticalSummary 15 | 16 | #Concultar datos 17 | class queriesData: 18 | 19 | #totalizar clases, totaliza un campo numerico por un campo categorico 20 | @staticmethod 21 | def summarizeClasses(listaEntidades,campoC,campoN): 22 | resultado=dict() 23 | for e in listaEntidades: 24 | categoria=e[campoC] 25 | valor=e[campoN] 26 | if type(valor)==int or type(valor)==float: 27 | if categoria in resultado: 28 | resultado[categoria]=resultado[categoria]+valor 29 | else: 30 | resultado[categoria]=valor 31 | return resultado 32 | 33 | #totalizar campos: totaliza todos los campos numericos 34 | @staticmethod 35 | def summarizeFields(listaEntidades,listaCampos): 36 | resultado=dict() 37 | for e in listaEntidades: 38 | for c in listaCampos: 39 | valor=e[c] 40 | if type(valor)==int or type(valor)==float: 41 | if c in resultado: 42 | resultado[c]=resultado[c]+valor 43 | else: 44 | resultado[c]=valor 45 | return resultado 46 | 47 | #Calcular el porcentaje del valor de un campo de las entidades seleccionadas 48 | #considera si el total existe como una variable o no, por defecto el total es None 49 | @staticmethod 50 | def porcentaje(listaEntidades,campo,capa=None,total=None): 51 | if total==None: 52 | sumat=sum([f[campo] for f in capa.getFeatures() if type(f[campo])==int or type(f[campo])==float ]) 53 | valorSelec= sum([f[campo] for f in listaEntidades if type(f[campo])==int or type(f[campo])==float ]) 54 | resultado=(valorSelec*100)/sumat 55 | else: 56 | valorSelec= sum([f[campo] for f in listaEntidades if type(f[campo])==int or type(f[campo])==float ]) 57 | resultado=(valorSelec*100)/total 58 | return resultado 59 | 60 | @staticmethod 61 | def valuesSelectRegister(listaEntidades,campoC,listCamposN,max): 62 | resultado=[] 63 | for e,i in enumerate(listaEntidades): 64 | if e==max: 65 | break 66 | categoria=i[campoC] 67 | dicc=dict() 68 | for c in listCamposN: 69 | valor=i[c] 70 | if type(valor)==int or type(valor)==float: 71 | if c in dicc: 72 | dicc[c]=dicc[c]+valor 73 | else: 74 | dicc[c]=valor 75 | else: 76 | if c in dicc: 77 | dicc[c]=dicc[c]+0 78 | else: 79 | dicc[c]=0 80 | resultado.append((categoria,dicc)) 81 | return resultado 82 | 83 | @staticmethod 84 | def statisticsField(lentidades,campo,operador): 85 | ncampo=campo 86 | if operador=='min': 87 | stat = QgsStatisticalSummary(QgsStatisticalSummary.Min) 88 | stat.calculate([i[ncampo] for i in lentidades]) 89 | min=stat.min() 90 | return min 91 | elif operador=='max': 92 | stat = QgsStatisticalSummary(QgsStatisticalSummary.Max) 93 | stat.calculate([i[ncampo] for i in lentidades]) 94 | max=stat.max() 95 | return max 96 | elif operador=='mean': 97 | stat = QgsStatisticalSummary(QgsStatisticalSummary.Mean) 98 | stat.calculate([i[ncampo] for i in lentidades]) 99 | mean=stat.mean() 100 | return mean 101 | elif operador=='range': 102 | stat = QgsStatisticalSummary(QgsStatisticalSummary.Range) 103 | stat.calculate([i[ncampo] for i in lentidades]) 104 | rango=stat.range() 105 | return rango 106 | elif operador=='median': 107 | stat = QgsStatisticalSummary(QgsStatisticalSummary.Median) 108 | stat.calculate([i[ncampo] for i in lentidades]) 109 | mediana=stat.median() 110 | return mediana 111 | 112 | -------------------------------------------------------------------------------- /calculations/spatialQuery.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis.core import QgsProject, QgsProcessingFeatureSourceDefinition,\ 15 | QgsCoordinateTransform, QgsGeometry, QgsSpatialIndex,QgsFeatureRequest,\ 16 | QgsGeometryEngine,QgsProcessingFeedback, QgsVectorLayer, QgsField, QgsFeature 17 | import processing 18 | from qgis.PyQt.QtCore import QVariant 19 | #import ..decorator 20 | #from ..decorator.medirTiempo import medirTiempo 21 | 22 | class spatialQueries: 23 | @staticmethod 24 | # @medirTiempo 25 | def containsCountSecuencial(capa,capa2): 26 | equalCoord=True 27 | if capa.crs()!=capa2.crs(): 28 | equalCoord=False 29 | if capa.crs().isGeographic()==False: 30 | scf=capa.crs() 31 | sci=capa2.crs() 32 | else: 33 | sci=capa.crs() 34 | scf=capa2.crs() 35 | transform=QgsCoordinateTransform(sci, scf, QgsProject.instance()) 36 | conteo=0 37 | for i in capa.selectedFeatures(): 38 | geo=i.geometry() 39 | if equalCoord==False: 40 | geo.transform(transform) 41 | for j in capa2.getFeatures(): 42 | if geo.boundingBoxIntersects(j.geometry()): 43 | if geo.contains(j.geometry()): 44 | conteo=conteo+1 45 | return conteo 46 | 47 | @staticmethod 48 | # @medirTiempo 49 | def containsCountOptimi(capa,capa2,IE): 50 | equalCoord=True 51 | if capa.crs()!=capa2.crs(): 52 | equalCoord=False 53 | if capa.crs().isGeographic()==False: 54 | scf=capa.crs() 55 | sci=capa2.crs() 56 | else: 57 | sci=capa.crs() 58 | scf=capa2.crs() 59 | transform=QgsCoordinateTransform(sci, scf, QgsProject.instance()) 60 | conteo=0 61 | for i in capa.selectedFeatures(): 62 | geo=i.geometry() 63 | if equalCoord==False: 64 | geo.transform(transform) 65 | engine = QgsGeometry.createGeometryEngine(geo.constGet()) 66 | engine.prepareGeometry() 67 | candidate_ids = index.intersects(geo.boundingBox()) 68 | req = QgsFeatureRequest().setFilterFids(candidate_ids) 69 | for c in capa2.getFeatures(req): 70 | if engine.contains(c.geometry().constGet()): 71 | conteo += 1 72 | return conteo 73 | 74 | @staticmethod 75 | # @medirTiempo 76 | def containsCountProcess(capa,capa2): 77 | selection=False 78 | idsSelect=None 79 | if capa2.selectedFeatureCount()>0: 80 | selection=True 81 | idsSelect=capa2.selectedFeatureIds() 82 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 83 | result=capa2.dataProvider().createSpatialIndex() 84 | pre=6 #contains 85 | inters=QgsProcessingFeatureSourceDefinition(capa.source(),True) 86 | metodo=0 #new selection 87 | param={'INPUT':capa2, 88 | 'PREDICATE':pre, 89 | 'INTERSECT':inters, 90 | 'METHOD':metodo } 91 | alg_name = 'native:selectbylocation' 92 | feedback = QgsProcessingFeedback() 93 | processing.run(alg_name,param,feedback=feedback) 94 | c=capa2.selectedFeatureCount() 95 | if selection is True: 96 | capa2.selectByIds(idsSelect) 97 | else: 98 | capa2.removeSelection() 99 | return c 100 | 101 | @staticmethod 102 | # @medirTiempo 103 | def containsCountAttribProcess(capa,capa2,campo,atributo): 104 | selection=False 105 | idsSelect=None 106 | if capa2.selectedFeatureCount()>0: 107 | selection=True 108 | idsSelect=capa2.selectedFeatureIds() 109 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 110 | result=capa2.dataProvider().createSpatialIndex() 111 | pre=6 #contains 112 | inters=QgsProcessingFeatureSourceDefinition(capa.source(),True) 113 | metodo=0 #new selection 114 | param={'INPUT':capa2, 115 | 'PREDICATE':pre, 116 | 'INTERSECT':inters, 117 | 'METHOD':metodo } 118 | alg_name = 'native:selectbylocation' 119 | feedback = QgsProcessingFeedback() 120 | processing.run(alg_name,param,feedback=feedback) 121 | featIds=capa2.selectedFeatureIds() 122 | if selection is True: 123 | capa2.selectByIds(idsSelect) 124 | else: 125 | capa2.removeSelection() 126 | idCampo=capa2.fields().indexOf(campo) 127 | reqts= QgsFeatureRequest().setFilterFids(featIds) 128 | reqts.setFlags(QgsFeatureRequest.NoGeometry ) 129 | reqts.setSubsetOfAttributes([idCampo]) 130 | lfeat=capa2.getFeatures(reqts) 131 | field=capa2.fields().field(campo) 132 | conteo=0 133 | if field.isNumeric: 134 | try: 135 | atributo=float(atributo) 136 | except: 137 | pass 138 | for i in lfeat: 139 | valor=i[campo] 140 | if i[campo]==atributo: 141 | conteo=conteo+1 142 | del(lfeat) 143 | del(featIds) 144 | return conteo 145 | 146 | @staticmethod 147 | def densityProcess(capa,capa2,divisor=1): 148 | selection=False 149 | idsSelect=None 150 | if capa2.selectedFeatureCount()>0: 151 | selection=True 152 | idsSelect=capa2.selectedFeatureIds() 153 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 154 | result=capa2.dataProvider().createSpatialIndex() 155 | 156 | area=sum([i.geometry().area() for i in capa.selectedFeatures()]) 157 | area=area/divisor 158 | pre=6 #contains 159 | inters=QgsProcessingFeatureSourceDefinition(capa.source(),True) 160 | metodo=0 #new selection 161 | param={'INPUT':capa2, 162 | 'PREDICATE':pre, 163 | 'INTERSECT':inters, 164 | 'METHOD':metodo } 165 | alg_name = 'native:selectbylocation' 166 | feedback = QgsProcessingFeedback() 167 | processing.run(alg_name,param,feedback=feedback) 168 | c=capa2.selectedFeatureCount() 169 | if selection is True: 170 | capa2.selectByIds(idsSelect) 171 | else: 172 | capa2.removeSelection() 173 | return c/area 174 | 175 | @staticmethod 176 | def densityAttribProcess(capa,capa2,campo,divisor=1): 177 | selection=False 178 | idsSelect=None 179 | if capa2.selectedFeatureCount()>0: 180 | selection=True 181 | idsSelect=capa2.selectedFeatureIds() 182 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 183 | result=capa2.dataProvider().createSpatialIndex() 184 | 185 | area=sum([i.geometry().area() for i in capa.selectedFeatures()]) 186 | area=area/divisor 187 | pre=6 #contains 188 | inters=QgsProcessingFeatureSourceDefinition(capa.source(),True) 189 | metodo=0 #new selection 190 | param={'INPUT':capa2, 191 | 'PREDICATE':pre, 192 | 'INTERSECT':inters, 193 | 'METHOD':metodo } 194 | alg_name = 'native:selectbylocation' 195 | feedback = QgsProcessingFeedback() 196 | processing.run(alg_name,param,feedback=feedback) 197 | 198 | accum=sum([i[campo] for i in capa2.selectedFeatures()\ 199 | if type(i[campo])==int or type(i[campo])==float]) 200 | 201 | if selection is True: 202 | capa2.selectByIds(idsSelect) 203 | else: 204 | capa2.removeSelection() 205 | return accum/area 206 | 207 | @staticmethod 208 | def bufferCountProcess(capa,capa2,dist): 209 | selection=False 210 | idsSelect=None 211 | if capa2.selectedFeatureCount()>0: 212 | selection=True 213 | idsSelect=capa2.selectedFeatureIds() 214 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 215 | result=capa2.dataProvider().createSpatialIndex() 216 | 217 | crs=capa.crs().authid() 218 | # uri="polygon?CRS="+crs 219 | uri="polygon?crs="+capa.crs().toWkt() 220 | capaTemp=QgsVectorLayer(uri, "capa temp", "memory") 221 | if capaTemp.crs().authid()!=crs: 222 | capaTemp.setCrs(capa.sourceCrs()) 223 | campID = QgsField("ID", QVariant.String) 224 | capaTemp.dataProvider().addAttributes([campID]) 225 | capaTemp.updateFields() 226 | entidades=[] 227 | 228 | for e,i in enumerate(capa.selectedFeatures()): 229 | feat=QgsFeature() 230 | feat.setFields(capaTemp.fields()) 231 | feat.setAttribute(0,e) 232 | geom=i.geometry() 233 | buffer=geom.buffer(dist,10) 234 | feat.setGeometry(buffer) 235 | entidades.append(feat) 236 | capaTemp.dataProvider().addFeatures(entidades) 237 | 238 | pre=6 #contains 239 | inters=capaTemp 240 | metodo=0 #new selection 241 | param={'INPUT':capa2, 242 | 'PREDICATE':pre, 243 | 'INTERSECT':inters, 244 | 'METHOD':metodo } 245 | alg_name = 'native:selectbylocation' 246 | feedback = QgsProcessingFeedback() 247 | processing.run(alg_name,param,feedback=feedback) 248 | conteo=capa2.selectedFeatureCount() 249 | if selection is True: 250 | capa2.selectByIds(idsSelect) 251 | else: 252 | capa2.removeSelection() 253 | del(capaTemp) 254 | return conteo 255 | 256 | @staticmethod 257 | def bufferAttribProcess(capa,capa2,dist,campo,atributo,tipo='conteo'): 258 | selection=False 259 | idsSelect=None 260 | if capa2.selectedFeatureCount()>0: 261 | selection=True 262 | idsSelect=capa2.selectedFeatureIds() 263 | if capa2.featureCount()>1000 and capa2.hasSpatialIndex()!=2: 264 | result=capa2.dataProvider().createSpatialIndex() 265 | crs=capa.crs().authid() 266 | # uri="polygon?CRS="+crs 267 | uri="polygon?crs="+capa.crs().toWkt() 268 | capaTemp=QgsVectorLayer(uri, "capa temp", "memory") 269 | if capaTemp.crs().authid()!=crs: 270 | capaTemp.setCrs(capa.sourceCrs()) 271 | campID = QgsField("ID", QVariant.String) 272 | capaTemp.dataProvider().addAttributes([campID]) 273 | capaTemp.updateFields() 274 | entidades=[] 275 | 276 | for e,i in enumerate(capa.selectedFeatures()): 277 | feat=QgsFeature() 278 | feat.setFields(capaTemp.fields()) 279 | feat.setAttribute(0,e) 280 | geom=i.geometry() 281 | buffer=geom.buffer(dist,10) 282 | feat.setGeometry(buffer) 283 | entidades.append(feat) 284 | capaTemp.dataProvider().addFeatures(entidades) 285 | 286 | pre=6 #contains 287 | inters=capaTemp 288 | metodo=0 #new selection 289 | param={'INPUT':capa2, 290 | 'PREDICATE':pre, 291 | 'INTERSECT':inters, 292 | 'METHOD':metodo } 293 | alg_name = 'native:selectbylocation' 294 | feedback = QgsProcessingFeedback() 295 | processing.run(alg_name,param,feedback=feedback) 296 | 297 | ids=capa2.selectedFeatureIds() 298 | idCampo=capa2.fields().indexOf(campo) 299 | request= QgsFeatureRequest().setFilterFids(ids) 300 | request.setFlags(QgsFeatureRequest.NoGeometry ) 301 | request.setSubsetOfAttributes([idCampo]) 302 | listResult=capa2.getFeatures(request) 303 | resultado=0 304 | if tipo=='conteo': 305 | for i in listResult: 306 | if i[campo]==atributo: 307 | resultado=resultado+1 308 | elif tipo=='sum': 309 | for i in listResult: 310 | valor=i[campo] 311 | if type(valor)==int or type(valor)==float: 312 | resultado=resultado+valor 313 | if selection is True: 314 | capa2.selectByIds(idsSelect) 315 | else: 316 | capa2.removeSelection() 317 | del(capaTemp) 318 | return resultado -------------------------------------------------------------------------------- /decorator/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /decorator/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/decorator/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /decorator/__pycache__/medirTiempo.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/decorator/__pycache__/medirTiempo.cpython-37.pyc -------------------------------------------------------------------------------- /decorator/medirTiempo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import time 15 | 16 | def medirTiempo(func): 17 | def wrapper(*args): 18 | starttime = time.perf_counter() 19 | d=func(*args) 20 | endtime = time.perf_counter() 21 | print(f"Duración: {endtime - starttime} seconds, ",d) 22 | return wrapper -------------------------------------------------------------------------------- /fix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/fix.png -------------------------------------------------------------------------------- /help/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 14 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " singlehtml to make a single large HTML file" 22 | @echo " pickle to make pickle files" 23 | @echo " json to make JSON files" 24 | @echo " htmlhelp to make HTML files and a HTML help project" 25 | @echo " qthelp to make HTML files and a qthelp project" 26 | @echo " devhelp to make HTML files and a Devhelp project" 27 | @echo " epub to make an epub" 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 30 | @echo " text to make text files" 31 | @echo " man to make manual pages" 32 | @echo " changes to make an overview of all changed/added/deprecated items" 33 | @echo " linkcheck to check all external links for integrity" 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 35 | 36 | clean: 37 | -rm -rf $(BUILDDIR)/* 38 | 39 | html: 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 43 | 44 | dirhtml: 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 48 | 49 | singlehtml: 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 51 | @echo 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 53 | 54 | pickle: 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 56 | @echo 57 | @echo "Build finished; now you can process the pickle files." 58 | 59 | json: 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 61 | @echo 62 | @echo "Build finished; now you can process the JSON files." 63 | 64 | htmlhelp: 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 66 | @echo 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." 69 | 70 | qthelp: 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 72 | @echo 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/template_class.qhcp" 76 | @echo "To view the help file:" 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/template_class.qhc" 78 | 79 | devhelp: 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 81 | @echo 82 | @echo "Build finished." 83 | @echo "To view the help file:" 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/template_class" 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/template_class" 86 | @echo "# devhelp" 87 | 88 | epub: 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 90 | @echo 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 92 | 93 | latex: 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 95 | @echo 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 98 | "(use \`make latexpdf' here to do that automatically)." 99 | 100 | latexpdf: 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 102 | @echo "Running LaTeX files through pdflatex..." 103 | make -C $(BUILDDIR)/latex all-pdf 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 105 | 106 | text: 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 108 | @echo 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 110 | 111 | man: 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 113 | @echo 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 115 | 116 | changes: 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 118 | @echo 119 | @echo "The overview file is in $(BUILDDIR)/changes." 120 | 121 | linkcheck: 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 123 | @echo 124 | @echo "Link check complete; look for any errors in the above output " \ 125 | "or in $(BUILDDIR)/linkcheck/output.txt." 126 | 127 | doctest: 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 129 | @echo "Testing of doctests in the sources finished, look at the " \ 130 | "results in $(BUILDDIR)/doctest/output.txt." 131 | -------------------------------------------------------------------------------- /help/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source 10 | if NOT "%PAPER%" == "" ( 11 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 12 | ) 13 | 14 | if "%1" == "" goto help 15 | 16 | if "%1" == "help" ( 17 | :help 18 | echo.Please use `make ^` where ^ is one of 19 | echo. html to make standalone HTML files 20 | echo. dirhtml to make HTML files named index.html in directories 21 | echo. singlehtml to make a single large HTML file 22 | echo. pickle to make pickle files 23 | echo. json to make JSON files 24 | echo. htmlhelp to make HTML files and a HTML help project 25 | echo. qthelp to make HTML files and a qthelp project 26 | echo. devhelp to make HTML files and a Devhelp project 27 | echo. epub to make an epub 28 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 29 | echo. text to make text files 30 | echo. man to make manual pages 31 | echo. changes to make an overview over all changed/added/deprecated items 32 | echo. linkcheck to check all external links for integrity 33 | echo. doctest to run all doctests embedded in the documentation if enabled 34 | goto end 35 | ) 36 | 37 | if "%1" == "clean" ( 38 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 39 | del /q /s %BUILDDIR%\* 40 | goto end 41 | ) 42 | 43 | if "%1" == "html" ( 44 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 45 | echo. 46 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 47 | goto end 48 | ) 49 | 50 | if "%1" == "dirhtml" ( 51 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 52 | echo. 53 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 54 | goto end 55 | ) 56 | 57 | if "%1" == "singlehtml" ( 58 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 59 | echo. 60 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 61 | goto end 62 | ) 63 | 64 | if "%1" == "pickle" ( 65 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 66 | echo. 67 | echo.Build finished; now you can process the pickle files. 68 | goto end 69 | ) 70 | 71 | if "%1" == "json" ( 72 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 73 | echo. 74 | echo.Build finished; now you can process the JSON files. 75 | goto end 76 | ) 77 | 78 | if "%1" == "htmlhelp" ( 79 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 80 | echo. 81 | echo.Build finished; now you can run HTML Help Workshop with the ^ 82 | .hhp project file in %BUILDDIR%/htmlhelp. 83 | goto end 84 | ) 85 | 86 | if "%1" == "qthelp" ( 87 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 88 | echo. 89 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 90 | .qhcp project file in %BUILDDIR%/qthelp, like this: 91 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\template_class.qhcp 92 | echo.To view the help file: 93 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\template_class.ghc 94 | goto end 95 | ) 96 | 97 | if "%1" == "devhelp" ( 98 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 99 | echo. 100 | echo.Build finished. 101 | goto end 102 | ) 103 | 104 | if "%1" == "epub" ( 105 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 106 | echo. 107 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 108 | goto end 109 | ) 110 | 111 | if "%1" == "latex" ( 112 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 113 | echo. 114 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 115 | goto end 116 | ) 117 | 118 | if "%1" == "text" ( 119 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 120 | echo. 121 | echo.Build finished. The text files are in %BUILDDIR%/text. 122 | goto end 123 | ) 124 | 125 | if "%1" == "man" ( 126 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 127 | echo. 128 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 129 | goto end 130 | ) 131 | 132 | if "%1" == "changes" ( 133 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 134 | echo. 135 | echo.The overview file is in %BUILDDIR%/changes. 136 | goto end 137 | ) 138 | 139 | if "%1" == "linkcheck" ( 140 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 141 | echo. 142 | echo.Link check complete; look for any errors in the above output ^ 143 | or in %BUILDDIR%/linkcheck/output.txt. 144 | goto end 145 | ) 146 | 147 | if "%1" == "doctest" ( 148 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 149 | echo. 150 | echo.Testing of doctests in the sources finished, look at the ^ 151 | results in %BUILDDIR%/doctest/output.txt. 152 | goto end 153 | ) 154 | 155 | :end 156 | -------------------------------------------------------------------------------- /help/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # QGISDashboard documentation build configuration file, created by 4 | # sphinx-quickstart on Sun Feb 12 17:11:03 2012. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.viewcode'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'QGISDashboard' 44 | copyright = u'2013, Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '0.1' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '0.1' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = [] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_TemplateModuleNames = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_domain_indices = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 | #html_show_sphinx = True 154 | 155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 156 | #html_show_copyright = True 157 | 158 | # If true, an OpenSearch description file will be output, and all pages will 159 | # contain a tag referring to it. The value of this option must be the 160 | # base URL from which the finished HTML is served. 161 | #html_use_opensearch = '' 162 | 163 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 164 | #html_file_suffix = None 165 | 166 | # Output file base name for HTML help builder. 167 | htmlhelp_basename = 'TemplateClassdoc' 168 | 169 | 170 | # -- Options for LaTeX output -------------------------------------------------- 171 | 172 | # The paper size ('letter' or 'a4'). 173 | #latex_paper_size = 'letter' 174 | 175 | # The font size ('10pt', '11pt' or '12pt'). 176 | #latex_font_size = '10pt' 177 | 178 | # Grouping the document tree into LaTeX files. List of tuples 179 | # (source start file, target name, title, author, documentclass [howto/manual]). 180 | latex_documents = [ 181 | ('index', 'QGISDashboard.tex', u'QGISDashboard Documentation', 182 | u'Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/', 'manual'), 183 | ] 184 | 185 | # The name of an image file (relative to this directory) to place at the top of 186 | # the title page. 187 | #latex_logo = None 188 | 189 | # For "manual" documents, if this is true, then toplevel headings are parts, 190 | # not chapters. 191 | #latex_use_parts = False 192 | 193 | # If true, show page references after internal links. 194 | #latex_show_pagerefs = False 195 | 196 | # If true, show URL addresses after external links. 197 | #latex_show_urls = False 198 | 199 | # Additional stuff for the LaTeX preamble. 200 | #latex_preamble = '' 201 | 202 | # Documents to append as an appendix to all manuals. 203 | #latex_appendices = [] 204 | 205 | # If false, no module index is generated. 206 | #latex_domain_indices = True 207 | 208 | 209 | # -- Options for manual page output -------------------------------------------- 210 | 211 | # One entry per manual page. List of tuples 212 | # (source start file, name, description, authors, manual section). 213 | man_pages = [ 214 | ('index', 'TemplateClass', u'QGISDashboard Documentation', 215 | [u'Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/'], 1) 216 | ] 217 | -------------------------------------------------------------------------------- /help/source/index.rst: -------------------------------------------------------------------------------- 1 | .. QGISDashboard documentation master file, created by 2 | sphinx-quickstart on Sun Feb 12 17:11:03 2012. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to QGISDashboard's documentation! 7 | ============================================ 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | Indices and tables 15 | ================== 16 | 17 | * :ref:`genindex` 18 | * :ref:`modindex` 19 | * :ref:`search` 20 | 21 | -------------------------------------------------------------------------------- /i18n/af.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @default 5 | 6 | 7 | Good morning 8 | Goeie more 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/icon.png -------------------------------------------------------------------------------- /images/b1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b1.png -------------------------------------------------------------------------------- /images/b11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b11.png -------------------------------------------------------------------------------- /images/b1a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b1a.png -------------------------------------------------------------------------------- /images/b2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b2.png -------------------------------------------------------------------------------- /images/b2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b2a.png -------------------------------------------------------------------------------- /images/b3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b3.png -------------------------------------------------------------------------------- /images/b3a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b3a.png -------------------------------------------------------------------------------- /images/b4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b4.png -------------------------------------------------------------------------------- /images/b4a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b4a.png -------------------------------------------------------------------------------- /images/b5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b5.png -------------------------------------------------------------------------------- /images/b5a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b5a.png -------------------------------------------------------------------------------- /images/b6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b6.png -------------------------------------------------------------------------------- /images/b6a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/b6a.png -------------------------------------------------------------------------------- /images/barras.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/barras.png -------------------------------------------------------------------------------- /images/iconCenter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/iconCenter.png -------------------------------------------------------------------------------- /images/iconTop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/iconTop.png -------------------------------------------------------------------------------- /images/indicador.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/indicador.png -------------------------------------------------------------------------------- /images/lserie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/lserie.png -------------------------------------------------------------------------------- /images/panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/panel.png -------------------------------------------------------------------------------- /images/serie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/images/serie.png -------------------------------------------------------------------------------- /loadRuta.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | dir= r'C:\Users\Luis Eduardo\AppData\Roaming\QGIS\QGIS3\profiles\teledec\python\plugins\qgis_dashboard' 4 | sys.path.append(dir) -------------------------------------------------------------------------------- /log.txt: -------------------------------------------------------------------------------- 1 | 2 | text 3 | can only concatenate str (not "QColor") to str 4 | local variable 'tp' referenced before assignment 5 | can only concatenate str (not "QColor") to str 6 | local variable 'tp' referenced before assignment 7 | can only concatenate str (not "QColor") to str 8 | local variable 'tp' referenced before assignment 9 | can only concatenate str (not "QColor") to str 10 | local variable 'tp' referenced before assignment 11 | can only concatenate str (not "QColor") to str 12 | local variable 'tp' referenced before assignment 13 | can only concatenate str (not "QColor") to str 14 | local variable 'tp' referenced before assignment 15 | No se pudieron remover los paneles de la lista 16 | Archivo persistente a borrar 'QgsTextAnnotation' object has no attribute 'tempf' 17 | No se pudieron remover los paneles de la lista 18 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 19 | No se pudieron remover los paneles de la lista 20 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 21 | No se pudieron remover los paneles de la lista 22 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 23 | No se pudieron remover los paneles de la lista 24 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 25 | No se pudieron remover los paneles de la lista 26 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 27 | No se pudieron remover los paneles de la lista 28 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 29 | No se pudieron remover los paneles de la lista 30 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 31 | No se pudieron remover los paneles de la lista 32 | Archivo persistente a borrar 'QgsHtmlAnnotation' object has no attribute 'tempf' 33 | No se pudieron remover los paneles de la lista 34 | -------------------------------------------------------------------------------- /metadata.txt: -------------------------------------------------------------------------------- 1 | # This file contains metadata for your plugin. 2 | 3 | # This file should be included when you package your plugin.# Mandatory items: 4 | 5 | [general] 6 | name=QGISDashboard 7 | qgisMinimumVersion=3.10 8 | description=This plugin allows the construction and management of Dashboards on screen. 9 | version=0.1 10 | author=Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email=luis3176@yahoo.com 12 | 13 | about=The QGIS Dashboards Plugin provides a wizard that facilitates the creation of Dashboards on screen, formed by panels, showing indicators or graphs. It also has tools for dashboard management. 14 | 15 | tracker=http://bugs 16 | repository=http://repo 17 | # End of mandatory metadata 18 | 19 | # Recommended items: 20 | 21 | hasProcessingProvider=no 22 | # Uncomment the following line and add your changelog: 23 | # changelog= 24 | 25 | # Tags are comma separated with spaces allowed 26 | tags=spatial query, dashboard, calculator 27 | 28 | homepage=http://homepage 29 | category=Plugins 30 | icon=icon.png 31 | # experimental flag 32 | experimental=True 33 | 34 | # deprecated flag (applies to the whole plugin, not just a single version) 35 | deprecated=False 36 | 37 | # Since QGIS 3.8, a comma separated list of plugins to be installed 38 | # (or upgraded) can be specified. 39 | # Check the documentation for more information. 40 | # plugin_dependencies= 41 | 42 | Category of the plugin: Raster, Vector, Database or Web 43 | # category= 44 | 45 | # If the plugin can run on QGIS Server. 46 | server=False 47 | 48 | -------------------------------------------------------------------------------- /myUtils/__pycache__/Utils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/myUtils/__pycache__/Utils.cpython-37.pyc -------------------------------------------------------------------------------- /myUtils/__pycache__/dashColors.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/myUtils/__pycache__/dashColors.cpython-37.pyc -------------------------------------------------------------------------------- /myUtils/__pycache__/myUtils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/myUtils/__pycache__/myUtils.cpython-37.pyc -------------------------------------------------------------------------------- /myUtils/dashColors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import random 15 | import numpy as np 16 | 17 | contrast=['red','blue','green','lightblue','magenta','orange','cyan','gray','darkblue','lightgray', 18 | 'purple','cyan','pink','rgb(229,245,249)','yellow','rgb(217,95,14)','rgb(255,247,188)', 19 | 'rgb(201,148,199)','rgb(127,205,187)','rgb(117,107,177)','rgb(199,233,180)','rgb(0,109,44)', 20 | 'rgb(55,250,188)'] 21 | 22 | breBlues=['rgb(230,242,255)','rgb(198,247,247)','rgb(247,252,240)','rgb(224,243,219)','rgb(204,235,197)', 23 | 'rgb(168,221,181)','rgb(0, 204, 255)','rgb(77, 136, 255)','rgb(102, 179, 255)','rgb(123,204,196)', 24 | 'rgb(78,179,211)','rgb(51, 153, 255)','rgb(77, 136, 255)','rgb(0, 184, 230)','rgb(43,140,190)', 25 | 'rgb(8,104,172)','rgb(0, 143, 179)','rgb(0, 122, 153)','rgb(0, 102, 128)','rgb(8,64,129)'] 26 | 27 | whiteRed=['rgb(255,255,255)','rgb(255,230,240)','rgb(255,179,209)','rgb(255,179,209)','rgb(255,153,194)', 28 | 'rgb(255,128,179)','rgb(255,102,163)','rgb(255,77,148)','rgb(255,51,133)','rgb(255,26,117)', 29 | 'rgb(255,0,102)','rgb(230,0,92)','rgb(rgb(204,0,82)','rgb(179,0,71)','rgb(153,0,61)','rgb(128,0,51)', 30 | 'rgb(102,0,41)','rgb(77,0,31)','rgb(51,0,20)','rgb(26,0,10)'] 31 | 32 | whiteBlue=['rgb(255,255,255)','rgb(204,255,255)','rgb(153,255,255)','rgb(102,255,255)','rgb(26,255,255)', 33 | 'rgb(153,230,255)','rgb(128,223,255)','rgb(102,217,255)','rgb(51,204,255)','rgb(0,191,255)', 34 | 'rgb(51,153,255)','rgb(0,153,255)','rgb(51,102,255)','rgb(51,133,255)','rgb(26,117,255)', 35 | 'rgb(51,51,255)','rgb(26,26,255)','rgb(0,0,255)','rgb(0,92,230)','rgb(0,57,230)','rgb(0,45,179)', 36 | 'rgb(0,38,153)','rgb(0,32,128)'] 37 | palettes={'contrast':contrast,'breBlues':breBlues,'whiteRed':whiteRed,'whiteBlue':whiteBlue} 38 | 39 | class dashColors: 40 | def __init__(self): 41 | self.v=0 42 | @staticmethod 43 | def returnPalette(paleta=palettes): 44 | return paleta.keys() 45 | 46 | @staticmethod 47 | def getPalette(name,nclasses,paleta=palettes): 48 | palettes=paleta 49 | if name in palettes: 50 | palet=palettes[name] 51 | else: 52 | palet=palettes['contrast'] 53 | ncolors=len(palet) 54 | if nclasses<=ncolors: 55 | div=ncolors//nclasses 56 | listc=[palet[i] for i in range(0,ncolors,div)] 57 | return "['"+"','".join(listc)+"']" 58 | else: 59 | nmissing=nclasses-ncolors 60 | if palet==breBlues or palet==whiteBlue: 61 | red=np.random.randint(0,255,nmissing) 62 | green=np.random.randint(0,255,nmissing) 63 | l1=",255)','rgb(".join(str(i[0])+','+str(i[1]) for i in zip(red,green)) 64 | if palet==breBlues: 65 | olist="','".join(breBlues)+"'" 66 | else: 67 | olist="','".join(whiteBlue)+"'" 68 | return "['"+olist+",'rgb("+l1+",255)'"+"]" 69 | elif palet==contrast: 70 | red=np.random.randint(0,255,nmissing) 71 | green=np.random.randint(0,255,nmissing) 72 | blue=np.random.randint(0,255,nmissing) 73 | lista=[] 74 | for e,z in enumerate(zip(green,blue)): 75 | t="'rgb("+str(red[e])+',' 76 | t2=','.join(str(e) for e in z)+")'" 77 | lista.append(t+t2) 78 | olist="','".join(contrast)+"'," 79 | return "['"+olist+','.join(lista)+']' 80 | elif palet==whiteRed: 81 | green=np.random.randint(0,255,nmissing) 82 | blue=np.random.randint(0,255,nmissing) 83 | lista=[] 84 | for z in zip(green,blue): 85 | t="'rgb(255," 86 | t2=','.join(str(e) for e in z)+")'" 87 | lista.append(t+t2) 88 | olist="','".join(whiteRed)+"'," 89 | return "['"+olist+','.join(lista)+']' 90 | 91 | 92 | -------------------------------------------------------------------------------- /myUtils/myUtils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis.core import QgsProject 15 | from qgis import PyQt 16 | from qgis.PyQt.QtGui import QColor 17 | 18 | def qcolorToStr(qcolor): 19 | if type(qcolor)==QColor: 20 | return 'rgb('+','.join([str(qcolor.red()),str(qcolor.green()),str(qcolor.blue())])+')' 21 | else: 22 | return qcolor 23 | 24 | class utils: 25 | @staticmethod 26 | def splitText(cadena): 27 | resultado=[] 28 | lbr=[] 29 | for e,texto in enumerate(cadena): 30 | if len(texto)>10: 31 | l=[texto[i:i+10] for i in range(0,len(texto),10)] 32 | text='' 33 | br=0 34 | for e,i in enumerate(l): 35 | if e4: 36 | br=br+1 37 | lbr.append(br) 38 | if i[-1].isspace(): 39 | text=text+i[:-1]+'
' 40 | else: 41 | text=text+i+'
' 42 | else: 43 | text=text+i 44 | resultado.append(text) 45 | else: 46 | resultado.append(texto) 47 | return resultado 48 | # return (resultado,lbr) 49 | 50 | @staticmethod 51 | def splitSentence(texto,max): 52 | if len(texto)>max: 53 | l=[texto[i:i+max] for i in range(0,len(texto),max)] 54 | text='' 55 | for e,i in enumerate(l): 56 | if e4: 57 | if i[-1].isspace(): 58 | text=text+i[:-1]+'
' 59 | else: 60 | text=text+i+'
' 61 | else: 62 | text=text+i 63 | return text 64 | else: 65 | return texto 66 | 67 | @staticmethod 68 | def writeTextPanel(tp): 69 | spatialOptions=['entid-selec-intersect','entid-selec-intersect-atrib','buffer-contains',\ 70 | 'buffer-contains-attrib','buffer-contains-sum','densidad','densidad valor'] 71 | capa=tp.capa 72 | texto='' 73 | texto=''.join([texto,'panel:textPanel','\n']) 74 | texto=''.join([texto,'capa:'+capa.name(),'\n']) 75 | texto=''.join([texto,'rutaCapa:'+capa.source(),'\n']) 76 | texto=''.join([texto,'idCapa:'+capa.id(),'\n']) 77 | texto=''.join([texto,'x:'+str(tp.relativePosition().x()),'\n']) 78 | texto=''.join([texto,'y:'+str(tp.relativePosition().y()),'\n']) 79 | 80 | texto=''.join([texto,'title:'+str(tp.title),'\n']) 81 | texto=''.join([texto,'type:'+str(tp.tipo),'\n']) 82 | exp=','.join(tp.expresion) 83 | texto=''.join([texto,'expression:'+exp,'\n']) 84 | if tp.tipo in spatialOptions: 85 | pry=QgsProject.instance() 86 | capa2=pry.mapLayersByName(tp.expresion[0])[0] 87 | id=capa2.id() 88 | path=capa2.source() 89 | texto=texto+'capa2:'+id+','+path+'\n' 90 | else: 91 | texto=texto+'capa2:None'+'\n' 92 | ancho=tp.frameSizeMm().width() 93 | alto=tp.frameSizeMm().height() 94 | texto=''.join([texto,'anchoP:'+str(ancho),'\n']) 95 | texto=''.join([texto,'altoP:'+str(alto),'\n']) 96 | 97 | fondTit=qcolorToStr(tp.fondTit) 98 | texto=texto+'fondTit:'+fondTit+'\n' 99 | colorTextTit=qcolorToStr(tp.colorTextTit) 100 | texto=texto+'colorTextTit:'+colorTextTit+'\n' 101 | fondVal=qcolorToStr(tp.fondVal) 102 | texto=texto+'fondVal:'+fondVal+'\n' 103 | colorTextVal=qcolorToStr(tp.colorTextVal) 104 | texto=texto+'colorTextVal:'+colorTextVal+'\n' 105 | 106 | texto=''.join([texto,'suavizado:'+str(tp.suavizado),'\n']) 107 | texto=''.join([texto,'estilo:'+str(tp.estilo),'\n']) 108 | if tp.icono: 109 | texto=''.join([texto,'icono:True','\n']) 110 | else: 111 | texto=''.join([texto,'icono:False','\n']) 112 | if type(tp.rutaIcono)==str: 113 | texto=''.join([texto,'rutaIcono:'+tp.rutaIcono,'\n']) 114 | else: 115 | texto=''.join([texto,'rutaIcono: ','\n']) 116 | texto=''.join([texto,'direccionIcono:'+tp.direccionIcono,'\n']) 117 | texto=''.join([texto,'colorIcono:'+str(tp.colorIcono),'\n']) 118 | return texto 119 | 120 | @staticmethod 121 | def writeBarPanel(tp): 122 | capa=tp.capa 123 | texto='' 124 | texto=''.join([texto,'panel:barrasPanel','\n']) 125 | texto=''.join([texto,'capa:'+capa.name(),'\n']) 126 | texto=''.join([texto,'rutaCapa:'+capa.source(),'\n']) 127 | texto=''.join([texto,'idCapa:'+capa.id(),'\n']) 128 | texto=''.join([texto,'x:'+str(tp.relativePosition().x()),'\n']) 129 | texto=''.join([texto,'y:'+str(tp.relativePosition().y()),'\n']) 130 | 131 | texto=''.join([texto,'title:'+str(tp.titulo),'\n']) 132 | texto=''.join([texto,'type:'+str(tp.tipo),'\n']) 133 | expresion=tp.expresion 134 | if type(expresion[0])==str: 135 | exp=','.join(tp.expresion) 136 | else: 137 | exp=','.join(tp.expresion[0]) 138 | texto=''.join([texto,'expression:'+exp,'\n']) 139 | 140 | 141 | colorBar=qcolorToStr(tp.colorBar) 142 | texto=''.join([texto,'colorBar:'+colorBar,'\n']) 143 | texto=''.join([texto,'typeColor:'+tp.typeColor,'\n']) 144 | texto=''.join([texto,'palette:'+tp.palette,'\n']) 145 | 146 | colorTit=qcolorToStr(tp.colorTit) 147 | texto=''.join([texto,'colorTit:'+colorTit,'\n']) 148 | texto=''.join([texto,'sizeTitle:'+str(tp.sizeTitle),'\n']) 149 | 150 | colorLabels=qcolorToStr(tp.colorLabels) 151 | texto=''.join([texto,'colorLabels:'+colorLabels,'\n']) 152 | texto=''.join([texto,'sizeLabels:'+str(tp.sizeLabels),'\n']) 153 | ancho=tp.frameSizeMm().width() 154 | alto=tp.frameSizeMm().height() 155 | texto=''.join([texto,'anchoP:'+str(ancho),'\n']) 156 | texto=''.join([texto,'altoP:'+str(alto),'\n']) 157 | if tp.wordBreak: 158 | texto=''.join([texto,'wordBreak:True','\n']) 159 | else: 160 | texto=''.join([texto,'wordBreak:False','\n']) 161 | return texto 162 | 163 | @staticmethod 164 | def writeSeriePanel(tp): 165 | capa=tp.capa 166 | texto='' 167 | texto=''.join([texto,'panel:seriesPanel','\n']) 168 | texto=''.join([texto,'capa:'+capa.name(),'\n']) 169 | texto=''.join([texto,'rutaCapa:'+capa.source(),'\n']) 170 | texto=''.join([texto,'idCapa:'+capa.id(),'\n']) 171 | texto=''.join([texto,'x:'+str(tp.relativePosition().x()),'\n']) 172 | texto=''.join([texto,'y:'+str(tp.relativePosition().y()),'\n']) 173 | campox=tp.expresion[1] 174 | camposy=','.join(tp.expresion[0]) 175 | 176 | texto=''.join([texto,'title:'+str(tp.title),'\n']) 177 | texto=''.join([texto,'camposy:'+camposy,'\n']) 178 | texto=''.join([texto,'campox:'+campox,'\n']) 179 | if tp.wordBreak: 180 | texto=''.join([texto,'wordBreak:True','\n']) 181 | else: 182 | texto=''.join([texto,'wordBreak:False','\n']) 183 | 184 | colorTit=qcolorToStr(tp.colorTit) 185 | texto=''.join([texto,'colorTit:'+colorTit,'\n']) 186 | texto=''.join([texto,'sizeTitle:'+str(tp.sizeTitle),'\n']) 187 | 188 | colorLabels=qcolorToStr(tp.colorLabels) 189 | texto=''.join([texto,'colorLabels:'+colorLabels,'\n']) 190 | texto=''.join([texto,'sizeLabels:'+str(tp.sizeLabels),'\n']) 191 | texto=''.join([texto,'widthline:'+str(tp.widthline),'\n']) 192 | ancho=tp.frameSizeMm().width() 193 | alto=tp.frameSizeMm().height() 194 | texto=''.join([texto,'anchoP:'+str(ancho),'\n']) 195 | texto=''.join([texto,'altoP:'+str(alto),'\n']) 196 | if tp.fill: 197 | texto=''.join([texto,'fill:True','\n']) 198 | else: 199 | texto=''.join([texto,'fill:False','\n']) 200 | return texto 201 | 202 | @staticmethod 203 | def writeIndicadorPanel(tp): 204 | spatialOptions=['entid-selec-intersect','entid-selec-intersect-atrib','buffer-contains',\ 205 | 'buffer-contains-attrib','buffer-contains-sum','densidad','densidad valor'] 206 | capa=tp.capa 207 | texto='' 208 | texto=''.join([texto,'panel:indicadorPanel','\n']) 209 | texto=''.join([texto,'capa:'+capa.name(),'\n']) 210 | texto=''.join([texto,'rutaCapa:'+capa.source(),'\n']) 211 | texto=''.join([texto,'idCapa:'+capa.id(),'\n']) 212 | texto=''.join([texto,'x:'+str(tp.relativePosition().x()),'\n']) 213 | texto=''.join([texto,'y:'+str(tp.relativePosition().y()),'\n']) 214 | ancho=tp.frameSizeMm().width() 215 | alto=tp.frameSizeMm().height() 216 | texto=''.join([texto,'anchoP:'+str(ancho),'\n']) 217 | texto=''.join([texto,'altoP:'+str(alto),'\n']) 218 | 219 | if type(tp.expresion[0])==str: 220 | exp=','.join(tp.expresion) 221 | else: 222 | exp=','.join(tp.expresion[0]) 223 | texto=''.join([texto,'expression:'+exp,'\n']) 224 | 225 | texto=''.join([texto,'title:'+str(tp.title),'\n']) 226 | 227 | colorTit=qcolorToStr(tp.colorTit) 228 | texto=''.join([texto,'colorTit:'+colorTit,'\n']) 229 | 230 | colorBar=qcolorToStr(tp.colorBar) 231 | texto=''.join([texto,'colorBar:'+colorBar,'\n']) 232 | 233 | colorBackground=qcolorToStr(tp.colorBackground) 234 | texto=''.join([texto,'colorBackground:'+colorBackground,'\n']) 235 | 236 | colorBase=qcolorToStr(tp.colorBase) 237 | texto=''.join([texto,'colorBase:'+colorBase,'\n']) 238 | 239 | colorLine=qcolorToStr(tp.colorLine) 240 | texto=''.join([texto,'colorLine:'+colorLine,'\n']) 241 | 242 | colorFinal=qcolorToStr(tp.colorFinal) 243 | texto=''.join([texto,'colorFinal:'+colorFinal,'\n']) 244 | 245 | colorMark=qcolorToStr(tp.colorMark) 246 | texto=''.join([texto,'colorMark:'+colorMark,'\n']) 247 | 248 | colorValue=qcolorToStr(tp.colorValue) 249 | texto=''.join([texto,'colorValue:'+colorValue,'\n']) 250 | texto=''.join([texto,'sizeTitle:'+str(tp.sizeTitle),'\n']) 251 | texto=''.join([texto,'sizeLabel:'+str(tp.sizeLabel),'\n']) 252 | texto=''.join([texto,'relative:'+tp.relative,'\n']) 253 | texto=''.join([texto,'type:'+tp.tipo,'\n']) 254 | texto=''.join([texto,'estilo:'+tp.estilo,'\n']) 255 | min=tp.range[0] 256 | max=tp.range[1] 257 | texto=''.join([texto,'min:'+str(min),'\n']) 258 | texto=''.join([texto,'max:'+str(max),'\n']) 259 | texto=''.join([texto,'threshold:'+str(tp.threshold),'\n']) 260 | return texto 261 | 262 | @staticmethod 263 | def loadPanels(lista): 264 | panels=[] 265 | position=0 266 | for e,i in enumerate(lista): 267 | if i=='textPanel': 268 | position=e+23 269 | panels.append(lista[e+1:position]) 270 | position=e 271 | elif i=='barrasPanel': 272 | position=e+20 273 | panels.append(lista[e+1:position]) 274 | position=e 275 | elif i=='seriesPanel': 276 | position=e+19 277 | panels.append(lista[e+1:position]) 278 | position=e 279 | elif i=='indicadorPanel': 280 | position=e+27 281 | panels.append(lista[e+1:position]) 282 | position=e 283 | else: 284 | position=e 285 | # print('como lista ',textPanels) 286 | listDicPanels=[] 287 | if len(panels)>0: 288 | for i in panels: 289 | d={t[0:t.find(':')]:t[t.find(':')+1:len(t)] for t in i} 290 | listDicPanels.append(d) 291 | 292 | return listDicPanels 293 | 294 | 295 | 296 | 297 | 298 | -------------------------------------------------------------------------------- /panels/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__init__.py -------------------------------------------------------------------------------- /panels/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/adminPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/adminPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/barrasPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/barrasPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/groupPanel6.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/groupPanel6.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/indicadorPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/indicadorPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/operations.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/operations.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/seriesPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/seriesPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/stylesBarPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/stylesBarPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/stylesSeriePanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/stylesSeriePanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/stylesTextPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/stylesTextPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/__pycache__/textPanel.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/panels/__pycache__/textPanel.cpython-37.pyc -------------------------------------------------------------------------------- /panels/barrasPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import os 15 | import random 16 | from qgis.PyQt.QtGui import * 17 | from qgis.PyQt.QtCore import * 18 | from qgis.core import * 19 | from .stylesBarPanel import styleBarPanel 20 | from ..calculations.dataQuery import queriesData 21 | import tempfile 22 | 23 | class barrasPanel(QgsHtmlAnnotation): 24 | def __init__(self,layer,type,title,expression,position='top-left',anchoP=80,altoP=40.0,\ 25 | colorBar="#4db0c3",wordBreak=True,colorTit='black',sizeTitle=12,colorLabels='black',sizeLabels=9,\ 26 | orientation='v',typeColor='palette',palette='contrast'): 27 | super().__init__() 28 | self.posicion=position 29 | self.capa= layer 30 | self.titulo=title 31 | self.colorBar=colorBar 32 | 33 | self.wordBreak=wordBreak 34 | self.colorBar=colorBar 35 | self.colorTit=colorTit 36 | self.sizeTitle=sizeTitle 37 | self.colorLabels=colorLabels 38 | self.sizeLabels=sizeLabels 39 | self.orientation=orientation 40 | self.typeColor=typeColor 41 | self.palette=palette 42 | 43 | self.tipo= type 44 | self.expresion=expression 45 | # self.canvas = canvas 46 | # self.setMapLayer(self.capa) 47 | self.anchop=anchoP 48 | self.altop=altoP 49 | 50 | self.iniHtml='' 51 | 52 | self.tempf=None 53 | 54 | 55 | self.defaultValue=None 56 | self.firtsTime=True 57 | self._select=False 58 | 59 | self.setFrameSizeMm(QSizeF(self.anchop,self.altop)) 60 | self.setFrameOffsetFromReferencePoint(QPointF(0, 0)) 61 | self.conectar() 62 | self.data=self.defData() 63 | self.style=self.assignStyle() 64 | self.cierreHtml() 65 | 66 | def conectar(self): 67 | self.capa.selectionChanged.connect(self.updateValue) 68 | 69 | def desconectar(self): 70 | self.capa.selectionChanged.disconnect(self.conectar) 71 | 72 | def assignStyle(self): 73 | if self.tipo=='atributo-sum': 74 | if self.capa.selectedFeatureCount()>0: 75 | select=True 76 | else: 77 | select=False 78 | estilo=styleBarPanel(self.data,title=self.titulo, estilo='sum_attrib',select=select,\ 79 | wordBreak=self.wordBreak,colorBar=self.colorBar,colorTit=self.colorTit,\ 80 | sizeTitle=self.sizeTitle,colorLabels=self.colorLabels,sizeLabels=self.sizeLabels,\ 81 | orientation=self.orientation,typeColor=self.typeColor,palette=self.palette) 82 | elif self.tipo=='multiple_fields': 83 | estilo=styleBarPanel(self.data,title=self.titulo,estilo='multiple_fields',\ 84 | wordBreak=self.wordBreak,colorBar=self.colorBar,colorTit=self.colorTit,\ 85 | sizeTitle=self.sizeTitle,colorLabels=self.colorLabels,sizeLabels=self.sizeLabels,\ 86 | orientation=self.orientation,typeColor=self.typeColor,palette=self.palette) 87 | estilo.assignStyle(estilo.style) 88 | return estilo 89 | 90 | def defData(self): 91 | if self.tipo=='atributo-sum': 92 | campox=self.expresion[0] 93 | campoy=self.expresion[1] 94 | if self.firtsTime==True: 95 | self.firtsTime=False 96 | if self.capa.selectedFeatureCount()==0: 97 | lentidades=self.capa.getFeatures() 98 | self.data= [queriesData.summarizeClasses(lentidades,campox,campoy)] 99 | self.defaultValue=self.data 100 | return self.defaultValue 101 | else: 102 | l1=self.capa.getFeatures() 103 | d1=queriesData.summarizeClasses(l1,campox,campoy) 104 | self.defaultValue=[d1] 105 | l2=self.capa.selectedFeatures() 106 | dt=queriesData.summarizeClasses(l2,campox,campoy) 107 | d2={i:d1[i] if i in dt else 0 for i in d1} 108 | del(dt) 109 | self.data=[d1,d2] 110 | return self.data 111 | else: 112 | if self.capa.selectedFeatureCount()==0: 113 | return self.defaultValue 114 | else: 115 | d1=self.defaultValue[0] 116 | l2=self.capa.selectedFeatures() 117 | dt=queriesData.summarizeClasses(l2,campox,campoy) 118 | d2={i:d1[i] if i in dt else 0 for i in d1} 119 | del(dt) 120 | self.data=[d1,d2] 121 | return self.data 122 | 123 | elif self.tipo=='multiple_fields': 124 | campos=self.expresion[0]#Lista con nombre de campos numericos 125 | if self.firtsTime==True: 126 | self.firtsTime=False 127 | if self.capa.selectedFeatureCount()==0: 128 | lentidades=self.capa.getFeatures() 129 | self.data= [queriesData.summarizeFields(lentidades,campos)] 130 | self.defaultValue=self.data 131 | return self.defaultValue 132 | else: 133 | self.defaultValue= [queriesData.summarizeFields(self.capa.getFeatures(),campos)] 134 | lentidades=self.capa.selectedFeatures() 135 | self.data= [queriesData.summarizeFields(lentidades,campos)] 136 | return self.data 137 | else: 138 | if self.capa.selectedFeatureCount()==0: 139 | return self.defaultValue 140 | else: 141 | lentidades=self.capa.selectedFeatures() 142 | self.data= [queriesData.summarizeFields(lentidades,campos)] 143 | return self.data 144 | 145 | def cierreHtml(self): 146 | self.tempf=tempfile.NamedTemporaryFile(mode='w+t',prefix='qd',suffix='.html',delete=False) 147 | self.tempf.seek(0) 148 | self.tempf.write(self.style.html) 149 | self.tempf.close() 150 | if os.path.exists(self.tempf.name): 151 | self.setSourceFile(self.tempf.name) 152 | else: 153 | print('el archivo temporal no existe') 154 | 155 | def updateValue(self): 156 | self.data=self.defData() 157 | self.style=self.assignStyle() 158 | if os.path.exists(self.tempf.name): 159 | if os.access(self.tempf.name,os.W_OK): 160 | with open(self.tempf.name,'w+t') as file: 161 | file.write(self.style.html) 162 | else: 163 | print('no hay acceso de escritura') 164 | else: 165 | print('el archivo no existe') 166 | self.setSourceFile(self.tempf.name) 167 | 168 | def update(self): 169 | if os.path.exists(self.tempf.name): 170 | if os.access(self.tempf.name,os.W_OK): 171 | with open(self.tempf.name,'w+t') as file: 172 | file.write(self.style.html) 173 | else: 174 | print('no hay acceso de escritura') 175 | else: 176 | print('el archivo no existe') 177 | self.setSourceFile(self.tempf.name) 178 | 179 | def colorTextTitle(self,color): 180 | self.style.colorTit(color) 181 | self.style.update() 182 | self.update() 183 | 184 | def colorTextLabels(self,color): 185 | self.style.colorLabels(color) 186 | self.style.update() 187 | self.update() 188 | 189 | def colorBar(self,color): 190 | self.style.colorBar(color) 191 | self.style.update() 192 | self.update() 193 | 194 | def borrarHtml(self): 195 | try: 196 | os.remove(self.tempf.name) 197 | except Exception as e: 198 | print(str(e)) 199 | -------------------------------------------------------------------------------- /panels/groupPanel6.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | #PERMITIR AGREGAR PANELES PAULATINAMENTE 15 | #CREA UN INDICE ESPACIAL DE SER NECESARIO 16 | from qgis.core import * 17 | from qgis.gui import * 18 | import qgis.utils 19 | from .textPanel import textPanel 20 | from .indicadorPanel import indicadorPanel 21 | from .seriesPanel import seriesPanel 22 | from .barrasPanel import barrasPanel 23 | from .stylesTextPanel import styleTextPanel 24 | from ..calculations.dataQuery import queriesData 25 | from ..calculations.spatialQuery import spatialQueries 26 | 27 | class groupPanel(): 28 | def __init__(self,canvas,listDash=[],ubicacion='top-left'): 29 | pry= QgsProject.instance() 30 | self.canvas = canvas 31 | self.manejador=pry.annotationManager() 32 | self.posicion=ubicacion #posicion por defecto de las disponibles 33 | self.paneles=listDash 34 | self.offset=40 #separación adicional entre paneles el 20.4% del canvas 35 | self.manejador.annotationAboutToBeRemoved.connect(self.desconecPanel) 36 | self.globalToolTip=False 37 | self.globalBordeMarco=True 38 | 39 | def desconecPanel(self,tp): 40 | try: 41 | self.paneles.remove(tp) 42 | except: 43 | pass 44 | if type(tp)== textPanel or type(tp)==indicadorPanel \ 45 | or type(tp)==barrasPanel or type(tp)==seriesPanel: 46 | print('entro borrar html') 47 | tp.borrarHtml() 48 | 49 | #AÑADIR PANEL 50 | def addPanel(self, panel): 51 | self.paneles.append(panel) 52 | 53 | #DEFINIENDO LA POSICION, SE INTRODUCE DE 0 A 1 54 | def yp(self,valor,altoPantalla): 55 | if valor==0: 56 | return 0 57 | else: 58 | return float(valor/altoPantalla) 59 | print(yp) 60 | 61 | def xp(self,valor,anchoPantalla): 62 | if valor==0: 63 | return 0 64 | else: 65 | return float(valor/anchoPantalla) 66 | 67 | def configurarIndiceEspacial(self): 68 | if len(self.paneles)>0: 69 | #creamos un diccionario cuyas claves son las capas secundarias 70 | listCS={} #inicializamos el diccionario 71 | #llenamos el diccionario con claves como capas2 y listas 72 | for i in self.paneles: 73 | if (type(i)==indicadorPanel or type(i)==textPanel) and type(i.capa2)==QgsVectorLayer: 74 | listCS[i.capa2]=[] 75 | #Ahora llenamos el dic con los paneles 76 | print('candidatos para el indice espacial: ',len(listCS)) 77 | if len(listCS)>0: 78 | for i in self.paneles: 79 | if type(i)==indicadorPanel or type(i)==textPanel: 80 | if type(i.capa2) is QgsVectorLayer: 81 | capa=i.capa2 82 | print(capa.name()) 83 | listCS[capa].append(i) 84 | for i in listCS.keys(): 85 | if i.featureCount()>=1000 and i.geometryType()!=QgsWkbTypes.PointGeometry: 86 | index = QgsSpatialIndex() # Spatial index 87 | index = QgsSpatialIndex(i.getFeatures()) 88 | print('evaluando importacion',index) 89 | for j in listCS[i]: 90 | j.asignarIndEspacial(index) 91 | print('asignando indice') 92 | 93 | def ubicarPaneles(self): 94 | self.configurarIndiceEspacial() 95 | print(self.paneles) 96 | nPaneles=len(self.paneles) 97 | altoPanel=self.paneles[0].altop 98 | anchoPanel=self.paneles[0].anchop 99 | #Dimensiones pantalla 100 | anchoC= self.canvas.size().width()#-self.canvas.size().width()*self.offset 101 | altoC= self.canvas.size().height()#-self.canvas.size().height()*self.offset 102 | print(self.posicion) 103 | if self.posicion=='top-left': 104 | xi=0 105 | yi=0 106 | c=0 107 | # print(len(self.paneles),self.paneles,c) 108 | for i in self.paneles: 109 | #Quitando la linea del borde del marco 110 | if self.globalBordeMarco==False: 111 | i.fillSymbol().setOpacity(0.0) 112 | # print(yi) 113 | capa=i.capa 114 | # print(i.capa.name()) 115 | geo=capa.getFeature(0).geometry() 116 | rec=geo.boundingBox() 117 | punto=rec.center() 118 | i.setMapPosition(punto) 119 | i.setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 120 | self.manejador.addAnnotation(i) 121 | ai=QgsMapCanvasAnnotationItem(i, self.canvas) 122 | if self.globalToolTip==True: 123 | nombre=i.capa.name() 124 | ai.setToolTip(""+nombre+"") 125 | i.setHasFixedMapPosition(False) 126 | i.setRelativePosition(QtCore.QPointF(0, self.yp(yi,altoC))) 127 | yi=yi+i.altop+60 128 | # if type(i)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 129 | # yi=yi+(i.altop+22)*2+self.offset 130 | # else: 131 | # yi=yi+i.altop+40 132 | c=c+1 133 | elif self.posicion=='top-right': 134 | c=0 135 | yi=0 136 | xi=0 137 | for i in self.paneles: 138 | #Quitando la linea del borde del marco 139 | if self.globalBordeMarco==False: 140 | i.fillSymbol().setOpacity(0.0) 141 | capa=i.capa 142 | geo=capa.getFeature(0).geometry() 143 | rec=geo.boundingBox() 144 | punto=rec.center() 145 | i.setMapPosition(punto) 146 | i.setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 147 | self.manejador.addAnnotation(i) 148 | ai=QgsMapCanvasAnnotationItem(i, self.canvas) 149 | if self.globalToolTip==True: 150 | nombre=i.capa.name() 151 | ai.setToolTip("nombre") 152 | i.setHasFixedMapPosition(False) 153 | xi=anchoC-(i.anchoF+self.offset) 154 | i.setRelativePosition(QtCore.QPointF(self.xp(xi,anchoC), self.yp(yi,altoC))) 155 | yi=yi+i.altop+60 156 | # if type(i)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 157 | # yi=yi+(i.altop+22)*2+self.offset 158 | # else: 159 | # yi=yi+i.altop+40 160 | c=c+1 161 | elif self.posicion=='bottom-left': 162 | c=0 163 | xi=0 164 | altoT=0 165 | for j in self.paneles: 166 | altoT=altoT+(j.altop+60) 167 | # if type(j)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 168 | # altoT=altoT+(j.altop+22)*2+self.offset 169 | # else: 170 | # altoT=altoT+(j.altop+40) 171 | yi=altoC-altoT 172 | print("yi",yi,", altoT ",altoT,", altoC ",altoC) 173 | for i in self.paneles: 174 | #Quitando la linea del borde del marco 175 | if self.globalBordeMarco==False: 176 | i.fillSymbol().setOpacity(0.0) 177 | capa=i.capa 178 | geo=capa.getFeature(0).geometry() 179 | rec=geo.boundingBox() 180 | punto=rec.center() 181 | i.setMapPosition(punto) 182 | i.setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 183 | self.manejador.addAnnotation(i) 184 | ai=QgsMapCanvasAnnotationItem(i, self.canvas) 185 | if self.globalToolTip==True: 186 | nombre=i.capa.name() 187 | ai.setToolTip("nombre") 188 | i.setHasFixedMapPosition(False) 189 | print(self.yp(yi,altoC)) 190 | i.setRelativePosition(QtCore.QPointF(xi, self.yp(yi,altoC))) 191 | yi=yi+i.altop+60 192 | # if type(i)==textPanel: 193 | # yi=yi+(i.altop+22)*2+self.offset 194 | # else: 195 | # yi=yi+i.altop+40 196 | c=c+1 197 | elif self.posicion=='bottom-right': 198 | c=0 199 | altoT=0 200 | for j in self.paneles: 201 | altoT=altoT+(j.altop+60) 202 | # if type(j)==textPanel and j.estilo!='entero-tenue' and j.estilo!='tim': 203 | # altoT=altoT+(j.altop+22)*2+self.offset 204 | # else: 205 | # altoT=altoT+(j.altop+40) 206 | yi=altoC-altoT 207 | print("yi",yi,", altoT ",altoT,", altoC ",altoC) 208 | for i in self.paneles: 209 | #Quitando la linea del borde del marco 210 | if self.globalBordeMarco==False: 211 | i.fillSymbol().setOpacity(0.0) 212 | capa=i.capa 213 | geo=list(capa.getFeatures())[c].geometry() 214 | rec=geo.boundingBox() 215 | punto=rec.center() 216 | i.setMapPosition(punto) 217 | i.setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 218 | self.manejador.addAnnotation(i) 219 | ai=QgsMapCanvasAnnotationItem(i, self.canvas) 220 | if self.globalToolTip==True: 221 | nombre=i.capa.name() 222 | ai.setToolTip("nombre") 223 | i.setHasFixedMapPosition(False) 224 | xi=anchoC-(i.anchoF+self.offset+10) 225 | # print(self.yp(yi,altoC)) 226 | i.setRelativePosition(QtCore.QPointF(self.xp(xi,anchoC), self.yp(yi,altoC))) 227 | # if type(i)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 228 | # yi=yi+(i.altop+22)*2+self.offset 229 | # else: 230 | # yi=yi+i.altop+40 231 | yi=yi+i.altop+60 232 | c=c+1 233 | if self.posicion=='dtop-left': 234 | if len(self.paneles)%2==0: #devuelve el resto, para un numero par es 0 235 | iteracion=int(len(self.paneles)/2) 236 | xi=0 237 | yi=0 238 | c=0 239 | for i in range(iteracion): 240 | #Quitando la linea del borde del marco 241 | if self.globalBordeMarco==False: 242 | self.paneles[i].fillSymbol().setOpacity(0.0) 243 | capa=self.paneles[i].capa 244 | geo=list(capa.getFeatures())[c].geometry() 245 | rec=geo.boundingBox() 246 | punto=rec.center() 247 | self.paneles[i].setMapPosition(punto) 248 | self.paneles[i].setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 249 | self.manejador.addAnnotation(self.paneles[i]) 250 | ai=QgsMapCanvasAnnotationItem(self.paneles[i], self.canvas) 251 | if self.globalToolTip==True: 252 | nombre=i.capa.name() 253 | ai.setToolTip("nombre") 254 | self.paneles[i].setHasFixedMapPosition(False) 255 | self.paneles[i].setRelativePosition(QtCore.QPointF(0, self.yp(yi,altoC))) 256 | # if type(i)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 257 | # yi=yi+(self.paneles[i].altop+22)*2+self.offset 258 | # else: 259 | # yi=yi+(self.paneles[i].altop+40) 260 | yi=yi+(self.paneles[i].altop+60) 261 | c=c+1 262 | xi=0 263 | yi=0 264 | c=0 265 | v=iteracion*2 266 | for j,i in enumerate(range(iteracion,v)): 267 | #Quitando la linea del borde del marco 268 | if self.globalBordeMarco==False: 269 | self.paneles[i].fillSymbol().setOpacity(0.0) 270 | capa=self.paneles[i].capa 271 | geo=list(capa.getFeatures())[c].geometry() 272 | rec=geo.boundingBox() 273 | punto=rec.center() 274 | self.paneles[i].setMapPosition(punto) 275 | self.paneles[i].setMapPositionCrs(QgsCoordinateReferenceSystem(capa.crs())) 276 | self.manejador.addAnnotation(self.paneles[i]) 277 | ai=QgsMapCanvasAnnotationItem(self.paneles[i], self.canvas) 278 | if self.globalToolTip==True: 279 | nombre=i.capa.name() 280 | ai.setToolTip("nombre") 281 | self.paneles[i].setHasFixedMapPosition(False) 282 | self.paneles[i].setRelativePosition(QtCore.QPointF(\ 283 | self.xp(self.paneles[i].anchop+1.55*self.offset,anchoC), self.yp(yi,altoC))) 284 | # if type(i)==textPanel and i.estilo!='entero-tenue' and i.estilo!='tim': 285 | # yi=yi+(self.paneles[i].altop+22)*2+self.offset 286 | # else: 287 | # yi=yi+(self.paneles[i].altop+40) 288 | yi=yi+(self.paneles[i].altop+60) 289 | c=c+1 290 | else: 291 | self.posicion='top-left' 292 | self.ubicarPaneles() 293 | 294 | def separarY(self, valor): 295 | if self.posicion=='top-left' or self.posicion=='top-right': 296 | for i in range(1,len(self.paneles)): 297 | psInicial=self.paneles[i].relativePosition() 298 | self.paneles[i].setRelativePosition(QPointF(psInicial.x(),psInicial.y()+valor*i)) 299 | -------------------------------------------------------------------------------- /panels/indicadorPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import os 15 | import random 16 | from qgis.core import * 17 | from qgis.PyQt.QtGui import * 18 | from qgis.PyQt.QtCore import * 19 | import os 20 | from .operations import operations 21 | from .stylesIndicadorPanel import styleIndicadorPanel 22 | from ..calculations.dataQuery import queriesData 23 | from ..calculations.spatialQuery import spatialQueries 24 | import tempfile 25 | 26 | class indicadorPanel(QgsHtmlAnnotation): 27 | def __init__(self,layer,type,title,expression,threshold,range,estilo='angular',anchoP=80,altoP=40.0,\ 28 | colorBar="blue",colorBackground='white',colorTit='black',sizeTitle=10,colorValue='black',\ 29 | colorBase='lightgray',colorLine='red',sizeLabel=10,colorFinal='#B31101',\ 30 | colorMark='red',relative=False): 31 | super().__init__() 32 | 33 | self.capa= layer 34 | self.title=title 35 | print(self.title) 36 | self.threshold=threshold 37 | self.range=range 38 | #CAPA PARA ANALISIS DE CONSULTAS INTERSECCIONES 39 | self.capa2=None 40 | #--------------------------------------------- 41 | 42 | self.colorTit=colorTit 43 | self.colorBar=colorBar 44 | self.colorBackground=colorBackground 45 | self.colorBase=colorBase 46 | self.sizeTitle=sizeTitle 47 | self.colorLine=colorLine 48 | self.sizeLabel=sizeLabel 49 | self.colorFinal=colorFinal 50 | self.colorMark=colorMark 51 | self.colorValue=colorValue 52 | self.relative=relative 53 | 54 | self.tipo= type 55 | self.estilo=estilo 56 | self.expresion=expression 57 | 58 | self.anchop=anchoP 59 | self.altop=altoP 60 | 61 | self.iniHtml='' 62 | self.ahtml=None 63 | 64 | self.tempf=None 65 | 66 | self.setFrameSizeMm(QSizeF(self.anchop,self.altop)) 67 | self.setFrameOffsetFromReferencePoint(QPointF(0, 0)) 68 | self.conectar() 69 | self.data=self.defData() 70 | print('en indicador ',self.estilo,self.data) 71 | 72 | self.assignStyle() 73 | self.cierreHtml() 74 | 75 | def conectar(self): 76 | self.capa.selectionChanged.connect(self.updateValue) 77 | 78 | def desconectar(self): 79 | self.capa.selectionChanged.disconnect(self.updateValue) 80 | 81 | def assignStyle(self): 82 | self.style=styleIndicadorPanel(self.data,self.threshold,self.range,title=self.title,\ 83 | colorTit=self.colorTit,sizeTitle=self.sizeTitle,colorBar=self.colorBar,\ 84 | estilo=self.estilo,colorBackground=self.colorBackground,colorBase=self.colorBase,\ 85 | colorLine=self.colorLine,sizeLabel=self.sizeLabel,colorFinal=self.colorFinal,\ 86 | colorValue=self.colorValue,colorMark=self.colorMark,relative=self.relative) 87 | self.style.assignStyle(self.estilo) 88 | 89 | def defData(self): 90 | calculador=operations(self,self.tipo) 91 | val=calculador.listOperations[self.tipo]() 92 | print('en indicador defdata ',val,self.tipo) 93 | return str(val) 94 | 95 | def cierreHtml(self): 96 | self.tempf=tempfile.NamedTemporaryFile(mode='w+t',prefix='qd',suffix='.html',delete=False) 97 | self.tempf.seek(0) 98 | self.tempf.write(self.style.html) 99 | self.tempf.close() 100 | if os.path.exists(self.tempf.name): 101 | self.setSourceFile(self.tempf.name) 102 | else: 103 | print('el archivo temporal no existe') 104 | 105 | def updateValue(self): 106 | self.data=self.defData() 107 | self.assignStyle() 108 | if os.path.exists(self.tempf.name): 109 | if os.access(self.tempf.name,os.W_OK): 110 | with open(self.tempf.name,'w+t') as file: 111 | file.write(self.style.html) 112 | else: 113 | print('no hay acceso de escritura') 114 | else: 115 | print('el archivo no existe') 116 | self.setSourceFile(self.tempf.name) 117 | 118 | def update(self): 119 | if os.path.exists(self.tempf.name): 120 | if os.access(self.tempf.name,os.W_OK): 121 | with open(self.tempf.name,'w+t') as file: 122 | file.write(self.style.html) 123 | else: 124 | print('no hay acceso de escritura') 125 | else: 126 | print('el archivo no existe') 127 | self.setSourceFile(self.tempf.name) 128 | 129 | def borrarHtml(self): 130 | try: 131 | os.remove(self.tempf.name) 132 | except Exception as e: 133 | print(e) 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /panels/operations.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from ..calculations.dataQuery import queriesData 15 | from ..calculations.spatialQuery import spatialQueries 16 | from qgis.core import QgsProject, QgsVectorLayer, QgsFeature, QgsStatisticalSummary,\ 17 | QgsFeatureRequest, QgsFields, QgsField 18 | 19 | class operations(): 20 | operations_polygon=['Sum of an attribute','Percentage','Statistics. Selected entities',\ 21 | 'Statistics. Selection that coincides with','Total selected entities','Entities contained in selection',\ 22 | 'Entities contained. count by attribute that coincides with','Number of entities in the area. Density',\ 23 | 'Sum of attribute between area. Density'] 24 | 25 | operations_nospatial=['Sum of an attribute','Percentage','Statistics. Selected entities',\ 26 | 'Statistics. Selection that coincides with','Total selected entities'] 27 | 28 | operations_nopolygon=['Sum of an attribute','Percentage','Statistics. Selected entities',\ 29 | 'Statistics. Selection that coincides with','Total selected entities','Entities contained at a distance. Buffer',\ 30 | 'Entities contained at a distance that coincides with','Sum of attributes of entities contained at a distance'] 31 | 32 | operations_ind_polygon=['Sum of an attribute',\ 33 | 'Entities contained in selection',\ 34 | 'Entities contained. count by attribute that coincides with','Number of entities in the area. Density',\ 35 | 'Sum of attribute between area. Density'] 36 | 37 | operations_ind_nospatial=['Sum of an attribute'] 38 | 39 | operations_ind_nopolygon=['Sum of an attribute',\ 40 | 'Entities contained at a distance. Buffer',\ 41 | 'Entities contained at a distance that coincides with','Sum of attributes of entities contained at a distance'] 42 | 43 | def __init__(self,panel,operation,modeE='processing'): 44 | self.listOperations={'atributo':self.attribute,'Porcentaje':self.percentage,\ 45 | 'math-atributo':self.statisticsAttrib,'entid_seleccionadas':self.selection,\ 46 | 'entid-selec-intersect':self.countContains,\ 47 | 'entid-selec-intersect-atrib':self.countsAttribContains,\ 48 | 'buffer-contains':self.countContainsBuffer,\ 49 | 'buffer-contains-attrib':self.countAttribBuffer,\ 50 | 'buffer-contains-sum':self.sumAttribBuffer,\ 51 | 'densidad':self.density,\ 52 | 'densidad valor':self.densityValue} 53 | self.spatialOperation=modeE 54 | self.panel=panel 55 | self.capa=panel.capa 56 | self.expression=self.panel.expresion 57 | 58 | @classmethod 59 | def getOperation(operation,type='polygon'): 60 | if type=='polygon': 61 | listOperat=operation.operations_polygon 62 | return listOperat 63 | elif type=='line or point': 64 | listOperat=operation.operations_nopolygon 65 | return listOperat 66 | elif type=='no spatial': 67 | listOperat=operation.operations_nospatial 68 | return listOperat 69 | elif type=='ind no spatial': 70 | listOperat=operation.operations_ind_nospatial 71 | return listOperat 72 | elif type=='ind polygon': 73 | listOperat=operation.operations_ind_polygon 74 | return listOperat 75 | elif type=='ind line or point': 76 | listOperat=operation.operations_ind_nopolygon 77 | return listOperat 78 | 79 | def attribute(self): 80 | campo=self.expression[0] 81 | if self.capa.selectedFeatureCount()==0: 82 | calculo=sum([f[campo] for f in self.capa.getFeatures() if type(f[campo])==int or type(f[campo])==float ]) 83 | val=calculo 84 | elif self.capa.selectedFeatureCount()==1: 85 | entidad=list(self.capa.getSelectedFeatures())[0] 86 | if type(entidad[campo])==int or type(entidad[campo])==float: 87 | calculo=entidad[campo] 88 | else: 89 | calculo=0 90 | val=calculo 91 | elif self.capa.selectedFeatureCount()>1: 92 | calculo=sum([f[campo] for f in self.capa.getSelectedFeatures() if type(f[campo])==int or type(f[campo])==float]) 93 | val=calculo 94 | return val 95 | 96 | def percentage(self): 97 | campo=self.expression[0] 98 | if self.capa.selectedFeatureCount()==0: 99 | val=100 100 | elif self.capa.selectedFeatureCount()>0: 101 | vp=queriesData.porcentaje(self.capa.getSelectedFeatures(),campo,self.capa) 102 | val=vp 103 | return val 104 | 105 | def selection(self): 106 | calculo=self.capa.selectedFeatureCount() 107 | val=calculo 108 | return val 109 | 110 | def statisticsAttrib(self): 111 | campo=self.expression[0] 112 | operador=self.expression[1] 113 | campos=self.capa.fields() 114 | idcampo=campos.indexOf(campo) 115 | request = QgsFeatureRequest() 116 | if len(self.expression)==2: 117 | request.setFlags(QgsFeatureRequest.NoGeometry ) 118 | request.setSubsetOfAttributes([idcampo]) 119 | if self.capa.selectedFeatureCount()>0: 120 | lentidades=self.capa.getSelectedFeatures(request) 121 | else: 122 | lentidades=self.capa.getFeatures(request) 123 | val= queriesData.statisticsField(lentidades,campo,operador) 124 | elif len(self.expression)==4: 125 | atrib=self.expression[2] 126 | valor_atrib=self.expression[3] 127 | idatrib=campos.indexOf(atrib) 128 | request.setFlags(QgsFeatureRequest.NoGeometry ) 129 | request.setSubsetOfAttributes([idcampo,idatrib]) 130 | request.setFilterExpression ("'"+'"'+atrib+'"'+'='+valor_atrib+"'") 131 | if self.capa.selectedFeatureCount()>0: 132 | lentidades=self.capa.getSelectedFeatures(request) 133 | else: 134 | lentidades=self.capa.getFeatures(request) 135 | val= queriesData.statisticsField(lentidades,campo,operador) 136 | return val 137 | 138 | #SPATIAL OPERATIONS********************************************************* 139 | def countContains(self): 140 | pry=QgsProject.instance() 141 | capa2=pry.mapLayersByName(self.expression[0])[0] 142 | if self.capa.selectedFeatureCount()==0: 143 | val=0 144 | elif self.capa.selectedFeatureCount()>0: 145 | if self.spatialOperation=='processing': 146 | calculo=spatialQueries.containsCountProcess(self.capa,capa2) 147 | val=calculo 148 | return val 149 | 150 | def countsAttribContains(self): 151 | pry=QgsProject.instance() 152 | capa2=pry.mapLayersByName(self.expression[0])[0] 153 | campo=self.expression[1] 154 | atributo=self.expression[2] 155 | if self.capa.selectedFeatureCount()==0: 156 | val=0 157 | elif self.capa.selectedFeatureCount()>0: 158 | if self.spatialOperation=='processing': 159 | calculo=spatialQueries.containsCountAttribProcess(self.capa,capa2,campo,atributo) 160 | val=calculo 161 | return val 162 | 163 | def density(self): 164 | pry=QgsProject.instance() 165 | capa2=pry.mapLayersByName(self.expression[0])[0] 166 | unidad=self.expression[1] 167 | #Definimos la unidad de medida 168 | divisor=1 169 | if unidad=='hectarea': 170 | divisor=10000 171 | elif unidad=='km2': 172 | divisor=1000000 173 | if self.capa.selectedFeatureCount()==0: 174 | val=0 175 | elif self.capa.selectedFeatureCount()>0: 176 | if self.spatialOperation=='processing': 177 | calculo=spatialQueries.densityProcess(self.capa,capa2,divisor) 178 | val=calculo 179 | return val 180 | 181 | def densityValue(self): 182 | pry=QgsProject.instance() 183 | capa2=pry.mapLayersByName(self.expression[0])[0] 184 | unidad=self.expression[1] 185 | campo=self.expression[2] 186 | #Definimos la unidad de medida 187 | divisor=1 188 | if unidad=='hectarea': 189 | divisor=10000 190 | elif unidad=='km2': 191 | divisor=1000000 192 | if self.capa.selectedFeatureCount()==0: 193 | val=0 194 | elif self.capa.selectedFeatureCount()>0: 195 | if self.spatialOperation=='processing': 196 | calculo=spatialQueries.densityAttribProcess(self.capa,capa2,campo,divisor) 197 | val=calculo 198 | return val 199 | 200 | def countContainsBuffer(self): 201 | pry=QgsProject.instance() 202 | capa2=pry.mapLayersByName(self.expression[0])[0] 203 | distancia=self.expression[1] 204 | if self.capa.selectedFeatureCount()==0: 205 | val=0 206 | elif self.capa.selectedFeatureCount()>0: 207 | if self.spatialOperation=='processing': 208 | calculo=spatialQueries.bufferCountProcess(self.capa,capa2,distancia) 209 | val=calculo 210 | return val 211 | 212 | def countAttribBuffer(self): 213 | pry=QgsProject.instance() 214 | capa2=pry.mapLayersByName(self.expression[0])[0] 215 | distancia=self.expression[1] 216 | campo=self.expression[2] 217 | atributo=self.expression[3] 218 | if self.capa.selectedFeatureCount()==0: 219 | val=0 220 | elif self.capa.selectedFeatureCount()>0: 221 | if self.spatialOperation=='processing': 222 | calculo=spatialQueries.bufferAttribProcess(self.capa,capa2,distancia,campo,atributo,tipo='conteo') 223 | val=calculo 224 | return val 225 | 226 | def sumAttribBuffer(self): 227 | pry=QgsProject.instance() 228 | capa2=pry.mapLayersByName(self.expression[0])[0] 229 | distancia=self.expression[1] 230 | campo=self.expression[2] 231 | atributo=self.expression[3] 232 | if self.capa.selectedFeatureCount()==0: 233 | val=0 234 | elif self.capa.selectedFeatureCount()>0: 235 | if self.spatialOperation=='processing': 236 | calculo=spatialQueries.bufferAttribProcess(self.capa,capa2,distancia,campo,atributo,tipo='sum') 237 | val=calculo 238 | return val 239 | 240 | -------------------------------------------------------------------------------- /panels/seriesPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import os 15 | import random 16 | from qgis.PyQt.QtGui import * 17 | from qgis.PyQt.QtCore import * 18 | from qgis.core import * 19 | from .stylesSeriePanel import styleSeriePanel 20 | from ..calculations.dataQuery import queriesData 21 | from ..myUtils.myUtils import utils 22 | import tempfile 23 | 24 | class seriesPanel(QgsHtmlAnnotation): 25 | def __init__(self,layer,expression,title='',estilo='multiple_fields',nselect=5,\ 26 | wordBreak=False,position='top-left',anchoP=80,altoP=40.0,sizeTitle=12,colorTit='black',\ 27 | colorLabels='black',sizeLabels=9,widthline=1,fill=False): 28 | super().__init__() 29 | self.capa=layer 30 | self.tipo='multiple_fields' 31 | 32 | self.title=title 33 | self.wordBreak=wordBreak 34 | self.colorTit=colorTit 35 | self.sizeTitle=sizeTitle 36 | self.colorLabels=colorLabels 37 | self.sizeLabels=sizeLabels 38 | self.widthline=widthline 39 | self.fill=fill 40 | self.registerSelect=nselect 41 | self.select=False 42 | 43 | self.posicion=position 44 | 45 | self.expresion=expression 46 | self.anchop=anchoP 47 | self.altop=altoP 48 | #guardamos aqui el ancho y alto luego de considerar 49 | #los espacios por los estilos html 50 | self.iniHtml='' 51 | 52 | self.tempf=None 53 | 54 | self.setFrameSizeMm(QSizeF(self.anchop,self.altop)) 55 | self.setFrameOffsetFromReferencePoint(QPointF(0, 0)) 56 | self.conectar() 57 | self.data=self.defData() 58 | self.style=self.assignStyle() 59 | self.cierreHtml() 60 | 61 | def conectar(self): 62 | self.capa.selectionChanged.connect(self.updateValue) 63 | 64 | def desconectar(self): 65 | self.capa.selectionChanged.disconnect(self.conectar) 66 | 67 | def assignStyle(self): 68 | if self.tipo=='multiple_fields': 69 | estilo=styleSeriePanel(self.data,title=self.title,select=self.select,\ 70 | fill=self.fill,wordBreak=self.wordBreak,colorTit=self.colorTit,\ 71 | sizeTitle=self.sizeTitle,colorLabels=self.colorLabels,\ 72 | sizeLabels=self.sizeLabels,widthline=self.widthline) 73 | estilo.assignStyle(estilo.style) 74 | return estilo 75 | 76 | def defData(self): 77 | camposy=self.expresion[0]#Lista con nombre de campos numericos 78 | campox=self.expresion[1] #Nombre del campo categorico 79 | 80 | if self.capa.selectedFeatureCount()==0: 81 | self.select=False 82 | result=queriesData.summarizeFields(self.capa.getFeatures(),camposy) 83 | elif self.capa.selectedFeatureCount()>0: 84 | self.select=True 85 | result=queriesData.valuesSelectRegister(self.capa.selectedFeatures(),campox,\ 86 | camposy,self.registerSelect) 87 | return result 88 | 89 | def cierreHtml(self): 90 | self.tempf=tempfile.NamedTemporaryFile(mode='w+t',prefix='qd',suffix='.html',delete=False) 91 | self.tempf.seek(0) 92 | self.tempf.write(self.style.html) 93 | self.tempf.close() 94 | if os.path.exists(self.tempf.name): 95 | self.setSourceFile(self.tempf.name) 96 | else: 97 | print('el archivo temporal no existe') 98 | 99 | def updateValue(self): 100 | self.data=self.defData() 101 | self.style=self.assignStyle() 102 | if os.path.exists(self.tempf.name): 103 | if os.access(self.tempf.name,os.W_OK): 104 | with open(self.tempf.name,'w+t') as file: 105 | file.write(self.style.html) 106 | else: 107 | print('no hay acceso de escritura') 108 | else: 109 | print('el archivo no existe') 110 | self.setSourceFile(self.tempf.name) 111 | 112 | def update(self): 113 | if os.path.exists(self.tempf.name): 114 | if os.access(self.tempf.name,os.W_OK): 115 | with open(self.tempf.name,'w+t') as file: 116 | file.write(self.style.html) 117 | else: 118 | print('no hay acceso de escritura') 119 | else: 120 | print('el archivo no existe') 121 | self.setSourceFile(self.tempf.name) 122 | 123 | def borrarHtml(self): 124 | try: 125 | os.remove(self.tempf.name) 126 | except Exception as e: 127 | print(e) 128 | -------------------------------------------------------------------------------- /panels/stylesBarPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis import PyQt 15 | from qgis.PyQt.QtGui import QColor 16 | import os 17 | from ..myUtils.myUtils import utils 18 | from ..myUtils.dashColors import dashColors 19 | 20 | class styleBarPanel(): 21 | typeStyles=('multiple_fields','sum_attrib') 22 | def __init__(self,data,estilo='sum_attrib',select=False,title='',colorBar="#4db0c3",\ 23 | wordBreak=False,colorTit='black',sizeTitle=12,colorLabels='black',sizeLabels=9,orientation='v',\ 24 | typeColor='palette',palette='contrast'): 25 | self.styles={'sum_attrib':self.sumAttrib,'multiple_fields':self.multipleFields} 26 | dir=os.path.dirname(__file__) 27 | self.dirJs=os.path.join(dir,'plotly-latest.min.js') 28 | self.title=title 29 | self.wordBreak=wordBreak 30 | self.colorBar=colorBar 31 | self.colorTit=colorTit 32 | self.sizeTitle=sizeTitle 33 | self.colorLabels=colorLabels 34 | self.sizeLabels=sizeLabels 35 | self.orientation=orientation 36 | self.typeColor=typeColor 37 | self.palette=palette 38 | 39 | self.data=data 40 | self.style=estilo 41 | #self.barpanel=panelo 42 | 43 | self._select=select 44 | self._database=None 45 | self.html='' 46 | self.html0=''+'\n'+\ 47 | ''+'\n'+\ 48 | ''+'\n'+\ 49 | ''+'\n'+\ 50 | ''+'\n'+\ 56 | ''+'\n'+\ 57 | ''+'\n'+\ 58 | ''+'\n'+\ 59 | '
'+'\n'+\ 60 | ''+'\n'+\ 205 | '
'+'\n'+\ 206 | ''+'\n'+\ 207 | '' 208 | self.html=self.html+cierre 209 | 210 | def update(self): 211 | self.styles[self.style]() 212 | 213 | 214 | 215 | -------------------------------------------------------------------------------- /panels/stylesIndicadorPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis import PyQt 15 | from qgis.PyQt.QtGui import QColor 16 | import os 17 | 18 | class styleIndicadorPanel(): 19 | typeStyles=('Angular','Bullet','Card') 20 | def __init__(self,data,threshold,range,estilo='Angular',title='',colorTit='black',sizeTitle=10,\ 21 | colorBar="blue",colorBackground='white',colorBase='lightgray',colorLine='red',colorValue='black',\ 22 | sizeLabel=10,colorFinal='#B31101',colorMark='red',relative='false'): 23 | self.styles={'Angular':self.angular,'Bullet':self.bullet,'Card':self.card} 24 | dirj=os.path.dirname(__file__) 25 | self.dir=os.path.join(dirj,'plotly-latest.min.js') 26 | self.title=title 27 | self.colorTit=colorTit 28 | self.sizeTitle=sizeTitle 29 | self.sizeLabel=sizeLabel 30 | self.colorBar=colorBar 31 | self.colorBackground=colorBackground 32 | self.colorBase=colorBase 33 | self.colorLine=colorLine 34 | self.colorFinal=colorFinal 35 | self.colorMark=colorMark 36 | self.colorValue=colorValue 37 | self.style=estilo 38 | print(self.style) 39 | self.relative=relative 40 | self.range=range 41 | self.vmax=range[1] 42 | self.vmin=range[0] 43 | self.threshold=threshold 44 | 45 | self.shape='"angular"' 46 | self.data=data 47 | self.html='' 48 | self.html0=''+'\n'+\ 49 | ''+'\n'+\ 50 | ''+'\n'+\ 51 | ''+'\n'+\ 52 | ''+'\n'+\ 58 | ''+'\n'+\ 59 | ''+'\n'+\ 60 | ''+'\n'+\ 61 | '
'+'\n'+\ 62 | ''+'\n'+\ 164 | '
'+'\n'+\ 165 | ''+'\n'+\ 166 | ''+'\n' 167 | self.html=self.html+close 168 | 169 | def update(self): 170 | self.styles[self.style]() 171 | 172 | -------------------------------------------------------------------------------- /panels/stylesSeriePanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis import PyQt 15 | from qgis.PyQt.QtGui import QColor 16 | import os 17 | from ..myUtils.myUtils import utils 18 | 19 | class styleSeriePanel(): 20 | typeStyles=('multiple_fields') 21 | def __init__(self,data,estilo='multiple_fields',title='',select=False,fill=False,\ 22 | wordBreak=False,colorTit='black',sizeTitle=12,colorLabels='black',sizeLabels=9,widthline=1): 23 | self.styles={'multiple_fields':self.multipleFields} 24 | dir=os.path.dirname(__file__) 25 | self.dirJs=os.path.join(dir,'plotly-latest.min.js') 26 | self.title=title 27 | self.wordBreak=wordBreak 28 | self.colorTit=colorTit 29 | self.sizeTitle=sizeTitle 30 | self.colorLabels=colorLabels 31 | self.sizeLabels=sizeLabels 32 | self.widthline=widthline 33 | self.fill=fill 34 | self.select=select 35 | 36 | self.data=data 37 | self.style=estilo 38 | self.relleno='none' 39 | 40 | self.html='' 41 | self.html0=''+'\n'+\ 42 | ''+'\n'+\ 43 | ''+'\n'+\ 44 | ''+'\n'+\ 45 | ''+'\n'+\ 51 | ''+'\n'+\ 52 | ''+'\n'+\ 53 | ''+'\n'+\ 54 | '
'+'\n'+\ 55 | ''+'\n'+\ 188 | '
'+'\n'+\ 189 | ''+'\n'+\ 190 | '' 191 | self.html=self.html+cierre 192 | 193 | def update(self): 194 | self.styles[self.style]() 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /panels/stylesTextPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | from qgis import PyQt 15 | from qgis.PyQt.QtGui import QColor 16 | import os 17 | 18 | class styleTextPanel(): 19 | typeStyles=('Separate frames','United frames','One frame') 20 | def __init__(self,title='',fondTit='black',colorTextTit='white',fondVal='lightblue', colorTextVal='black',\ 21 | estilo='Separate frames',icono=False,rutaIcono=None,suavizado=0,\ 22 | direccionIcono='center',colorIcono=0): 23 | self.styles={'Separate frames':self.twoFrames,'United frames':self.tim,'One frame':self.oneFrame} 24 | self.title=title 25 | self.style=estilo 26 | self.html='' 27 | self.html0='' 28 | self.value='

0

'+'\n' 29 | self.colorTitle=fondTit 30 | self.colorFontTitle=colorTextTit 31 | self.colorValue=fondVal 32 | self.colorFontValue=colorTextVal 33 | self.suavizado=suavizado 34 | #Icon settings 35 | self.iconPath=rutaIcono 36 | self.icon=icono #boolean 37 | self.iconDirection=direccionIcono 38 | self.iconColor=colorIcono 39 | 40 | @classmethod 41 | def getTypeStyles(estilo): 42 | tipos=estilo.typeStyles 43 | return tipos 44 | 45 | def assignStyle(self,estilo): 46 | if estilo in self.styles: 47 | self.style=estilo 48 | self.styles[estilo]() 49 | 50 | def twoFrames(self): 51 | self.evalColors() 52 | self.html0=''+'\n'+\ 53 | ''+'\n'+\ 95 | ''+'\n'+\ 96 | '
' 97 | self.html=self.html0 98 | self.defTitle() 99 | self.defValue() 100 | self.defCierre() 101 | 102 | def tim(self): 103 | self.evalColors() 104 | self.html0=''+'\n'+\ 105 | ''+'\n'+\ 106 | ''+'\n'+\ 217 | ''+'\n'+\ 218 | '
'+'\n'+\ 219 | '
'+\ 220 | '+
' 222 | elif self.style=='One frame' and\ 223 | self.icon==True and os.path.exists(self.iconPath): 224 | textIm='.r{filter:invert('+str(self.iconColor)+');'+'\n'+\ 225 | 'height:100%;}'+'\n'+\ 226 | ''+'\n'+\ 227 | ''+'\n'+\ 228 | '
'+'\n'+\ 229 | '
'+\ 230 | '+
' 232 | else: 233 | textIm=''+'\n'+\ 234 | ''+'\n'+\ 235 | '
'+'\n'+\ 236 | '
' 237 | self.html=self.html+textIm 238 | 239 | def update(self): 240 | self.styles[self.style]() 241 | 242 | def evalColors(self): 243 | # if type(self.colorTitle)!='str': 244 | colors=[self.colorTitle,self.colorFontTitle,self.colorValue,self.colorFontValue] 245 | lc=map(lambda x:'rgb('+str(x.red())+','+str(x.green())+','+str(x.blue())+')'\ 246 | if type(x)==QColor else x,colors) 247 | self.colorTitle,self.colorFontTitle,self.colorValue,self.colorFontValue=lc 248 | 249 | # def colorTextTitle(self,color): 250 | # self.colFontTitulo=color 251 | # self.update() 252 | # 253 | # def colorBackTitle(self,color): 254 | # self.colorTitulo=color 255 | # self.update() 256 | # 257 | # def colorTextValue(self,color): 258 | # self.colFontValor=color 259 | # self.update() 260 | # 261 | # def colorBackValue(self,color): 262 | # self.colorValor=color 263 | # self.update() 264 | 265 | 266 | -------------------------------------------------------------------------------- /panels/textPanel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import os 15 | from qgis import PyQt 16 | from qgis.PyQt import QtWidgets 17 | from qgis.PyQt.QtWidgets import * 18 | from qgis.PyQt.QtGui import * 19 | from qgis.PyQt.QtCore import * 20 | from qgis.core import * 21 | import random 22 | import os 23 | from .operations import operations 24 | from .stylesTextPanel import styleTextPanel 25 | from ..calculations.dataQuery import queriesData 26 | from ..calculations.spatialQuery import spatialQueries 27 | import tempfile 28 | 29 | class textPanel(QgsHtmlAnnotation): 30 | def __init__(self,layer,type,title,expression,position='top-left',anchoP=40,altoP=30,\ 31 | fondTit='black',colorTextTit='white',fondVal='lightblue', colorTextVal='black',\ 32 | suavizado=0,estilo='cuadrado',icono=False,rutaIcono=None,toolTip=False,\ 33 | direccionIcono='center',colorIcono=0): 34 | super().__init__() 35 | self.posicion=position 36 | self.capa= layer 37 | 38 | self.spatialOperation='processing' 39 | self.tipo= type 40 | 41 | self.expresion=expression 42 | 43 | self.title=title 44 | self.estilo=estilo 45 | self.fondTit=fondTit 46 | self.colorTextTit=colorTextTit 47 | self.fondVal=fondVal 48 | self.colorTextVal=colorTextVal 49 | self.suavizado=suavizado 50 | self.icono=icono 51 | self.rutaIcono=rutaIcono 52 | self.direccionIcono=direccionIcono 53 | self.colorIcono=colorIcono 54 | 55 | # self.setMapLayer(self.capa) 56 | self.anchop=anchoP 57 | self.altop=altoP 58 | 59 | #CAPA PARA ANALISIS DE CONSULTAS INTERSECCIONES 60 | self.capa2=None 61 | #--------------------------------------------- 62 | #INDICE ESPACIAL 63 | self.indiceE=None 64 | 65 | self.valor=self.defValor() 66 | self.style=styleTextPanel(title=self.title,fondTit=self.fondTit,colorTextTit=self.colorTextTit,\ 67 | fondVal=self.fondVal,colorTextVal=self.colorTextVal,estilo=self.estilo, icono=self.icono,\ 68 | suavizado=self.suavizado,rutaIcono=self.rutaIcono,direccionIcono=self.direccionIcono,colorIcono=self.colorIcono) 69 | self.style.value=self.valor 70 | self.asignarEstilo() 71 | 72 | self.setFrameSizeMm(QSizeF(self.anchop,self.altop)) 73 | self.tempf=None 74 | self.setFrameOffsetFromReferencePoint(QPointF(0, 0)) 75 | self.conectar() 76 | self.cierreHtml() 77 | 78 | #temporal 79 | def asignarEstilo(self): 80 | self.style.assignStyle(self.estilo) 81 | 82 | def asignarIndEspacial(self, indexS): 83 | # print('asignando indice espacial') 84 | self.indiceE=indexS 85 | 86 | def conectar(self): 87 | self.capa.selectionChanged.connect(self.updateValue) 88 | 89 | def desconectar(self): 90 | self.capa.selectionChanged.disconnect(self.conectar) 91 | 92 | def defValor(self): 93 | calculador=operations(self,self.tipo) 94 | val=calculador.listOperations[self.tipo]() 95 | if self.tipo=='atributo' or self.tipo=='buffer-contains-sum': 96 | valor= '

'+str(round(val,3))+'

'+'\n' 97 | elif self.tipo=='Porcentaje': 98 | valor='

'+str(round(val,3))+' %'+'

'+'\n' 99 | elif self.tipo=='math-atributo': 100 | valor='

'+str(round(val,3))+'

'+'\n' 101 | elif self.tipo=='entid_seleccionadas' or self.tipo=='entid-selec-intersect' or\ 102 | self.tipo=='entid-selec-intersect-atrib' or self.tipo=='buffer-contains' or\ 103 | self.tipo=='buffer-contains-attrib': 104 | valor='

'+str(val)+'

'+'\n' 105 | elif self.tipo=='densidad' or self.tipo=='densidad valor': 106 | valor='

'+str(round(val,6))+'

'+'\n' 107 | return valor 108 | 109 | def cierreHtml(self): 110 | texto="0" 111 | self.tempf=tempfile.NamedTemporaryFile(mode='w+t',prefix='qd',suffix='.html',delete=False) 112 | self.tempf.seek(0) 113 | self.tempf.write(self.style.html) 114 | self.tempf.close() 115 | if os.path.exists(self.tempf.name): 116 | self.setSourceFile(self.tempf.name) 117 | else: 118 | print('el archivo temporal no existe') 119 | 120 | def updateValue(self): 121 | valor=self.defValor() 122 | self.valor=valor 123 | self.style.value=self.valor 124 | self.style.assignStyle(self.style.style) 125 | if os.path.exists(self.tempf.name): 126 | if os.access(self.tempf.name,os.W_OK): 127 | with open(self.tempf.name,'w+t') as file: 128 | file.write(self.style.html) 129 | else: 130 | print('no hay acceso de escritura') 131 | else: 132 | print('el archivo no existe') 133 | self.setSourceFile(self.tempf.name) 134 | 135 | def update(self): 136 | if os.path.exists(self.tempf.name): 137 | if os.access(self.tempf.name,os.W_OK): 138 | with open(self.tempf.name,'w+t') as file: 139 | file.write(self.style.html) 140 | else: 141 | print('no hay acceso de escritura') 142 | else: 143 | print('el archivo no existe') 144 | self.setSourceFile(self.tempf.name) 145 | 146 | def borrarHtml(self): 147 | try: 148 | os.remove(self.tempf.name) 149 | except: 150 | pass 151 | 152 | def colorTextTitle(self,color): 153 | self.style.colorFontTitle=color 154 | self.style.update() 155 | self.update() 156 | 157 | def colorBackTitle(self,color): 158 | self.style.colorTitle=color 159 | self.style.update() 160 | self.update() 161 | 162 | def colorTextValue(self,color): 163 | self.style.colorFontValue(color) 164 | self.style.update() 165 | self.update() 166 | 167 | def colorBackValue(self,color): 168 | self.style.colorValue(color) 169 | self.style.update() 170 | self.update() 171 | 172 | -------------------------------------------------------------------------------- /pb_tool.cfg: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # QGISDashboard 3 | # 4 | # Configuration file for plugin builder tool (pb_tool) 5 | # Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 6 | # ------------------- 7 | # begin : 2021-06-14 8 | # copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 9 | # email : luis3176@yahoo.com 10 | # ***************************************************************************/ 11 | # 12 | #/*************************************************************************** 13 | # * * 14 | # * This program is free software; you can redistribute it and/or modify * 15 | # * it under the terms of the GNU General Public License as published by * 16 | # * the Free Software Foundation; either version 2 of the License, or * 17 | # * (at your option) any later version. * 18 | # * * 19 | # ***************************************************************************/ 20 | # 21 | # 22 | # You can install pb_tool using: 23 | # pip install http://geoapt.net/files/pb_tool.zip 24 | # 25 | # Consider doing your development (and install of pb_tool) in a virtualenv. 26 | # 27 | # For details on setting up and using pb_tool, see: 28 | # http://g-sherman.github.io/plugin_build_tool/ 29 | # 30 | # Issues and pull requests here: 31 | # https://github.com/g-sherman/plugin_build_tool: 32 | # 33 | # Sane defaults for your plugin generated by the Plugin Builder are 34 | # already set below. 35 | # 36 | # As you add Python source files and UI files to your plugin, add 37 | # them to the appropriate [files] section below. 38 | 39 | [plugin] 40 | # Name of the plugin. This is the name of the directory that will 41 | # be created in .qgis2/python/plugins 42 | name: QGIS_Dashboard 43 | 44 | # Full path to where you want your plugin directory copied. If empty, 45 | # the QGIS default path will be used. Don't include the plugin name in 46 | # the path. 47 | plugin_path: 48 | 49 | [files] 50 | # Python files that should be deployed with the plugin 51 | python_files: __init__.py QGIS_Dashboard.py QGIS_Dashboard_dialog.py 52 | 53 | # The main dialog file that is loaded (not compiled) 54 | main_dialog: QGIS_Dashboard_dialog_base.ui 55 | 56 | # Other ui files for dialogs you create (these will be compiled) 57 | compiled_ui_files: 58 | 59 | # Resource file(s) that will be compiled 60 | resource_files: resources.qrc 61 | 62 | # Other files required for the plugin 63 | extras: metadata.txt icon.png 64 | 65 | # Other directories to be deployed with the plugin. 66 | # These must be subdirectories under the plugin directory 67 | extra_dirs: 68 | 69 | # ISO code(s) for any locales (translations), separated by spaces. 70 | # Corresponding .ts files must exist in the i18n directory 71 | locales: 72 | 73 | [help] 74 | # the built help directory that should be deployed with the plugin 75 | dir: help/build/html 76 | # the name of the directory to target in the deployed plugin 77 | target: help 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /plugin_upload.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding=utf-8 3 | """This script uploads a plugin package to the plugin repository. 4 | Authors: A. Pasotti, V. Picavet 5 | git sha : $TemplateVCSFormat 6 | """ 7 | 8 | import sys 9 | import getpass 10 | import xmlrpc.client 11 | from optparse import OptionParser 12 | 13 | standard_library.install_aliases() 14 | 15 | # Configuration 16 | PROTOCOL = 'https' 17 | SERVER = 'plugins.qgis.org' 18 | PORT = '443' 19 | ENDPOINT = '/plugins/RPC2/' 20 | VERBOSE = False 21 | 22 | 23 | def main(parameters, arguments): 24 | """Main entry point. 25 | 26 | :param parameters: Command line parameters. 27 | :param arguments: Command line arguments. 28 | """ 29 | address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format( 30 | protocol=PROTOCOL, 31 | username=parameters.username, 32 | password=parameters.password, 33 | server=parameters.server, 34 | port=parameters.port, 35 | endpoint=ENDPOINT) 36 | print("Connecting to: %s" % hide_password(address)) 37 | 38 | server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE) 39 | 40 | try: 41 | with open(arguments[0], 'rb') as handle: 42 | plugin_id, version_id = server.plugin.upload( 43 | xmlrpc.client.Binary(handle.read())) 44 | print("Plugin ID: %s" % plugin_id) 45 | print("Version ID: %s" % version_id) 46 | except xmlrpc.client.ProtocolError as err: 47 | print("A protocol error occurred") 48 | print("URL: %s" % hide_password(err.url, 0)) 49 | print("HTTP/HTTPS headers: %s" % err.headers) 50 | print("Error code: %d" % err.errcode) 51 | print("Error message: %s" % err.errmsg) 52 | except xmlrpc.client.Fault as err: 53 | print("A fault occurred") 54 | print("Fault code: %d" % err.faultCode) 55 | print("Fault string: %s" % err.faultString) 56 | 57 | 58 | def hide_password(url, start=6): 59 | """Returns the http url with password part replaced with '*'. 60 | 61 | :param url: URL to upload the plugin to. 62 | :type url: str 63 | 64 | :param start: Position of start of password. 65 | :type start: int 66 | """ 67 | start_position = url.find(':', start) + 1 68 | end_position = url.find('@') 69 | return "%s%s%s" % ( 70 | url[:start_position], 71 | '*' * (end_position - start_position), 72 | url[end_position:]) 73 | 74 | 75 | if __name__ == "__main__": 76 | parser = OptionParser(usage="%prog [options] plugin.zip") 77 | parser.add_option( 78 | "-w", "--password", dest="password", 79 | help="Password for plugin site", metavar="******") 80 | parser.add_option( 81 | "-u", "--username", dest="username", 82 | help="Username of plugin site", metavar="user") 83 | parser.add_option( 84 | "-p", "--port", dest="port", 85 | help="Server port to connect to", metavar="80") 86 | parser.add_option( 87 | "-s", "--server", dest="server", 88 | help="Specify server name", metavar="plugins.qgis.org") 89 | options, args = parser.parse_args() 90 | if len(args) != 1: 91 | print("Please specify zip file.\n") 92 | parser.print_help() 93 | sys.exit(1) 94 | if not options.server: 95 | options.server = SERVER 96 | if not options.port: 97 | options.port = PORT 98 | if not options.username: 99 | # interactive mode 100 | username = getpass.getuser() 101 | print("Please enter user name [%s] :" % username, end=' ') 102 | 103 | res = input() 104 | if res != "": 105 | options.username = res 106 | else: 107 | options.username = username 108 | if not options.password: 109 | # interactive mode 110 | options.password = getpass.getpass() 111 | main(options, args) 112 | -------------------------------------------------------------------------------- /pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # Specify a configuration file. 4 | #rcfile= 5 | 6 | # Python code to execute, usually for sys.path manipulation such as 7 | # pygtk.require(). 8 | #init-hook= 9 | 10 | # Profiled execution. 11 | profile=no 12 | 13 | # Add files or directories to the blacklist. They should be base names, not 14 | # paths. 15 | ignore=CVS 16 | 17 | # Pickle collected data for later comparisons. 18 | persistent=yes 19 | 20 | # List of plugins (as comma separated values of python modules names) to load, 21 | # usually to register additional checkers. 22 | load-plugins= 23 | 24 | 25 | [MESSAGES CONTROL] 26 | 27 | # Enable the message, report, category or checker with the given id(s). You can 28 | # either give multiple identifier separated by comma (,) or put this option 29 | # multiple time. See also the "--disable" option for examples. 30 | #enable= 31 | 32 | # Disable the message, report, category or checker with the given id(s). You 33 | # can either give multiple identifiers separated by comma (,) or put this 34 | # option multiple times (only on the command line, not in the configuration 35 | # file where it should appear only once).You can also use "--disable=all" to 36 | # disable everything first and then reenable specific checks. For example, if 37 | # you want to run only the similarities checker, you can use "--disable=all 38 | # --enable=similarities". If you want to run only the classes checker, but have 39 | # no Warning level messages displayed, use"--disable=all --enable=classes 40 | # --disable=W" 41 | # see http://stackoverflow.com/questions/21487025/pylint-locally-defined-disables-still-give-warnings-how-to-suppress-them 42 | disable=locally-disabled,C0103 43 | 44 | 45 | [REPORTS] 46 | 47 | # Set the output format. Available formats are text, parseable, colorized, msvs 48 | # (visual studio) and html. You can also give a reporter class, eg 49 | # mypackage.mymodule.MyReporterClass. 50 | output-format=text 51 | 52 | # Put messages in a separate file for each module / package specified on the 53 | # command line instead of printing them on stdout. Reports (if any) will be 54 | # written in a file name "pylint_global.[txt|html]". 55 | files-output=no 56 | 57 | # Tells whether to display a full report or only the messages 58 | reports=yes 59 | 60 | # Python expression which should return a note less than 10 (10 is the highest 61 | # note). You have access to the variables errors warning, statement which 62 | # respectively contain the number of errors / warnings messages and the total 63 | # number of statements analyzed. This is used by the global evaluation report 64 | # (RP0004). 65 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 66 | 67 | # Add a comment according to your evaluation note. This is used by the global 68 | # evaluation report (RP0004). 69 | comment=no 70 | 71 | # Template used to display messages. This is a python new-style format string 72 | # used to format the message information. See doc for all details 73 | #msg-template= 74 | 75 | 76 | [BASIC] 77 | 78 | # Required attributes for module, separated by a comma 79 | required-attributes= 80 | 81 | # List of builtins function names that should not be used, separated by a comma 82 | bad-functions=map,filter,apply,input 83 | 84 | # Regular expression which should only match correct module names 85 | module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 86 | 87 | # Regular expression which should only match correct module level names 88 | const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 89 | 90 | # Regular expression which should only match correct class names 91 | class-rgx=[A-Z_][a-zA-Z0-9]+$ 92 | 93 | # Regular expression which should only match correct function names 94 | function-rgx=[a-z_][a-z0-9_]{2,30}$ 95 | 96 | # Regular expression which should only match correct method names 97 | method-rgx=[a-z_][a-z0-9_]{2,30}$ 98 | 99 | # Regular expression which should only match correct instance attribute names 100 | attr-rgx=[a-z_][a-z0-9_]{2,30}$ 101 | 102 | # Regular expression which should only match correct argument names 103 | argument-rgx=[a-z_][a-z0-9_]{2,30}$ 104 | 105 | # Regular expression which should only match correct variable names 106 | variable-rgx=[a-z_][a-z0-9_]{2,30}$ 107 | 108 | # Regular expression which should only match correct attribute names in class 109 | # bodies 110 | class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 111 | 112 | # Regular expression which should only match correct list comprehension / 113 | # generator expression variable names 114 | inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ 115 | 116 | # Good variable names which should always be accepted, separated by a comma 117 | good-names=i,j,k,ex,Run,_ 118 | 119 | # Bad variable names which should always be refused, separated by a comma 120 | bad-names=foo,bar,baz,toto,tutu,tata 121 | 122 | # Regular expression which should only match function or class names that do 123 | # not require a docstring. 124 | no-docstring-rgx=__.*__ 125 | 126 | # Minimum line length for functions/classes that require docstrings, shorter 127 | # ones are exempt. 128 | docstring-min-length=-1 129 | 130 | 131 | [MISCELLANEOUS] 132 | 133 | # List of note tags to take in consideration, separated by a comma. 134 | notes=FIXME,XXX,TODO 135 | 136 | 137 | [TYPECHECK] 138 | 139 | # Tells whether missing members accessed in mixin class should be ignored. A 140 | # mixin class is detected if its name ends with "mixin" (case insensitive). 141 | ignore-mixin-members=yes 142 | 143 | # List of classes names for which member attributes should not be checked 144 | # (useful for classes with attributes dynamically set). 145 | ignored-classes=SQLObject 146 | 147 | # When zope mode is activated, add a predefined set of Zope acquired attributes 148 | # to generated-members. 149 | zope=no 150 | 151 | # List of members which are set dynamically and missed by pylint inference 152 | # system, and so shouldn't trigger E0201 when accessed. Python regular 153 | # expressions are accepted. 154 | generated-members=REQUEST,acl_users,aq_parent 155 | 156 | 157 | [VARIABLES] 158 | 159 | # Tells whether we should check for unused import in __init__ files. 160 | init-import=no 161 | 162 | # A regular expression matching the beginning of the name of dummy variables 163 | # (i.e. not used). 164 | dummy-variables-rgx=_$|dummy 165 | 166 | # List of additional names supposed to be defined in builtins. Remember that 167 | # you should avoid to define new builtins when possible. 168 | additional-builtins= 169 | 170 | 171 | [FORMAT] 172 | 173 | # Maximum number of characters on a single line. 174 | max-line-length=80 175 | 176 | # Regexp for a line that is allowed to be longer than the limit. 177 | ignore-long-lines=^\s*(# )??$ 178 | 179 | # Allow the body of an if to be on the same line as the test if there is no 180 | # else. 181 | single-line-if-stmt=no 182 | 183 | # List of optional constructs for which whitespace checking is disabled 184 | no-space-check=trailing-comma,dict-separator 185 | 186 | # Maximum number of lines in a module 187 | max-module-lines=1000 188 | 189 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 190 | # tab). 191 | indent-string=' ' 192 | 193 | 194 | [SIMILARITIES] 195 | 196 | # Minimum lines number of a similarity. 197 | min-similarity-lines=4 198 | 199 | # Ignore comments when computing similarities. 200 | ignore-comments=yes 201 | 202 | # Ignore docstrings when computing similarities. 203 | ignore-docstrings=yes 204 | 205 | # Ignore imports when computing similarities. 206 | ignore-imports=no 207 | 208 | 209 | [IMPORTS] 210 | 211 | # Deprecated modules which should not be used, separated by a comma 212 | deprecated-modules=regsub,TERMIOS,Bastion,rexec 213 | 214 | # Create a graph of every (i.e. internal and external) dependencies in the 215 | # given file (report RP0402 must not be disabled) 216 | import-graph= 217 | 218 | # Create a graph of external dependencies in the given file (report RP0402 must 219 | # not be disabled) 220 | ext-import-graph= 221 | 222 | # Create a graph of internal dependencies in the given file (report RP0402 must 223 | # not be disabled) 224 | int-import-graph= 225 | 226 | 227 | [DESIGN] 228 | 229 | # Maximum number of arguments for function / method 230 | max-args=5 231 | 232 | # Argument names that match this expression will be ignored. Default to name 233 | # with leading underscore 234 | ignored-argument-names=_.* 235 | 236 | # Maximum number of locals for function / method body 237 | max-locals=15 238 | 239 | # Maximum number of return / yield for function / method body 240 | max-returns=6 241 | 242 | # Maximum number of branch for function / method body 243 | max-branches=12 244 | 245 | # Maximum number of statements in function / method body 246 | max-statements=50 247 | 248 | # Maximum number of parents for a class (see R0901). 249 | max-parents=7 250 | 251 | # Maximum number of attributes for a class (see R0902). 252 | max-attributes=7 253 | 254 | # Minimum number of public methods for a class (see R0903). 255 | min-public-methods=2 256 | 257 | # Maximum number of public methods for a class (see R0904). 258 | max-public-methods=20 259 | 260 | 261 | [CLASSES] 262 | 263 | # List of interface methods to ignore, separated by a comma. This is used for 264 | # instance to not check methods defines in Zope's Interface base class. 265 | ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by 266 | 267 | # List of method names used to declare (i.e. assign) instance attributes. 268 | defining-attr-methods=__init__,__new__,setUp 269 | 270 | # List of valid names for the first argument in a class method. 271 | valid-classmethod-first-arg=cls 272 | 273 | # List of valid names for the first argument in a metaclass class method. 274 | valid-metaclass-classmethod-first-arg=mcs 275 | 276 | 277 | [EXCEPTIONS] 278 | 279 | # Exceptions that will emit a warning when being caught. Defaults to 280 | # "Exception" 281 | overgeneral-exceptions=Exception 282 | -------------------------------------------------------------------------------- /register.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | QGISDashboard 5 | A QGIS plugin 6 | This plugin allows the construction and management of Dashboards on screen. 7 | ------------------- 8 | begin : 2021-06-14 9 | git sha : https://github.com/luisCartoGeo/QGIS_Dashboard 10 | copyright : (C) 2021 by Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/ 11 | email : luis3176@yahoo.com 12 | ***************************************************************************/ 13 | """ 14 | import os 15 | import os.path 16 | 17 | class logControl: 18 | def __init__(self): 19 | self.dir = os.path.dirname(__file__) 20 | self.path=os.path.join(self.dir,'log.txt') 21 | 22 | def canWriteLog(self): 23 | firtsIntent=False 24 | if os.path.exists(self.dir): 25 | if os.access(self.dir,os.W_OK): 26 | firtsIntent=True 27 | else: 28 | return False 29 | else: 30 | return False 31 | test=os.path.join(self.dir,'test.txt') 32 | if firtsIntent==True: 33 | try: 34 | f=open(test,'w+t') 35 | f.write('prueba escritura') 36 | f.close() 37 | os.remove(test) 38 | return True 39 | except IOError: 40 | return False 41 | 42 | def writeLog(self,text): 43 | if os.path.isfile(self.path): 44 | with open(self.path,'at') as file: 45 | file.write("\n"+text) 46 | else: 47 | with open(self.path,'wt') as file: 48 | file.write("\n"+'text') 49 | 50 | 51 | -------------------------------------------------------------------------------- /resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/resources/__init__.py -------------------------------------------------------------------------------- /resources/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/resources/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /resources/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luisCartoGeo/QGIS_Dashboard/e1e56d39d5f70819e97433bbd8f4920d9aa6ede7/save.png -------------------------------------------------------------------------------- /scripts/compile-strings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LRELEASE=$1 3 | LOCALES=$2 4 | 5 | 6 | for LOCALE in ${LOCALES} 7 | do 8 | echo "Processing: ${LOCALE}.ts" 9 | # Note we don't use pylupdate with qt .pro file approach as it is flakey 10 | # about what is made available. 11 | $LRELEASE i18n/${LOCALE}.ts 12 | done 13 | -------------------------------------------------------------------------------- /scripts/run-env-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QGIS_PREFIX_PATH=/usr/local/qgis-2.0 4 | if [ -n "$1" ]; then 5 | QGIS_PREFIX_PATH=$1 6 | fi 7 | 8 | echo ${QGIS_PREFIX_PATH} 9 | 10 | 11 | export QGIS_PREFIX_PATH=${QGIS_PREFIX_PATH} 12 | export QGIS_PATH=${QGIS_PREFIX_PATH} 13 | export LD_LIBRARY_PATH=${QGIS_PREFIX_PATH}/lib 14 | export PYTHONPATH=${QGIS_PREFIX_PATH}/share/qgis/python:${QGIS_PREFIX_PATH}/share/qgis/python/plugins:${PYTHONPATH} 15 | 16 | echo "QGIS PATH: $QGIS_PREFIX_PATH" 17 | export QGIS_DEBUG=0 18 | export QGIS_LOG_FILE=/tmp/inasafe/realtime/logs/qgis.log 19 | 20 | export PATH=${QGIS_PREFIX_PATH}/bin:$PATH 21 | 22 | echo "This script is intended to be sourced to set up your shell to" 23 | echo "use a QGIS 2.0 built in $QGIS_PREFIX_PATH" 24 | echo 25 | echo "To use it do:" 26 | echo "source $BASH_SOURCE /your/optional/install/path" 27 | echo 28 | echo "Then use the make file supplied here e.g. make guitest" 29 | -------------------------------------------------------------------------------- /scripts/update-strings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LOCALES=$* 3 | 4 | # Get newest .py files so we don't update strings unnecessarily 5 | 6 | CHANGED_FILES=0 7 | PYTHON_FILES=`find . -regex ".*\(ui\|py\)$" -type f` 8 | for PYTHON_FILE in $PYTHON_FILES 9 | do 10 | CHANGED=$(stat -c %Y $PYTHON_FILE) 11 | if [ ${CHANGED} -gt ${CHANGED_FILES} ] 12 | then 13 | CHANGED_FILES=${CHANGED} 14 | fi 15 | done 16 | 17 | # Qt translation stuff 18 | # for .ts file 19 | UPDATE=false 20 | for LOCALE in ${LOCALES} 21 | do 22 | TRANSLATION_FILE="i18n/$LOCALE.ts" 23 | if [ ! -f ${TRANSLATION_FILE} ] 24 | then 25 | # Force translation string collection as we have a new language file 26 | touch ${TRANSLATION_FILE} 27 | UPDATE=true 28 | break 29 | fi 30 | 31 | MODIFICATION_TIME=$(stat -c %Y ${TRANSLATION_FILE}) 32 | if [ ${CHANGED_FILES} -gt ${MODIFICATION_TIME} ] 33 | then 34 | # Force translation string collection as a .py file has been updated 35 | UPDATE=true 36 | break 37 | fi 38 | done 39 | 40 | if [ ${UPDATE} == true ] 41 | # retrieve all python files 42 | then 43 | echo ${PYTHON_FILES} 44 | # update .ts 45 | echo "Please provide translations by editing the translation files below:" 46 | for LOCALE in ${LOCALES} 47 | do 48 | echo "i18n/"${LOCALE}".ts" 49 | # Note we don't use pylupdate with qt .pro file approach as it is flakey 50 | # about what is made available. 51 | pylupdate4 -noobsolete ${PYTHON_FILES} -ts i18n/${LOCALE}.ts 52 | done 53 | else 54 | echo "No need to edit any translation files (.ts) because no python files" 55 | echo "has been updated since the last update translation. " 56 | fi 57 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- 1 | # import qgis libs so that ve set the correct sip api version 2 | import qgis # pylint: disable=W0611 # NOQA -------------------------------------------------------------------------------- /test/qgis_interface.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """QGIS plugin implementation. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | .. note:: This source code was copied from the 'postgis viewer' application 10 | with original authors: 11 | Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk 12 | Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org 13 | Copyright (c) 2014 Tim Sutton, tim@linfiniti.com 14 | 15 | """ 16 | 17 | __author__ = 'tim@linfiniti.com' 18 | __revision__ = '$Format:%H$' 19 | __date__ = '10/01/2011' 20 | __copyright__ = ( 21 | 'Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk and ' 22 | 'Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org' 23 | 'Copyright (c) 2014 Tim Sutton, tim@linfiniti.com' 24 | ) 25 | 26 | import logging 27 | from qgis.PyQt.QtCore import QObject, pyqtSlot, pyqtSignal 28 | from qgis.core import QgsMapLayerRegistry 29 | from qgis.gui import QgsMapCanvasLayer 30 | LOGGER = logging.getLogger('QGIS') 31 | 32 | 33 | #noinspection PyMethodMayBeStatic,PyPep8Naming 34 | class QgisInterface(QObject): 35 | """Class to expose QGIS objects and functions to plugins. 36 | 37 | This class is here for enabling us to run unit tests only, 38 | so most methods are simply stubs. 39 | """ 40 | currentLayerChanged = pyqtSignal(QgsMapCanvasLayer) 41 | 42 | def __init__(self, canvas): 43 | """Constructor 44 | :param canvas: 45 | """ 46 | QObject.__init__(self) 47 | self.canvas = canvas 48 | # Set up slots so we can mimic the behaviour of QGIS when layers 49 | # are added. 50 | LOGGER.debug('Initialising canvas...') 51 | # noinspection PyArgumentList 52 | QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers) 53 | # noinspection PyArgumentList 54 | QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer) 55 | # noinspection PyArgumentList 56 | QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers) 57 | 58 | # For processing module 59 | self.destCrs = None 60 | 61 | @pyqtSlot('QStringList') 62 | def addLayers(self, layers): 63 | """Handle layers being added to the registry so they show up in canvas. 64 | 65 | :param layers: list list of map layers that were added 66 | 67 | .. note:: The QgsInterface api does not include this method, 68 | it is added here as a helper to facilitate testing. 69 | """ 70 | #LOGGER.debug('addLayers called on qgis_interface') 71 | #LOGGER.debug('Number of layers being added: %s' % len(layers)) 72 | #LOGGER.debug('Layer Count Before: %s' % len(self.canvas.layers())) 73 | current_layers = self.canvas.layers() 74 | final_layers = [] 75 | for layer in current_layers: 76 | final_layers.append(QgsMapCanvasLayer(layer)) 77 | for layer in layers: 78 | final_layers.append(QgsMapCanvasLayer(layer)) 79 | 80 | self.canvas.setLayerSet(final_layers) 81 | #LOGGER.debug('Layer Count After: %s' % len(self.canvas.layers())) 82 | 83 | @pyqtSlot('QgsMapLayer') 84 | def addLayer(self, layer): 85 | """Handle a layer being added to the registry so it shows up in canvas. 86 | 87 | :param layer: list list of map layers that were added 88 | 89 | .. note: The QgsInterface api does not include this method, it is added 90 | here as a helper to facilitate testing. 91 | 92 | .. note: The addLayer method was deprecated in QGIS 1.8 so you should 93 | not need this method much. 94 | """ 95 | pass 96 | 97 | @pyqtSlot() 98 | def removeAllLayers(self): 99 | """Remove layers from the canvas before they get deleted.""" 100 | self.canvas.setLayerSet([]) 101 | 102 | def newProject(self): 103 | """Create new project.""" 104 | # noinspection PyArgumentList 105 | QgsMapLayerRegistry.instance().removeAllMapLayers() 106 | 107 | # ---------------- API Mock for QgsInterface follows ------------------- 108 | 109 | def zoomFull(self): 110 | """Zoom to the map full extent.""" 111 | pass 112 | 113 | def zoomToPrevious(self): 114 | """Zoom to previous view extent.""" 115 | pass 116 | 117 | def zoomToNext(self): 118 | """Zoom to next view extent.""" 119 | pass 120 | 121 | def zoomToActiveLayer(self): 122 | """Zoom to extent of active layer.""" 123 | pass 124 | 125 | def addVectorLayer(self, path, base_name, provider_key): 126 | """Add a vector layer. 127 | 128 | :param path: Path to layer. 129 | :type path: str 130 | 131 | :param base_name: Base name for layer. 132 | :type base_name: str 133 | 134 | :param provider_key: Provider key e.g. 'ogr' 135 | :type provider_key: str 136 | """ 137 | pass 138 | 139 | def addRasterLayer(self, path, base_name): 140 | """Add a raster layer given a raster layer file name 141 | 142 | :param path: Path to layer. 143 | :type path: str 144 | 145 | :param base_name: Base name for layer. 146 | :type base_name: str 147 | """ 148 | pass 149 | 150 | def activeLayer(self): 151 | """Get pointer to the active layer (layer selected in the legend).""" 152 | # noinspection PyArgumentList 153 | layers = QgsMapLayerRegistry.instance().mapLayers() 154 | for item in layers: 155 | return layers[item] 156 | 157 | def addToolBarIcon(self, action): 158 | """Add an icon to the plugins toolbar. 159 | 160 | :param action: Action to add to the toolbar. 161 | :type action: QAction 162 | """ 163 | pass 164 | 165 | def removeToolBarIcon(self, action): 166 | """Remove an action (icon) from the plugin toolbar. 167 | 168 | :param action: Action to add to the toolbar. 169 | :type action: QAction 170 | """ 171 | pass 172 | 173 | def addToolBar(self, name): 174 | """Add toolbar with specified name. 175 | 176 | :param name: Name for the toolbar. 177 | :type name: str 178 | """ 179 | pass 180 | 181 | def mapCanvas(self): 182 | """Return a pointer to the map canvas.""" 183 | return self.canvas 184 | 185 | def mainWindow(self): 186 | """Return a pointer to the main window. 187 | 188 | In case of QGIS it returns an instance of QgisApp. 189 | """ 190 | pass 191 | 192 | def addDockWidget(self, area, dock_widget): 193 | """Add a dock widget to the main window. 194 | 195 | :param area: Where in the ui the dock should be placed. 196 | :type area: 197 | 198 | :param dock_widget: A dock widget to add to the UI. 199 | :type dock_widget: QDockWidget 200 | """ 201 | pass 202 | 203 | def legendInterface(self): 204 | """Get the legend.""" 205 | return self.canvas 206 | -------------------------------------------------------------------------------- /test/tenbytenraster.asc: -------------------------------------------------------------------------------- 1 | NCOLS 10 2 | NROWS 10 3 | XLLCENTER 1535380.000000 4 | YLLCENTER 5083260.000000 5 | DX 10 6 | DY 10 7 | NODATA_VALUE -9999 8 | 0 1 2 3 4 5 6 7 8 9 9 | 0 1 2 3 4 5 6 7 8 9 10 | 0 1 2 3 4 5 6 7 8 9 11 | 0 1 2 3 4 5 6 7 8 9 12 | 0 1 2 3 4 5 6 7 8 9 13 | 0 1 2 3 4 5 6 7 8 9 14 | 0 1 2 3 4 5 6 7 8 9 15 | 0 1 2 3 4 5 6 7 8 9 16 | 0 1 2 3 4 5 6 7 8 9 17 | 0 1 2 3 4 5 6 7 8 9 18 | CRS 19 | NOTES 20 | -------------------------------------------------------------------------------- /test/tenbytenraster.asc.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Point 4 | 5 | 6 | 7 | 9 8 | 4.5 9 | 0 10 | 2.872281323269 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/tenbytenraster.keywords: -------------------------------------------------------------------------------- 1 | title: Tenbytenraster 2 | -------------------------------------------------------------------------------- /test/tenbytenraster.lic: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tim Sutton, Linfiniti Consulting CC 5 | 6 | 7 | 8 | tenbytenraster.asc 9 | 2700044251 10 | Yes 11 | Tim Sutton 12 | Tim Sutton (QGIS Source Tree) 13 | Tim Sutton 14 | This data is publicly available from QGIS Source Tree. The original 15 | file was created and contributed to QGIS by Tim Sutton. 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/tenbytenraster.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /test/tenbytenraster.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | -------------------------------------------------------------------------------- /test/test_QGIS_Dashboard_dialog.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Dialog test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | 11 | __author__ = 'luis3176@yahoo.com' 12 | __date__ = '2021-06-14' 13 | __copyright__ = 'Copyright 2021, Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/' 14 | 15 | import unittest 16 | 17 | from qgis.PyQt.QtGui import QDialogButtonBox, QDialog 18 | 19 | from QGIS_Dashboard_dialog import QGISDashboardDialog 20 | 21 | from utilities import get_qgis_app 22 | QGIS_APP = get_qgis_app() 23 | 24 | 25 | class QGISDashboardDialogTest(unittest.TestCase): 26 | """Test dialog works.""" 27 | 28 | def setUp(self): 29 | """Runs before each test.""" 30 | self.dialog = QGISDashboardDialog(None) 31 | 32 | def tearDown(self): 33 | """Runs after each test.""" 34 | self.dialog = None 35 | 36 | def test_dialog_ok(self): 37 | """Test we can click OK.""" 38 | 39 | button = self.dialog.button_box.button(QDialogButtonBox.Ok) 40 | button.click() 41 | result = self.dialog.result() 42 | self.assertEqual(result, QDialog.Accepted) 43 | 44 | def test_dialog_cancel(self): 45 | """Test we can click cancel.""" 46 | button = self.dialog.button_box.button(QDialogButtonBox.Cancel) 47 | button.click() 48 | result = self.dialog.result() 49 | self.assertEqual(result, QDialog.Rejected) 50 | 51 | if __name__ == "__main__": 52 | suite = unittest.makeSuite(QGISDashboardDialogTest) 53 | runner = unittest.TextTestRunner(verbosity=2) 54 | runner.run(suite) 55 | 56 | -------------------------------------------------------------------------------- /test/test_init.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Tests QGIS plugin init.""" 3 | 4 | __author__ = 'Tim Sutton ' 5 | __revision__ = '$Format:%H$' 6 | __date__ = '17/10/2010' 7 | __license__ = "GPL" 8 | __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' 9 | __copyright__ += 'Disaster Reduction' 10 | 11 | import os 12 | import unittest 13 | import logging 14 | import configparser 15 | 16 | LOGGER = logging.getLogger('QGIS') 17 | 18 | 19 | class TestInit(unittest.TestCase): 20 | """Test that the plugin init is usable for QGIS. 21 | 22 | Based heavily on the validator class by Alessandro 23 | Passoti available here: 24 | 25 | http://github.com/qgis/qgis-django/blob/master/qgis-app/ 26 | plugins/validator.py 27 | 28 | """ 29 | 30 | def test_read_init(self): 31 | """Test that the plugin __init__ will validate on plugins.qgis.org.""" 32 | 33 | # You should update this list according to the latest in 34 | # https://github.com/qgis/qgis-django/blob/master/qgis-app/ 35 | # plugins/validator.py 36 | 37 | required_metadata = [ 38 | 'name', 39 | 'description', 40 | 'version', 41 | 'qgisMinimumVersion', 42 | 'email', 43 | 'author'] 44 | 45 | file_path = os.path.abspath(os.path.join( 46 | os.path.dirname(__file__), os.pardir, 47 | 'metadata.txt')) 48 | LOGGER.info(file_path) 49 | metadata = [] 50 | parser = configparser.ConfigParser() 51 | parser.optionxform = str 52 | parser.read(file_path) 53 | message = 'Cannot find a section named "general" in %s' % file_path 54 | assert parser.has_section('general'), message 55 | metadata.extend(parser.items('general')) 56 | 57 | for expectation in required_metadata: 58 | message = ('Cannot find metadata "%s" in metadata source (%s).' % ( 59 | expectation, file_path)) 60 | 61 | self.assertIn(expectation, dict(metadata), message) 62 | 63 | if __name__ == '__main__': 64 | unittest.main() 65 | -------------------------------------------------------------------------------- /test/test_qgis_environment.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Tests for QGIS functionality. 3 | 4 | 5 | .. note:: This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | """ 11 | __author__ = 'tim@linfiniti.com' 12 | __date__ = '20/01/2011' 13 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 14 | 'Disaster Reduction') 15 | 16 | import os 17 | import unittest 18 | from qgis.core import ( 19 | QgsProviderRegistry, 20 | QgsCoordinateReferenceSystem, 21 | QgsRasterLayer) 22 | 23 | from .utilities import get_qgis_app 24 | QGIS_APP = get_qgis_app() 25 | 26 | 27 | class QGISTest(unittest.TestCase): 28 | """Test the QGIS Environment""" 29 | 30 | def test_qgis_environment(self): 31 | """QGIS environment has the expected providers""" 32 | 33 | r = QgsProviderRegistry.instance() 34 | self.assertIn('gdal', r.providerList()) 35 | self.assertIn('ogr', r.providerList()) 36 | self.assertIn('postgres', r.providerList()) 37 | 38 | def test_projection(self): 39 | """Test that QGIS properly parses a wkt string. 40 | """ 41 | crs = QgsCoordinateReferenceSystem() 42 | wkt = ( 43 | 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",' 44 | 'SPHEROID["WGS_1984",6378137.0,298.257223563]],' 45 | 'PRIMEM["Greenwich",0.0],UNIT["Degree",' 46 | '0.0174532925199433]]') 47 | crs.createFromWkt(wkt) 48 | auth_id = crs.authid() 49 | expected_auth_id = 'EPSG:4326' 50 | self.assertEqual(auth_id, expected_auth_id) 51 | 52 | # now test for a loaded layer 53 | path = os.path.join(os.path.dirname(__file__), 'tenbytenraster.asc') 54 | title = 'TestRaster' 55 | layer = QgsRasterLayer(path, title) 56 | auth_id = layer.crs().authid() 57 | self.assertEqual(auth_id, expected_auth_id) 58 | 59 | if __name__ == '__main__': 60 | unittest.main() 61 | -------------------------------------------------------------------------------- /test/test_resources.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Resources test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | 11 | __author__ = 'luis3176@yahoo.com' 12 | __date__ = '2021-06-14' 13 | __copyright__ = 'Copyright 2021, Luis Eduardo Perez https://www.linkedin.com/in/luisedpg/' 14 | 15 | import unittest 16 | 17 | from qgis.PyQt.QtGui import QIcon 18 | 19 | 20 | 21 | class QGISDashboardDialogTest(unittest.TestCase): 22 | """Test rerources work.""" 23 | 24 | def setUp(self): 25 | """Runs before each test.""" 26 | pass 27 | 28 | def tearDown(self): 29 | """Runs after each test.""" 30 | pass 31 | 32 | def test_icon_png(self): 33 | """Test we can click OK.""" 34 | path = ':/plugins/QGISDashboard/icon.png' 35 | icon = QIcon(path) 36 | self.assertFalse(icon.isNull()) 37 | 38 | if __name__ == "__main__": 39 | suite = unittest.makeSuite(QGISDashboardResourcesTest) 40 | runner = unittest.TextTestRunner(verbosity=2) 41 | runner.run(suite) 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/test_translations.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Safe Translations Test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | from .utilities import get_qgis_app 11 | 12 | __author__ = 'ismailsunni@yahoo.co.id' 13 | __date__ = '12/10/2011' 14 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 15 | 'Disaster Reduction') 16 | import unittest 17 | import os 18 | 19 | from qgis.PyQt.QtCore import QCoreApplication, QTranslator 20 | 21 | QGIS_APP = get_qgis_app() 22 | 23 | 24 | class SafeTranslationsTest(unittest.TestCase): 25 | """Test translations work.""" 26 | 27 | def setUp(self): 28 | """Runs before each test.""" 29 | if 'LANG' in iter(os.environ.keys()): 30 | os.environ.__delitem__('LANG') 31 | 32 | def tearDown(self): 33 | """Runs after each test.""" 34 | if 'LANG' in iter(os.environ.keys()): 35 | os.environ.__delitem__('LANG') 36 | 37 | def test_qgis_translations(self): 38 | """Test that translations work.""" 39 | parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir) 40 | dir_path = os.path.abspath(parent_path) 41 | file_path = os.path.join( 42 | dir_path, 'i18n', 'af.qm') 43 | translator = QTranslator() 44 | translator.load(file_path) 45 | QCoreApplication.installTranslator(translator) 46 | 47 | expected_message = 'Goeie more' 48 | real_message = QCoreApplication.translate("@default", 'Good morning') 49 | self.assertEqual(real_message, expected_message) 50 | 51 | 52 | if __name__ == "__main__": 53 | suite = unittest.makeSuite(SafeTranslationsTest) 54 | runner = unittest.TextTestRunner(verbosity=2) 55 | runner.run(suite) 56 | -------------------------------------------------------------------------------- /test/utilities.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Common functionality used by regression tests.""" 3 | 4 | import sys 5 | import logging 6 | 7 | 8 | LOGGER = logging.getLogger('QGIS') 9 | QGIS_APP = None # Static variable used to hold hand to running QGIS app 10 | CANVAS = None 11 | PARENT = None 12 | IFACE = None 13 | 14 | 15 | def get_qgis_app(): 16 | """ Start one QGIS application to test against. 17 | 18 | :returns: Handle to QGIS app, canvas, iface and parent. If there are any 19 | errors the tuple members will be returned as None. 20 | :rtype: (QgsApplication, CANVAS, IFACE, PARENT) 21 | 22 | If QGIS is already running the handle to that app will be returned. 23 | """ 24 | 25 | try: 26 | from qgis.PyQt import QtGui, QtCore 27 | from qgis.core import QgsApplication 28 | from qgis.gui import QgsMapCanvas 29 | from .qgis_interface import QgisInterface 30 | except ImportError: 31 | return None, None, None, None 32 | 33 | global QGIS_APP # pylint: disable=W0603 34 | 35 | if QGIS_APP is None: 36 | gui_flag = True # All test will run qgis in gui mode 37 | #noinspection PyPep8Naming 38 | QGIS_APP = QgsApplication(sys.argv, gui_flag) 39 | # Make sure QGIS_PREFIX_PATH is set in your env if needed! 40 | QGIS_APP.initQgis() 41 | s = QGIS_APP.showSettings() 42 | LOGGER.debug(s) 43 | 44 | global PARENT # pylint: disable=W0603 45 | if PARENT is None: 46 | #noinspection PyPep8Naming 47 | PARENT = QtGui.QWidget() 48 | 49 | global CANVAS # pylint: disable=W0603 50 | if CANVAS is None: 51 | #noinspection PyPep8Naming 52 | CANVAS = QgsMapCanvas(PARENT) 53 | CANVAS.resize(QtCore.QSize(400, 400)) 54 | 55 | global IFACE # pylint: disable=W0603 56 | if IFACE is None: 57 | # QgisInterface is a stub implementation of the QGIS plugin interface 58 | #noinspection PyPep8Naming 59 | IFACE = QgisInterface(CANVAS) 60 | 61 | return QGIS_APP, CANVAS, IFACE, PARENT 62 | --------------------------------------------------------------------------------