diff --git a/README.md b/README.md index 39717ed..dae2360 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # FLO-2D-Rasterizor -![F2D 400 Transparent](https://github.com/FLO-2DKaren/FLO-2D-Rasterizor/assets/39889306/05a2477e-3cca-4240-bb32-0cd4e721596c) Rasterizor is a QGIS plugin used to rasterize FLO-2D output data. It is a quick mapping tool for FLO-2D output files. The files should have a standard format with 4 columns ge, x, y, n. These are grid element number, x coordinate, y coordinate, and n is the mapped value. It could be water surface elevation, depth, velocity or time to depth. A brief list of files that can be used are: @@ -26,7 +25,7 @@ Find differences between rasters ## Versions -- 0.3 Under development +- 0.3 Latest Release - 0.2 Latest Release - 0.1 First release @@ -39,3 +38,18 @@ FLO-2D Rasterizor QGIS Repository ## Bugs Our issue tracker is at [https://github.com/FLO-2DKaren/FLO-2D-Rasterizor/issues](https://github.com/FLO-2DKaren/FLO-2D-Rasterizor/issues). Please report any bugs that you find. + +## FLO-2D Rasterizor license + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . diff --git a/package.py b/package.py deleted file mode 100644 index dbf3ca7..0000000 --- a/package.py +++ /dev/null @@ -1,35 +0,0 @@ -# FLO-2D Preprocessor tools for QGIS -# Copyright © 2021 Lutra Consulting for FLO-2D - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version -import os -import re -import shutil -import subprocess - - -def get_plugin_version(directory): - metadata = os.path.join(directory, "metadata.txt") - reg = "\nversion=(.+)\n" - version = "" - with open(metadata, "r") as f: - match = re.search(reg, f.read()) - if match: - version = match.group(1) - return version - - -if __name__ == "__main__": - print("Creating plugin package...") - this_dir = os.path.dirname(os.path.realpath(__file__)) - plugin_dirname = "rasterizor" - plugin_path = os.path.join(this_dir, plugin_dirname) - print("Zipping plugin package...") - plugin_version = get_plugin_version(plugin_path) - zip_filename = f"{plugin_dirname}-{plugin_version}" - plugin_zip_path = os.path.join(this_dir, zip_filename) - shutil.make_archive(plugin_zip_path, "zip", this_dir, plugin_dirname) - print(f"Creating plugin package '{zip_filename}' finished.") diff --git a/rasterizor/LICENSE.md b/rasterizor/LICENSE.md new file mode 100644 index 0000000..d8cf7d4 --- /dev/null +++ b/rasterizor/LICENSE.md @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/rasterizor/Makefile b/rasterizor/Makefile deleted file mode 100644 index 82aee0c..0000000 --- a/rasterizor/Makefile +++ /dev/null @@ -1,244 +0,0 @@ -#/*************************************************************************** -# FLO-2D Rasterizor -# -# A plugin to rasterize general FLO-2D output files. -# ------------------- -# begin : 2023-04-10 -# git sha : $Format:%H$ -# copyright : (C) 2023 by Karen OBrien -# email : karen@flo-2d.com -# ***************************************************************************/ -# -#/*************************************************************************** -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU General Public License as published by * -# * the Free Software Foundation; either version 2 of the License, or * -# * (at your option) any later version. * -# * * -# ***************************************************************************/ - -################################################# -# Edit the following to match your sources lists -################################################# - - -#Add iso code for any locales you want to support here (space separated) -# default is no locales -# LOCALES = af -LOCALES = - -# If locales are enabled, set the name of the lrelease binary on your system. If -# you have trouble compiling the translations, you may have to specify the full path to -# lrelease -#LRELEASE = lrelease -#LRELEASE = lrelease-qt4 - - -# translation -SOURCES = \ - __init__.py \ - rasterizor.py rasterizor_dialog.py - -PLUGINNAME = rasterizor - -PY_FILES = \ - __init__.py \ - rasterizor.py rasterizor_dialog.py - -UI_FILES = rasterizor_dialog_base.ui - -EXTRAS = metadata.txt icon.png - -EXTRA_DIRS = - -COMPILED_RESOURCE_FILES = resources.py - -PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui - -# QGISDIR points to the location where your plugin should be installed. -# This varies by platform, relative to your HOME directory: -# * Linux: -# .local/share/QGIS/QGIS3/profiles/default/python/plugins/ -# * Mac OS X: -# Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins -# * Windows: -# AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins' - -QGISDIR=C:\Users\FLO-2D Laptop\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins - -################################################# -# Normally you would not need to edit below here -################################################# - -HELP = help/build/html - -PLUGIN_UPLOAD = $(c)/plugin_upload.py - -RESOURCE_SRC=$(shell grep '^ *@@g;s/.*>//g' | tr '\n' ' ') - -.PHONY: default -default: - @echo While you can use make to build and deploy your plugin, pb_tool - @echo is a much better solution. - @echo A Python script, pb_tool provides platform independent management of - @echo your plugins and runs anywhere. - @echo You can install pb_tool using: pip install pb_tool - @echo See https://g-sherman.github.io/plugin_build_tool/ for info. - -compile: $(COMPILED_RESOURCE_FILES) - -%.py : %.qrc $(RESOURCES_SRC) - pyrcc5 -o $*.py $< - -%.qm : %.ts - $(LRELEASE) $< - -test: compile transcompile - @echo - @echo "----------------------" - @echo "Regression Test Suite" - @echo "----------------------" - - @# Preceding dash means that make will continue in case of errors - @-export PYTHONPATH=`pwd`:$(PYTHONPATH); \ - export QGIS_DEBUG=0; \ - export QGIS_LOG_FILE=/dev/null; \ - nosetests -v --with-id --with-coverage --cover-package=. \ - 3>&1 1>&2 2>&3 3>&- || true - @echo "----------------------" - @echo "If you get a 'no module named qgis.core error, try sourcing" - @echo "the helper script we have provided first then run make test." - @echo "e.g. source run-env-linux.sh ; make test" - @echo "----------------------" - -deploy: compile doc transcompile - @echo - @echo "------------------------------------------" - @echo "Deploying plugin to your .qgis2 directory." - @echo "------------------------------------------" - # The deploy target only works on unix like operating system where - # the Python plugin directory is located at: - # $HOME/$(QGISDIR)/python/plugins - mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help - # Copy extra directories if any - (foreach EXTRA_DIR,(EXTRA_DIRS), cp -R (EXTRA_DIR) (HOME)/(QGISDIR)/python/plugins/(PLUGINNAME)/;) - - -# The dclean target removes compiled python files from plugin directory -# also deletes any .git entry -dclean: - @echo - @echo "-----------------------------------" - @echo "Removing any compiled python files." - @echo "-----------------------------------" - find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete - find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \; - - -derase: - @echo - @echo "-------------------------" - @echo "Removing deployed plugin." - @echo "-------------------------" - rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) - -zip: deploy dclean - @echo - @echo "---------------------------" - @echo "Creating plugin zip bundle." - @echo "---------------------------" - # The zip target deploys the plugin and creates a zip file with the deployed - # content. You can then upload the zip file on http://plugins.qgis.org - rm -f $(PLUGINNAME).zip - cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME) - -package: compile - # Create a zip package of the plugin named $(PLUGINNAME).zip. - # This requires use of git (your plugin development directory must be a - # git repository). - # To use, pass a valid commit or tag as follows: - # make package VERSION=Version_0.3.2 - @echo - @echo "------------------------------------" - @echo "Exporting plugin to zip package. " - @echo "------------------------------------" - rm -f $(PLUGINNAME).zip - git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION) - echo "Created package: $(PLUGINNAME).zip" - -upload: zip - @echo - @echo "-------------------------------------" - @echo "Uploading plugin to QGIS Plugin repo." - @echo "-------------------------------------" - $(PLUGIN_UPLOAD) $(PLUGINNAME).zip - -transup: - @echo - @echo "------------------------------------------------" - @echo "Updating translation files with any new strings." - @echo "------------------------------------------------" - @chmod +x scripts/update-strings.sh - @scripts/update-strings.sh $(LOCALES) - -transcompile: - @echo - @echo "----------------------------------------" - @echo "Compiled translation files to .qm files." - @echo "----------------------------------------" - @chmod +x scripts/compile-strings.sh - @scripts/compile-strings.sh $(LRELEASE) $(LOCALES) - -transclean: - @echo - @echo "------------------------------------" - @echo "Removing compiled translation files." - @echo "------------------------------------" - rm -f i18n/*.qm - -clean: - @echo - @echo "------------------------------------" - @echo "Removing uic and rcc generated files" - @echo "------------------------------------" - rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES) - -doc: - @echo - @echo "------------------------------------" - @echo "Building documentation using sphinx." - @echo "------------------------------------" - cd help; make html - -pylint: - @echo - @echo "-----------------" - @echo "Pylint violations" - @echo "-----------------" - @pylint --reports=n --rcfile=pylintrc . || true - @echo - @echo "----------------------" - @echo "If you get a 'no module named qgis.core' error, try sourcing" - @echo "the helper script we have provided first then run make pylint." - @echo "e.g. source run-env-linux.sh ; make pylint" - @echo "----------------------" - - -# Run pep8 style checking -#http://pypi.python.org/pypi/pep8 -pep8: - @echo - @echo "-----------" - @echo "PEP8 issues" - @echo "-----------" - @pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true - @echo "-----------" - @echo "Ignored in PEP8 check:" - @echo $(PEP8EXCLUDE) diff --git a/rasterizor/help/Makefile b/rasterizor/help/Makefile deleted file mode 100644 index 9def777..0000000 --- a/rasterizor/help/Makefile +++ /dev/null @@ -1,130 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - -rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/template_class.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/template_class.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/template_class" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/template_class" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - make -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." diff --git a/rasterizor/help/make.bat b/rasterizor/help/make.bat deleted file mode 100644 index 3377610..0000000 --- a/rasterizor/help/make.bat +++ /dev/null @@ -1,155 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\template_class.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\template_class.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end diff --git a/rasterizor/help/source/conf.py b/rasterizor/help/source/conf.py deleted file mode 100644 index 1e20de0..0000000 --- a/rasterizor/help/source/conf.py +++ /dev/null @@ -1,216 +0,0 @@ -# -*- coding: utf-8 -*- -# -# FLO-2DRasterizor documentation build configuration file, created by -# sphinx-quickstart on Sun Feb 12 17:11:03 2012. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.viewcode'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'FLO-2DRasterizor' -copyright = u'2013, Karen OBrien' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '0.1' -# The full version, including alpha/beta/rc tags. -release = '0.1' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = [] - -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_TemplateModuleNames = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'default' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'TemplateClassdoc' - - -# -- Options for LaTeX output -------------------------------------------------- - -# The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'FLO-2DRasterizor.tex', u'FLO-2DRasterizor Documentation', - u'Karen OBrien', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'TemplateClass', u'FLO-2DRasterizor Documentation', - [u'Karen OBrien'], 1) -] diff --git a/rasterizor/help/source/index.rst b/rasterizor/help/source/index.rst deleted file mode 100644 index d665dc0..0000000 --- a/rasterizor/help/source/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. FLO-2DRasterizor documentation master file, created by - sphinx-quickstart on Sun Feb 12 17:11:03 2012. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to FLO-2DRasterizor's documentation! -============================================ - -Contents: - -.. toctree:: - :maxdepth: 2 - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/rasterizor/i18n/af.ts b/rasterizor/i18n/af.ts deleted file mode 100644 index 615a88c..0000000 --- a/rasterizor/i18n/af.ts +++ /dev/null @@ -1,11 +0,0 @@ - - - - @default - - - Good morning - Goeie more - - - diff --git a/rasterizor/metadata.txt b/rasterizor/metadata.txt index d2206d6..01c9f55 100644 --- a/rasterizor/metadata.txt +++ b/rasterizor/metadata.txt @@ -16,11 +16,15 @@ repository=https://github.com/FLO-2DKaren/FLO-2D-Rasterizor hasProcessingProvider=no # Uncomment the following line and add your changelog: -changelog=0.4 +changelog= + 0.3.1 + - Added a new symbology for comparison + - Allowed only rasters layers for comparison - Added a CRS selector 0.3 - Added the difference between rasters - Updated style code + - Simplified the rasterizor folder 0.2 - Replace rasterio with GDAL - Pixel size calculated automatically diff --git a/rasterizor/pb_tool.cfg b/rasterizor/pb_tool.cfg deleted file mode 100644 index 90b3931..0000000 --- a/rasterizor/pb_tool.cfg +++ /dev/null @@ -1,80 +0,0 @@ -#/*************************************************************************** -# FLO-2DRasterizor -# -# Configuration file for plugin builder tool (pb_tool) -# Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ -# ------------------- -# begin : 2023-04-10 -# copyright : (C) 2023 by Karen OBrien -# email : karen@flo-2d.com -# ***************************************************************************/ -# -#/*************************************************************************** -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU General Public License as published by * -# * the Free Software Foundation; either version 2 of the License, or * -# * (at your option) any later version. * -# * * -# ***************************************************************************/ -# -# -# You can install pb_tool using: -# pip install http://geoapt.net/files/pb_tool.zip -# -# Consider doing your development (and install of pb_tool) in a virtualenv. -# -# For details on setting up and using pb_tool, see: -# http://g-sherman.github.io/plugin_build_tool/ -# -# Issues and pull requests here: -# https://github.com/g-sherman/plugin_build_tool: -# -# Sane defaults for your plugin generated by the Plugin Builder are -# already set below. -# -# As you add Python source files and UI files to your plugin, add -# them to the appropriate [files] section below. - -[plugin] -# Name of the plugin. This is the name of the directory that will -# be created in .qgis2/python/plugins -name: rasterizor - -# Full path to where you want your plugin directory copied. If empty, -# the QGIS default path will be used. Don't include the plugin name in -# the path. -plugin_path: - -[files] -# Python files that should be deployed with the plugin -python_files: __init__.py rasterizor.py rasterizor_dialog.py - -# The main dialog file that is loaded (not compiled) -main_dialog: rasterizor_dialog_base.ui - -# Other ui files for dialogs you create (these will be compiled) -compiled_ui_files: - -# Resource file(s) that will be compiled -resource_files: resources.qrc - -# Other files required for the plugin -extras: metadata.txt icon.png - -# Other directories to be deployed with the plugin. -# These must be subdirectories under the plugin directory -extra_dirs: - -# ISO code(s) for any locales (translations), separated by spaces. -# Corresponding .ts files must exist in the i18n directory -locales: - -[help] -# the built help directory that should be deployed with the plugin -dir: help/build/html -# the name of the directory to target in the deployed plugin -target: help - - - diff --git a/rasterizor/plugin_upload.py b/rasterizor/plugin_upload.py deleted file mode 100644 index a88ea2b..0000000 --- a/rasterizor/plugin_upload.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -"""This script uploads a plugin package to the plugin repository. - Authors: A. Pasotti, V. Picavet - git sha : $TemplateVCSFormat -""" - -import sys -import getpass -import xmlrpc.client -from optparse import OptionParser - -standard_library.install_aliases() - -# Configuration -PROTOCOL = 'https' -SERVER = 'plugins.qgis.org' -PORT = '443' -ENDPOINT = '/plugins/RPC2/' -VERBOSE = False - - -def main(parameters, arguments): - """Main entry point. - - :param parameters: Command line parameters. - :param arguments: Command line arguments. - """ - address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format( - protocol=PROTOCOL, - username=parameters.username, - password=parameters.password, - server=parameters.server, - port=parameters.port, - endpoint=ENDPOINT) - print("Connecting to: %s" % hide_password(address)) - - server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE) - - try: - with open(arguments[0], 'rb') as handle: - plugin_id, version_id = server.plugin.upload( - xmlrpc.client.Binary(handle.read())) - print("Plugin ID: %s" % plugin_id) - print("Version ID: %s" % version_id) - except xmlrpc.client.ProtocolError as err: - print("A protocol error occurred") - print("URL: %s" % hide_password(err.url, 0)) - print("HTTP/HTTPS headers: %s" % err.headers) - print("Error code: %d" % err.errcode) - print("Error message: %s" % err.errmsg) - except xmlrpc.client.Fault as err: - print("A fault occurred") - print("Fault code: %d" % err.faultCode) - print("Fault string: %s" % err.faultString) - - -def hide_password(url, start=6): - """Returns the http url with password part replaced with '*'. - - :param url: URL to upload the plugin to. - :type url: str - - :param start: Position of start of password. - :type start: int - """ - start_position = url.find(':', start) + 1 - end_position = url.find('@') - return "%s%s%s" % ( - url[:start_position], - '*' * (end_position - start_position), - url[end_position:]) - - -if __name__ == "__main__": - parser = OptionParser(usage="%prog [options] plugin.zip") - parser.add_option( - "-w", "--password", dest="password", - help="Password for plugin site", metavar="******") - parser.add_option( - "-u", "--username", dest="username", - help="Username of plugin site", metavar="user") - parser.add_option( - "-p", "--port", dest="port", - help="Server port to connect to", metavar="80") - parser.add_option( - "-s", "--server", dest="server", - help="Specify server name", metavar="plugins.qgis.org") - options, args = parser.parse_args() - if len(args) != 1: - print("Please specify zip file.\n") - parser.print_help() - sys.exit(1) - if not options.server: - options.server = SERVER - if not options.port: - options.port = PORT - if not options.username: - # interactive mode - username = getpass.getuser() - print("Please enter user name [%s] :" % username, end=' ') - - res = input() - if res != "": - options.username = res - else: - options.username = username - if not options.password: - # interactive mode - options.password = getpass.getpass() - main(options, args) diff --git a/rasterizor/pylintrc b/rasterizor/pylintrc deleted file mode 100644 index 7e168f6..0000000 --- a/rasterizor/pylintrc +++ /dev/null @@ -1,281 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. See also the "--disable" option for examples. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -# see http://stackoverflow.com/questions/21487025/pylint-locally-defined-disables-still-give-warnings-how-to-suppress-them -disable=locally-disabled,C0103 - - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=yes - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (RP0004). -comment=no - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - - -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct attribute names in class -# bodies -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=__.*__ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_$|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - -# List of optional constructs for which whitespace checking is disabled -no-space-check=trailing-comma,dict-separator - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branches=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/rasterizor/rasterizor.py b/rasterizor/rasterizor.py index 293d5ee..986083b 100644 --- a/rasterizor/rasterizor.py +++ b/rasterizor/rasterizor.py @@ -104,7 +104,8 @@ def __init__(self, iface): self.dlg.cancelButton.clicked.connect(self.closeDialog) self.dlg.cancelButton_2.clicked.connect(self.closeDialog) - # noinspection PyMethodMayBeStatic + self.dlg.readFile_1.setFilters(QgsMapLayerProxyModel.RasterLayer) + self.dlg.readFile_2.setFilters(QgsMapLayerProxyModel.RasterLayer) def tr(self, message): """Get the translation for a string using Qt translation API. @@ -274,7 +275,10 @@ def open(self): # Adapted function from dlg_sampling_xyz_.py def lidar_to_raster(self, lidar_file, raster_file, nodata_value=-9999): - + """ + Function to sample an ascii text file for x y z data into a numpy array and + build a raster. + """ # Open the file and read the lines self.dlg.plainTextEdit.appendPlainText("Reading data...") @@ -402,17 +406,29 @@ def setStyle(self, layer, style): elif style == 5: min = stats.minimumValue + max = stats.maximumValue range_distance = max - min zero_position = 0 - min normalized_position = zero_position / range_distance + neg1 = (-0.1 - min) / range_distance + neg5 = (-0.05 - min) / range_distance + pos5 = (0.05 - min) / range_distance + pos1 = (0.1 - min) / range_distance + color_ramp = QgsGradientColorRamp( - QColor(QColor(colDic["blue"])), - QColor(QColor(colDic["red"])), - discrete=False, stops=[ - QgsGradientStop(normalized_position, QColor(colDic["green"])), - ]) + QColor('#08306b'), + QColor('#FF0000'), + discrete=False, + stops=[ + QgsGradientStop(neg1, QColor(158, 202, 225)), + QgsGradientStop(neg5, QColor(158, 202, 225, 0)), + QgsGradientStop(normalized_position, QColor(65, 171, 93, 0)), + QgsGradientStop(pos5, QColor(255, 127, 0, 0)), + QgsGradientStop(pos1, QColor(255, 127, 0)), + ], + ) myPseudoRenderer = QgsSingleBandPseudoColorRenderer( layer.dataProvider(), layer.type(), myRasterShader diff --git a/rasterizor/rasterizor_dialog_base.ui b/rasterizor/rasterizor_dialog_base.ui index fb53931..bbc988e 100644 --- a/rasterizor/rasterizor_dialog_base.ui +++ b/rasterizor/rasterizor_dialog_base.ui @@ -6,8 +6,8 @@ 0 0 - 419 - 519 + 423 + 528 diff --git a/rasterizor/scripts/compile-strings.sh b/rasterizor/scripts/compile-strings.sh deleted file mode 100644 index 9d76083..0000000 --- a/rasterizor/scripts/compile-strings.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LRELEASE=$1 -LOCALES=$2 - - -for LOCALE in ${LOCALES} -do - echo "Processing: ${LOCALE}.ts" - # Note we don't use pylupdate with qt .pro file approach as it is flakey - # about what is made available. - $LRELEASE i18n/${LOCALE}.ts -done diff --git a/rasterizor/scripts/run-env-linux.sh b/rasterizor/scripts/run-env-linux.sh deleted file mode 100644 index 668247c..0000000 --- a/rasterizor/scripts/run-env-linux.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -QGIS_PREFIX_PATH=/usr/local/qgis-2.0 -if [ -n "$1" ]; then - QGIS_PREFIX_PATH=$1 -fi - -echo ${QGIS_PREFIX_PATH} - - -export QGIS_PREFIX_PATH=${QGIS_PREFIX_PATH} -export QGIS_PATH=${QGIS_PREFIX_PATH} -export LD_LIBRARY_PATH=${QGIS_PREFIX_PATH}/lib -export PYTHONPATH=${QGIS_PREFIX_PATH}/share/qgis/python:${QGIS_PREFIX_PATH}/share/qgis/python/plugins:${PYTHONPATH} - -echo "QGIS PATH: $QGIS_PREFIX_PATH" -export QGIS_DEBUG=0 -export QGIS_LOG_FILE=/tmp/inasafe/realtime/logs/qgis.log - -export PATH=${QGIS_PREFIX_PATH}/bin:$PATH - -echo "This script is intended to be sourced to set up your shell to" -echo "use a QGIS 2.0 built in $QGIS_PREFIX_PATH" -echo -echo "To use it do:" -echo "source $BASH_SOURCE /your/optional/install/path" -echo -echo "Then use the make file supplied here e.g. make guitest" diff --git a/rasterizor/scripts/update-strings.sh b/rasterizor/scripts/update-strings.sh deleted file mode 100644 index a31f712..0000000 --- a/rasterizor/scripts/update-strings.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -LOCALES=$* - -# Get newest .py files so we don't update strings unnecessarily - -CHANGED_FILES=0 -PYTHON_FILES=`find . -regex ".*\(ui\|py\)$" -type f` -for PYTHON_FILE in $PYTHON_FILES -do - CHANGED=$(stat -c %Y $PYTHON_FILE) - if [ ${CHANGED} -gt ${CHANGED_FILES} ] - then - CHANGED_FILES=${CHANGED} - fi -done - -# Qt translation stuff -# for .ts file -UPDATE=false -for LOCALE in ${LOCALES} -do - TRANSLATION_FILE="i18n/$LOCALE.ts" - if [ ! -f ${TRANSLATION_FILE} ] - then - # Force translation string collection as we have a new language file - touch ${TRANSLATION_FILE} - UPDATE=true - break - fi - - MODIFICATION_TIME=$(stat -c %Y ${TRANSLATION_FILE}) - if [ ${CHANGED_FILES} -gt ${MODIFICATION_TIME} ] - then - # Force translation string collection as a .py file has been updated - UPDATE=true - break - fi -done - -if [ ${UPDATE} == true ] -# retrieve all python files -then - echo ${PYTHON_FILES} - # update .ts - echo "Please provide translations by editing the translation files below:" - for LOCALE in ${LOCALES} - do - echo "i18n/"${LOCALE}".ts" - # Note we don't use pylupdate with qt .pro file approach as it is flakey - # about what is made available. - pylupdate4 -noobsolete ${PYTHON_FILES} -ts i18n/${LOCALE}.ts - done -else - echo "No need to edit any translation files (.ts) because no python files" - echo "has been updated since the last update translation. " -fi diff --git a/rasterizor/test/__init__.py b/rasterizor/test/__init__.py deleted file mode 100644 index 8feeb0b..0000000 --- a/rasterizor/test/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# import qgis libs so that ve set the correct sip api version -import qgis # pylint: disable=W0611 # NOQA \ No newline at end of file diff --git a/rasterizor/test/qgis_interface.py b/rasterizor/test/qgis_interface.py deleted file mode 100644 index a407052..0000000 --- a/rasterizor/test/qgis_interface.py +++ /dev/null @@ -1,205 +0,0 @@ -# coding=utf-8 -"""QGIS plugin implementation. - -.. note:: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -.. note:: This source code was copied from the 'postgis viewer' application - with original authors: - Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk - Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org - Copyright (c) 2014 Tim Sutton, tim@linfiniti.com - -""" - -__author__ = 'tim@linfiniti.com' -__revision__ = '$Format:%H$' -__date__ = '10/01/2011' -__copyright__ = ( - 'Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk and ' - 'Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org' - 'Copyright (c) 2014 Tim Sutton, tim@linfiniti.com' -) - -import logging -from qgis.PyQt.QtCore import QObject, pyqtSlot, pyqtSignal -from qgis.core import QgsMapLayerRegistry -from qgis.gui import QgsMapCanvasLayer -LOGGER = logging.getLogger('QGIS') - - -#noinspection PyMethodMayBeStatic,PyPep8Naming -class QgisInterface(QObject): - """Class to expose QGIS objects and functions to plugins. - - This class is here for enabling us to run unit tests only, - so most methods are simply stubs. - """ - currentLayerChanged = pyqtSignal(QgsMapCanvasLayer) - - def __init__(self, canvas): - """Constructor - :param canvas: - """ - QObject.__init__(self) - self.canvas = canvas - # Set up slots so we can mimic the behaviour of QGIS when layers - # are added. - LOGGER.debug('Initialising canvas...') - # noinspection PyArgumentList - QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers) - # noinspection PyArgumentList - QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer) - # noinspection PyArgumentList - QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers) - - # For processing module - self.destCrs = None - - @pyqtSlot('QStringList') - def addLayers(self, layers): - """Handle layers being added to the registry so they show up in canvas. - - :param layers: list list of map layers that were added - - .. note:: The QgsInterface api does not include this method, - it is added here as a helper to facilitate testing. - """ - #LOGGER.debug('addLayers called on qgis_interface') - #LOGGER.debug('Number of layers being added: %s' % len(layers)) - #LOGGER.debug('Layer Count Before: %s' % len(self.canvas.layers())) - current_layers = self.canvas.layers() - final_layers = [] - for layer in current_layers: - final_layers.append(QgsMapCanvasLayer(layer)) - for layer in layers: - final_layers.append(QgsMapCanvasLayer(layer)) - - self.canvas.setLayerSet(final_layers) - #LOGGER.debug('Layer Count After: %s' % len(self.canvas.layers())) - - @pyqtSlot('QgsMapLayer') - def addLayer(self, layer): - """Handle a layer being added to the registry so it shows up in canvas. - - :param layer: list list of map layers that were added - - .. note: The QgsInterface api does not include this method, it is added - here as a helper to facilitate testing. - - .. note: The addLayer method was deprecated in QGIS 1.8 so you should - not need this method much. - """ - pass - - @pyqtSlot() - def removeAllLayers(self): - """Remove layers from the canvas before they get deleted.""" - self.canvas.setLayerSet([]) - - def newProject(self): - """Create new project.""" - # noinspection PyArgumentList - QgsMapLayerRegistry.instance().removeAllMapLayers() - - # ---------------- API Mock for QgsInterface follows ------------------- - - def zoomFull(self): - """Zoom to the map full extent.""" - pass - - def zoomToPrevious(self): - """Zoom to previous view extent.""" - pass - - def zoomToNext(self): - """Zoom to next view extent.""" - pass - - def zoomToActiveLayer(self): - """Zoom to extent of active layer.""" - pass - - def addVectorLayer(self, path, base_name, provider_key): - """Add a vector layer. - - :param path: Path to layer. - :type path: str - - :param base_name: Base name for layer. - :type base_name: str - - :param provider_key: Provider key e.g. 'ogr' - :type provider_key: str - """ - pass - - def addRasterLayer(self, path, base_name): - """Add a raster layer given a raster layer file name - - :param path: Path to layer. - :type path: str - - :param base_name: Base name for layer. - :type base_name: str - """ - pass - - def activeLayer(self): - """Get pointer to the active layer (layer selected in the legend).""" - # noinspection PyArgumentList - layers = QgsMapLayerRegistry.instance().mapLayers() - for item in layers: - return layers[item] - - def addToolBarIcon(self, action): - """Add an icon to the plugins toolbar. - - :param action: Action to add to the toolbar. - :type action: QAction - """ - pass - - def removeToolBarIcon(self, action): - """Remove an action (icon) from the plugin toolbar. - - :param action: Action to add to the toolbar. - :type action: QAction - """ - pass - - def addToolBar(self, name): - """Add toolbar with specified name. - - :param name: Name for the toolbar. - :type name: str - """ - pass - - def mapCanvas(self): - """Return a pointer to the map canvas.""" - return self.canvas - - def mainWindow(self): - """Return a pointer to the main window. - - In case of QGIS it returns an instance of QgisApp. - """ - pass - - def addDockWidget(self, area, dock_widget): - """Add a dock widget to the main window. - - :param area: Where in the ui the dock should be placed. - :type area: - - :param dock_widget: A dock widget to add to the UI. - :type dock_widget: QDockWidget - """ - pass - - def legendInterface(self): - """Get the legend.""" - return self.canvas diff --git a/rasterizor/test/tenbytenraster.asc b/rasterizor/test/tenbytenraster.asc deleted file mode 100644 index 96a0ee1..0000000 --- a/rasterizor/test/tenbytenraster.asc +++ /dev/null @@ -1,19 +0,0 @@ -NCOLS 10 -NROWS 10 -XLLCENTER 1535380.000000 -YLLCENTER 5083260.000000 -DX 10 -DY 10 -NODATA_VALUE -9999 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -0 1 2 3 4 5 6 7 8 9 -CRS -NOTES diff --git a/rasterizor/test/tenbytenraster.asc.aux.xml b/rasterizor/test/tenbytenraster.asc.aux.xml deleted file mode 100644 index cfb1578..0000000 --- a/rasterizor/test/tenbytenraster.asc.aux.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Point - - - - 9 - 4.5 - 0 - 2.872281323269 - - - diff --git a/rasterizor/test/tenbytenraster.keywords b/rasterizor/test/tenbytenraster.keywords deleted file mode 100644 index 8be3f61..0000000 --- a/rasterizor/test/tenbytenraster.keywords +++ /dev/null @@ -1 +0,0 @@ -title: Tenbytenraster diff --git a/rasterizor/test/tenbytenraster.lic b/rasterizor/test/tenbytenraster.lic deleted file mode 100644 index 8345533..0000000 --- a/rasterizor/test/tenbytenraster.lic +++ /dev/null @@ -1,18 +0,0 @@ - - - - Tim Sutton, Linfiniti Consulting CC - - - - tenbytenraster.asc - 2700044251 - Yes - Tim Sutton - Tim Sutton (QGIS Source Tree) - Tim Sutton - This data is publicly available from QGIS Source Tree. The original - file was created and contributed to QGIS by Tim Sutton. - - - diff --git a/rasterizor/test/tenbytenraster.prj b/rasterizor/test/tenbytenraster.prj deleted file mode 100644 index a30c00a..0000000 --- a/rasterizor/test/tenbytenraster.prj +++ /dev/null @@ -1 +0,0 @@ -GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/rasterizor/test/tenbytenraster.qml b/rasterizor/test/tenbytenraster.qml deleted file mode 100644 index 85247d4..0000000 --- a/rasterizor/test/tenbytenraster.qml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 0 - diff --git a/rasterizor/test/test_init.py b/rasterizor/test/test_init.py deleted file mode 100644 index a11ca44..0000000 --- a/rasterizor/test/test_init.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -"""Tests QGIS plugin init.""" - -__author__ = 'Tim Sutton ' -__revision__ = '$Format:%H$' -__date__ = '17/10/2010' -__license__ = "GPL" -__copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' -__copyright__ += 'Disaster Reduction' - -import os -import unittest -import logging -import configparser - -LOGGER = logging.getLogger('QGIS') - - -class TestInit(unittest.TestCase): - """Test that the plugin init is usable for QGIS. - - Based heavily on the validator class by Alessandro - Passoti available here: - - http://github.com/qgis/qgis-django/blob/master/qgis-app/ - plugins/validator.py - - """ - - def test_read_init(self): - """Test that the plugin __init__ will validate on plugins.qgis.org.""" - - # You should update this list according to the latest in - # https://github.com/qgis/qgis-django/blob/master/qgis-app/ - # plugins/validator.py - - required_metadata = [ - 'name', - 'description', - 'version', - 'qgisMinimumVersion', - 'email', - 'author'] - - file_path = os.path.abspath(os.path.join( - os.path.dirname(__file__), os.pardir, - 'metadata.txt')) - LOGGER.info(file_path) - metadata = [] - parser = configparser.ConfigParser() - parser.optionxform = str - parser.read(file_path) - message = 'Cannot find a section named "general" in %s' % file_path - assert parser.has_section('general'), message - metadata.extend(parser.items('general')) - - for expectation in required_metadata: - message = ('Cannot find metadata "%s" in metadata source (%s).' % ( - expectation, file_path)) - - self.assertIn(expectation, dict(metadata), message) - -if __name__ == '__main__': - unittest.main() diff --git a/rasterizor/test/test_qgis_environment.py b/rasterizor/test/test_qgis_environment.py deleted file mode 100644 index 1becb30..0000000 --- a/rasterizor/test/test_qgis_environment.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -"""Tests for QGIS functionality. - - -.. note:: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -""" -__author__ = 'tim@linfiniti.com' -__date__ = '20/01/2011' -__copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' - 'Disaster Reduction') - -import os -import unittest -from qgis.core import ( - QgsProviderRegistry, - QgsCoordinateReferenceSystem, - QgsRasterLayer) - -from .utilities import get_qgis_app -QGIS_APP = get_qgis_app() - - -class QGISTest(unittest.TestCase): - """Test the QGIS Environment""" - - def test_qgis_environment(self): - """QGIS environment has the expected providers""" - - r = QgsProviderRegistry.instance() - self.assertIn('gdal', r.providerList()) - self.assertIn('ogr', r.providerList()) - self.assertIn('postgres', r.providerList()) - - def test_projection(self): - """Test that QGIS properly parses a wkt string. - """ - crs = QgsCoordinateReferenceSystem() - wkt = ( - 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",' - 'SPHEROID["WGS_1984",6378137.0,298.257223563]],' - 'PRIMEM["Greenwich",0.0],UNIT["Degree",' - '0.0174532925199433]]') - crs.createFromWkt(wkt) - auth_id = crs.authid() - expected_auth_id = 'EPSG:4326' - self.assertEqual(auth_id, expected_auth_id) - - # now test for a loaded layer - path = os.path.join(os.path.dirname(__file__), 'tenbytenraster.asc') - title = 'TestRaster' - layer = QgsRasterLayer(path, title) - auth_id = layer.crs().authid() - self.assertEqual(auth_id, expected_auth_id) - -if __name__ == '__main__': - unittest.main() diff --git a/rasterizor/test/test_rasterizor_dialog.py b/rasterizor/test/test_rasterizor_dialog.py deleted file mode 100644 index 550381a..0000000 --- a/rasterizor/test/test_rasterizor_dialog.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -"""Dialog test. - -.. note:: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -""" - -__author__ = 'karen@flo-2d.com' -__date__ = '2023-04-10' -__copyright__ = 'Copyright 2023, Karen OBrien' - -import unittest - -from qgis.PyQt.QtGui import QDialogButtonBox, QDialog - -from rasterizor_dialog import FLO-2DRasterizorDialog - -from utilities import get_qgis_app -QGIS_APP = get_qgis_app() - - -class FLO-2DRasterizorDialogTest(unittest.TestCase): - """Test dialog works.""" - - def setUp(self): - """Runs before each test.""" - self.dialog = FLO-2DRasterizorDialog(None) - - def tearDown(self): - """Runs after each test.""" - self.dialog = None - - def test_dialog_ok(self): - """Test we can click OK.""" - - button = self.dialog.button_box.button(QDialogButtonBox.Ok) - button.click() - result = self.dialog.result() - self.assertEqual(result, QDialog.Accepted) - - def test_dialog_cancel(self): - """Test we can click cancel.""" - button = self.dialog.button_box.button(QDialogButtonBox.Cancel) - button.click() - result = self.dialog.result() - self.assertEqual(result, QDialog.Rejected) - -if __name__ == "__main__": - suite = unittest.makeSuite(FLO-2DRasterizorDialogTest) - runner = unittest.TextTestRunner(verbosity=2) - runner.run(suite) - diff --git a/rasterizor/test/test_resources.py b/rasterizor/test/test_resources.py deleted file mode 100644 index 417c393..0000000 --- a/rasterizor/test/test_resources.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -"""Resources test. - -.. note:: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -""" - -__author__ = 'karen@flo-2d.com' -__date__ = '2023-04-10' -__copyright__ = 'Copyright 2023, Karen OBrien' - -import unittest - -from qgis.PyQt.QtGui import QIcon - - - -class FLO-2DRasterizorDialogTest(unittest.TestCase): - """Test rerources work.""" - - def setUp(self): - """Runs before each test.""" - pass - - def tearDown(self): - """Runs after each test.""" - pass - - def test_icon_png(self): - """Test we can click OK.""" - path = ':/plugins/FLO-2DRasterizor/icon.png' - icon = QIcon(path) - self.assertFalse(icon.isNull()) - -if __name__ == "__main__": - suite = unittest.makeSuite(FLO-2DRasterizorResourcesTest) - runner = unittest.TextTestRunner(verbosity=2) - runner.run(suite) - - - diff --git a/rasterizor/test/test_translations.py b/rasterizor/test/test_translations.py deleted file mode 100644 index 035dc62..0000000 --- a/rasterizor/test/test_translations.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -"""Safe Translations Test. - -.. note:: This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - -""" -from .utilities import get_qgis_app - -__author__ = 'ismailsunni@yahoo.co.id' -__date__ = '12/10/2011' -__copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' - 'Disaster Reduction') -import unittest -import os - -from qgis.PyQt.QtCore import QCoreApplication, QTranslator - -QGIS_APP = get_qgis_app() - - -class SafeTranslationsTest(unittest.TestCase): - """Test translations work.""" - - def setUp(self): - """Runs before each test.""" - if 'LANG' in iter(os.environ.keys()): - os.environ.__delitem__('LANG') - - def tearDown(self): - """Runs after each test.""" - if 'LANG' in iter(os.environ.keys()): - os.environ.__delitem__('LANG') - - def test_qgis_translations(self): - """Test that translations work.""" - parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir) - dir_path = os.path.abspath(parent_path) - file_path = os.path.join( - dir_path, 'i18n', 'af.qm') - translator = QTranslator() - translator.load(file_path) - QCoreApplication.installTranslator(translator) - - expected_message = 'Goeie more' - real_message = QCoreApplication.translate("@default", 'Good morning') - self.assertEqual(real_message, expected_message) - - -if __name__ == "__main__": - suite = unittest.makeSuite(SafeTranslationsTest) - runner = unittest.TextTestRunner(verbosity=2) - runner.run(suite) diff --git a/rasterizor/test/utilities.py b/rasterizor/test/utilities.py deleted file mode 100644 index be7ee3b..0000000 --- a/rasterizor/test/utilities.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -"""Common functionality used by regression tests.""" - -import sys -import logging - - -LOGGER = logging.getLogger('QGIS') -QGIS_APP = None # Static variable used to hold hand to running QGIS app -CANVAS = None -PARENT = None -IFACE = None - - -def get_qgis_app(): - """ Start one QGIS application to test against. - - :returns: Handle to QGIS app, canvas, iface and parent. If there are any - errors the tuple members will be returned as None. - :rtype: (QgsApplication, CANVAS, IFACE, PARENT) - - If QGIS is already running the handle to that app will be returned. - """ - - try: - from qgis.PyQt import QtGui, QtCore - from qgis.core import QgsApplication - from qgis.gui import QgsMapCanvas - from .qgis_interface import QgisInterface - except ImportError: - return None, None, None, None - - global QGIS_APP # pylint: disable=W0603 - - if QGIS_APP is None: - gui_flag = True # All test will run qgis in gui mode - #noinspection PyPep8Naming - QGIS_APP = QgsApplication(sys.argv, gui_flag) - # Make sure QGIS_PREFIX_PATH is set in your env if needed! - QGIS_APP.initQgis() - s = QGIS_APP.showSettings() - LOGGER.debug(s) - - global PARENT # pylint: disable=W0603 - if PARENT is None: - #noinspection PyPep8Naming - PARENT = QtGui.QWidget() - - global CANVAS # pylint: disable=W0603 - if CANVAS is None: - #noinspection PyPep8Naming - CANVAS = QgsMapCanvas(PARENT) - CANVAS.resize(QtCore.QSize(400, 400)) - - global IFACE # pylint: disable=W0603 - if IFACE is None: - # QgisInterface is a stub implementation of the QGIS plugin interface - #noinspection PyPep8Naming - IFACE = QgisInterface(CANVAS) - - return QGIS_APP, CANVAS, IFACE, PARENT