Python qgis.PyQt.QtGui.QColor() Examples
The following are 22
code examples of qgis.PyQt.QtGui.QColor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
qgis.PyQt.QtGui
, or try the search function
.
Example #1
Source File: rb_result_renderer.py From quickmapservices with GNU General Public License v2.0 | 6 votes |
def __init__(self): self.iface = iface self.srs_wgs84 = QgsCoordinateReferenceSystem(4326) self.transform_decorator = QgsCoordinateTransform(self.srs_wgs84, self.srs_wgs84) self.rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point) self.rb.setColor(QColor('magenta')) self.rb.setIconSize(12) self.features_rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point) magenta_transp = QColor('#3388ff') magenta_transp.setAlpha(120) self.features_rb.setColor(magenta_transp) self.features_rb.setIconSize(12) self.features_rb.setWidth(2)
Example #2
Source File: mapillary_cursor.py From go2mapillary with GNU General Public License v3.0 | 6 votes |
def __init__(self,parentInstance): self.parentInstance = parentInstance self.iface = parentInstance.iface self.mapCanvas = self.iface.mapCanvas() self.lineOfSight = QgsRubberBand(self.mapCanvas, QgsWkbTypes.LineGeometry) self.sightDirection = QgsRubberBand(self.mapCanvas, QgsWkbTypes.LineGeometry) self.pointOfView = QgsVertexMarker(self.mapCanvas) self.cursor = QgsVertexMarker(self.mapCanvas) self.sightDirection.setColor(QColor(CURSOR_COLOR)) self.lineOfSight.setColor(QColor(CURSOR_COLOR)) self.pointOfView.setColor(QColor(CURSOR_COLOR)) self.cursor.setColor(QColor(CURSOR_COLOR)) self.lineOfSight.setWidth(2) self.sightDirection.setWidth(1) self.sightDirection.setLineStyle(Qt.DashLine) self.pointOfView.setIconType(QgsRubberBand.ICON_CIRCLE) self.cursor.setIconType(QgsRubberBand.ICON_CIRCLE) self.pointOfView.setIconSize(20) self.cursor.setIconSize(20) self.cursor.setPenWidth(2) self.pointOfView.setPenWidth(2) self.samples_datasource = '' self.delete() #self.update_ds(self.parentInstance.sample_settings.settings['sample_source'])
Example #3
Source File: settings.py From qgis-shapetools-plugin with GNU General Public License v2.0 | 6 votes |
def readSettings(self): '''Load the user selected settings. The settings are retained even when the user quits QGIS.''' qset = QSettings() self.geomXName = qset.value('/ShapeTools/GeomXName', 'geom_x') self.geomYName = qset.value('/ShapeTools/GeomYName', 'geom_y') self.maxSegLength = float(qset.value('/ShapeTools/MaxSegLength', 20.0)) # In km self.maxSegments = int(qset.value('/ShapeTools/MaxSegments', 1000)) self.mtAzMode = int(qset.value('/ShapeTools/MtAzMode', 0)) self.measureSignificantDigits = int(qset.value('/ShapeTools/MeasureSignificantDigits', 2)) color = qset.value('/ShapeTools/RubberBandColor', '#dea743') self.rubberBandColor = QColor(color) value = int(qset.value('/ShapeTools/RubberBandOpacity', 192)) self.rubberBandColor.setAlpha(value) color = qset.value('/ShapeTools/MeasureLineColor', '#000000') self.measureLineColor = QColor(color) color = qset.value('/ShapeTools/MeasureTextColor', '#000000') self.measureTextColor = QColor(color) acronym = qset.value('/ShapeTools/Ellipsoid', 'WGS84') self.setEllipsoid(acronym)
Example #4
Source File: shapeTool.py From DsgTools with GNU General Public License v2.0 | 6 votes |
def __init__(self, canvas, geometryType, param, type, color = QColor( 254, 178, 76, 63 )): """ Constructor """ QgsMapTool.__init__(self, canvas) self.canvas = canvas self.active = False self.geometryType = self.tr(geometryType) self.param=param self.type=type self.cursor=None self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.setColor(color) self.reset() self.rotAngle = 0 self.currentCentroid = None self.rotate = False
Example #5
Source File: buttonPropWidget.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def setInterface(self, parameterDict): """ Sets the interface with a dict in the format: { 'buttonColor':--color of the button--, 'buttonToolTip'--button toolTip--, 'buttonGroupTag':--group tag of the button--, 'buttonShortcut':--shortcut for the button--, 'openForm':--open feature form when digitizing-- } """ if 'buttonColor' in list(parameterDict.keys()): self.colorCheckBox.setCheckState(Qt.Checked) R,G,B,A = list(map(int,parameterDict['buttonColor'].split(','))) #QColor only accepts int values self.mColorButton.setColor(QColor(R,G,B,A)) else: self.colorCheckBox.setCheckState(Qt.Unchecked) #if 'buttonColor' isn't on dict keys, set colorCheckBox as unchecked if 'buttonToolTip' in list(parameterDict.keys()): self.tooltipCheckBox.setCheckState(Qt.Checked) self.toolTipLineEdit.setText(parameterDict['buttonToolTip']) else: self.tooltipCheckBox.setCheckState(Qt.Unchecked) #if 'buttonToolTip' isn't on dict keys, set tooltipCheckBox as unchecked self.toolTipLineEdit.setText('') if 'buttonGroupTag' in list(parameterDict.keys()): self.customCategoryCheckBox.setCheckState(Qt.Checked) self.customCategoryLineEdit.setText(parameterDict['buttonGroupTag']) else: self.customCategoryCheckBox.setCheckState(Qt.Unchecked) #if 'buttonGroupTag' isn't on dict keys, set customCategoryCheckBox as unchecked self.customCategoryLineEdit.setText('') if 'buttonShortcut' in list(parameterDict.keys()): self.shortcutCheckBox.setCheckState(Qt.Checked) self.shortcutWidget.setShortcut(parameterDict['buttonShortcut']) else: self.shortcutCheckBox.setCheckState(Qt.Unchecked) #if 'buttonShortcut' isn't on dict keys, set shortcutCheckBox as unchecked self.shortcutWidget.clearAll() if 'openForm' in list(parameterDict.keys()): self.openFormCheckBox.setCheckState(Qt.Checked) else: self.openFormCheckBox.setCheckState(Qt.Unchecked) #if 'openForm' isn't on dict keys, set openFormCheckBox as unchecked
Example #6
Source File: geometricaAquisition.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def setAllowedStyleSnapRubberBand(self): self.rubberBand.setLineStyle(Qt.PenStyle(Qt.SolidLine)) self.rubberBand.setSecondaryStrokeColor(QColor(255, 0, 0, 200)) self.rubberBand.setFillColor(QColor(255, 0, 0, 40))
Example #7
Source File: geometricaAquisition.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def getSnapRubberBand(self): rubberBand = QgsRubberBand(self.canvas, geometryType = QgsWkbTypes.PointGeometry) rubberBand.setFillColor(QColor(255, 0, 0, 40)) rubberBand.setSecondaryStrokeColor(QColor(255, 0, 0, 200)) rubberBand.setWidth(2) rubberBand.setIcon(QgsRubberBand.ICON_X) return rubberBand
Example #8
Source File: geometricaAquisition.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def getRubberBand(self): geomType = self.iface.activeLayer().geometryType() if geomType == QgsWkbTypes.PolygonGeometry: rubberBand = QgsRubberBand(self.canvas, True) rubberBand.setFillColor(QColor(255, 0, 0, 40)) elif geomType == QgsWkbTypes.LineGeometry: rubberBand = QgsRubberBand(self.canvas, False) rubberBand.setSecondaryStrokeColor(QColor(255, 0, 0, 200)) rubberBand.setWidth(2) return rubberBand
Example #9
Source File: genericSelectionTool.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def __init__(self, iface): """ Tool Behaviours: (all behaviours start edition, except for rectangle one) 1- Left Click: Clears previous selection, selects feature, sets feature layer as active layer. The selection is done with the following priority: Point, Line then Polygon. Selection is only done in visible layer. 2- Control + Left Click: Adds to selection selected feature. This selection follows the priority in item 1. 3- Right Click: Opens feature form 4- Control + Right Click: clears selection and set feature's layer as activeLayer. activeLayer's definition follows priority of item 1; 5- Shift + drag and drop: draws a rectangle, then features that intersect this rectangl'e are added to selection """ self.iface = iface self.canvas = self.iface.mapCanvas() self.toolAction = None QgsMapTool.__init__(self, self.canvas) self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.hoverRubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) mFillColor = QColor( 254, 178, 76, 63 ) self.rubberBand.setColor(mFillColor) self.hoverRubberBand.setColor(QColor( 255, 0, 0, 90 )) self.rubberBand.setWidth(1) self.reset() self.blackList = self.getBlackList() self.cursorChanged = False self.cursorChangingHotkey = Qt.Key_Alt self.menuHovered = False # indicates hovering actions over context menu self.geometryHandler = GeometryHandler(iface=self.iface)
Example #10
Source File: acquisitionFree.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def startRubberBand(self, pointMap, layer): #Método para iniciar o rubberBand da aquisição #Parâmetro de entrada: pointMap (Primeiro ponto da feição em aquisição), layer (Camada ativa) self.setDrawingState(True) self.setGeometryType(layer.geometryType()) if self.isPolygon(): rubberBand = gui.QgsRubberBand(self.getCanvas(), core.QgsWkbTypes.PolygonGeometry) rubberBand.setColor(QtGui.QColor(255, 0, 0, 63)) rubberBand.setWidth(2) else: rubberBand = gui.QgsRubberBand(self.getCanvas(), core.QgsWkbTypes.LineGeometry) rubberBand.setColor(QtGui.QColor(255, 0, 0, 150)) rubberBand.setWidth(1) rubberBand.addPoint(pointMap) self.setRubberBand(rubberBand)
Example #11
Source File: acquisitionFree.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def removeVertice(self): #Método para remover vertices firstPoint = None lastPoint = None rubberBand = self.getRubberBand() qtnUndoPoints = self.getParametersFromConfig() if rubberBand and rubberBand.numberOfVertices() > qtnUndoPoints: for x in range(qtnUndoPoints): rubberBand.removeLastPoint() if not self.isPolygon(): lastPoint = rubberBand.asGeometry().asPolyline()[-1] new_rubberBand = gui.QgsRubberBand(self.getCanvas(), core.QgsWkbTypes.LineGeometry) new_rubberBand.setColor(QtGui.QColor(255, 0, 0, 150)) else: if len(rubberBand.asGeometry().asPolygon()[0]) > 1: firstPoint = rubberBand.asGeometry().asPolygon()[0][0] lastPoint = rubberBand.asGeometry().asPolygon()[0][-2] new_rubberBand = gui.QgsRubberBand(self.getCanvas(), core.QgsWkbTypes.PolygonGeometry) new_rubberBand.setColor(QtGui.QColor(255, 0, 0, 63)) new_rubberBand.setWidth(1) rubberBandToStopState = self.getRubberBandToStopState() if rubberBandToStopState: rubberBandToStopState.reset() new_rubberBand.setLineStyle(QtCore.Qt.DotLine) new_rubberBand.addPoint(lastPoint) if firstPoint: new_rubberBand.addPoint(firstPoint) self.setRubberBandToStopState(new_rubberBand) elif rubberBand: self.setStopedState(False) self.getRubberBandToStopState().reset() self.cancelEdition()
Example #12
Source File: dsg_line_tool.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def defineRubberBand(self): """ Defines the rubber band style """ settings = QSettings() myRed = int(settings.value("/qgis/default_measure_color_red", 222)) myGreen = int(settings.value("/qgis/default_measure_color_green", 155)) myBlue = int(settings.value("/qgis/default_measure_color_blue", 67)) self.rubberBand = QgsRubberBand(self.canvas) self.rubberBand.setColor(QColor(myRed, myGreen, myBlue, 100)) self.rubberBand.setWidth(3)
Example #13
Source File: assignBandValueTool.py From DsgTools with GNU General Public License v2.0 | 5 votes |
def setRubberbandParameters(self): self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.hoverRubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) mFillColor = QColor( 254, 178, 76, 63 ) self.rubberBand.setColor(mFillColor) self.hoverRubberBand.setColor(QColor( 255, 0, 0, 90 )) self.rubberBand.setWidth(1)
Example #14
Source File: reverseGeocode.py From qgis-bulk-nominatim with GNU General Public License v2.0 | 5 votes |
def __init__(self, iface, settings): self.canvas = iface.mapCanvas() QgsMapTool.__init__(self, self.canvas) self.iface = iface self.settings = settings self.reverseGeoCodeDialog = ReverseGeocodeDialog(self, self.iface, self.iface.mainWindow()) self.iface.addDockWidget(Qt.TopDockWidgetArea, self.reverseGeoCodeDialog) self.reverseGeoCodeDialog.hide() self.epsg4326 = QgsCoordinateReferenceSystem('EPSG:4326') self.marker = None # Set up a polygon/line rubber band self.rubber = QgsRubberBand(self.canvas) self.rubber.setColor(QColor(255, 70, 0, 200)) self.rubber.setWidth(5) self.rubber.setBrushStyle(Qt.NoBrush)
Example #15
Source File: lineDigitizer.py From qgis-shapetools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): '''When activated set the cursor to a crosshair.''' self.canvas.setCursor(Qt.CrossCursor) self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #16
Source File: azDigitizer.py From qgis-shapetools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): """When activated set the cursor to a crosshair.""" self.canvas.setCursor(Qt.CrossCursor) self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #17
Source File: geodesicMeasureTool.py From qgis-shapetools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): '''When activated set the cursor to a crosshair.''' self.canvas.setCursor(Qt.CrossCursor) self.measureDialog.initGeodLabel() self.measureDialog.show() self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #18
Source File: log_strati.py From albion with GNU General Public License v3.0 | 5 votes |
def formation_color(self, code): color = { 300: QColor(150, 50, 50), 310: QColor(100, 50, 50), 320: QColor(150, 50, 50), 340: QColor(200, 50, 50), 400: QColor(150, 100, 50) } col = color[code] if code in color else QColor(150, 150, 150) return col
Example #19
Source File: captureCoordinate.py From qgis-latlontools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): '''When activated set the cursor to a crosshair.''' self.canvas.setCursor(Qt.CrossCursor) self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #20
Source File: showOnMapTool.py From qgis-latlontools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): '''When activated set the cursor to a crosshair.''' self.canvas.setCursor(Qt.CrossCursor) self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #21
Source File: copyLatLonTool.py From qgis-latlontools-plugin with GNU General Public License v2.0 | 5 votes |
def activate(self): '''When activated set the cursor to a crosshair.''' self.canvas.setCursor(Qt.CrossCursor) self.snapcolor = QgsSettings().value( "/qgis/digitizing/snap_color" , QColor( Qt.magenta ) )
Example #22
Source File: reverseGeocode.py From qgis-bulk-nominatim with GNU General Public License v2.0 | 5 votes |
def addMarker(self, lat, lon): if self.marker: self.removeMarker() canvasCrs = self.canvas.mapSettings().destinationCrs() transform = QgsCoordinateTransform(self.epsg4326, canvasCrs, QgsProject.instance()) center = transform.transform(lon, lat) self.marker = QgsVertexMarker(self.canvas) self.marker.setCenter(center) self.marker.setColor(QColor(255, 70, 0)) self.marker.setIconSize(15) self.marker.setIconType(QgsVertexMarker.ICON_X) self.marker.setPenWidth(3) self.marker.show()