From 69159cfe1d8c24be516ebe4fab3e7bdd320285b1 Mon Sep 17 00:00:00 2001 From: "Thomas Baumann @work" Date: Thu, 14 Jun 2018 11:23:33 +0200 Subject: [PATCH 1/3] fix for issue #2 https://github.com/geo-data/qgis-quick-draw/issues/2 --- plugin/quickdraw.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugin/quickdraw.py b/plugin/quickdraw.py index 6eeff84..182b47f 100644 --- a/plugin/quickdraw.py +++ b/plugin/quickdraw.py @@ -90,7 +90,8 @@ def initGui(self): self.iface.addPluginToMenu(u"&Quick Draw", self.action) QObject.connect(self.dlg.clearButton, SIGNAL("clicked()"), self.clearButtonClicked) - self.dlg.buttonBox.clicked.connect(self.buttonBoxClicked) + self.dlg.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.buttonBoxReset) + self.dlg.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(self.buttonBoxApply) self.dlg.exampleComboBox.activated.connect(self.exampleSelected) def unload(self): @@ -99,13 +100,12 @@ def unload(self): self.iface.removeToolBarIcon(self.action) self.removeItems() - def buttonBoxClicked(self, button): - button_text = str(button.text()) - if button_text == 'Apply': - self.draw() - self.applied = True - elif button_text == 'Reset': - self.resetText() + def buttonBoxReset(self, button): + self.resetText() + + def buttonBoxApply(self, button): + self.draw() + self.applied = True def clearButtonClicked(self): self.dlg.geometryTextEdit.setPlainText('') From 1a86c2c5790c640e1c9420119754e050833ccea7 Mon Sep 17 00:00:00 2001 From: Baumann Thomas Date: Mon, 18 Feb 2019 09:59:52 +0100 Subject: [PATCH 2/3] updated for qgis3 --- plugin/__init__.py | 3 +- plugin/metadata.txt | 4 +-- plugin/quickdraw.py | 60 +++++++++++++++++++++++++------------- plugin/quickdrawdialog.py | 9 +++--- plugin/resources_rc.pyc | Bin 0 -> 2001 bytes 5 files changed, 48 insertions(+), 28 deletions(-) create mode 100644 plugin/resources_rc.pyc diff --git a/plugin/__init__.py b/plugin/__init__.py index ca9a72a..26a9c8b 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -20,8 +20,9 @@ ***************************************************************************/ This script initializes the plugin, making it known to QGIS. """ +from __future__ import absolute_import def classFactory(iface): # load QuickDraw class from file QuickDraw - from quickdraw import QuickDraw + from .quickdraw import QuickDraw return QuickDraw(iface) diff --git a/plugin/metadata.txt b/plugin/metadata.txt index a531356..48d5e64 100644 --- a/plugin/metadata.txt +++ b/plugin/metadata.txt @@ -10,7 +10,7 @@ [general] name=Quick Draw -qgisMinimumVersion=2.0 +qgisMinimumVersion=3.0 description=Input simple geometries as text coordinates and display them on the map canvas. version=0.4 author=Homme Zwaagstra @@ -27,7 +27,7 @@ email=hrz@geodata.soton.ac.uk category=Vector # tags are comma separated with spaces allowed -tags=geometry,geometries,point,polygon,polyline,bbox,bounding box,draw,canvas,digitizing,digitising +tags=geometry,geometries,point,polygon,polyline,bbox,bounding box,draw,canvas homepage=http://www.github.com/geo-data/qgis-quick-draw tracker=http://www.github.com/geo-data/qgis-quick-draw/issues diff --git a/plugin/quickdraw.py b/plugin/quickdraw.py index 182b47f..0b8f19a 100644 --- a/plugin/quickdraw.py +++ b/plugin/quickdraw.py @@ -19,24 +19,31 @@ * * ***************************************************************************/ """ +from __future__ import absolute_import # Import the PyQt and QGIS libraries -from PyQt4.QtCore import * -from PyQt4.QtGui import * -from qgis.core import * -from qgis.gui import * +from builtins import zip +from builtins import str +from builtins import range +from builtins import object +from qgis.PyQt.QtCore import QSettings, QObject +from qgis.PyQt.QtWidgets import QAction, QDialogButtonBox, QMessageBox +from qgis.PyQt.QtGui import QIcon, QColor +from qgis.core import QgsPointXY, QgsGeometry, QgsRectangle +from qgis.gui import QgsVertexMarker, QgsRubberBand # Initialize Qt resources from file resources.py -import resources_rc +from . import resources_rc # Import the code for the dialog -from quickdrawdialog import QuickDrawDialog +from .quickdrawdialog import QuickDrawDialog import os.path from random import uniform -from itertools import izip + class QuickDrawError(Exception): def __init__(self, message, title): super(QuickDrawError, self).__init__(message) self.title = title + self.message=message class InvalidGeometry(QuickDrawError): def __init__(self, geom): @@ -47,7 +54,7 @@ def __init__(self, geom): super(InvalidGeometry, self).__init__("The geometry formatting is wrong: %s" % msg, 'Invalid Geometry') self.geom = geom -class QuickDraw: +class QuickDraw(object): def __init__(self, iface): # Save reference to the QGIS interface @@ -89,9 +96,11 @@ def initGui(self): self.iface.addToolBarIcon(self.action) self.iface.addPluginToMenu(u"&Quick Draw", self.action) - QObject.connect(self.dlg.clearButton, SIGNAL("clicked()"), self.clearButtonClicked) + self.dlg.clearButton.clicked.connect(self.clearButtonClicked) + # self.dlg.buttonBox.clicked.connect(self.buttonBoxClicked) self.dlg.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.buttonBoxReset) self.dlg.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(self.buttonBoxApply) + self.dlg.exampleComboBox.activated.connect(self.exampleSelected) def unload(self): @@ -99,13 +108,21 @@ def unload(self): self.iface.removePluginMenu(u"&Quick Draw", self.action) self.iface.removeToolBarIcon(self.action) self.removeItems() - + def buttonBoxReset(self, button): self.resetText() - + def buttonBoxApply(self, button): self.draw() self.applied = True + + # def buttonBoxClicked(self, button): + # button_text = str(button.text()) + # if button_text == 'Apply': + # self.draw() + # self.applied = True + # elif button_text == 'Reset': + # self.resetText() def clearButtonClicked(self): self.dlg.geometryTextEdit.setPlainText('') @@ -132,7 +149,7 @@ def exampleSelected(self, index): for i in range(3): x.append(uniform(minx, maxx)) y.append(uniform(miny, maxy)) - text = ','.join(('%s,%s' % t for t in izip(sorted(x), y))) + text = ','.join(('%s,%s' % t for t in zip(sorted(x), y))) else: # polygon x, y = [], [] for i in range(4): @@ -141,8 +158,7 @@ def exampleSelected(self, index): x.sort() x.append(x[0]) y.append(y[0]) - text = ','.join(('%s,%s' % t for t in izip(x, y))) - + text = ','.join(('%s,%s' % t for t in zip(x, y))) self.dlg.geometryTextEdit.appendPlainText(text) def draw(self, checkZoom = True): @@ -157,7 +173,7 @@ def draw(self, checkZoom = True): r = self.geometryToCanvas(geom) r.show() drawStack.append(r) - except QuickDrawError, e: + except QuickDrawError as e: message = e.message + "\n\nUse the QGIS \"What's This?\" help tool to click on the text input box for information on how to correctly format geometries." QMessageBox.warning(self.dlg, e.title, message) self.removeItems(drawStack) # remove added items @@ -216,10 +232,10 @@ def getBBOX(item): for item in self.drawStack[1:]: bbox = getBBOX(item) extent.combineExtentWith(bbox) - if extent: canvas.setExtent(extent) - canvas.updateFullExtent() + #canvas.refresh() + #canvas.updateFullExtent() def removeItems(self, drawStack = None): if drawStack is None: @@ -264,7 +280,7 @@ def toCoords(text): return toCoords(text) def coordsToPoints(self, coords): - return [QgsPoint(*coord) for coord in coords] + return [QgsPointXY(*coord) for coord in coords] def textToGeometry(self, text): coords = self.textToCoords(text) @@ -275,12 +291,14 @@ def textToGeometry(self, text): return points[0] elif coord_count > 2 and coords[0] == coords[-1]: # it's a polygon - return QgsGeometry.fromPolygon([points]) + return QgsGeometry.fromPolygonXY([points]) - return QgsGeometry.fromPolyline(points) + #return QgsGeometry.fromPolyline(points) + # fromPolyline() now requires a list of QgsPoint objects, instead of QgsPointXY 2d points. A new method fromPolylineXY was added which uses the old list of 2d QgsPointXY objects. Using the newer method + return QgsGeometry.fromPolylineXY(points) def geometryToCanvas(self, geom): - if isinstance(geom, QgsPoint): + if isinstance(geom, QgsPointXY): r = self.pointToVertexMarker(geom) else: r = self.geometryToRubberBand(geom) diff --git a/plugin/quickdrawdialog.py b/plugin/quickdrawdialog.py index 2ace1f5..8781387 100644 --- a/plugin/quickdrawdialog.py +++ b/plugin/quickdrawdialog.py @@ -20,14 +20,15 @@ ***************************************************************************/ """ -from PyQt4 import QtCore, QtGui -from ui_quickdraw import Ui_QuickDraw +from qgis.PyQt import QtCore, QtGui +from .ui_quickdraw import Ui_QuickDraw +from qgis.PyQt.QtWidgets import QDialog # create the dialog for zoom to point -class QuickDrawDialog(QtGui.QDialog, Ui_QuickDraw): +class QuickDrawDialog(QDialog, Ui_QuickDraw): def __init__(self): - QtGui.QDialog.__init__(self) + QDialog.__init__(self) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self., and you can use autoconnect slots - see diff --git a/plugin/resources_rc.pyc b/plugin/resources_rc.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c8711209df8f194b1fd5122594b4d4ed428fda29 GIT binary patch literal 2001 zcmcgteNYoe6yFe%040K75KtgEb{bF!fjA(76cRAeijbfKOh!18GaM#&$KA#Vtus_? z#jgrFDn-;%VLElDTA@^{!Z?1R7O(?S=@&)n_|Z|&g0)zM?ncy3+dtdxWZ&+4@3;GY z?=Ja8I4t!l?WxHzgNfmW*4NSGlaR5Xj{w*JunR!000=B@AlD68gdkT4EbbuJ9auzQ z0|2=qU=h1EVnB*OIY3YeFe*II9n?4)3IW+wEGMshqU_u}Q$uKC3f;JLZ$W>GUN7-xyWH`Bvu`>E~)pmsO!I)$R zEMz!P02v2I6D2Fh2jWp`7EWnN-po-fq!=0$k^~3kP6`&v3Av537DAe$t-pdPDufQj zXbnda7%I=A>?DYeQpH3>MMp%%Wkspu=S9cQi=FzTx&?tVG1!QznMqIxAseq$GAv1( zZ4`@2;1-k?5)zb6sftz4kBUX!pZG^${t*Qw5zh%nJVPlyNq!Gqu6HqE*b)v?1R0J3 z8)cSj89PDI@`-9@7tuAOnX%g$ns-%1D3az$Udg&nSX>8`IcLW%1K<{+*CuD_HZ^xG z({&Rw+a5g17A3ojlGiUI}P=2FX-m z-`@<6Nu7MQF==s=Hs+0{h8-U)>3aGY`kKey@BCu_(9?%EOZFepSBw|`@~HZApKUu% zh4uwj$mYy#jtUdj>wd~k_IQZS^xmr{I-F>rLkL$jv-WkToS_jIc z?YqJ(BR_nYl=V(RK-`%J(?wp}3#g8RkvCGR?pM26cVrJ8<=55M7AMwRXjyaF@64Vc zh5q_TTfvjkcW-FY<{i4Ub?c&_i^m!pTER7K(7QF2ft8tCiW>de_ITed>+y-K>K^)O zV_#@!iljoG&D$Q(*_qHHdo3>HUTK%l_)hzw`oY3EGM)lCj3z^2wd+p`3&%H9{|7nQ)VNv+W0qK?Yyw<&;%Wm&UyMn%r zK%bhfJ)Dxi9;RSVB3aPi1X!dp4qycopaBm&ed_eLKrxC?zzkL+9pV51oWR42$o2-+4y>whAR>m}G3i^E1P#ASJJWPDS_K4OX3%~R+p`~%eFeIx(? literal 0 HcmV?d00001 From e4f2e22c0f23a7c7ceae33d3b09650de55733d60 Mon Sep 17 00:00:00 2001 From: Baumann Thomas Date: Mon, 18 Feb 2019 10:08:12 +0100 Subject: [PATCH 3/3] added previously ignored files --- .gitignore | 2 - plugin/resources_rc.py | 127 +++++++++++++++++++++++++++++++++++++++++ plugin/ui_quickdraw.py | 85 +++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 plugin/resources_rc.py create mode 100644 plugin/ui_quickdraw.py diff --git a/.gitignore b/.gitignore index 704b55e..a264cd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -plugin/resources_rc.py -plugin/ui_quickdraw.py plugin/quickdraw.zip diff --git a/plugin/resources_rc.py b/plugin/resources_rc.py new file mode 100644 index 0000000..7e3fb26 --- /dev/null +++ b/plugin/resources_rc.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created by: The Resource Compiler for PyQt5 (Qt v5.11.2) +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore + +qt_resource_data = b"\ +\x00\x00\x03\xfc\ +\x89\ +\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ +\x00\x00\x18\x00\x00\x00\x18\x08\x06\x00\x00\x00\xe0\x77\x3d\xf8\ +\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\ +\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x00\xfd\x00\x00\x00\xfd\ +\x01\xe2\x7b\x83\x93\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\ +\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\ +\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x00\x18\x74\x45\ +\x58\x74\x54\x69\x74\x6c\x65\x00\x64\x65\x66\x69\x62\x72\x69\x6c\ +\x6c\x61\x74\x6f\x72\x20\x6c\x6f\x67\x6f\x49\x7d\x98\x6d\x00\x00\ +\x00\x0f\x74\x45\x58\x74\x41\x75\x74\x68\x6f\x72\x00\x62\x74\x6f\ +\x75\x72\x6e\x61\x79\x5e\xff\xe2\x3a\x00\x00\x00\x22\x74\x45\x58\ +\x74\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x00\x68\x65\x61\ +\x72\x74\x20\x77\x69\x74\x68\x20\x61\x20\x6c\x69\x67\x68\x74\x6e\ +\x69\x6e\x67\xf6\x00\x12\x31\x00\x00\x00\x21\x74\x45\x58\x74\x43\ +\x72\x65\x61\x74\x69\x6f\x6e\x20\x54\x69\x6d\x65\x00\x32\x30\x31\ +\x33\x2d\x30\x32\x2d\x30\x38\x54\x30\x34\x3a\x35\x32\x3a\x35\x37\ +\x13\xdf\x34\xbd\x00\x00\x00\x51\x74\x45\x58\x74\x53\x6f\x75\x72\ +\x63\x65\x00\x68\x74\x74\x70\x3a\x2f\x2f\x6f\x70\x65\x6e\x63\x6c\ +\x69\x70\x61\x72\x74\x2e\x6f\x72\x67\x2f\x64\x65\x74\x61\x69\x6c\ +\x2f\x31\x37\x34\x39\x30\x37\x2f\x64\x65\x66\x69\x62\x72\x69\x6c\ +\x6c\x61\x74\x6f\x72\x2d\x6c\x6f\x67\x6f\x2d\x62\x79\x2d\x62\x74\ +\x6f\x75\x72\x6e\x61\x79\x2d\x31\x37\x34\x39\x30\x37\x28\xad\x41\ +\x8e\x00\x00\x00\x49\x74\x45\x58\x74\x43\x6f\x70\x79\x72\x69\x67\ +\x68\x74\x00\x50\x75\x62\x6c\x69\x63\x20\x44\x6f\x6d\x61\x69\x6e\ +\x20\x68\x74\x74\x70\x3a\x2f\x2f\x63\x72\x65\x61\x74\x69\x76\x65\ +\x63\x6f\x6d\x6d\x6f\x6e\x73\x2e\x6f\x72\x67\x2f\x6c\x69\x63\x65\ +\x6e\x73\x65\x73\x2f\x70\x75\x62\x6c\x69\x63\x64\x6f\x6d\x61\x69\ +\x6e\x2f\x59\xc3\xfe\xca\x00\x00\x02\x2d\x49\x44\x41\x54\x48\x89\ +\xb5\xd2\x4f\x48\xd3\x61\x1c\xc7\xf1\xf7\x58\x05\x41\x04\x05\x41\ +\x82\x47\x3b\x44\x78\x88\x0e\x0d\x8a\xe8\xd0\x1f\xaa\x75\x28\x5a\ +\x14\x9d\x44\x0c\x22\x74\x1e\xd2\x20\x3d\x18\x46\x48\x60\x44\x48\ +\x52\x96\x4d\x1d\x18\x31\x29\xdc\xe6\x2a\x33\x45\x11\xc3\xb2\x3f\ +\x4a\xb3\x44\x33\x4c\xb3\xa5\x92\xa0\x4b\xd2\xfd\xfa\x74\x10\x63\ +\xfe\x99\xce\xb9\x9e\xef\xfd\xf5\xe6\x79\x9e\xaf\x49\x88\xff\x71\ +\xf2\xf7\x98\xb6\x0f\x8d\x92\xbc\x2a\xde\xf0\xc9\x44\xd3\xda\x53\ +\x56\x72\x37\x06\x48\xe8\x68\x24\x0d\xc5\x71\xee\x9c\xc0\xfa\xbe\ +\x80\xb7\x9e\x74\xee\xdb\xc0\x2c\x44\x5c\xe0\xec\x9d\x24\xbe\xb8\ +\x48\xd9\x98\x93\x29\x6f\x18\xbe\xe2\x80\x0d\xcc\x95\x29\x64\xf4\ +\xdd\xa2\x3f\x54\x85\x3c\x19\x38\xc2\xf1\x15\x05\x0a\x8f\x62\x69\ +\xcd\xa3\x2e\xe4\x42\x91\xf0\x98\x02\x67\x92\x58\xef\xb1\x73\x7d\ +\xa4\x9c\x71\x3d\x9a\xc6\xbd\x76\xca\x16\xc2\x97\x1d\x28\x49\xe1\ +\xf4\xc7\x62\xfc\x7a\x86\xe4\x43\x46\x35\xaa\xc9\x8c\x8c\x47\x1d\ +\xc8\xb7\xb2\xa5\xbe\x00\xd7\x44\x1d\x86\x9a\x90\x1a\x90\x51\x8b\ +\x6a\xb2\x16\xc7\x97\x0c\xec\x80\xd5\x0f\x2e\x91\xd3\xef\xe3\x87\ +\xde\x21\xb5\x21\xb5\x22\xa3\x19\xf9\x72\x29\x5f\x0a\x5f\x34\x70\ +\x33\x8d\x7d\xaf\x2b\x69\x31\xba\x90\x3e\x21\xf9\x91\x3a\x90\xf1\ +\x06\x79\xf3\xa9\x88\x06\x8f\x18\xc8\x3e\xc2\x56\xff\x53\x06\x34\ +\x80\xd4\x87\xd4\x8b\xd4\x3d\x1d\xea\x75\x13\xb8\x72\x1c\x4b\xb4\ +\xff\x16\xf9\x06\xe9\x58\xba\x1a\xf0\x2b\x80\xf4\x0d\xe9\x2b\xd2\ +\x17\xa4\x1e\xf4\xbd\x91\x11\xe7\x05\x32\x01\x53\xcc\x01\x21\xb2\ +\x0f\x91\xd8\xe2\xe2\xf9\x9f\x21\x34\x37\xf4\xbb\x13\xd5\xde\xc0\ +\x95\x75\x98\xcd\x31\x07\x84\xd8\xbb\x89\x75\x2f\x1f\xd3\xae\x9f\ +\x48\xc3\xb3\x43\x83\xcd\x0c\x95\xd8\xc9\x88\x39\x60\x03\xb3\xfb\ +\x1e\xa5\xa1\x20\xd2\x2f\xa4\x31\xa4\x51\x34\xde\xcb\x64\xbd\x83\ +\x8a\x3c\x1b\x49\x31\x3f\x91\x0d\xcc\xee\x52\x4a\x43\x53\x48\x42\ +\x0a\xa1\x50\x10\xb5\x3d\xa1\xb1\xc8\xce\xfe\xa5\xe0\x45\x03\xf3\ +\x70\xa1\xee\x0e\x7a\x9c\xd7\x38\x1f\xed\x7a\x46\x0c\xcc\xc5\x87\ +\x07\x19\xf5\x96\x51\x78\x6e\x37\x1b\x96\x03\x2f\x18\x08\xc7\x27\ +\x82\x18\x4d\xd5\x54\x15\x9c\x25\x39\x16\x78\x5e\x60\x06\x9f\x9a\ +\x44\xed\xcd\xbc\x2a\xce\xe1\xd8\x4a\xe0\x59\x81\x19\xfc\xf3\x07\ +\x06\x1e\x16\x91\xb5\x0d\xd6\xc4\x03\x17\x02\x1b\x98\xef\x5e\xc6\ +\x51\x53\xce\xed\xcc\x83\x24\xc4\x0b\xfe\x17\xb0\x1f\x20\xf5\x6a\ +\x2a\xbb\xe2\x0d\xcf\xcc\x5f\xbe\x9b\x21\x4f\xe8\x97\x46\xcf\x00\ +\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\ +" + +qt_resource_name = b"\ +\x00\x07\ +\x07\x3b\xe0\xb3\ +\x00\x70\ +\x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\ +\x00\x09\ +\x0f\xa1\x49\xe7\ +\x00\x71\ +\x00\x75\x00\x69\x00\x63\x00\x6b\x00\x64\x00\x72\x00\x61\x00\x77\ +\x00\x08\ +\x0a\x61\x5a\xa7\ +\x00\x69\ +\x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\ +" + +qt_resource_struct_v1 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ +\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ +\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +" + +qt_resource_struct_v2 = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x5e\x04\xd1\xe4\x90\ +" + +qt_version = [int(v) for v in QtCore.qVersion().split('.')] +if qt_version < [5, 8, 0]: + rcc_version = 1 + qt_resource_struct = qt_resource_struct_v1 +else: + rcc_version = 2 + qt_resource_struct = qt_resource_struct_v2 + +def qInitResources(): + QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/plugin/ui_quickdraw.py b/plugin/ui_quickdraw.py new file mode 100644 index 0000000..d6d5c42 --- /dev/null +++ b/plugin/ui_quickdraw.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'ui_quickdraw.ui' +# +# Created by: PyQt5 UI code generator 5.11.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_QuickDraw(object): + def setupUi(self, QuickDraw): + QuickDraw.setObjectName("QuickDraw") + QuickDraw.resize(399, 275) + self.gridLayout = QtWidgets.QGridLayout(QuickDraw) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label = QtWidgets.QLabel(QuickDraw) + self.label.setObjectName("label") + self.horizontalLayout_2.addWidget(self.label) + self.exampleComboBox = QtWidgets.QComboBox(QuickDraw) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.exampleComboBox.sizePolicy().hasHeightForWidth()) + self.exampleComboBox.setSizePolicy(sizePolicy) + self.exampleComboBox.setLayoutDirection(QtCore.Qt.LeftToRight) + self.exampleComboBox.setObjectName("exampleComboBox") + self.exampleComboBox.addItem("") + self.exampleComboBox.addItem("") + self.exampleComboBox.addItem("") + self.exampleComboBox.addItem("") + self.horizontalLayout_2.addWidget(self.exampleComboBox) + self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 2, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(QuickDraw) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Reset) + self.buttonBox.setCenterButtons(False) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 13, 0, 1, 1) + self.geometryTextEdit = QtWidgets.QPlainTextEdit(QuickDraw) + self.geometryTextEdit.setEnabled(True) + self.geometryTextEdit.setStatusTip("") + self.geometryTextEdit.setPlainText("") + self.geometryTextEdit.setObjectName("geometryTextEdit") + self.gridLayout.addWidget(self.geometryTextEdit, 9, 0, 1, 1) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.clearButton = QtWidgets.QPushButton(QuickDraw) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.clearButton.sizePolicy().hasHeightForWidth()) + self.clearButton.setSizePolicy(sizePolicy) + self.clearButton.setObjectName("clearButton") + self.horizontalLayout.addWidget(self.clearButton) + self.zoomCheckBox = QtWidgets.QCheckBox(QuickDraw) + self.zoomCheckBox.setLayoutDirection(QtCore.Qt.RightToLeft) + self.zoomCheckBox.setChecked(True) + self.zoomCheckBox.setObjectName("zoomCheckBox") + self.horizontalLayout.addWidget(self.zoomCheckBox) + self.gridLayout.addLayout(self.horizontalLayout, 11, 0, 1, 1) + + self.retranslateUi(QuickDraw) + self.buttonBox.accepted.connect(QuickDraw.accept) + self.buttonBox.rejected.connect(QuickDraw.reject) + QtCore.QMetaObject.connectSlotsByName(QuickDraw) + + def retranslateUi(self, QuickDraw): + _translate = QtCore.QCoreApplication.translate + QuickDraw.setWindowTitle(_translate("QuickDraw", "QuickDraw")) + self.label.setText(_translate("QuickDraw", "Enter geometries and/or choose examples: ")) + self.exampleComboBox.setToolTip(_translate("QuickDraw", "

