def __init__(self, iface, plugincore, parent=None): QWidget.__init__(self, parent) self.iface = iface self.plugincore = plugincore # remimber repository for saving if QtCore.QSettings().value("profiletool/lastdirectory") != '': self.loaddirectory = QtCore.QSettings().value("profiletool/lastdirectory") else: self.loaddirectory = '' self.isInitialised = False self.finishing = False # mouse tracking self.doTracking = False # the datas / results self.profiles = None # dictionary where is saved the plotting data {"l":[l],"z":[z], "layer":layer1, "curve":curve1} # The line information self.pointstoDraw = [] self.wellsOnProfile = [] self.logsOnWells = [] self.zonesOnWells = [] # he renderer for temporary polyline # self.toolrenderer = ProfiletoolMapToolRenderer(self) self.toolrenderer = None # the maptool previously loaded self.saveTool = None # Save the standard mapttool for restoring it at the end # Used to remove highlighting from previously active layer. self.previousLayerId = None self.x_cursor = None # Keep track of last x position of cursor # the dockwidget self.dockwidget = PTDockWidget(self.iface, self) # Initialize the dockwidget combo box with the list of available profiles. # (Use sorted list to be sure that Height is always on top and # the combobox order is consistent) for profile in sorted(profilers.PLOT_PROFILERS): self.dockwidget.plotComboBox.addItem(profile) self.dockwidget.plotComboBox.setCurrentIndex(0) self.dockwidget.plotComboBox.currentIndexChanged.connect(self.plotComboBox_indexChanged) # lambda index: self.plotProfil()) # dockwidget graph zone self.dockwidget.changePlotLibrary(self.dockwidget.cboLibrary.currentIndex()) self.enableMouseCoordonates()
def __init__(self, iface, projFolder=None, parent=None, TEC_Box=None): QWidget.__init__(self, parent) self.iface = iface self.dlg = profileViewerDialog() self.TEC_Box = TEC_Box # ---Signals Connections--- self.dlg.TecFileList.itemChanged.connect(self.setLayerState) self.dlg.TecFileList.itemActivated.connect(self.setToActive) self.registry = QgsMapLayerRegistry.instance() self.iface = iface # the rubberband self.polygon = False self.rubberband = QgsRubberBand(self.iface.mapCanvas(), self.polygon) self.rubberband.setWidth(2) self.rubberband.setColor(QColor(Qt.red)) self.rubberbandpoint = QgsVertexMarker(self.iface.mapCanvas()) self.rubberbandpoint.setColor(QColor(Qt.red)) self.rubberbandpoint.setIconSize(5) self.rubberbandpoint.setIconType(QgsVertexMarker.ICON_BOX) # or ICON_CROSS, ICON_X self.rubberbandpoint.setPenWidth(3) self.rubberbandbuf = QgsRubberBand(self.iface.mapCanvas()) self.rubberbandbuf.setWidth(1) self.rubberbandbuf.setColor(QColor(Qt.blue)) # remember repository for saving if QSettings().value("projFolder") != '': self.loaddirectory = QSettings().value("projFolder") else: self.loaddirectory = '' self.profileSec = profileSec(self.iface, self) # profile settings registry = QgsMapLayerRegistry.instance() registry.legendLayersAdded.connect(self.layerFromRegistry) self.dlg.methodSelector.currentIndexChanged.connect( self.changeOfMethod) self.dlg.exportTextBtn.clicked.connect(self.exportText)
def __init__(self, iface, plugincore, parent=None): QWidget.__init__(self, parent) self.iface = iface self.plugincore = plugincore #the rubberband self.polygon = False self.rubberband = QgsRubberBand(self.iface.mapCanvas(), self.polygon) self.rubberband.setWidth(2) self.rubberband.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint = QgsVertexMarker(self.iface.mapCanvas()) self.rubberbandpoint.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint.setIconSize(5) self.rubberbandpoint.setIconType( QgsVertexMarker.ICON_BOX) # or ICON_CROSS, ICON_X self.rubberbandpoint.setPenWidth(3) self.rubberbandbuf = QgsRubberBand(self.iface.mapCanvas()) self.rubberbandbuf.setWidth(1) self.rubberbandbuf.setColor(QtGui.QColor(QtCore.Qt.blue)) #remimber repository for saving if QtCore.QSettings().value("profiletool/lastdirectory") != '': self.loaddirectory = QtCore.QSettings().value( "profiletool/lastdirectory") else: self.loaddirectory = '' #mouse tracking self.doTracking = False #the dockwidget self.dockwidget = PTDockWidget(self.iface, self) #dockwidget graph zone self.dockwidget.changePlotLibrary( self.dockwidget.cboLibrary.currentIndex()) #the datas / results self.profiles = None #dictionary where is saved the plotting data {"l":[l],"z":[z], "layer":layer1, "curve":curve1} #The line information self.pointstoDraw = None #he renderer for temporary polyline #self.toolrenderer = ProfiletoolMapToolRenderer(self) self.toolrenderer = None #the maptool previously loaded self.saveTool = None #Save the standard mapttool for restoring it at the end
def __init__(self, iface, plugincore, parent=None): QWidget.__init__(self, parent) self.iface = iface self.plugincore = plugincore #the rubberband self.polygon = False self.rubberband = QgsRubberBand(self.iface.mapCanvas(), self.polygon) self.rubberband.setWidth(2) self.rubberband.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint = QgsVertexMarker(self.iface.mapCanvas()) self.rubberbandpoint.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint.setIconSize(5) self.rubberbandpoint.setIconType( QgsVertexMarker.ICON_BOX) # or ICON_CROSS, ICON_X self.rubberbandpoint.setPenWidth(3) self.rubberbandbuf = QgsRubberBand(self.iface.mapCanvas()) self.rubberbandbuf.setWidth(1) self.rubberbandbuf.setColor(QtGui.QColor(QtCore.Qt.blue)) if QtCore.QSettings().value("profiletool/lastdirectory") != '': self.loaddirectory = QtCore.QSettings().value( "profiletool/lastdirectory") else: self.loaddirectory = '' #mouse tracking self.doTracking = False #the dockwidget self.dockwidget = PTDockWidget(self.iface, self) #dockwidget graph zone self.dockwidget.changePlotLibrary('PyQtGraph') #the data / results self.profiles = None #The line information self.pointstoDraw = None #he renderer for temporary polyline self.toolrenderer = None #the maptool previously loaded self.saveTool = None
def __init__(self, iface,plugincore, parent = None): QWidget.__init__(self, parent) self.iface = iface self.plugincore = plugincore #the rubberband self.polygon = False self.rubberband = QgsRubberBand(self.iface.mapCanvas(), self.polygon) self.rubberband.setWidth(2) self.rubberband.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint = QgsVertexMarker(self.iface.mapCanvas()) self.rubberbandpoint.setColor(QtGui.QColor(QtCore.Qt.red)) self.rubberbandpoint.setIconSize(5) self.rubberbandpoint.setIconType(QgsVertexMarker.ICON_BOX) # or ICON_CROSS, ICON_X self.rubberbandpoint.setPenWidth(3) self.rubberbandbuf = QgsRubberBand(self.iface.mapCanvas()) self.rubberbandbuf.setWidth(1) self.rubberbandbuf.setColor(QtGui.QColor(QtCore.Qt.blue)) #remimber repository for saving if QtCore.QSettings().value("profiletool/lastdirectory") != '': self.loaddirectory = QtCore.QSettings().value("profiletool/lastdirectory") else: self.loaddirectory = '' #mouse tracking self.doTracking = False #the dockwidget self.dockwidget = PTDockWidget(self.iface,self) #dockwidget graph zone self.dockwidget.changePlotLibrary( self.dockwidget.cboLibrary.currentIndex() ) #the datas / results self.profiles = None #dictionary where is saved the plotting data {"l":[l],"z":[z], "layer":layer1, "curve":curve1} #The line information self.pointstoDraw = None #he renderer for temporary polyline #self.toolrenderer = ProfiletoolMapToolRenderer(self) self.toolrenderer = None #the maptool previously loaded self.saveTool = None #Save the standard mapttool for restoring it at the end
def __init__(self, iface, plugincore, parent=None): QWidget.__init__(self, parent) self.iface = iface self.plugincore = plugincore if QtCore.QSettings().value( "sigfoxprofiletool/lastdirectory" ) != '': #recordar repositorio para guardar self.loaddirectory = QtCore.QSettings().value( "sigfoxprofiletool/lastdirectory") else: self.loaddirectory = '' self.doTracking = False #variable necesaria para el seguimiento del mouse self.profiles = None #diccionario donde se guardan los datos de trazado del perfil self.pointstoDraw = [ ] #variable donde se almacena las coordenadas proyectadas en m del Tx y Rx self.toolrenderer = None #renderizador para la polilínea temporal. self.saveTool = None #guarda las herramientas del mapa self.previousLayerId = None self.x_cursor = None #Mantiene un registro de la última posición x del cursor #the dockwidget self.dockwidget = PTDockWidget( self.iface, self ) #proporciona un widget general que se puede acoplar dentro de la pantalla principal del mapa de Qgis self.dockwidget.changePlotLibrary()
def showAttribute(self, item): self.attributeTabs.clear() browser0 = QTextBrowser() vLayout = QVBoxLayout() vLayout.addWidget(browser0) browser0.append(toUnicode(item.name)) browser0.append(toUnicode(MSG['msg08'])) string = '' for name in item.cName: string += (' ' + toUnicode(name) + '\n') browser0.append(string) browser0.append(toUnicode(MSG['msg09']) + ' : ' + toUnicode(item.family) + ' ' + item.Efamily) browser0.append(toUnicode(MSG['msg11']) + ' : ' + toUnicode(item.BinoName)) browser0.append(toUnicode(MSG['msg10']) + ' : ' + toUnicode(item.region)) browser0.append(toUnicode(MSG['msg12']) + ' : ' + toUnicode(item.researcher)) newWidget = QWidget() newWidget.setLayout(vLayout) self.attributeTabs.addTab(newWidget, toUnicode(MSG['msg07'])) browser1 = QTextBrowser() vLayout = QVBoxLayout() vLayout.addWidget(browser1) for row in item.flowCategory: string = ('{:5.2f}'.format(row[0]) + ' ' + item.flowUnit + ' < ' + toUnicode(MSG['msg04']) + ' <= ' + '{:5.2f}'.format(row[1]) + ' ' + item.flowUnit + ' : ' + '{:5.2f}'.format(row[2])) browser1.append(string) newWidget = QWidget() newWidget.setLayout(vLayout) self.attributeTabs.addTab(newWidget, toUnicode(MSG['msg04'])) browser2 = QTextBrowser() vLayout = QVBoxLayout() vLayout.addWidget(browser2) for row in item.depthCategory: string = ('{:5.2f}'.format(row[0]) + ' ' + item.depthUnit + ' < ' + toUnicode(MSG['msg03']) + ' <= ' + '{:5.2f}'.format(row[1]) + ' ' + item.depthUnit + ' : ' + '{:5.2f}'.format(row[2])) browser2.append(string) newWidget = QWidget() newWidget.setLayout(vLayout) self.attributeTabs.addTab(newWidget, toUnicode(MSG['msg03'])) browser3 = QTextBrowser() vLayout = QVBoxLayout() vLayout.addWidget(browser3) for row in item.bedCategory: string = ('{:5.2f}'.format(row[0]) + ' ' + item.bedUnit + ' < ' + toUnicode(MSG['msg05']) + ' <= ' + '{:5.2f}'.format(row[2]) + ' ' + item.bedUnit + ' : ' + '{:5.2f}'.format(row[2])) browser3.append(string) newWidget = QWidget() newWidget.setLayout(vLayout) self.attributeTabs.addTab(newWidget, toUnicode(MSG['msg05']))
def showTECResult(self, tec): if tec.mapUnit == 'meter': area_factor = 1.0E-6 area_unit = self.tr('km<sup>2</sup>') elif tec.mapUnit == 'feet': area_factor = 1. / 43560 area_unit = 'Acre' else: area_factor = 1.0 area_unit = '' self.reportTab.clear() browser0 = QTextBrowser() browser0.append('\n') browser0.append( toUnicode(MSG['msg18']) + u' : ' + '%10.3f' % (tec.totalArea * area_factor) + ' ' + area_unit + '\n') browser0.append( toUnicode(MSG['msg19']) + u' : ' + '%10.3f' % tec.glideRatio) browser0.append( toUnicode(MSG['msg20']) + u' : ' + '%10.3f' % tec.riffleRatio) browser0.append( toUnicode(MSG['msg21']) + u' : ' + '%10.3f' % tec.poolRatio) browser0.append( toUnicode(MSG['msg22']) + u' : ' + '%10.3f' % tec.runRatio) browser0.append('\n') browser0.append( toUnicode(MSG['msg23']) + u' : ' + '%10.3f' % tec.divIndex) vLayout0 = QVBoxLayout() vLayout0.addWidget(browser0) newWidget0 = QWidget() newWidget0.setLayout(vLayout0) self.reportTab.addTab(newWidget0, toUnicode(MSG['msg17'])) for i in range(0, len(tec.specieWUA)): name = tec.specieWUA[i]['name'] browser = QTextBrowser() vLayout = QVBoxLayout() vLayout.addWidget(browser) browser.append('\n') browser.append(toUnicode(MSG['msg13'])) browser.append( toUnicode(MSG['msg14']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAsimple'] * area_factor) + ' ' + area_unit) browser.append( toUnicode(MSG['msg24']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAsimple'] / tec.totalArea) + '\n') browser.append( toUnicode(MSG['msg15']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAarith'] * area_factor) + ' ' + area_unit) browser.append( toUnicode(MSG['msg24']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAarith'] / tec.totalArea) + '\n') browser.append( toUnicode(MSG['msg16']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAharmonic'] * area_factor) + ' ' + area_unit) browser.append( toUnicode(MSG['msg24']) + ' ' + '%10.3f' % (tec.specieWUA[i]['WUAharmonic'] / tec.totalArea) + '\n') newWidget = QWidget() newWidget.setLayout(vLayout) self.reportTab.addTab(newWidget, name)