From 44c3196c2b8bce50a603abf3064dba7f367d3f13 Mon Sep 17 00:00:00 2001 From: Jorge Gil Date: Mon, 11 Jan 2016 10:39:51 +0100 Subject: [PATCH] final updates based on student questions --- SpatialDecision/icon (1).png | Bin 1034 -> 0 bytes SpatialDecision/spatial_decision.py | 14 +++++++- .../spatial_decision_dockwidget.py | 34 +++++++++--------- 3 files changed, 30 insertions(+), 18 deletions(-) delete mode 100755 SpatialDecision/icon (1).png diff --git a/SpatialDecision/icon (1).png b/SpatialDecision/icon (1).png deleted file mode 100755 index f696c00303219cfcc2f0d57608d04e298fbf56c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1034 zcmV+l1oiugP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXD@ z77;9+NQ1io00W9iL_t(Y$E}r1Xk1ko$A9PCduQg(OlBrY(9Ks7iMEcmzAKc3;VzZCAM*45PN_;^e6>czpi>a)k;jWgn$XwX#(ffW0x= z+8`f&KFz}YS*DXYlF=gSn-KxzBG6N#o}Sbu5ylW$ifX;y!Gxcoccb7X?l*&Cg%BLp+upi(AsPbFBN>WXDC?; z&(>7p1`~%XZ)m0`uQ4(<$FhGH?|poXGiT2da3o4;)@nx9({OUBf@d^Etti_X6*QRt zM(yu64Vk}6JTN%G$V;!1TAbqGBW-lFx`bT|DMfv_l!BJF5c985o@kjA(}*tNFK{QCU>`#$u@1vR=}>qa5@&kCuGhvP`xkhN}@YN}=O zQj$Y2Uc!t58W8mdtiyG1gOY%=`Oqf#kFzPpKDdk-HFaxyemu%W41P&5^jJIh_B4=) zIRqS8AO73bJYStlGW|rdy4U))V9(wb+>k{~N-CaW{!Ycn!A{zChUn=E(`kQe>l33Is7?7;qutHE1STpm8YoYyRmhySVLwneD zILtlW(W=jJRx_{aH|L?0Ar`gK1}rHy^>Uk*mB7T>op^&oQzC$62^{-|!2sta za1=;y9wJfWb=kJ1ful09`}7PjxUqtpunAx=vHSGQzo6-Eu3FzqfdBvi07*qoM6N<$ Ef=x2zx&QzG diff --git a/SpatialDecision/spatial_decision.py b/SpatialDecision/spatial_decision.py index 0aa16cfe..9827e498 100644 --- a/SpatialDecision/spatial_decision.py +++ b/SpatialDecision/spatial_decision.py @@ -35,7 +35,19 @@ import xlrd except ImportError, e: from .external import xlrd as xl - print('local imported') + +#change sys path to networkx package if not installed +import sys +import inspect +try: + import networkx as nx +except ImportError, e: + cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0],"external"))) + if cmd_subfolder not in sys.path: + sys.path.insert(0, cmd_subfolder) + # now can import complex package placed in the external folder + # import networkx as nx + is_debug = False try: diff --git a/SpatialDecision/spatial_decision_dockwidget.py b/SpatialDecision/spatial_decision_dockwidget.py index c1eac5cb..a09e14f3 100644 --- a/SpatialDecision/spatial_decision_dockwidget.py +++ b/SpatialDecision/spatial_decision_dockwidget.py @@ -27,6 +27,7 @@ from qgis.gui import * import processing +# matplotlib for the charts from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure @@ -145,23 +146,6 @@ def closeEvent(self, event): self.closingPlugin.emit() event.accept() - def enterPoi(self): - # remember currently selected tool - self.userTool = self.canvas.mapTool() - # activate coordinate capture tool - self.canvas.setMapTool(self.emitPoint) - - def getPoint(self, mapPoint, mouseButton): - # change tool so you don't get more than one POI - self.canvas.unsetMapTool(self.emitPoint) - self.canvas.setMapTool(self.userTool) - #Get the click - if mapPoint: - print(mapPoint) - # here do something with the point - - - ####### # Data functions ####### @@ -542,6 +526,22 @@ def updateNumberFeatures(self): count = layer.featureCount() self.featureCounterEdit.setText(str(count)) + # get the point when the user clicks on the canvas + def enterPoi(self): + # remember currently selected tool + self.userTool = self.canvas.mapTool() + # activate coordinate capture tool + self.canvas.setMapTool(self.emitPoint) + + def getPoint(self, mapPoint, mouseButton): + # change tool so you don't get more than one POI + self.canvas.unsetMapTool(self.emitPoint) + self.canvas.setMapTool(self.userTool) + #Get the click + if mapPoint: + print(mapPoint) + # here do something with the point + # selecting a file for saving def selectFile(self): last_dir = uf.getLastDir("SDSS")