These are example geometries which can be edited after selecting them

")) + self.exampleComboBox.setItemText(0, _translate("QuickDraw", "Bounding box")) + self.exampleComboBox.setItemText(1, _translate("QuickDraw", "Point")) + self.exampleComboBox.setItemText(2, _translate("QuickDraw", "Line")) + self.exampleComboBox.setItemText(3, _translate("QuickDraw", "Polygon")) + self.geometryTextEdit.setToolTip(_translate("QuickDraw", "

Enter your geometries here.

Use the What\'s This? tool for more information.

")) + self.geometryTextEdit.setWhatsThis(_translate("QuickDraw", "

Editing Geometries

Enter and edit your geometries here. Geometries can be input as points, polylines, polygons and bounding boxes in the following formats:

Points: x,y
Polylines and polygons: x1,y1,x2,y2,x3,y3 etc.
Bounding box: xmin,ymin : xmax,ymax

Coordinates are comma separated (whitespace is ignored). It is assumed that coordinates are entered in the same projection as the map.

The difference between a polyline and a polygon is that in a polygon the final coordinate pair must match the initial coordinate pair, thus closing the line. Complex polygons with holes are not supported. The bounding box format is shorthand for creating a rectangular polygon, and is the same format as that used for the QGIS extents shown in the status bar.

Multiple geometries are supported: there is one geometry per line.

Deleting or editing geometries and pressing OK or Apply will update the canvas.

")) + self.clearButton.setText(_translate("QuickDraw", "Clear")) + self.zoomCheckBox.setToolTip(_translate("QuickDraw", "

After clicking OK zoom the map to the combined extent of the geometries.

")) + self.zoomCheckBox.setText(_translate("QuickDraw", "Zoom to geometries")) +