├── .gitignore ├── Makefile ├── __init__.py ├── help ├── Makefile ├── make.bat └── source │ ├── conf.py │ └── index.rst ├── i18n └── af.ts ├── metadata.txt ├── osmDownloader.py ├── osmDownloader_dialog.py ├── osmDownloader_dialog_base.ui ├── osm_downloader.py ├── pb_tool.cfg ├── plugin_upload.py ├── pylintrc ├── rectangle.png ├── rectangleAreaTool.py ├── resources.qrc ├── resources_rc.py ├── scripts ├── compile-strings.sh ├── run-env-linux.sh └── update-strings.sh ├── styles ├── osm_mapnik_line.qml ├── osm_mapnik_point.qml └── osm_mapnik_polygon.qml └── test ├── __init__.py ├── qgis_interface.py ├── tenbytenraster.asc ├── tenbytenraster.asc.aux.xml ├── tenbytenraster.keywords ├── tenbytenraster.lic ├── tenbytenraster.prj ├── tenbytenraster.qml ├── test_init.py ├── test_osmDownloader_dialog.py ├── test_qgis_environment.py ├── test_resources.py ├── test_translations.py └── utilities.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must end with two \r 29 | Icon 30 | 31 | 32 | # Thumbnails 33 | ._* 34 | 35 | # Files that might appear on external disk 36 | .Spotlight-V100 37 | .Trashes 38 | 39 | # Directories potentially created on remote AFP share 40 | .AppleDB 41 | .AppleDesktop 42 | Network Trash Folder 43 | Temporary Items 44 | .apdisk 45 | 46 | # Python 47 | *.pyc 48 | __pycache__/ 49 | *.pydevproject 50 | *.project 51 | 52 | # VSCode 53 | *.json -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # OSMDownloader 3 | # 4 | # Plugin to download OSM data by area 5 | # ------------------- 6 | # begin : 2015-04-07 7 | # git sha : $Format:%H$ 8 | # copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 9 | # email : suporte.dsgtools@dsg.eb.mil.br 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 | osmDownloader.py \ 42 | osmDownloader_dialog.py 43 | 44 | PLUGINNAME = OSMDownloader 45 | 46 | PY_FILES = \ 47 | osmDownloader.py \ 48 | osmDownloader_dialog.py \ 49 | __init__.py 50 | 51 | UI_FILES = osmDownloader_dialog_base.ui 52 | 53 | EXTRAS = icon.png metadata.txt 54 | 55 | COMPILED_RESOURCE_FILES = resources_rc.py 56 | 57 | PEP8EXCLUDE=pydev,resources_rc.py,conf.py,third_party,ui 58 | 59 | 60 | ################################################# 61 | # Normally you would not need to edit below here 62 | ################################################# 63 | 64 | HELP = help/build/html 65 | 66 | PLUGIN_UPLOAD = $(c)/plugin_upload.py 67 | 68 | RESOURCE_SRC=$(shell grep '^ *@@g;s/.*>//g' | tr '\n' ' ') 69 | 70 | QGISDIR=.qgis2 71 | 72 | default: compile 73 | 74 | compile: $(COMPILED_RESOURCE_FILES) 75 | 76 | %_rc.py : %.qrc $(RESOURCES_SRC) 77 | pyrcc4 -o $*_rc.py $< 78 | 79 | %.qm : %.ts 80 | $(LRELEASE) $< 81 | 82 | test: compile transcompile 83 | @echo 84 | @echo "----------------------" 85 | @echo "Regression Test Suite" 86 | @echo "----------------------" 87 | 88 | @# Preceding dash means that make will continue in case of errors 89 | @-export PYTHONPATH=`pwd`:$(PYTHONPATH); \ 90 | export QGIS_DEBUG=0; \ 91 | export QGIS_LOG_FILE=/dev/null; \ 92 | nosetests -v --with-id --with-coverage --cover-package=. \ 93 | 3>&1 1>&2 2>&3 3>&- || true 94 | @echo "----------------------" 95 | @echo "If you get a 'no module named qgis.core error, try sourcing" 96 | @echo "the helper script we have provided first then run make test." 97 | @echo "e.g. source run-env-linux.sh ; make test" 98 | @echo "----------------------" 99 | 100 | deploy: compile doc transcompile 101 | @echo 102 | @echo "------------------------------------------" 103 | @echo "Deploying plugin to your .qgis2 directory." 104 | @echo "------------------------------------------" 105 | # The deploy target only works on unix like operating system where 106 | # the Python plugin directory is located at: 107 | # $HOME/$(QGISDIR)/python/plugins 108 | mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 109 | cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 110 | cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 111 | cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 112 | cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 113 | cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 114 | cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help 115 | 116 | # The dclean target removes compiled python files from plugin directory 117 | # also deletes any .git entry 118 | dclean: 119 | @echo 120 | @echo "-----------------------------------" 121 | @echo "Removing any compiled python files." 122 | @echo "-----------------------------------" 123 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete 124 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \; 125 | 126 | 127 | derase: 128 | @echo 129 | @echo "-------------------------" 130 | @echo "Removing deployed plugin." 131 | @echo "-------------------------" 132 | rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 133 | 134 | zip: deploy dclean 135 | @echo 136 | @echo "---------------------------" 137 | @echo "Creating plugin zip bundle." 138 | @echo "---------------------------" 139 | # The zip target deploys the plugin and creates a zip file with the deployed 140 | # content. You can then upload the zip file on http://plugins.qgis.org 141 | rm -f $(PLUGINNAME).zip 142 | cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME) 143 | 144 | package: compile 145 | # Create a zip package of the plugin named $(PLUGINNAME).zip. 146 | # This requires use of git (your plugin development directory must be a 147 | # git repository). 148 | # To use, pass a valid commit or tag as follows: 149 | # make package VERSION=Version_0.3.2 150 | @echo 151 | @echo "------------------------------------" 152 | @echo "Exporting plugin to zip package. " 153 | @echo "------------------------------------" 154 | rm -f $(PLUGINNAME).zip 155 | git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION) 156 | echo "Created package: $(PLUGINNAME).zip" 157 | 158 | upload: zip 159 | @echo 160 | @echo "-------------------------------------" 161 | @echo "Uploading plugin to QGIS Plugin repo." 162 | @echo "-------------------------------------" 163 | $(PLUGIN_UPLOAD) $(PLUGINNAME).zip 164 | 165 | transup: 166 | @echo 167 | @echo "------------------------------------------------" 168 | @echo "Updating translation files with any new strings." 169 | @echo "------------------------------------------------" 170 | @chmod +x scripts/update-strings.sh 171 | @scripts/update-strings.sh $(LOCALES) 172 | 173 | transcompile: 174 | @echo 175 | @echo "----------------------------------------" 176 | @echo "Compiled translation files to .qm files." 177 | @echo "----------------------------------------" 178 | @chmod +x scripts/compile-strings.sh 179 | @scripts/compile-strings.sh $(LRELEASE) $(LOCALES) 180 | 181 | transclean: 182 | @echo 183 | @echo "------------------------------------" 184 | @echo "Removing compiled translation files." 185 | @echo "------------------------------------" 186 | rm -f i18n/*.qm 187 | 188 | clean: 189 | @echo 190 | @echo "------------------------------------" 191 | @echo "Removing uic and rcc generated files" 192 | @echo "------------------------------------" 193 | rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES) 194 | 195 | doc: 196 | @echo 197 | @echo "------------------------------------" 198 | @echo "Building documentation using sphinx." 199 | @echo "------------------------------------" 200 | cd help; make html 201 | 202 | pylint: 203 | @echo 204 | @echo "-----------------" 205 | @echo "Pylint violations" 206 | @echo "-----------------" 207 | @pylint --reports=n --rcfile=pylintrc . || true 208 | @echo 209 | @echo "----------------------" 210 | @echo "If you get a 'no module named qgis.core' error, try sourcing" 211 | @echo "the helper script we have provided first then run make pylint." 212 | @echo "e.g. source run-env-linux.sh ; make pylint" 213 | @echo "----------------------" 214 | 215 | 216 | # Run pep8 style checking 217 | #http://pypi.python.org/pypi/pep8 218 | pep8: 219 | @echo 220 | @echo "-----------" 221 | @echo "PEP8 issues" 222 | @echo "-----------" 223 | @pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true 224 | @echo "-----------" 225 | @echo "Ignored in PEP8 check:" 226 | @echo $(PEP8EXCLUDE) 227 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OSMDownloader 5 | A QGIS plugin 6 | Plugin to download OSM data by area 7 | ------------------- 8 | begin : 2015-04-07 9 | copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 10 | email : suporte.dsgtools@dsg.eb.mil.br 11 | git sha : $Format:%H$ 12 | ***************************************************************************/ 13 | 14 | /*************************************************************************** 15 | * * 16 | * This program is free software; you can redistribute it and/or modify * 17 | * it under the terms of the GNU General Public License as published by * 18 | * the Free Software Foundation; either version 2 of the License, or * 19 | * (at your option) any later version. * 20 | * * 21 | ***************************************************************************/ 22 | This script initializes the plugin, making it known to QGIS. 23 | """ 24 | 25 | 26 | # noinspection PyPep8Naming 27 | def classFactory(iface): # pylint: disable=invalid-name 28 | """Load OSMDownloader class from file OSMDownloader. 29 | 30 | :param iface: A QGIS interface instance. 31 | :type iface: QgsInterface 32 | """ 33 | # 34 | from .osmDownloader import OSMDownloader 35 | return OSMDownloader(iface) 36 | -------------------------------------------------------------------------------- /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 | # OSMDownloader 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.pngmath', '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'OSMDownloader' 44 | copyright = u'2013, Brazilian Army - Geographic Service Bureau' 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', 'OSMDownloader.tex', u'OSMDownloader Documentation', 182 | u'Brazilian Army - Geographic Service Bureau', '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'OSMDownloader Documentation', 215 | [u'Brazilian Army - Geographic Service Bureau'], 1) 216 | ] 217 | -------------------------------------------------------------------------------- /help/source/index.rst: -------------------------------------------------------------------------------- 1 | .. OSMDownloader 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 OSMDownloader'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 | -------------------------------------------------------------------------------- /metadata.txt: -------------------------------------------------------------------------------- 1 | # This file contains metadata for your plugin. Beginning 2 | # with version 1.8 this is the preferred way to supply information about a 3 | # plugin. The current method of embedding metadata in __init__.py will 4 | # be supported until version 2.0 5 | 6 | # This file should be included when you package your plugin. 7 | 8 | # Mandatory items: 9 | 10 | 11 | [general] 12 | name=OSMDownloader 13 | qgisMinimumVersion=3.0 14 | description=Plugin to download OSM data by area, using a selection by rectangle. The plugin can also automatically load the osm file into QGIS in a transparent way. 15 | version=1.0.3 16 | author=Luiz Andrade 17 | email=lcoandrade@gmail.com 18 | about= 19 | Plugin to download OSM data using threads with a simple area selection. 20 | It can automatically load downloaded *.osm files as QGIS layers. 21 | 22 | # End of mandatory metadata 23 | 24 | # Recommended items: 25 | 26 | # Uncomment the following line and add your changelog: 27 | changelog= 28 | 2015-04-10: Fixed bug to inform bad connections. Now it is possible to cancel the download by closing the progress bar. Minor fix to check if start point is equal to end point in the rectangle. 29 | 2015-04-13: Fixed bug that occurred when canceling a started download. 30 | 1.0.1 - Removing _MACOSX folder. 31 | 1.0.2 - Fixed an issue with proxy settings. 32 | 1.0.3 - Fix an issue with proxy settings and add the loading OSM layers with style (updated by SIGMOÉ). 33 | 34 | # Tags are comma separated with spaces allowed 35 | tags=OSM,downloader,rectangle,thread,area,OpenStreetMap,tool 36 | 37 | homepage=https://github.com/lcoandrade/OSMDownloader 38 | tracker=https://github.com/lcoandrade/OSMDownloader 39 | repository=https://github.com/lcoandrade/OSMDownloader 40 | category=Plugins 41 | icon=rectangle.png 42 | # experimental flag 43 | experimental=False 44 | 45 | # deprecated flag (applies to the whole plugin, not just a single version) 46 | deprecated=False 47 | 48 | -------------------------------------------------------------------------------- /osmDownloader.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OSMDownloader 5 | A QGIS plugin 6 | Plugin to download OSM data by area 7 | ------------------- 8 | begin : 2015-04-07 9 | git sha : $Format:%H$ 10 | copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 11 | email : suporte.dsgtools@dsg.eb.mil.br 12 | ***************************************************************************/ 13 | 14 | /*************************************************************************** 15 | * * 16 | * This program is free software; you can redistribute it and/or modify * 17 | * it under the terms of the GNU General Public License as published by * 18 | * the Free Software Foundation; either version 2 of the License, or * 19 | * (at your option) any later version. * 20 | * * 21 | ***************************************************************************/ 22 | """ 23 | from __future__ import absolute_import 24 | from builtins import object 25 | from qgis.PyQt.QtCore import QSettings, QTranslator, qVersion, QCoreApplication 26 | from qgis.PyQt.QtWidgets import QAction 27 | from qgis.PyQt.QtGui import QIcon 28 | # Initialize Qt resources from file resources.py 29 | from . import resources_rc 30 | # Import the code for the dialog 31 | from .osmDownloader_dialog import OSMDownloaderDialog 32 | import os.path 33 | 34 | from .rectangleAreaTool import RectangleAreaTool 35 | 36 | try: 37 | import ptvsd 38 | ptvsd.enable_attach(secret='my_secret', address = ('localhost', 5679)) 39 | except: 40 | pass 41 | 42 | class OSMDownloader(object): 43 | """QGIS Plugin Implementation.""" 44 | 45 | def __init__(self, iface): 46 | """Constructor. 47 | 48 | :param iface: An interface instance that will be passed to this class 49 | which provides the hook by which you can manipulate the QGIS 50 | application at run time. 51 | :type iface: QgsInterface 52 | """ 53 | # Save reference to the QGIS interface 54 | self.iface = iface 55 | # initialize plugin directory 56 | self.plugin_dir = os.path.dirname(__file__) 57 | # initialize locale 58 | locale = QSettings().value('locale/userLocale')[0:2] 59 | locale_path = os.path.join( 60 | self.plugin_dir, 61 | 'i18n', 62 | 'OSMDownloader_{}.qm'.format(locale)) 63 | 64 | if os.path.exists(locale_path): 65 | self.translator = QTranslator() 66 | self.translator.load(locale_path) 67 | 68 | if qVersion() > '4.3.3': 69 | QCoreApplication.installTranslator(self.translator) 70 | 71 | # Declare instance attributes 72 | self.actions = [] 73 | self.menu = self.tr(u'&OSM Downloader') 74 | # TODO: We are going to let the user set this up in a future iteration 75 | self.toolbar = self.iface.addToolBar(u'OSMDownloader') 76 | self.toolbar.setObjectName(u'OSMDownloader') 77 | 78 | # noinspection PyMethodMayBeStatic 79 | def tr(self, message): 80 | """Get the translation for a string using Qt translation API. 81 | 82 | We implement this ourselves since we do not inherit QObject. 83 | 84 | :param message: String for translation. 85 | :type message: str, QString 86 | 87 | :returns: Translated version of message. 88 | :rtype: QString 89 | """ 90 | # noinspection PyTypeChecker,PyArgumentList,PyCallByClass 91 | return QCoreApplication.translate('OSMDownloader', message) 92 | 93 | def add_action( 94 | self, 95 | icon_path, 96 | text, 97 | callback, 98 | enabled_flag=True, 99 | add_to_menu=True, 100 | add_to_toolbar=True, 101 | status_tip=None, 102 | whats_this=None, 103 | parent=None, 104 | checkable=True): 105 | """Add a toolbar icon to the toolbar. 106 | 107 | :param icon_path: Path to the icon for this action. Can be a resource 108 | path (e.g. ':/plugins/foo/bar.png') or a normal file system path. 109 | :type icon_path: str 110 | 111 | :param text: Text that should be shown in menu items for this action. 112 | :type text: str 113 | 114 | :param callback: Function to be called when the action is triggered. 115 | :type callback: function 116 | 117 | :param enabled_flag: A flag indicating if the action should be enabled 118 | by default. Defaults to True. 119 | :type enabled_flag: bool 120 | 121 | :param add_to_menu: Flag indicating whether the action should also 122 | be added to the menu. Defaults to True. 123 | :type add_to_menu: bool 124 | 125 | :param add_to_toolbar: Flag indicating whether the action should also 126 | be added to the toolbar. Defaults to True. 127 | :type add_to_toolbar: bool 128 | 129 | :param status_tip: Optional text to show in a popup when mouse pointer 130 | hovers over the action. 131 | :type status_tip: str 132 | 133 | :param parent: Parent widget for the new action. Defaults None. 134 | :type parent: QWidget 135 | 136 | :param whats_this: Optional text to show in the status bar when the 137 | mouse pointer hovers over the action. 138 | 139 | :returns: The action that was created. Note that the action is also 140 | added to self.actions list. 141 | :rtype: QAction 142 | """ 143 | 144 | icon = QIcon(icon_path) 145 | action = QAction(icon, text, parent) 146 | action.triggered.connect(callback) 147 | action.setEnabled(enabled_flag) 148 | 149 | if status_tip is not None: 150 | action.setStatusTip(status_tip) 151 | 152 | if whats_this is not None: 153 | action.setWhatsThis(whats_this) 154 | 155 | action.setCheckable(checkable) 156 | 157 | if add_to_toolbar: 158 | self.toolbar.addAction(action) 159 | 160 | if add_to_menu: 161 | self.iface.addPluginToMenu( 162 | self.menu, 163 | action) 164 | 165 | self.actions.append(action) 166 | 167 | return action 168 | 169 | def initGui(self): 170 | """Create the menu entries and toolbar icons inside the QGIS GUI.""" 171 | 172 | icon_path = ':/plugins/OSMDownloader/rectangle.png' 173 | self.rectangleAction = self.add_action( 174 | icon_path, 175 | text=self.tr(u'Download OSM data by rectangle selection'), 176 | callback=self.runRectangle, 177 | parent=self.iface.mainWindow(), 178 | add_to_menu=False, 179 | checkable=True) 180 | 181 | self.rectangleAreaTool = RectangleAreaTool(self.iface.mapCanvas(), self.rectangleAction) 182 | 183 | self.rectangleAreaTool.rectangleCreated.connect(self.run) 184 | 185 | def unload(self): 186 | """Removes the plugin menu item and icon from QGIS GUI.""" 187 | for action in self.actions: 188 | self.iface.removePluginMenu( 189 | self.tr(u'&OSM Downloader'), 190 | action) 191 | self.iface.removeToolBarIcon(action) 192 | # remove the toolbar 193 | del self.toolbar 194 | 195 | def run(self, startX, startY, endX, endY): 196 | """Run method that performs all the real work""" 197 | # Create the dialog (after translation) and keep reference 198 | if startX == endX and startY == endY: 199 | return 200 | 201 | self.dlg = OSMDownloaderDialog(self.iface, startX, startY, endX, endY) 202 | # show the dialog 203 | self.dlg.show() 204 | # Run the dialog event loop 205 | result = self.dlg.exec_() 206 | # See if OK was pressed 207 | if result: 208 | # Do something useful here - delete the line containing pass and 209 | # substitute with your code. 210 | pass 211 | 212 | def runRectangle(self, b): 213 | if b: 214 | self.iface.mapCanvas().setMapTool(self.rectangleAreaTool) 215 | else: 216 | self.iface.mapCanvas().unsetMapTool(self.rectangleAreaTool) 217 | 218 | -------------------------------------------------------------------------------- /osmDownloader_dialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OSMDownloaderDialog 5 | A QGIS plugin 6 | Plugin to download OSM data by area 7 | ------------------- 8 | begin : 2015-04-07 9 | git sha : $Format:%H$ 10 | copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 11 | email : suporte.dsgtools@dsg.eb.mil.br 12 | ***************************************************************************/ 13 | 14 | /*************************************************************************** 15 | * * 16 | * This program is free software; you can redistribute it and/or modify * 17 | * it under the terms of the GNU General Public License as published by * 18 | * the Free Software Foundation; either version 2 of the License, or * 19 | * (at your option) any later version. * 20 | * * 21 | ***************************************************************************/ 22 | """ 23 | from __future__ import absolute_import 24 | 25 | from builtins import str 26 | import os 27 | 28 | from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QMessageBox, QProgressBar 29 | from qgis.PyQt import uic 30 | from qgis.PyQt.QtCore import pyqtSlot, QThreadPool, Qt 31 | from qgis.core import Qgis 32 | 33 | FORM_CLASS, _ = uic.loadUiType(os.path.join( 34 | os.path.dirname(__file__), 'osmDownloader_dialog_base.ui')) 35 | 36 | from .osm_downloader import OSMRequest 37 | 38 | class OSMDownloaderDialog(QDialog, FORM_CLASS): 39 | def __init__(self, iface, startX, startY, endX, endY, parent=None): 40 | """Constructor.""" 41 | super(OSMDownloaderDialog, self).__init__(parent) 42 | # Set up the user interface from Designer. 43 | # After setupUI you can access any designer object by doing 44 | # self., and you can use autoconnect slots - see 45 | # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html 46 | # #widgets-and-dialogs-with-auto-connect 47 | self.setupUi(self) 48 | 49 | self.iface = iface 50 | 51 | self.setCoordinates(startX, startY, endX, endY) 52 | 53 | self.threadpool = QThreadPool() 54 | 55 | self.size = 0 56 | 57 | self.plugin_dir = os.path.dirname(__file__) 58 | 59 | def setCoordinates(self, startX, startY, endX, endY): 60 | if startX < endX: 61 | minLong = startX 62 | maxLong = endX 63 | else: 64 | minLong = endX 65 | maxLong = startX 66 | 67 | if startY < endY: 68 | minLat = startY 69 | maxLat = endY 70 | else: 71 | minLat = endY 72 | maxLat = startY 73 | 74 | self.wEdit.setText(str(minLong)) 75 | self.sEdit.setText(str(minLat)) 76 | self.eEdit.setText(str(maxLong)) 77 | self.nEdit.setText(str(maxLat)) 78 | 79 | @pyqtSlot() 80 | def on_saveButton_clicked(self): 81 | ret = QFileDialog.getSaveFileName(parent=None, caption='Define file name and location', filter='OSM Files(*.osm)') 82 | fileName = ret[0] 83 | 84 | split = fileName.split('.') 85 | if len(split)>0 and split[-1] == 'osm': 86 | pass 87 | else: 88 | fileName += '.osm' 89 | 90 | self.filenameEdit.setText(fileName) 91 | 92 | @pyqtSlot() 93 | def on_button_box_accepted(self): 94 | if self.filenameEdit.text() == '': 95 | QMessageBox.warning(self, self.tr("Warning!"), self.tr("Please, select a location to save the file.")) 96 | return 97 | 98 | # Initiating processing 99 | osmRequest = OSMRequest(self.filenameEdit.text()) 100 | osmRequest.setParameters(self.wEdit.text(), self.sEdit.text(), self.eEdit.text(), self.nEdit.text()) 101 | # Connecting end signal 102 | osmRequest.signals.processFinished.connect(self.processFinished) 103 | osmRequest.signals.sizeReported.connect(self.reportSize) 104 | osmRequest.signals.proxyOpened.connect(self.proxy) 105 | osmRequest.signals.errorOccurred.connect(self.errorOccurred) 106 | osmRequest.signals.userCanceled.connect(self.userCanceled) 107 | # Setting the progress bar 108 | # << Updated by SIGMOÉ 109 | self.msgBar = self.iface.messageBar() 110 | self.progressMessageBar = self.msgBar.createMessage('Downloading data...') 111 | # >> 112 | self.progressBar = QProgressBar() 113 | self.progressBar.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) 114 | self.progressMessageBar.layout().addWidget(self.progressBar) 115 | self.iface.messageBar().pushWidget(self.progressMessageBar, Qgis.Info) 116 | self.progressBar.setRange(0, 0) 117 | self.progressMessageBar.destroyed.connect(osmRequest.signals.cancel) 118 | # Starting process 119 | self.threadpool.start(osmRequest) 120 | 121 | @pyqtSlot(str) 122 | def proxy(self, proxy): 123 | self.progressMessageBar.setText('Proxy set to: '+proxy) 124 | 125 | @pyqtSlot(str) 126 | def errorOccurred(self, message): 127 | QMessageBox.warning(self, 'Fatal!', message) 128 | self.close() 129 | 130 | @pyqtSlot() 131 | def userCanceled(self): 132 | QMessageBox.warning(self, 'Info!', 'Process canceled by user!') 133 | self.close() 134 | 135 | @pyqtSlot(float) 136 | def reportSize(self, size): 137 | self.size = size 138 | self.progressMessageBar.setText('Downloading: '+"{0:.2f}".format(size)+' megabytes from OSM servers...') 139 | 140 | @pyqtSlot(str) 141 | def processFinished(self, message): 142 | self.progressBar.setRange(0, 100) 143 | self.progressBar.setValue(100) 144 | self.progressMessageBar.setText('Downloaded '+"{0:.2f}".format(self.size)+' megabytes in total from OSM servers') 145 | 146 | if self.checkBox.isChecked(): 147 | # << Updated by SIGMOÉ 148 | # Add each OSM layer with specific style 149 | lyr_types = [ 150 | ['multipolygons', 'polygon'], 151 | ['multilinestrings', 'line'], 152 | ['lines', 'line'], 153 | ['points', 'point'] 154 | ] 155 | for lt in lyr_types: 156 | lyr = self.iface.addVectorLayer(self.filenameEdit.text()+'|layername='+lt[0], 'osm', 'ogr') 157 | style = "styles/osm_mapnik_" + lt[1] + ".qml" 158 | qml_file = os.path.join(self.plugin_dir, style) 159 | lyr.loadNamedStyle(qml_file) 160 | # >> 161 | 162 | QMessageBox.warning(self, 'Info!', message) 163 | # << Updated by SIGMOÉ 164 | self.msgBar.clearWidgets() 165 | # >> 166 | self.close() 167 | -------------------------------------------------------------------------------- /osmDownloader_dialog_base.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | OSMDownloaderDialogBase 4 | 5 | 6 | 7 | 0 8 | 0 9 | 492 10 | 308 11 | 12 | 13 | 14 | OSM Downloader 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | N 25 | 26 | 27 | Qt::AlignCenter 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | E 42 | 43 | 44 | Qt::AlignCenter 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | W 59 | 60 | 61 | Qt::AlignCenter 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | S 76 | 77 | 78 | Qt::AlignCenter 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | Save Location: 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Load layer after download 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | Save File 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Qt::Horizontal 125 | 126 | 127 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | button_box 137 | accepted() 138 | OSMDownloaderDialogBase 139 | accept() 140 | 141 | 142 | 20 143 | 20 144 | 145 | 146 | 20 147 | 20 148 | 149 | 150 | 151 | 152 | button_box 153 | rejected() 154 | OSMDownloaderDialogBase 155 | reject() 156 | 157 | 158 | 20 159 | 20 160 | 161 | 162 | 20 163 | 20 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /osm_downloader.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OSMRequest 5 | A QGIS plugin 6 | Plugin to download OSM data by area 7 | ------------------- 8 | begin : 2015-04-07 9 | git sha : $Format:%H$ 10 | copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 11 | email : suporte.dsgtools@dsg.eb.mil.br 12 | ***************************************************************************/ 13 | 14 | /*************************************************************************** 15 | * * 16 | * This program is free software; you can redistribute it and/or modify * 17 | * it under the terms of the GNU General Public License as published by * 18 | * the Free Software Foundation; either version 2 of the License, or * 19 | * (at your option) any later version. * 20 | * * 21 | ***************************************************************************/ 22 | """ 23 | 24 | #Another way to do the Job with OVERPASS 25 | from future import standard_library 26 | standard_library.install_aliases() 27 | from builtins import str 28 | import urllib.request, urllib.error, urllib.parse 29 | from qgis.PyQt.QtCore import QObject, pyqtSignal, QSettings, pyqtSlot, QThreadPool, QRunnable 30 | import time 31 | import sys 32 | 33 | class Signals(QObject): 34 | processFinished = pyqtSignal(str) 35 | sizeReported = pyqtSignal(float) 36 | proxyOpened = pyqtSignal(str) 37 | errorOccurred = pyqtSignal(str) 38 | userCanceled = pyqtSignal() 39 | 40 | def __init__(self, thread): 41 | super(Signals, self).__init__() 42 | 43 | self.thread = thread 44 | 45 | @pyqtSlot() 46 | def cancel(self): 47 | self.thread.stop() 48 | 49 | class OSMRequest(QRunnable): 50 | def __init__(self, filename): 51 | super(OSMRequest, self).__init__() 52 | 53 | self.signals = Signals(self) 54 | 55 | self.filename = filename 56 | self.xmlData = '' 57 | self.xmlData += '' 58 | self.xmlData += '' 59 | self.xmlData += '' 60 | self.xmlData += '' 61 | self.xmlData += '' 62 | 63 | self.stopped = False 64 | 65 | def stop(self): 66 | self.stopped = True 67 | 68 | def getProxyConfiguration(self): 69 | settings = QSettings() 70 | settings.beginGroup('proxy') 71 | # << Updated by SIGMOÉ 72 | enabled = str(settings.value('proxyEnabled')) 73 | # >> 74 | host = str(settings.value('proxyHost')) 75 | port = str(settings.value('proxyPort')) 76 | user = str(settings.value('proxyUser')) 77 | password = str(settings.value('proxyPassword')) 78 | type = str(settings.value('proxyType')) 79 | settings.endGroup() 80 | return (enabled, host, port, user, password, type) 81 | 82 | def setUrllibProxy(self): 83 | (enabled, host, port, user, password, type) = self.getProxyConfiguration() 84 | if enabled == 'false' or type != 'HttpProxy': 85 | self.signals.proxyOpened.emit('No proxy set.') 86 | return 87 | 88 | proxyStr = 'http://'+user+':'+password+'@'+host+':'+port 89 | print(proxyStr) 90 | self.signals.proxyOpened.emit(host+'| Port: '+port) 91 | 92 | proxy = urllib.request.ProxyHandler({'http': proxyStr}) 93 | opener = urllib.request.build_opener(proxy, urllib.request.HTTPHandler) 94 | urllib.request.install_opener(opener) 95 | 96 | def setParameters(self, minLong, minLat, maxLong, maxLat): 97 | self.minLong = minLong 98 | self.minLat = minLat 99 | self.maxLong = maxLong 100 | self.maxLat = maxLat 101 | 102 | def makePostFile(self): 103 | xmlData = self.xmlData.replace('maxlong', str(self.maxLong)) 104 | xmlData = xmlData.replace('maxlat', str(self.maxLat)) 105 | xmlData = xmlData.replace('minlong', str(self.minLong)) 106 | xmlData = xmlData.replace('minlat', str(self.minLat)) 107 | xmlData = xmlData.encode('utf-8') 108 | return xmlData 109 | 110 | def makeRequest(self): 111 | osmUrl = 'http://overpass-api.de/api/interpreter' 112 | postFile = self.makePostFile() 113 | req = urllib.request.Request(url=osmUrl, data=postFile, headers={'Content-Type': 'application/xml'}) 114 | return req 115 | 116 | def run(self): 117 | self.setUrllibProxy() 118 | 119 | req = self.makeRequest() 120 | 121 | try: 122 | response = urllib.request.urlopen(req) 123 | except urllib.error.URLError as e: 124 | self.signals.errorOccurred.emit('Error occurred: '+str(e.args) + '\nReason: '+str(e.reason)) 125 | return 126 | except urllib.error.HTTPError as e: 127 | self.signals.errorOccurred.emit('Error occurred: '+str(e.code) + '\nReason: '+str(e.msg)) 128 | return 129 | 130 | local_file = open(self.filename, 'wb') 131 | 132 | total_size = 0 133 | block_size = 1024*8 134 | while not self.stopped: 135 | self.signals.sizeReported.emit(total_size) 136 | buffer = response.read(block_size) 137 | if not buffer: 138 | break 139 | 140 | try: 141 | local_file.write(buffer) 142 | size = len(buffer)/float(1000000) 143 | total_size += size 144 | except: 145 | local_file.close() 146 | self.signals.errorOccurred.emit('An error occurred writing the osm file.') 147 | return 148 | 149 | local_file.close() 150 | if self.stopped: 151 | response.close() 152 | self.signals.userCanceled.emit() 153 | else: 154 | self.signals.processFinished.emit('Success, the file has been downloaded!') 155 | -------------------------------------------------------------------------------- /pb_tool.cfg: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # OSMDownloader 3 | # 4 | # Configuration file for plugin builder tool (pb_tool) 5 | # ------------------- 6 | # begin : 2015-04-07 7 | # copyright : (C) 2015 by Brazilian Army - Geographic Service Bureau 8 | # email : suporte.dsgtools@dsg.eb.mil.br 9 | # ***************************************************************************/ 10 | # 11 | #/*************************************************************************** 12 | # * * 13 | # * This program is free software; you can redistribute it and/or modify * 14 | # * it under the terms of the GNU General Public License as published by * 15 | # * the Free Software Foundation; either version 2 of the License, or * 16 | # * (at your option) any later version. * 17 | # * * 18 | # ***************************************************************************/ 19 | # 20 | # 21 | # You can install pb_tool using: 22 | # pip install http://geoapt.net/files/pb_tool.zip 23 | # 24 | # Consider doing your development (and install of pb_tool) in a virtualenv. 25 | # 26 | # For details on setting up and using pb_tool, see: 27 | # http://spatialgalaxy.net/qgis-plugin-development-with-pb_tool 28 | # 29 | # Issues and pull requests here: 30 | # https://github.com/g-sherman/plugin_build_tool: 31 | # 32 | # Sane defaults for your plugin generated by the Plugin Builder are 33 | # already set below. 34 | # 35 | # As you add Python source files and UI files to your plugin, add 36 | # them to the appropriate [files] section below. 37 | 38 | [plugin] 39 | # Name of the plugin. This is the name of the directory that will 40 | # be created in .qgis2/python/plugins 41 | name: OSMDownloader 42 | 43 | [files] 44 | # Python files that should be deployed with the plugin 45 | python_files: __init__.py osmDownloader.py osmDownloader_dialog.py 46 | 47 | # The main dialog file that is loaded (not compiled) 48 | main_dialog: osmDownloader_dialog_base.ui 49 | 50 | # Other ui files for dialogs you create (these will be compiled) 51 | compiled_ui_files: 52 | 53 | # Resource file(s) that will be compiled 54 | resource_files: resources.qrc 55 | 56 | # Other files required for the plugin 57 | extras: icon.png metadata.txt 58 | 59 | # Other directories to be deployed with the plugin. 60 | # These must be subdirectories under the plugin directory 61 | extra_dirs: 62 | 63 | # ISO code(s) for any locales (translations), separated by spaces. 64 | # Corresponding .ts files must exist in the i18n directory 65 | locales: 66 | 67 | [help] 68 | # the built help directory that should be deployed with the plugin 69 | dir: help/build/html 70 | # the name of the directory to target in the deployed plugin 71 | target: help 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /plugin_upload.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding=utf-8 3 | """This script uploads a plugin package on the server. 4 | Authors: A. Pasotti, V. Picavet 5 | git sha : $TemplateVCSFormat 6 | """ 7 | from __future__ import print_function 8 | 9 | from future import standard_library 10 | standard_library.install_aliases() 11 | from builtins import input 12 | import sys 13 | import getpass 14 | import xmlrpc.client 15 | from optparse import OptionParser 16 | 17 | # Configuration 18 | PROTOCOL = 'http' 19 | SERVER = 'plugins.qgis.org' 20 | PORT = '80' 21 | ENDPOINT = '/plugins/RPC2/' 22 | VERBOSE = False 23 | 24 | 25 | def main(parameters, arguments): 26 | """Main entry point. 27 | 28 | :param parameters: Command line parameters. 29 | :param arguments: Command line arguments. 30 | """ 31 | address = "%s://%s:%s@%s:%s%s" % ( 32 | PROTOCOL, 33 | parameters.username, 34 | parameters.password, 35 | parameters.server, 36 | parameters.port, 37 | ENDPOINT) 38 | # fix_print_with_import 39 | print("Connecting to: %s" % hide_password(address)) 40 | 41 | server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE) 42 | 43 | try: 44 | plugin_id, version_id = server.plugin.upload( 45 | xmlrpc.client.Binary(open(arguments[0]).read())) 46 | # fix_print_with_import 47 | print("Plugin ID: %s" % plugin_id) 48 | # fix_print_with_import 49 | print("Version ID: %s" % version_id) 50 | except xmlrpc.client.ProtocolError as err: 51 | # fix_print_with_import 52 | print("A protocol error occurred") 53 | # fix_print_with_import 54 | print("URL: %s" % hide_password(err.url, 0)) 55 | # fix_print_with_import 56 | print("HTTP/HTTPS headers: %s" % err.headers) 57 | # fix_print_with_import 58 | print("Error code: %d" % err.errcode) 59 | # fix_print_with_import 60 | print("Error message: %s" % err.errmsg) 61 | except xmlrpc.client.Fault as err: 62 | # fix_print_with_import 63 | print("A fault occurred") 64 | # fix_print_with_import 65 | print("Fault code: %d" % err.faultCode) 66 | # fix_print_with_import 67 | print("Fault string: %s" % err.faultString) 68 | 69 | 70 | def hide_password(url, start=6): 71 | """Returns the http url with password part replaced with '*'. 72 | 73 | :param url: URL to upload the plugin to. 74 | :type url: str 75 | 76 | :param start: Position of start of password. 77 | :type start: int 78 | """ 79 | start_position = url.find(':', start) + 1 80 | end_position = url.find('@') 81 | return "%s%s%s" % ( 82 | url[:start_position], 83 | '*' * (end_position - start_position), 84 | url[end_position:]) 85 | 86 | 87 | if __name__ == "__main__": 88 | parser = OptionParser(usage="%prog [options] plugin.zip") 89 | parser.add_option( 90 | "-w", "--password", dest="password", 91 | help="Password for plugin site", metavar="******") 92 | parser.add_option( 93 | "-u", "--username", dest="username", 94 | help="Username of plugin site", metavar="user") 95 | parser.add_option( 96 | "-p", "--port", dest="port", 97 | help="Server port to connect to", metavar="80") 98 | parser.add_option( 99 | "-s", "--server", dest="server", 100 | help="Specify server name", metavar="plugins.qgis.org") 101 | options, args = parser.parse_args() 102 | if len(args) != 1: 103 | # fix_print_with_import 104 | print("Please specify zip file.\n") 105 | parser.print_help() 106 | sys.exit(1) 107 | if not options.server: 108 | options.server = SERVER 109 | if not options.port: 110 | options.port = PORT 111 | if not options.username: 112 | # interactive mode 113 | username = getpass.getuser() 114 | # fix_print_with_import 115 | print("Please enter user name [%s] :" % username, end=' ') 116 | res = input() 117 | if res != "": 118 | options.username = res 119 | else: 120 | options.username = username 121 | if not options.password: 122 | # interactive mode 123 | options.password = getpass.getpass() 124 | main(options, args) 125 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcoandrade/OSMDownloader/56281f670d41685d485f6dc724a4b8d75de36b08/rectangle.png -------------------------------------------------------------------------------- /rectangleAreaTool.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | DsgTools 5 | A QGIS plugin 6 | Brazilian Army Cartographic Production Tools 7 | ------------------- 8 | begin : 2015-04-07 9 | git sha : $Format:%H$ 10 | copyright : (C) 2014 by Luiz Andrade - Cartographic Engineer @ Brazilian Army 11 | email : luiz.claudio@dsg.eb.mil.br 12 | ***************************************************************************/ 13 | 14 | /*************************************************************************** 15 | * * 16 | * This program is free software; you can redistribute it and/or modify * 17 | * it under the terms of the GNU General Public License as published by * 18 | * the Free Software Foundation; either version 2 of the License, or * 19 | * (at your option) any later version. * 20 | * * 21 | ***************************************************************************/ 22 | """ 23 | from qgis.gui import QgsMapTool, QgsRubberBand 24 | from qgis.core import QgsWkbTypes, QgsPointXY, QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsProject 25 | from qgis.PyQt.QtGui import QColor 26 | from qgis.PyQt.QtCore import pyqtSignal 27 | 28 | class RectangleAreaTool(QgsMapTool): 29 | 30 | rectangleCreated = pyqtSignal(float, float, float, float) 31 | 32 | def __init__(self, canvas, action): 33 | QgsMapTool.__init__(self, canvas) 34 | 35 | self.canvas = canvas 36 | self.active = False 37 | self.setAction(action) 38 | self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) 39 | mFillColor = QColor(254, 178, 76, 63) 40 | self.rubberBand.setColor(mFillColor) 41 | self.rubberBand.setWidth(1) 42 | self.reset() 43 | 44 | def reset(self): 45 | self.startPoint = self.endPoint = None 46 | self.isEmittingPoint = False 47 | self.rubberBand.reset(QgsWkbTypes.PolygonGeometry) 48 | 49 | def canvasPressEvent(self, e): 50 | self.startPoint = self.toMapCoordinates(e.pos()) 51 | self.endPoint = self.startPoint 52 | self.isEmittingPoint = True 53 | self.showRect(self.startPoint, self.endPoint) 54 | 55 | def canvasReleaseEvent(self, e): 56 | self.isEmittingPoint = False 57 | self.rubberBand.hide() 58 | self.transformCoordinates() 59 | self.rectangleCreated.emit(self.startPoint.x(), self.startPoint.y(), self.endPoint.x(), self.endPoint.y()) 60 | 61 | def canvasMoveEvent(self, e): 62 | if not self.isEmittingPoint: 63 | return 64 | self.endPoint = self.toMapCoordinates( e.pos() ) 65 | self.showRect(self.startPoint, self.endPoint) 66 | 67 | def showRect(self, startPoint, endPoint): 68 | self.rubberBand.reset(QgsWkbTypes.PolygonGeometry) 69 | if startPoint.x() == endPoint.x() or startPoint.y() == endPoint.y(): 70 | return 71 | point1 = QgsPointXY(startPoint.x(), startPoint.y()) 72 | point2 = QgsPointXY(startPoint.x(), endPoint.y()) 73 | point3 = QgsPointXY(endPoint.x(), endPoint.y()) 74 | point4 = QgsPointXY(endPoint.x(), startPoint.y()) 75 | 76 | self.rubberBand.addPoint(point1, False) 77 | self.rubberBand.addPoint(point2, False) 78 | self.rubberBand.addPoint(point3, False) 79 | self.rubberBand.addPoint(point4, True) # true to update canvas 80 | self.rubberBand.show() 81 | 82 | def transformCoordinates(self): 83 | if self.startPoint is None or self.endPoint is None: 84 | return None 85 | elif self.startPoint.x() == self.endPoint.x() or self.startPoint.y() == self.endPoint.y(): 86 | return None 87 | 88 | # Defining the crs from src and destiny 89 | epsg = self.canvas.mapSettings().destinationCrs().authid() 90 | crsSrc = QgsCoordinateReferenceSystem(epsg) 91 | crsDest = QgsCoordinateReferenceSystem(4326) 92 | # Creating a transformer 93 | coordinateTransformer = QgsCoordinateTransform(crsSrc, crsDest, QgsProject.instance()) 94 | # Transforming the points 95 | self.startPoint = coordinateTransformer.transform(self.startPoint) 96 | self.endPoint = coordinateTransformer.transform(self.endPoint) 97 | 98 | def deactivate(self): 99 | self.rubberBand.hide() 100 | QgsMapTool.deactivate(self) 101 | -------------------------------------------------------------------------------- /resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | rectangle.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources_rc.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Resource object code 4 | # 5 | # Created by: The Resource Compiler for PyQt5 (Qt v5.10.1) 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | from PyQt5 import QtCore 10 | 11 | qt_resource_data = b"\ 12 | \x00\x00\x13\x31\ 13 | \x89\ 14 | \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ 15 | \x00\x00\x80\x00\x00\x00\x80\x08\x06\x00\x00\x00\xc3\x3e\x61\xcb\ 16 | \x00\x00\x12\xf8\x49\x44\x41\x54\x78\x5e\xec\xd2\x01\x01\x00\x00\ 17 | \x08\x02\xa0\xea\xff\x67\x1b\x22\x6c\x60\x93\x4c\x2f\x6e\x10\xa0\ 18 | \x9b\x00\x08\x80\x00\x08\x80\x00\x08\x80\x00\x08\xf0\xdc\x99\x41\ 19 | \x68\x1c\x65\x14\xc7\xff\xef\x7d\xdf\xcc\x6e\xb2\xb1\x2d\x8b\xab\ 20 | \x51\x41\x88\x94\xa6\x31\xa6\x89\x14\x5a\xf0\xa2\xe0\x29\x82\xc7\ 21 | \x78\xf0\x2a\x54\x73\xf1\x24\x78\xf1\xe0\xa2\xd7\x9c\x55\x10\x0a\ 22 | \x09\xd9\xec\xee\x24\x9b\x58\x02\x4a\x41\x21\xe4\x50\x14\x9d\x9b\ 23 | \x07\x45\x7a\xaa\x1e\x3c\x14\xb5\xd9\xee\xcc\xce\x7e\xdf\xf3\x7b\ 24 | \xc4\x61\xc1\x58\xd4\x63\xf3\x87\x07\xef\xfb\xf1\xf8\x7f\xff\x37\ 25 | \x0c\xcc\x61\x5a\x49\x72\x25\xe9\x7d\xb6\xdb\xdd\xd9\xdb\x6d\x27\ 26 | \x3b\x9f\xee\xef\xef\x4f\x2a\x4f\x92\xc4\x94\x05\x80\xfe\x23\x03\ 27 | \x05\xfd\x8d\xa9\x4e\xb0\x66\xb3\xc9\x25\x6b\x02\x7c\x82\x85\xbe\ 28 | \xcc\xfe\x7f\x73\x90\xea\x5f\x73\x9c\x64\xf8\xe7\x1c\x27\xd8\xa9\ 29 | \x7a\x01\x22\xe0\x27\x38\xbf\xe6\xbc\xac\x91\xa7\x4f\x06\x83\x41\ 30 | \xae\x4b\x7a\xe1\x0e\x71\x9c\x9a\xb8\x9a\x6e\xb6\x93\xd7\xc2\x03\ 31 | \x88\x47\x42\x37\x3d\x99\x54\x79\xa7\xd3\xbb\xba\x9e\x24\x4f\x05\ 32 | \xf6\xb5\x03\xa7\x5e\xf8\xdb\x8d\x24\x99\xe9\x76\x77\x17\x3d\xdb\ 33 | \x34\xcc\x29\xfb\x6a\x63\x63\xa3\xd6\x4e\x7a\xaf\xb2\xad\xa6\x08\ 34 | \xdc\x81\x7a\x08\x9a\x9d\x7b\xee\x9a\x7a\xb3\xa9\xa4\xb3\x9d\x9d\ 35 | \x8f\x94\x5d\x98\x5b\xf8\x50\xe7\x94\xcf\xce\xcd\xbf\xaf\x6c\xab\ 36 | \xdb\xbb\x4e\x61\x46\xd9\x56\x67\xfb\x0d\x65\x23\xcf\x37\xd4\x8b\ 37 | \x6d\x25\x6d\x75\x77\x96\xf7\xf6\xf6\xce\x85\x1c\x87\x9a\x4d\xab\ 38 | \xdd\xee\xcd\x6f\x6e\x6e\x9f\x77\x9e\xbf\xd3\x6c\x4e\xf8\xd6\xd6\ 39 | \xd6\x8d\xc7\x5b\xad\xee\x4b\x7a\x9f\x27\x1b\x18\x7d\xae\x7b\xb6\ 40 | \x3a\xdb\xaf\xab\x37\xe9\x4e\xdd\xde\xfa\x5f\x39\xde\x55\xa6\xfe\ 41 | \xa1\x5f\x3b\x66\xf3\x6b\x71\xb5\xa6\xf9\x77\x9a\x49\x12\x9f\xa6\ 42 | \x4f\x80\x63\x36\xfd\x38\x14\x40\x83\x12\x8a\x60\xde\x46\xf6\x52\ 43 | \x64\xa3\x4b\xd6\x70\xa3\x5e\xaf\x13\x40\x8b\x7a\x56\x0e\xf8\x33\ 44 | \xae\x28\x2a\x04\xba\xac\x8c\x8d\x59\x8a\xad\xad\x02\x32\xa5\x67\ 45 | \x2d\x11\x2c\x15\xc5\x59\x86\xc8\xa3\x51\x14\x7c\x02\x83\x60\x01\ 46 | \x2a\xd0\x93\xa5\x17\x31\x2e\x28\x11\x91\x67\x74\x4e\xb9\x78\xcc\ 47 | \x28\x23\xc2\xc5\x32\x07\x11\x9e\xc0\xb1\x16\xd4\x4b\x67\x09\xa8\ 48 | \x0f\x06\xd6\x12\xe8\xf9\xf2\x5e\x6b\xb9\x46\x15\x4c\x18\x6b\x16\ 49 | \x95\x01\xb8\x9c\x65\xf7\x63\x66\x3a\x57\x7a\x09\xb0\xd8\x68\x34\ 50 | \x88\xc9\x3c\x36\xde\x09\x73\x08\x22\xc8\xd3\x51\xe9\x4f\x32\x73\ 51 | \x3d\x49\x1a\x44\xe6\x05\x63\x8c\xe6\x5a\xa8\x4f\x4d\xd1\xa9\x79\ 52 | \x01\x1c\xcc\x8b\x42\x48\x1d\x7c\x2a\xe4\xbe\x18\x0e\x87\xb5\x95\ 53 | \x95\x15\x4f\x4c\x26\x08\x5a\x22\x60\x04\x11\x60\x4b\x46\x41\x95\ 54 | \x6a\x55\xfb\xb2\x30\x1a\x8d\x02\x65\x1a\xcf\xc0\xf6\xfb\xf7\x14\ 55 | \x71\xc9\x00\xb2\x08\x12\x91\x92\x69\xaf\x0c\x44\x62\xc6\xfe\xc4\ 56 | \x50\x89\x94\x77\x8e\xf7\xa0\x71\x0e\xf5\xb1\xd6\x90\x08\xa2\x71\ 57 | \x0e\x47\x2e\x64\x29\xcf\x1c\x34\x31\x31\xa1\x9e\xe3\x6c\xc0\x71\ 58 | \x0e\x9c\xc8\xa1\x32\x25\x0b\xb0\x98\x24\xfb\x72\xb5\x12\x5f\xc9\ 59 | \xb2\x0c\x41\x0e\x0f\xa1\x2c\x1e\x20\x0a\x62\x66\x40\x00\xf1\x4c\ 60 | \x71\x1c\x13\xb4\x15\x79\x6f\x98\x0d\xeb\x1c\x31\xc4\xe1\x70\x7a\ 61 | \x7a\x7a\x54\x78\x79\x3b\x1f\xe6\x93\x06\x06\x45\x41\xdf\x3f\x52\ 62 | \xb5\xbf\xdf\xcf\x8a\x6b\xce\x39\x43\x42\x52\xab\x44\xbf\x14\xc5\ 63 | \xf0\x6e\x9e\xfb\x55\x40\x4d\x28\xab\x54\x2e\x0e\x58\x6e\x1f\x66\ 64 | \x59\xbe\xea\x7c\x01\x62\xf9\x0d\x41\x24\xd8\x0b\x5e\x77\xbc\xf3\ 65 | \xda\xdf\x51\xe6\x3d\x3e\x0e\x73\x5f\xb2\x01\x3c\xd1\x0f\xca\x04\ 66 | \xf8\x60\x98\xe7\xd3\x6c\x18\x24\xee\x1b\x65\xe4\xe9\x9d\x2c\xcf\ 67 | \xce\x18\x1d\x74\x74\xab\x3f\x98\xb8\x17\x57\x8f\xde\x0c\x7e\x11\ 68 | \x82\xc2\x0a\xb7\x79\xc4\xa3\x22\x2f\xde\x12\x12\x02\xe0\x8a\xa2\ 69 | \x76\x37\x8a\x24\xcd\x73\xcd\xe1\x00\x2f\xfd\x83\x83\x03\x7f\xfe\ 70 | \xd9\xa5\x9b\x21\xc7\xaa\x2f\x3c\x08\xf2\x2b\x82\x84\x78\x3d\xb0\ 71 | \x54\xb3\x09\x99\x1f\x21\xd2\xf0\xde\x1f\x89\x08\x82\x8e\xf0\x10\ 72 | \xea\x81\xbf\x83\xc3\x37\xf4\x95\xd8\x46\x6d\x2f\x1e\xde\xbb\x9f\ 73 | \xcf\x4e\x4d\x5e\x5d\x5e\x5e\xfe\xe3\xcf\xf6\xee\x3c\xb8\xaa\x22\ 74 | \xdf\x03\xf8\xb7\xfb\xac\xf7\x66\x01\x92\x48\xd0\xf7\x7c\xb2\xca\ 75 | \x12\x65\x53\x16\x15\x19\x02\xa3\x22\xb2\x09\x89\xa0\xf8\x46\x40\ 76 | \x59\x54\x74\x46\x71\x9c\x19\x05\xc3\xbe\xca\x80\xe2\x1b\x87\x45\ 77 | \x16\x17\xc6\x47\x42\x90\xdd\x0d\x47\x54\xd6\x11\x07\x03\x04\x54\ 78 | \x84\x10\x10\x03\x11\x02\x42\xee\xbd\x67\xe9\xee\x77\x4e\x26\x35\ 79 | \x95\x20\x6f\xaa\xa6\x34\x8b\x87\xfe\x54\x9d\x54\x52\xa9\xfc\x71\ 80 | \xab\xbf\xe9\xfe\xdd\xde\x2e\xfe\x49\x5a\xf6\xe1\x87\x66\x9d\x92\ 81 | \x92\x44\x78\xce\x9f\x3f\xcf\x1e\x78\xe0\x81\x33\xc2\x13\x88\x1e\ 82 | \x40\x23\xfc\x7d\xc1\xac\x26\x2c\x14\x12\x6a\xd4\xe1\x5e\xe3\x9f\ 83 | \x47\x25\x52\x5c\xf1\x85\xfa\x9c\x92\x0e\x0c\x80\x62\x84\xcf\x4f\ 84 | \x10\xe2\x7d\x00\x22\x18\x35\x00\x33\x52\x08\x31\xba\xd1\x98\x93\ 85 | \xce\xa0\xdc\xb4\x70\xe1\x42\x15\x95\x48\x9c\x38\x3d\x8c\x50\x28\ 86 | \x47\xd7\xf5\x1c\x85\x90\x05\x49\x9b\x36\x69\xc1\x99\x08\x52\xdc\ 87 | \x4e\xba\xa9\xaf\x34\x0c\x63\x25\x04\x5f\x56\xaf\x5e\xbd\x30\x2a\ 88 | \x91\x08\x01\x67\x8c\xf9\x5f\x00\x08\x37\x68\x45\xe0\x3f\x5e\x9c\ 89 | \xe0\xf0\xb8\xb8\x04\x89\x5c\x60\x8c\x1d\xf3\x1e\x80\xe0\x78\x83\ 90 | \x0b\x17\x44\x60\x02\xc0\x05\x22\xae\xcb\x0a\xcb\xbe\x23\xa4\xc8\ 91 | \x30\x74\x8e\x4a\xa4\x7b\x06\xf6\xcf\xf5\x26\x8d\xde\x82\x67\x70\ 92 | \x66\xa6\x00\xc0\x03\x13\x80\xfb\xee\x19\xf0\xfe\x84\x09\x13\x1a\ 93 | \xa1\x5c\x56\x56\x16\x47\x25\x92\xd7\xf8\x2d\xa9\x6a\xf4\xe4\x2e\ 94 | \x83\x37\xab\x79\x46\x01\x7b\xcd\x9b\x2b\x61\x81\xa8\x01\xde\x5c\ 95 | \xbd\xba\x71\x5a\xeb\xb6\x4f\xb6\x4c\x6b\xfd\x64\x8b\xb4\xb4\x11\ 96 | \xf3\xe7\x6f\x32\x50\x89\x24\xa8\xda\xd9\x34\x43\x73\x8c\x90\x39\ 97 | \x07\x82\x4f\x2c\x8a\x8f\x57\x03\x53\x04\x0a\x87\xb7\x36\xf4\xd0\ 98 | \x6c\xc3\x34\x67\x0b\x4e\xa6\x25\x24\x9c\x0c\x41\xfa\x41\x9d\xc4\ 99 | \x39\x03\xe3\x3c\x78\x33\x81\xc2\xc3\x79\x79\x11\x48\xe0\xc6\xc5\ 100 | \xc5\x09\x54\x22\x71\x8e\x93\x8e\xed\xec\x70\xb9\x0b\x08\x72\xd4\ 101 | \xa8\x5f\x3f\x38\x35\x00\x08\xfd\xce\x71\x9c\x6d\x42\x70\x10\xe0\ 102 | \xd4\x0f\x13\x2e\x0d\xca\xe8\xbf\x09\xc0\x26\xfc\x8c\xfd\x88\x93\ 103 | \x41\x92\xb7\xf4\xdd\x59\xd1\x95\xa1\xe0\x10\x36\x73\x4e\x7e\x55\ 104 | \x3f\x65\x4a\x56\xb7\x6e\x6e\x00\x6a\x00\xff\xc5\xad\x6e\xb3\x2a\ 105 | \x77\xed\x82\xec\x55\x6f\x2d\x58\x99\x93\x3b\xc3\xab\x78\x43\xa8\ 106 | \x44\x22\x2a\x69\x15\x32\x43\xa3\x74\x43\x1f\x4d\x81\x61\x49\xd1\ 107 | \xa8\x12\x9c\x22\x90\x8a\xc6\xba\x61\x8c\xf4\x1f\x2e\xc4\x43\xa5\ 108 | \xa5\xa5\x06\x2a\x91\x84\x80\xf0\xe0\x1f\x0f\x44\xa0\x8a\x40\x5f\ 109 | \xf9\x8b\x03\x40\x04\x7e\x40\xa2\x02\x87\x2d\xcb\xca\xe5\x9c\x0b\ 110 | \x00\x27\x8c\x63\xc7\x02\x54\x04\x52\x71\xcc\xb6\xed\x6c\x01\x01\ 111 | \x10\x71\x3a\x25\x25\xc5\x46\x25\x52\x66\xe6\xdd\x5b\x00\x6c\xb9\ 112 | \x6c\x8b\x40\x39\x13\xb8\xba\x3b\xd5\xd4\xb1\xdc\x75\x05\xe7\xec\ 113 | \xf8\xb9\xb3\x67\x1e\x1b\x39\x72\xa4\x13\x88\x1a\xe0\x0d\xaf\xc2\ 114 | \xcd\x59\xbd\x76\xa3\x57\x04\x6e\xf4\x76\x05\xbf\xea\x6f\xe2\x44\ 115 | \x25\x12\x27\xb8\xc6\xd0\xf5\x5e\xba\x61\xdc\x25\x40\xee\xb0\xae\ 116 | \xbe\x9a\x06\xa6\x08\x54\x28\xae\xd4\x35\xfd\x4e\x4d\xd7\xef\x24\ 117 | \x40\x4f\xd3\x34\x55\x54\x22\x11\x02\x42\x28\xf5\xbf\x00\x10\x34\ 118 | \x70\x45\x60\xd9\x8b\x13\xf0\x29\xde\xbb\x00\x82\x4a\x24\x41\xc4\ 119 | \x1e\x2b\x1a\x9b\xc9\x85\x0b\x01\x14\x9f\x09\x85\x58\x60\x02\x40\ 120 | \x38\x39\x68\xc5\x62\xd3\x39\xe7\x10\x42\x9c\x03\x10\x43\x25\xd2\ 121 | \xa0\x01\x03\x3e\x03\xf0\xd9\xe5\x59\x04\x4a\xfe\x12\x70\x5f\x5d\ 122 | \xd3\xa6\x32\xc6\xc0\x5c\xb7\xe0\x0b\x2a\x06\x66\x65\x66\xda\xc1\ 123 | \x38\x1a\xb6\x32\x37\x3d\x27\x77\xed\xbe\xec\x55\x6b\xf6\xbd\x99\ 124 | \x9d\xb3\x79\xc9\x92\x25\x09\xb8\x98\x94\xa4\xaa\xea\x75\xfe\x23\ 125 | \x80\x56\x81\x3a\x18\xa2\x50\x92\xa8\xa8\x6a\x1a\x55\x95\x34\x08\ 126 | \xa4\x25\x24\x24\x50\x54\x22\x51\x4a\x68\xc5\xc3\x2e\x41\x5b\x0e\ 127 | \xa6\x9c\xb9\x60\x8c\x81\x80\x32\xc7\x89\x51\x54\x22\xd9\xdc\xdd\ 128 | \xaa\x58\xb1\x47\x38\xe3\x10\xe0\x67\xbd\x3d\x81\x6e\xc0\xa6\x82\ 129 | \x01\x10\x02\x01\x86\x70\x38\x2c\x50\x89\x64\x00\x87\xc2\x86\x56\ 130 | \x00\xcf\x85\x0b\x8e\xf0\xb7\x83\x05\xea\x70\x28\xca\x81\x10\xee\ 131 | \x38\x8e\x40\x25\x12\x27\xea\x80\x98\xcd\x0a\x4a\xa3\x76\x01\x13\ 132 | \xf4\x83\xec\xfc\x7c\xfd\x32\xba\x20\x42\x32\x35\xa1\x31\x46\x1a\ 133 | \x30\x4e\x1a\x28\x0a\xae\xb8\xa2\x55\x36\xbf\x4c\x02\x20\xb5\xef\ 134 | \xb5\xf4\x17\xf3\xde\x88\x8c\x5e\x90\x73\x16\xaf\xe4\x7e\x8f\xdc\ 135 | \xf7\xad\x3a\x59\x19\xff\x79\x7d\xf0\x03\x20\xa1\xc3\x5d\xcb\x07\ 136 | \xaa\x54\x7b\xfb\x7c\x84\xdc\x7a\xba\xc4\xc1\x77\x25\x2e\x0e\x16\ 137 | \xb8\xa9\x91\x98\xfe\xee\x0d\xbd\x97\xdd\x1a\xe0\x00\x48\x37\xf7\ 138 | \xcc\x4e\x12\x10\x73\x05\x81\x09\xe1\x80\x52\x94\x3d\x0a\xe5\x20\ 139 | \x54\x49\x21\x1c\x2f\xdd\xd8\x77\x61\x38\xa0\x01\x90\x1c\x52\xda\ 140 | \x99\x52\xf5\x6a\xc1\x5d\x5c\x8c\x33\x1b\x84\xd2\xd6\xc4\x35\xda\ 141 | \x05\x34\x00\x12\xa3\xa4\x0e\x27\x0a\x04\x08\x2e\x85\x10\x05\x20\ 142 | \xac\x41\x40\x03\x20\xfd\x57\xec\xf4\xd1\x64\xfb\x0c\x0b\x0b\x1b\ 143 | \x36\x51\xc1\x41\x51\x11\xe7\xae\xe0\x44\x29\x08\x56\x00\x04\x84\ 144 | \xb7\x1c\x6c\xe1\x32\x96\x7f\xdd\x75\xf1\xa7\x9a\x5e\x3b\x69\x71\ 145 | \xe1\x82\xa5\x0b\x8e\xfc\x99\xbc\x5c\xb0\x10\x8f\x9f\xda\x88\xba\ 146 | \xbc\x14\x2e\x51\xe0\xa3\xaa\x09\x01\xbe\x99\x14\x59\x79\x81\x98\ 147 | \x09\xf4\x09\xce\xe1\x49\x31\x43\x09\x6f\xbe\xb9\x32\xc7\xc1\xe5\ 148 | \x86\x50\x28\xcc\x11\x1d\x12\x12\x9a\x84\xad\xd3\xed\x6d\x02\xc4\ 149 | \xf1\x18\xe2\x59\x14\x83\x4e\x6f\x45\xcb\xd8\x37\x78\xe6\xaa\x7b\ 150 | \x51\x42\xe2\x85\xc1\xec\xdd\x0a\xc1\xa8\x5d\x9f\x8e\x74\x82\x13\ 151 | \x00\x21\x40\x08\x09\x69\xba\xd6\x0f\x97\x21\xae\x69\xb8\x6a\xf7\ 152 | \x2e\xd4\x2d\x2e\x46\x29\xa1\x80\x10\x50\x41\xa0\x51\x0a\x40\x41\ 153 | \xbb\x0b\x47\x31\x9a\xff\x0d\x9f\xa6\xdf\x55\xac\xd8\xac\xcf\xac\ 154 | \xac\xcc\xa2\xa0\xac\x05\x28\x86\x61\x40\x51\xe8\xe5\x7e\x00\x14\ 155 | \x75\xf6\xef\x87\xe3\xb8\x80\xae\xc3\x24\x04\x87\x98\x8b\xf7\xa2\ 156 | \x51\x7c\xcf\x39\x7a\xea\x06\x6e\xe3\x47\x60\x34\x73\x8a\x42\x6d\ 157 | \x13\x4b\x02\xb3\x18\xc4\xc0\x0e\xc5\x2c\xeb\x25\xe6\x38\xb8\x9c\ 158 | \x71\xe6\xc2\x38\x59\xd4\x4b\x51\xd5\xc6\x2a\x21\x58\x16\x29\xc5\ 159 | \x84\x53\xa7\x70\xd6\x65\x80\xaa\x62\x81\x42\xf1\x46\x7c\xdc\x99\ 160 | \x66\x47\x8f\x0f\xbf\x3e\x63\xac\x15\xc0\x1d\x41\xd2\xa9\x46\x4d\ 161 | \x9e\x4b\x32\xf4\x89\xcb\x4b\x2f\xe0\xa1\x6f\xbf\x45\xab\xb4\xeb\ 162 | \x30\x6d\xf2\x24\x28\x94\x62\xd0\xfd\xff\x8d\x6b\x1c\x7b\x67\x7e\ 163 | \x24\xd2\x05\x42\xb8\x01\x9c\x0a\x96\x38\xf4\x57\x4b\x39\x3f\x95\ 164 | \x7d\xfe\x3c\x92\x53\x53\xb1\x71\xed\x1a\xf4\xeb\xdb\x17\xbd\x7b\ 165 | \xf7\xc6\xcd\x1d\x3b\xe2\x40\x24\x92\x42\x00\x23\xa0\xd7\xc5\x4b\ 166 | \x0d\x8e\x1c\x28\x70\x38\x1b\x7c\x38\x1a\x3d\xd3\xb8\x61\x23\x5c\ 167 | \x73\xcd\x35\x28\x87\x2e\x5d\x6e\x81\xa7\xa1\xa6\x85\xae\x0b\x70\ 168 | \x00\xa4\x94\x43\x87\xfe\xfa\x95\x6d\x1f\x24\x9c\x81\x73\x8e\x72\ 169 | \x48\xef\xd6\x0d\x8a\xa6\x29\x82\xb0\x1e\x41\x0f\x80\x44\xc8\xf7\ 170 | \xe7\xce\x9d\x43\xd9\xe5\xd0\xe5\xda\xb7\x6f\x8f\x46\x8d\x1a\xc3\ 171 | \x75\x58\x2f\x42\x08\x0d\x70\x00\x24\x4a\xd5\xe3\xa7\x4f\x9f\x41\ 172 | \x49\x49\x09\xca\x21\x3e\x3e\x1e\xbf\xec\xd1\x1d\x10\xec\x06\x5d\ 173 | \xd7\x9b\x07\x38\x00\x12\x55\xe9\xc1\xb3\x5e\xe3\x17\x1c\x3d\x8a\ 174 | \x8a\x06\x0c\x18\x00\xaa\xa8\x26\x07\x1d\x18\xec\x00\x48\x79\xae\ 175 | \x63\x23\xef\xf3\xcf\x51\x51\x97\x5b\x6e\x41\xab\x56\xad\xe0\xfd\ 176 | \x6e\x30\x21\xc4\x0c\x68\x00\x24\x57\x51\xf6\x03\x38\xbb\x6d\xfb\ 177 | \x0e\x54\x14\x0a\x85\x30\x68\xd0\x3d\x80\xe0\x69\x86\x61\xf4\x08\ 178 | \x6a\x00\xa4\x48\xe4\x5b\x10\x65\xef\xae\x5d\xbb\xe0\xad\x8e\xa2\ 179 | \xa2\x21\x43\xee\x43\xbd\xe4\x14\xd8\x8c\x3d\x12\xd0\x00\x48\xc2\ 180 | \xa3\x6a\xca\xe6\xc3\x47\x0e\x63\xcf\x9e\x3d\xa8\xa8\x51\xc3\x46\ 181 | \x18\xe8\xd5\x02\xc2\x75\x6f\xd3\xc3\xe1\x4e\x01\x0d\x80\x44\x84\ 182 | \xb2\xc9\xb5\x6d\xb6\x61\xe3\x46\x5c\x6c\xcc\x98\x47\x11\x17\x9f\ 183 | \xa0\x71\x87\x3d\x1d\xd0\x00\x48\x8e\x13\xdd\x03\x42\xf3\xd7\xaf\ 184 | \xdf\x50\x69\x3e\xc0\xd7\xa6\x75\x6b\x78\xa7\x83\xc0\x5c\xbb\xaf\ 185 | \x16\x0a\x75\x0d\x66\x00\xe4\x30\x60\xab\x9a\xbe\x2a\x3f\x3f\x1f\ 186 | \x5b\xb7\x6e\xc5\xc5\x7e\xf7\xf4\x6f\x51\xa7\x5e\x92\x2a\x5c\x36\ 187 | \x99\x10\xa2\xc2\x43\xc2\xe1\xff\xd0\xf5\xb8\x76\x5e\xb1\xd8\x98\ 188 | \xfc\x43\x9c\x61\x18\x77\xeb\xba\x39\xc6\x7b\x7e\x6d\x18\xe1\xc1\ 189 | \xde\xcf\x69\x3f\x93\xd5\x40\xc9\x30\x8c\x96\xb6\x6d\xef\xfe\xd5\ 190 | \x03\x43\x43\xcb\x97\x2d\xc5\xc5\x9e\x79\xf6\x59\x4c\x9f\x36\x0d\ 191 | \xba\x69\xde\x2f\x00\x85\xb9\x6c\x2e\x77\x9d\xba\x00\xa2\x20\xca\ 192 | \xe7\x9a\xa6\x51\x42\x49\x67\x45\x51\xe0\x38\x0e\x5c\xdb\x06\x20\ 193 | \x2c\xa2\x6a\xdb\x14\x85\xce\xd0\x28\x3d\xc0\x18\xab\x4b\x08\x89\ 194 | \x58\x96\x55\x28\x84\x70\x6a\x51\x0f\x20\x59\x96\x75\x80\x28\xea\ 195 | \xe6\xf5\x1b\x36\xa0\xa0\xa0\x00\x17\x7b\x6a\xec\x58\x34\x6f\xd1\ 196 | \x12\xb6\x65\xcf\x66\x8e\x3b\xab\x71\xe3\xc6\x49\x33\x67\xcd\xa2\ 197 | \x63\x1e\x7b\x2c\xae\x59\xb3\xa6\x37\x3b\x76\xac\x33\x11\x02\xe3\ 198 | \x9e\x7d\x06\x3b\xb7\x6f\x43\xce\xaa\x1c\x3c\x3a\x66\x8c\x91\x92\ 199 | \x9c\x94\xce\x5c\xb6\xc9\xe5\x62\x9f\xf7\xf8\x1f\x65\x97\x07\x42\ 200 | \x77\x7a\x41\x7a\x84\x10\xa2\xd5\xa2\x1e\x40\x32\xcd\xb8\xde\x96\ 201 | \x15\x59\x37\x61\xc2\x44\x64\x65\x3d\x87\x8b\xbd\xb5\x66\x0d\x32\ 202 | \x32\x32\xc0\x18\x47\xfb\x1b\x6e\xc0\xee\xbf\xed\x82\xcf\x9f\x46\ 203 | \x5e\xb8\x68\x11\xb2\x9e\xcb\x42\x5c\x5c\x18\xcf\xcf\x99\x83\x61\ 204 | \x43\x87\xc2\x97\x97\x97\x87\xdb\xef\xe8\x89\x93\x27\x4f\x96\xfd\ 205 | \x4d\x8f\xee\xe9\xf0\x6b\x8d\x03\xf9\xfb\xa1\xea\xc6\x5a\xd7\x36\ 206 | \x87\x0a\x71\xb6\xa4\x16\xf4\x00\x92\xd7\xf8\xef\x12\xaa\xfe\x7d\ 207 | \xe9\xf2\xe5\x38\x7d\xfa\x34\x2e\xd6\xbf\x5f\x3f\x0c\x1f\xfe\x20\ 208 | \x20\x38\xf6\xed\xcd\xc3\x47\x1f\x7f\x0c\x9f\xf7\xe1\x5b\x5e\x9d\ 209 | \xf0\x34\x5e\x9c\xff\x22\xce\x9e\x3d\x87\xe1\xc3\x86\x61\xf2\x94\ 210 | \xa9\xf0\xb5\xf6\x8a\xc8\xf9\x2f\xbe\x08\xc3\xd0\x71\xf8\xeb\x43\ 211 | \xe8\xd3\xbb\x0f\xb6\x6f\xdb\x8a\x27\xbd\x1e\x85\xb9\x6e\x5f\x55\ 212 | \x8f\xbd\x4e\x08\x31\x6b\x4b\x00\x64\x31\xa8\xab\x2f\x1c\x3d\x72\ 213 | \x18\x4b\x97\x2e\xc3\xa5\xcc\x98\x3e\x0d\x6d\xda\xb6\x83\x6d\x59\ 214 | \x98\x3b\x77\x1e\x2a\x1a\x39\x62\x04\x16\x79\x3d\x81\x19\x0a\xe1\ 215 | \xb9\xf1\xe3\xca\x42\xe0\xba\x2e\x32\x33\x33\xf0\xca\xe2\xc5\xb0\ 216 | \x62\x31\x2f\x24\xf3\x51\xa7\x4e\x1d\xcc\x79\xfe\x79\x3c\xf5\xd4\ 217 | \x58\xb8\xb6\xd5\x4b\xd5\xcd\xdf\xd7\x92\x00\x48\x4e\x2c\x96\x4d\ 218 | \xa8\xba\xff\x4f\x2f\xbf\x7c\xc9\x5e\x20\x29\x29\xc9\x6b\xcc\x45\ 219 | \xa8\x97\x94\x8c\x75\xeb\xd6\x62\x8d\x37\x2c\x54\x34\x7c\xf8\x30\ 220 | \xe4\x64\x67\xa3\x7e\x6a\x2a\xa6\x4f\x9f\xfe\xcf\x7a\x62\xc8\x90\ 221 | \x21\xd8\xb1\x73\x27\x66\xcd\x9c\x81\x72\x98\x3c\x69\x12\x7e\xd1\ 222 | \x2d\xdd\x0f\xc1\x53\x86\x61\x5c\x5f\x4b\x6a\x00\x49\x0f\x85\x7e\ 223 | \xe5\x05\x61\xf9\xa4\xc9\x53\x30\x7e\xdc\xb3\xb8\x94\x95\x2b\xb3\ 224 | \x31\x68\xf0\xa0\xb2\x2d\x64\x6b\xde\x7a\x0b\x94\x52\x54\xb4\xc7\ 225 | \x5b\x5c\x3a\x56\x58\x88\x3e\x7d\xfa\xe0\x5f\xd9\xb1\x63\x07\xba\ 226 | \xf7\xe8\x01\xdb\x71\xff\xd7\x0b\xc2\xe0\x5a\x10\x00\x89\xf8\x54\ 227 | \xf5\xc3\x2b\x92\x53\xba\xee\xdc\xb1\x1d\x0d\x1b\x36\xc4\xa5\xac\ 228 | \xca\xcd\x2d\x9b\x28\x6a\xda\xb4\x29\x7e\x8c\xfb\xee\xbf\x1f\x7f\ 229 | \x79\xe3\x0d\x4b\xd3\xe2\x3a\xdb\xf6\x85\x3d\x35\x3c\x04\x48\x5e\ 230 | \x43\xb4\xa1\x84\xd0\x53\x27\x8b\x30\x7d\xc6\x0c\xfc\x7f\xfc\x75\ 231 | \x02\xbf\xf1\x7f\xac\x5f\x3f\xfe\x38\x0c\x33\x64\x70\xb8\x63\x6a\ 232 | \xb8\x06\x90\x8c\x70\xf8\x1e\xc7\x8d\xfe\x35\x2e\x2e\xbe\x4b\xf2\ 233 | \x15\xf5\xb1\x62\xc5\x5f\x70\xe0\xe0\x41\x54\xa5\x8e\x1d\x3a\xe0\ 234 | \xf6\xdb\x6f\x07\x73\xac\xc1\x5a\x38\x7c\x73\x0d\x05\x40\xd2\xcd\ 235 | \xb8\x51\x76\x34\xfa\x9a\xd7\xa5\xd7\x7d\xf7\x9d\xb7\xf1\xda\xf2\ 236 | \x65\xb8\x70\xfe\x7b\xbc\xfa\xea\xab\x55\x3d\xe4\x60\xe2\x84\x2c\ 237 | \x24\x25\x27\xc7\x71\xc7\x5d\x42\x48\x62\x4a\xf5\x07\x40\x36\xfe\ 238 | \xa3\x8e\x15\x79\xb9\x6d\xbb\xf6\xfa\x86\xf5\xeb\xd0\xa9\x63\x47\ 239 | \xa4\xa7\xa7\xa3\x49\xd3\x66\x58\x95\xbb\x1a\xd1\x68\x14\x55\xa9\ 240 | \x5d\xbb\x76\x98\x3d\x7b\x36\x04\x67\xcd\x15\xc3\x9e\x5c\xbd\x01\ 241 | \x90\xeb\x00\x2d\x5c\xc7\x9a\x75\x63\x87\x8e\xc4\x6f\xfc\x6b\xaf\ 242 | \xbd\x16\x3e\xd3\x34\xd1\xc1\xeb\x9e\x0f\x7d\xf5\x15\x0e\x7a\xc3\ 243 | \x40\x55\xf3\x67\x0f\xfb\xf5\xeb\x0f\x66\x59\x0f\xfa\x43\x41\x35\ 244 | \x05\x40\x12\x84\xdc\x4e\x29\x0d\x4f\x9d\x3a\x05\x57\x5d\x75\x15\ 245 | \x2a\x6a\xd1\xa2\x39\x04\x67\xc8\xcf\x3f\x50\x2d\x87\x56\xa7\x4c\ 246 | \x9e\x84\x3a\x75\xeb\x69\xc2\x71\x27\x12\x42\x94\x6a\x08\x80\xc4\ 247 | \x98\x48\xd4\x74\x1d\x57\x36\x68\x80\x8b\xa5\xa6\x36\x80\xef\xf8\ 248 | \x37\xc7\x51\x1d\xd2\xd2\xd2\x30\xd4\xeb\x09\x98\xeb\xf4\x50\x0d\ 249 | \xe3\x97\xd5\x10\x00\x49\x21\xb4\xd0\x8a\x45\x2f\xb9\x0a\x18\x0e\ 250 | \x87\xe1\xf3\x6b\x80\xea\xf2\xf8\x63\x63\x90\x94\x9c\x42\x18\x63\ 251 | \xbf\x21\x9e\x2a\x0f\x80\xa4\xe4\x09\xce\xdd\x9d\x3b\x77\xe1\x62\ 252 | \xae\xe3\xc0\x97\x98\x98\x88\xea\xe2\x2d\x35\x63\xe0\xc0\xb2\xbd\ 253 | \x88\x3d\x34\x2d\xdc\xb6\x8a\x03\x20\x39\x4e\xe9\x17\x00\x39\xf2\ 254 | \xf1\x27\x9f\x80\x73\x8e\x8a\x8a\xbf\x2b\x2e\xdf\x20\xda\x10\xd5\ 255 | \x69\xd8\xb0\x61\xd0\x0d\x53\x13\x60\x43\xaa\x38\x00\x92\x10\x22\ 256 | \x4a\x15\x75\x5b\xde\xde\xbd\x28\x3c\x76\x0c\x15\x65\x0c\xcc\xc0\ 257 | \xfc\xf9\x2f\xa1\x73\xe7\xce\xa8\x4e\x1d\x6e\xbc\x11\x6d\xdb\xb5\ 258 | \x85\xeb\xda\x7d\x08\x21\xa1\x2a\x5e\x0b\x90\x0c\x23\x34\xc4\xb6\ 259 | \xad\xd7\x57\xac\x58\x81\x7b\xef\x1d\x8c\xda\xc0\xdf\x98\x32\x71\ 260 | \xe2\x04\xae\x69\xa1\x9b\x6d\x3b\xb2\xb3\x0a\x7b\x00\x89\x52\x6c\ 261 | \x05\xc4\x85\xcd\x1f\x6c\x46\x6d\xd1\xb5\xeb\xad\xa0\xaa\x4a\x41\ 262 | \x79\xc7\x2a\x1e\x02\xa4\x58\x2c\x56\x08\xa2\xec\xdd\xbe\x63\x47\ 263 | \x79\xc5\x5f\xf3\x9a\x36\x6d\x86\xba\x75\xeb\x81\xb9\xbc\x65\xd5\ 264 | \x07\x40\xd6\x01\x5c\xd5\x94\x2d\x87\xbf\x3e\x8c\x2f\xbe\xf8\x02\ 265 | \xb5\x41\x62\x62\x02\xe2\xe3\xe2\xc1\x05\x4f\xaa\x8e\x00\x48\x84\ 266 | \x6c\x89\x45\x23\xd8\xb6\x7d\x3b\x6a\x03\xff\xac\x62\x69\xa4\x14\ 267 | \x94\xd0\xef\xab\x21\x00\x92\xab\xaa\x7b\x00\x94\xf8\x87\x43\x6a\ 268 | \x83\xfd\xf9\xf9\x28\x39\x73\x06\x8a\x4a\xf7\xca\x00\x54\xcf\xbf\ 269 | \xdc\x49\x45\x55\xf3\x3e\xfc\x70\x0b\x8e\x1d\x3b\x86\x9a\xb6\x69\ 270 | \xd3\xdb\xe0\xcc\x75\xc0\xd5\x8f\xaa\x2b\x00\xf2\xa4\xb0\xa2\xff\ 271 | \xf1\xc4\x37\xdf\x88\x87\x1f\x79\xc4\x2f\x0c\x6b\xb2\x28\x45\xd9\ 272 | \x3b\x12\x42\xf2\x1c\xa7\x74\x7f\x35\x05\x40\x8a\xc5\x4a\xd7\xea\ 273 | \x86\x3e\x7b\xc3\xfa\xf5\x18\xfd\xf0\xc3\xb0\x6d\x1b\x35\xe1\xc4\ 274 | \x89\x13\x28\x3c\x5a\x08\xaa\xa8\x5b\x85\x10\x6e\x35\x06\x40\xb2\ 275 | \x2d\xeb\x59\x4d\x37\x97\x2e\x5f\xb6\x0c\x0f\x3e\xf4\x10\x22\x91\ 276 | \x48\x8d\xf4\x00\x8e\xeb\x02\x20\xe7\xaa\x7f\x2a\x58\x0e\x05\xae\ 277 | \x63\xc7\x46\x6b\x86\xb9\xe8\xf5\xd7\x5e\xc3\x3d\x83\x06\xa1\xb8\ 278 | \xb8\x18\xd5\x29\x35\x35\x15\xf5\xea\xd6\x85\x10\xac\x4d\xcd\x04\ 279 | \x40\x86\xc0\x76\xac\xd8\x68\xdd\x34\x67\xfa\xc3\x41\xcf\x3b\x7b\ 280 | \x61\xdf\xbe\x7d\xa8\x2e\xc9\xc9\xc9\xb8\xe9\xa6\x9b\x20\x18\xeb\ 281 | \x66\x9a\x66\x93\x9a\x09\x80\x0c\x01\xb7\xa2\xd1\xdf\x6b\x46\xf8\ 282 | \xd1\xcf\x76\x7f\x1a\xbd\xed\x8e\x3b\xb0\x7a\xf5\x6a\x54\x97\x51\ 283 | \x23\x47\x40\x51\xb5\x44\x97\xe3\x77\x35\x18\x00\xc9\x8e\x95\xfe\ 284 | \x49\x35\x8c\xfe\x45\x45\x27\x0b\x07\x0d\xbe\x17\xe3\xc6\x8f\x87\ 285 | \x65\x59\xa8\x6a\xdd\xbb\x77\x47\xbf\x7e\xfd\xc0\x1c\x6b\xa8\x16\ 286 | \x0a\xf5\xa8\xd9\x00\xc8\x33\x83\xef\x9a\xba\x96\xce\x05\x7f\x6f\ 287 | \xea\x94\x29\xe8\xdd\xa7\x6f\x95\x9f\x17\xa0\x94\x62\xfa\xb4\xa9\ 288 | \xb8\x22\x35\x55\x63\xae\xfb\x12\x21\x89\xc9\x35\x18\x00\x29\x1a\ 289 | \x8d\x1e\x66\x8e\xd3\x47\x35\xcd\x29\xef\xbf\xf7\xae\xe3\x6f\x1b\ 290 | \x5f\xbc\xf8\x15\x54\xe5\xf2\xbb\xbf\x43\x79\xc6\xb4\xe9\x10\x8c\ 291 | \xb7\x50\x0c\x7b\x6a\xcd\x07\x40\xd6\x05\x96\x13\x8d\x8e\x57\x0d\ 292 | \xa3\xf7\xa9\xef\xbe\x3b\x30\x62\xc4\x08\x64\x64\x64\xe2\xcb\x2f\ 293 | \xbf\xac\xd2\xed\xe2\x19\x19\x03\xc1\x2c\xeb\x21\xcd\x34\xef\xa8\ 294 | \x25\x01\x90\x43\x82\x08\x85\xba\x2a\x86\xfe\x3f\xb9\xb9\xab\xd8\ 295 | \xad\x5d\xbb\xe2\x8f\x73\xe7\x56\xc9\x52\x32\xa1\x04\xb3\x66\xce\ 296 | \x44\x6a\x83\x2b\x15\xc6\xd8\x2c\x42\x48\x5c\x2d\xda\x11\x24\xf9\ 297 | \xff\x95\x8c\xb1\xe9\xc2\x75\xdb\x75\xec\xd4\x09\xe3\xc7\x8d\x2b\ 298 | \x3b\x36\xfe\x53\x9b\x37\x6f\x1e\x9e\x78\xe2\x09\x68\x46\xe8\x09\ 299 | \x3b\x16\x99\x57\x7b\x7a\x00\xd9\x1b\xbc\x23\x5c\xb7\xab\xaa\x87\ 300 | \xfe\xb0\x6b\xe7\xae\xe2\x7e\xfd\xef\x46\x46\x66\x26\x8a\x8a\x8a\ 301 | \xf0\x53\xf2\x87\x9b\xeb\xdb\xb4\x81\xeb\x58\xbf\x21\xa4\x6e\xbd\ 302 | \x5a\xd8\x03\x48\xfe\xbd\x81\x8e\x10\x4f\x33\xcb\x1a\xe1\x0d\x0b\ 303 | \x74\xfd\xba\x75\x3f\xe9\x96\xf2\x85\x0b\x17\x61\xd4\xa8\x91\xd0\ 304 | \x34\xf3\x41\xdb\x8e\x2e\xa9\x85\x3d\x80\x7c\xa7\xe0\xc6\x62\xa3\ 305 | \x55\xdd\x1c\xf7\xf1\x47\x1f\x61\xde\x0b\x2f\xe0\xa7\xe4\xdf\x37\ 306 | \xd4\xb0\x71\x93\x08\xe3\xac\x53\x2d\x1e\x02\x24\xd7\x8e\x3d\x4f\ 307 | \x14\xf5\xd3\xc5\xaf\x2c\x29\xbb\x6b\xe8\x47\x3a\x0d\xe0\x13\x00\ 308 | \x73\xbc\x1b\xc9\x32\x7e\x3b\xf6\xc9\x36\x9c\x39\x7f\xa8\xe5\x43\ 309 | \x80\xa4\x9b\xe6\x28\xc7\xb2\xff\xbc\x6a\x55\x4e\xd9\x27\x90\xfc\ 310 | \x1b\x4e\x00\xd8\x0b\x60\x3b\x80\x1d\xe5\xdf\x9f\xf8\x99\xcd\x04\ 311 | \x4a\x14\xf8\x00\x10\xd1\x2d\xde\x50\xf0\x2f\xb8\x00\xbe\x06\x90\ 312 | \x03\xe0\x49\x00\x5d\x00\x5c\x0f\xa0\x27\x80\x89\x00\xde\xf9\x77\ 313 | \x1a\xdf\xa7\xa2\x56\x90\xfc\x3b\x81\x01\x9c\xc8\x3f\x70\xa0\xe2\ 314 | \x6a\x5e\xa4\xbc\xc1\x77\x03\xd8\x0a\xe0\x53\x00\x5f\x01\x28\x0d\ 315 | \xe0\x35\x71\x92\xa2\xa8\x2b\x9a\xb7\x68\xde\xfa\xef\x9f\x7d\xf6\ 316 | \x81\x61\x18\xdb\xca\x1b\xbe\x00\x80\x13\xfc\xdb\xc2\x25\x10\x42\ 317 | \x0c\x00\xc2\x63\xe3\xc7\x92\x01\x90\x64\x11\x28\xc9\x00\x48\x32\ 318 | \x00\x92\x0c\x80\x24\x03\x20\xc9\x00\x48\x32\x00\x92\x0c\x80\x24\ 319 | \x03\x20\xc9\x00\x48\x32\x00\x92\x0c\x80\xf4\x7f\xe3\xe8\xd6\xb6\ 320 | \x46\xaa\x21\x02\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\ 321 | \ 322 | " 323 | 324 | qt_resource_name = b"\ 325 | \x00\x07\ 326 | \x07\x3b\xe0\xb3\ 327 | \x00\x70\ 328 | \x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\ 329 | \x00\x0d\ 330 | \x0c\x36\x17\xc2\ 331 | \x00\x4f\ 332 | \x00\x53\x00\x4d\x00\x44\x00\x6f\x00\x77\x00\x6e\x00\x6c\x00\x6f\x00\x61\x00\x64\x00\x65\x00\x72\ 333 | \x00\x0d\ 334 | \x0f\x55\x06\x27\ 335 | \x00\x72\ 336 | \x00\x65\x00\x63\x00\x74\x00\x61\x00\x6e\x00\x67\x00\x6c\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\ 337 | " 338 | 339 | qt_resource_struct_v1 = b"\ 340 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 341 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 342 | \x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ 343 | \x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ 344 | " 345 | 346 | qt_resource_struct_v2 = b"\ 347 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 348 | \x00\x00\x00\x00\x00\x00\x00\x00\ 349 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 350 | \x00\x00\x00\x00\x00\x00\x00\x00\ 351 | \x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ 352 | \x00\x00\x00\x00\x00\x00\x00\x00\ 353 | \x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ 354 | \x00\x00\x01\x62\x97\x8d\xa3\xc2\ 355 | " 356 | 357 | qt_version = QtCore.qVersion().split('.') 358 | if qt_version < ['5', '8', '0']: 359 | rcc_version = 1 360 | qt_resource_struct = qt_resource_struct_v1 361 | else: 362 | rcc_version = 2 363 | qt_resource_struct = qt_resource_struct_v2 364 | 365 | def qInitResources(): 366 | QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 367 | 368 | def qCleanupResources(): 369 | QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 370 | 371 | qInitResources() 372 | -------------------------------------------------------------------------------- /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 | print ${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 | -------------------------------------------------------------------------------- /styles/osm_mapnik_point.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 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 0 456 | 0 457 | 0 458 | name 459 | 460 | 461 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | ../Work/Formations/Donnees 488 | 489 | 490 | 491 | ../Work/Formations/Donnees 492 | 493 | 0 494 | ../.. 495 | 512 | 0 513 | generatedlayout 514 | 515 | 516 | 517 | 518 | 519 | 0 520 | 521 | -------------------------------------------------------------------------------- /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_init.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Tests QGIS plugin init.""" 3 | 4 | from future import standard_library 5 | standard_library.install_aliases() 6 | __author__ = 'Tim Sutton ' 7 | __revision__ = '$Format:%H$' 8 | __date__ = '17/10/2010' 9 | __license__ = "GPL" 10 | __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' 11 | __copyright__ += 'Disaster Reduction' 12 | 13 | import os 14 | import unittest 15 | import logging 16 | import configparser 17 | 18 | LOGGER = logging.getLogger('QGIS') 19 | 20 | 21 | class TestInit(unittest.TestCase): 22 | """Test that the plugin init is usable for QGIS. 23 | 24 | Based heavily on the validator class by Alessandro 25 | Passoti available here: 26 | 27 | http://github.com/qgis/qgis-django/blob/master/qgis-app/ 28 | plugins/validator.py 29 | 30 | """ 31 | 32 | def test_read_init(self): 33 | """Test that the plugin __init__ will validate on plugins.qgis.org.""" 34 | 35 | # You should update this list according to the latest in 36 | # https://github.com/qgis/qgis-django/blob/master/qgis-app/ 37 | # plugins/validator.py 38 | 39 | required_metadata = [ 40 | 'name', 41 | 'description', 42 | 'version', 43 | 'qgisMinimumVersion', 44 | 'email', 45 | 'author'] 46 | 47 | file_path = os.path.abspath(os.path.join( 48 | os.path.dirname(__file__), os.pardir, 49 | 'metadata.txt')) 50 | LOGGER.info(file_path) 51 | metadata = [] 52 | parser = configparser.ConfigParser() 53 | parser.optionxform = str 54 | parser.read(file_path) 55 | message = 'Cannot find a section named "general" in %s' % file_path 56 | assert parser.has_section('general'), message 57 | metadata.extend(parser.items('general')) 58 | 59 | for expectation in required_metadata: 60 | message = ('Cannot find metadata "%s" in metadata source (%s).' % ( 61 | expectation, file_path)) 62 | 63 | self.assertIn(expectation, dict(metadata), message) 64 | 65 | if __name__ == '__main__': 66 | unittest.main() 67 | -------------------------------------------------------------------------------- /test/test_osmDownloader_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 | from __future__ import absolute_import 11 | 12 | __author__ = 'suporte.dsgtools@dsg.eb.mil.br' 13 | __date__ = '2015-04-07' 14 | __copyright__ = 'Copyright 2015, Brazilian Army - Geographic Service Bureau' 15 | 16 | import unittest 17 | 18 | from qgis.PyQt.QtWidgets import QDialogButtonBox, QDialog 19 | 20 | from osmDownloader_dialog import OSMDownloaderDialog 21 | 22 | from .utilities import get_qgis_app 23 | QGIS_APP = get_qgis_app() 24 | 25 | 26 | class OSMDownloaderDialogTest(unittest.TestCase): 27 | """Test dialog works.""" 28 | 29 | def setUp(self): 30 | """Runs before each test.""" 31 | self.dialog = OSMDownloaderDialog(None) 32 | 33 | def tearDown(self): 34 | """Runs after each test.""" 35 | self.dialog = None 36 | 37 | def test_dialog_ok(self): 38 | """Test we can click OK.""" 39 | 40 | button = self.dialog.button_box.button(QDialogButtonBox.Ok) 41 | button.click() 42 | result = self.dialog.result() 43 | self.assertEqual(result, QDialog.Accepted) 44 | 45 | def test_dialog_cancel(self): 46 | """Test we can click cancel.""" 47 | button = self.dialog.button_box.button(QDialogButtonBox.Cancel) 48 | button.click() 49 | result = self.dialog.result() 50 | self.assertEqual(result, QDialog.Rejected) 51 | 52 | if __name__ == "__main__": 53 | suite = unittest.makeSuite(OSMDownloaderDialogTest) 54 | runner = unittest.TextTestRunner(verbosity=2) 55 | runner.run(suite) 56 | 57 | -------------------------------------------------------------------------------- /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 | from __future__ import absolute_import 12 | __author__ = 'tim@linfiniti.com' 13 | __date__ = '20/01/2011' 14 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 15 | 'Disaster Reduction') 16 | 17 | import os 18 | import unittest 19 | from qgis.core import ( 20 | QgsProviderRegistry, 21 | QgsCoordinateReferenceSystem, 22 | QgsRasterLayer) 23 | 24 | from .utilities import get_qgis_app 25 | QGIS_APP = get_qgis_app() 26 | 27 | 28 | class QGISTest(unittest.TestCase): 29 | """Test the QGIS Environment""" 30 | 31 | def test_qgis_environment(self): 32 | """QGIS environment has the expected providers""" 33 | 34 | r = QgsProviderRegistry.instance() 35 | self.assertIn('gdal', r.providerList()) 36 | self.assertIn('ogr', r.providerList()) 37 | self.assertIn('postgres', r.providerList()) 38 | 39 | def test_projection(self): 40 | """Test that QGIS properly parses a wkt string. 41 | """ 42 | crs = QgsCoordinateReferenceSystem() 43 | wkt = ( 44 | 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",' 45 | 'SPHEROID["WGS_1984",6378137.0,298.257223563]],' 46 | 'PRIMEM["Greenwich",0.0],UNIT["Degree",' 47 | '0.0174532925199433]]') 48 | crs.createFromWkt(wkt) 49 | auth_id = crs.authid() 50 | expected_auth_id = 'EPSG:4326' 51 | self.assertEqual(auth_id, expected_auth_id) 52 | 53 | # now test for a loaded layer 54 | path = os.path.join(os.path.dirname(__file__), 'tenbytenraster.asc') 55 | title = 'TestRaster' 56 | layer = QgsRasterLayer(path, title) 57 | auth_id = layer.crs().authid() 58 | self.assertEqual(auth_id, expected_auth_id) 59 | 60 | if __name__ == '__main__': 61 | unittest.main() 62 | -------------------------------------------------------------------------------- /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__ = 'suporte.dsgtools@dsg.eb.mil.br' 12 | __date__ = '2015-04-07' 13 | __copyright__ = 'Copyright 2015, Brazilian Army - Geographic Service Bureau' 14 | 15 | import unittest 16 | 17 | from qgis.PyQt.QtGui import QIcon 18 | 19 | 20 | 21 | class OSMDownloaderDialogTest(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/OSMDownloader/icon.png' 35 | icon = QIcon(path) 36 | self.assertFalse(icon.isNull()) 37 | 38 | if __name__ == "__main__": 39 | suite = unittest.makeSuite(OSMDownloaderResourcesTest) 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 __future__ import absolute_import 11 | from .utilities import get_qgis_app 12 | 13 | __author__ = 'ismailsunni@yahoo.co.id' 14 | __date__ = '12/10/2011' 15 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 16 | 'Disaster Reduction') 17 | import unittest 18 | import os 19 | 20 | from qgis.PyQt.QtCore import QCoreApplication, QTranslator 21 | 22 | QGIS_APP = get_qgis_app() 23 | 24 | 25 | class SafeTranslationsTest(unittest.TestCase): 26 | """Test translations work.""" 27 | 28 | def setUp(self): 29 | """Runs before each test.""" 30 | if 'LANG' in iter(os.environ.keys()): 31 | os.environ.__delitem__('LANG') 32 | 33 | def tearDown(self): 34 | """Runs after each test.""" 35 | if 'LANG' in iter(os.environ.keys()): 36 | os.environ.__delitem__('LANG') 37 | 38 | def test_qgis_translations(self): 39 | """Test that translations work.""" 40 | parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir) 41 | dir_path = os.path.abspath(parent_path) 42 | file_path = os.path.join( 43 | dir_path, 'i18n', 'af.qm') 44 | translator = QTranslator() 45 | translator.load(file_path) 46 | QCoreApplication.installTranslator(translator) 47 | 48 | expected_message = 'Goeie more' 49 | real_message = QCoreApplication.translate("@default", 'Good morning') 50 | self.assertEqual(real_message, expected_message) 51 | 52 | 53 | if __name__ == "__main__": 54 | suite = unittest.makeSuite(SafeTranslationsTest) 55 | runner = unittest.TextTestRunner(verbosity=2) 56 | runner.run(suite) 57 | -------------------------------------------------------------------------------- /test/utilities.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Common functionality used by regression tests.""" 3 | from __future__ import absolute_import 4 | 5 | import sys 6 | import logging 7 | 8 | 9 | LOGGER = logging.getLogger('QGIS') 10 | QGIS_APP = None # Static variable used to hold hand to running QGIS app 11 | CANVAS = None 12 | PARENT = None 13 | IFACE = None 14 | 15 | 16 | def get_qgis_app(): 17 | """ Start one QGIS application to test against. 18 | 19 | :returns: Handle to QGIS app, canvas, iface and parent. If there are any 20 | errors the tuple members will be returned as None. 21 | :rtype: (QgsApplication, CANVAS, IFACE, PARENT) 22 | 23 | If QGIS is already running the handle to that app will be returned. 24 | """ 25 | 26 | try: 27 | from qgis.PyQt import QtGui, QtCore 28 | from qgis.core import QgsApplication 29 | from qgis.gui import QgsMapCanvas 30 | from .qgis_interface import QgisInterface 31 | except ImportError: 32 | return None, None, None, None 33 | 34 | global QGIS_APP # pylint: disable=W0603 35 | 36 | if QGIS_APP is None: 37 | gui_flag = True # All test will run qgis in gui mode 38 | #noinspection PyPep8Naming 39 | QGIS_APP = QgsApplication(sys.argv, gui_flag) 40 | # Make sure QGIS_PREFIX_PATH is set in your env if needed! 41 | QGIS_APP.initQgis() 42 | s = QGIS_APP.showSettings() 43 | LOGGER.debug(s) 44 | 45 | global PARENT # pylint: disable=W0603 46 | if PARENT is None: 47 | #noinspection PyPep8Naming 48 | PARENT = QtGui.QWidget() 49 | 50 | global CANVAS # pylint: disable=W0603 51 | if CANVAS is None: 52 | #noinspection PyPep8Naming 53 | CANVAS = QgsMapCanvas(PARENT) 54 | CANVAS.resize(QtCore.QSize(400, 400)) 55 | 56 | global IFACE # pylint: disable=W0603 57 | if IFACE is None: 58 | # QgisInterface is a stub implementation of the QGIS plugin interface 59 | #noinspection PyPep8Naming 60 | IFACE = QgisInterface(CANVAS) 61 | 62 | return QGIS_APP, CANVAS, IFACE, PARENT 63 | --------------------------------------------------------------------------------