def __init__(self, iface): """ Constructor :param iface: interface """ QgsMapTool.__init__(self, iface.mapCanvas()) self.__clear()
def __init__(self, plugin): QgsMapTool.__init__(self, plugin.iface.mapCanvas()) self.plugin = plugin self.iface = plugin.iface self.cursor = QCursor(QPixmap([ "16 16 3 1", " c None", ". c #FF0000", "+ c #FFFFFF", " ", " +.+ ", " ++.++ ", " +.....+ ", " +. .+ ", " +. . .+ ", " +. . .+ ", " ++. . .++", " ... ...+... ...", " ++. . .++", " +. . .+ ", " +. . .+ ", " ++. .+ ", " ++.....+ ", " ++.++ ", " +.+ " ])) self.areaMarkerLayer = None
def __init__(self, canvas, layerfrom, layerto, mapping, validation_method): """ mapping - A dict of field - field mapping with values to copy to the new layer """ QgsMapTool.__init__(self, canvas) self.layerfrom = layerfrom self.layerto = layerto self.fields = mapping self.validation_method = validation_method self.band = QgsRubberBand(canvas, QGis.Polygon ) self.band.setColor(QColor.fromRgb(255,0,0, 65)) self.band.setWidth(5) self.cursor = QCursor(QPixmap(["16 16 3 1", " c None", ". c #FF0000", "+ c #FFFFFF", " ", " +.+ ", " ++.++ ", " +.....+ ", " +. .+ ", " +. . .+ ", " +. . .+ ", " ++. . .++", " ... ...+... ...", " ++. . .++", " +. . .+ ", " +. . .+ ", " ++. .+ ", " ++.....+ ", " ++.++ ", " +.+ "]))
def __init__(self, canvas, layer,Parent): QgsMapTool.__init__(self,canvas) self.Parent = Parent self.canvas=canvas self.layer = layer self.geom = None self.rb = None self.x0 = None self.y0 = None #our own fancy cursor self.cursor = QCursor(QPixmap(["16 16 3 1", " c None", ". c #FF0000", "+ c #17a51a", " ", " +.+ ", " ++.++ ", " +.....+ ", " +. . .+ ", " +. . .+ ", " +. . .+ ", " ++. . .++", " ... ...+... ...", " ++. . .++", " +. . .+ ", " +. . .+ ", " ++. . .+ ", " ++.....+ ", " ++.++ ", " +.+ "]))
def __init__(self, canvas, 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 = canvas self.toolAction = None QgsMapTool.__init__(self, self.canvas) self.rubberBand = QgsRubberBand(self.canvas, QGis.Polygon) self.hoverRubberBand = QgsRubberBand(self.canvas, QGis.Polygon) 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 = QtCore.Qt.Key_Alt self.menuHovered = False # indicates hovering actions over context menu
def __init__(self, canvas, layer): """ Constructor. """ QgsMapTool.__init__(self, canvas) self.canvas = canvas self.layer = layer self.setCursor(Qt.CrossCursor)
def __init__(self, iface): """ Constructor :param iface: interface """ QgsMapTool.__init__(self, iface.mapCanvas()) self.__iface = iface self.icon_path = ':/plugins/VDLTools/icons/drawdown_icon.png' self.text = QCoreApplication.translate("VDLTools", "Drawdown") self.setCursor(Qt.ArrowCursor) self.__isChoosed = False self.__lastFeatureId = None self.__lastFeature = None self.__dockWdg = None self.__adjDlg = None self.__editDlg = None self.__confDlg = None self.__points = None self.__layers = None self.__altitudes = None self.__extras = None self.__adjustments = None self.__inSelection = False self.__selectedIds = None self.__renderedIds = None self.__selectedStarts = None self.__selectedDirections = None self.__startVertex = None self.__endVertex = None self.ownSettings = None self.__usedMnts = None self.__isfloating = False self.__dockGeom = None self.__rendered = False
def __init__(self, iface, settings, action, index_action): """ Class constructor """ self.iface = iface self.canvas = self.iface.mapCanvas() self.settings = settings self.show_help = bool(int(self.settings.value("status/show_help", 1))) self.index_action = index_action self.layer_arc = None self.layer_connec = None self.layer_node = None self.schema_name = None self.controller = None self.dao = None # Call superclass constructor and set current action QgsMapTool.__init__(self, self.canvas) self.setAction(action) # Snapper self.snapperManager = SnappingConfigManager(self.iface) self.snapper = QgsMapCanvasSnapper(self.canvas) # Change map tool cursor self.cursor = QCursor() self.cursor.setShape(Qt.CrossCursor) # Get default cursor self.stdCursor = self.parent().cursor()
def __init__(self, canvas, drawLineButton, showProfileButton): #buttonShowProf QgsMapTool.__init__(self, canvas) self.canvas = canvas self.cursor = QCursor(Qt.CrossCursor) # Red line self.rubberband = QgsRubberBand(self.canvas) self.rubberband.setWidth(3) self.rubberband.setColor(QColor(231, 28, 35)) # Buttons from main dialog self.drawLineButton = drawLineButton self.buttonShowProf = showProfileButton # Coordinates of drawn line points self.pointsToDraw = [] # Temporary save double clicks self.dblclktemp = None # Drawn line geometry self.drawnLine = None # Point markers on each end of the line self.markers = [] # Backup the last active Tool before the pofile tool became active self.savedTool = self.canvas.mapTool()
def __init__(self, iface): """ Constructor :param iface: interface """ QgsMapTool.__init__(self, iface.mapCanvas()) self.__iface = iface self.icon_path = ':/plugins/VDLTools/icons/profile_icon.png' self.text = QCoreApplication.translate("VDLTools", "Profile of a line") self.__lineLayer = None self.setCursor(Qt.ArrowCursor) self.__isChoosed = False self.__lastFeatureId = None self.__lastFeature = None self.__dockWdg = None self.__layDlg = None self.__msgDlg = None self.__confDlg = None self.__zeroDlg = None self.__points = None self.__layers = None self.__features = None self.__inSelection = False self.__selectedIds = None self.__selectedStarts = None self.__selectedDirections = None self.__startVertex = None self.__endVertex = None self.__rubberSit = None self.__rubberDif = None self.ownSettings = None self.__usedMnts = None self.__isfloating = False self.__dockGeom = None
def __init__(self, iface, couleur): canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PointGeometry) self.rb.setColor(couleur) self.rb.setWidth(3)
def __init__(self, iface, couleur): canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.status = 0 self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rb.setColor(couleur) return None
def __init__(self, parentObj): self.parentObj = parentObj self.iface = parentObj.iface QgsMapTool.__init__(self, self.iface.mapCanvas()) self.contextShape = QgsRubberBand(self.iface.mapCanvas(), QgsWkbTypes.LineGeometry) self.contextShape.setWidth(1) self.contextShape.setColor(QtCore.Qt.red) self.pressed = False
def __init__(self, canvas, callback): self.canvas = canvas QgsMapTool.__init__(self, self.canvas) self.callback = callback self.rubberBand = QgsRubberBand(self.canvas, True) self.rubberBand.setColor(QColor(227, 26, 28, 255)) self.rubberBand.setWidth(5) self.rubberBand.setLineStyle(Qt.PenStyle(Qt.DashLine)) self.reset()
def __init__(self, canvas, dialog): self.canvas = canvas self.dialog = dialog QgsMapTool.__init__(self, self.canvas) self.setCursor(Qt.CrossCursor) self.rubberBand = QgsRubberBand(self.canvas, QGis.Polygon) self.rubberBand.setColor(Qt.red) self.rubberBand.setWidth(1) self.reset()
def __init__(self, iface, couleur): canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rb.setColor(couleur) self.rbSelect = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) return None
def __init__(self, iface, layer): QgsMapTool.__init__(self, iface.mapCanvas() ) self.iface = iface self.canvas = iface.mapCanvas() self.layer = layer self.rubberband = QgsRubberBand( iface.mapCanvas(), QGis.Line ) self.rubberband.setColor( QColor( "#ee5555" ) ) self.rubberband.setWidth( 2 ) self.firstPoint = None
def __init__(self, iface, couleur): canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.status = 0 self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.LineGeometry) self.rb.setColor(couleur) return None
def __init__(self, settings, iface, dlg): QgsMapTool.__init__(self, iface.mapCanvas()) self.iface = iface self.canvas = iface.mapCanvas() self.settings = settings self.latlon = LatLon() self.capture4326 = False self.dlg = dlg self.point_name = "" self.layer_mng = LayerMng(self.iface)
def __init__(self, iface, color, segments): canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.status = 0 self.segments = segments self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rb.setColor(color) return None
def __init__(self, iface): """ Constructor :param iface: interface """ QgsMapTool.__init__(self, iface.mapCanvas()) self.__iface = iface self.icon_path = ':/plugins/VDLTools/icons/pointer_icon.png' self.text = QCoreApplication.translate("VDLTools", "Elevation pointer") self.setCursor(Qt.ArrowCursor)
def __init__(self, canvas, callback): self.canvas = canvas QgsMapTool.__init__(self, self.canvas) self.callback = callback self.rubberBand = QgsRubberBand(self.canvas, 3) self.rubberBand.setColor(QColor(227, 26, 28, 255)) self.rubberBand.setWidth(3) self.rubberBand.setLineStyle(Qt.PenStyle(Qt.DashLine)) self.rotation = self.canvas.rotation() * math.pi / 180 self.reset()
def __init__(self, canvas, distance): self.mCanvas = canvas QgsMapTool.__init__(self, canvas) self.mCursor = Qt.ArrowCursor self.mRubberBand = None self.mDragging = False self.mSelectRect = QRect() self.rubberBandLine = None self.distance = distance self.mSnapper = QgsMapCanvasSnapper(canvas)
def __init__(self, canvas): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.circle = QgsGeometry self.dragging = False self.rubber_band = None self.center = QPointF() self.tangent_point = QPointF() self.radius = 0.0
def __init__(self, iface, segments): canvas = iface QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.status = 0 self.segments = segments self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rb.setColor(QColor(255, 0, 0, 100)) return None
def __init__(self, canvas, action): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.active = False self.setAction(action) self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) mFillColor = QColor(254, 178, 76, 63) self.rubberBand.setColor(mFillColor) self.rubberBand.setWidth(1) self.reset()
def __init__(self, canvas): QgsMapTool.__init__(self, canvas) self.mCanvas = canvas self.mRubberBand = None self.mRubberBand0 = QgsRubberBand(self.mCanvas, QGis.Polygon) self.mCursor = Qt.ArrowCursor self.mFillColor = QColor(254, 178, 76, 63) self.mBorderColour = QColor(254, 58, 29, 100) self.mRubberBand0.setBorderColor(self.mBorderColour) self.polygonGeom = None self.drawFlag = False
def __init__(self, canvas, layer,Parent): QgsMapTool.__init__(self,canvas) self.Parent = Parent self.canvas=canvas self.layer = layer self.geom = None self.rb = None self.x0 = None self.y0 = None #our own fancy cursor self.cursor = QCursor(Qt.CrossCursor)
def __init__(self, canvas): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.rubberBand = None self.tempRubberBand = None self.vertexMarker = None self.capturedPoints = [] self.derivedPoint = None self.capturing = False self.setCursor(Qt.CrossCursor)
def __init__(self, canvas): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.extent = None self.rubber_band = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rubber_band.setFillColor(RB_FILL) self.rubber_band.setStrokeColor(RB_STROKE) self.rubber_band.setWidth(1) self.vertex_count = 1 # two points are dropped initially
def __init__(self, iface): self.iface = iface self.mapCanvas = iface.mapCanvas() QgsMapTool.__init__(self, self.mapCanvas) self.settings = MySettings() self.rubber = QgsRubberBand(self.mapCanvas) self.tolerance = self.settings.value("selectTolerance") units = self.settings.value("selectUnits") if units == "pixels": self.tolerance *= self.mapCanvas.mapUnitsPerPixel()
def __init__(self, canvas, action): self.canvas = canvas self.active = False QgsMapTool.__init__(self, self.canvas) self.setAction(action) self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) mFillColor = QColor(254, 178, 76, 63) self.rubberBand.setColor(mFillColor) self.rubberBand.setWidth(1) self.reset()
def __init__(self, iface, callback): QgsMapTool.__init__(self,iface.mapCanvas()) self.iface = iface self.canvas = iface.mapCanvas() self.cursor = QCursor(Qt.CrossCursor) self.callback = callback self.rubberBand = QgsRubberBand(self.canvas, False) self.points = [] self.rubberBand.setColor(Qt.red) self.rubberBand.setWidth(1.6)
def __init__(self, iface, observationType): self.iface = iface QgsMapTool.__init__(self, iface.mapCanvas()) self.observationType = observationType # distance or orientation self.settings = MySettings() self.lineRubber = QgsRubberBand(self.canvas()) self.editing = False self.layer = None self.observationType = self.observationType.lower().title() if self.observationType not in ("Orientation", "Distance"): raise NameError("Wrong observation type")
def __init__(self, canvas, action, main): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.action = action self.index = None #self.poly_layer = None #self.poly_path = None #self.poly_layer_name = parcel # large polygons # smaller polygons #self.in_poly_layers = buildings self.main = main
def __init__(self, canvas, layer, Parent): QgsMapTool.__init__(self, canvas) self.Parent = Parent self.canvas = canvas self.layer = layer self.geom = None self.rb = None self.x0 = None self.y0 = None #our own fancy cursor self.cursor = QCursor(Qt.CrossCursor)
def __init__(self, iface, layer): QgsMapTool.__init__(self, iface.mapCanvas()) self.iface = iface self.canvas = iface.mapCanvas() self.layer = layer self.rubberband = QgsRubberBand(iface.mapCanvas(), QGis.Line) self.rubberband.setColor(QColor("#ee5555")) self.rubberband.setWidth(2) self.firstPoint = None self.messageBarItem = None self.geometry = None
def __init__(self, canvas, diagonal=200): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.vertexMarker = None self.rubberBand = None self.capturedPoint = None self.derivedPolygon = [] self.capturing = False # self.setLayers(pointLayer, polygonLayer) self.setDiagonal(diagonal) self.setCursor(Qt.CrossCursor)
def __init__(self, canvas, layer, callback): QgsMapTool.__init__(self, canvas) self._canvas = canvas self._layer = layer self._callback = callback self._pixels = [] self._start_point = None self._mode = Mode.NONE self._rubber_band = QgsRubberBand(self._canvas) self._rubber_band.setColor(Qt.red) self._rubber_band.setWidth(1) self.parent().setCursor(Qt.CrossCursor)
def __init__(self, canvas): """Constructor""" QgsMapTool.__init__(self, canvas) self.canvas = canvas self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) color = QColor(30, 230, 30, 65) self.rubberBand.setColor(color) self.rubberBand.setWidth(1) self.start_point = self.end_point = None
def __init__(self, canvas, button, callback_on_draw_finish): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.callback_on_draw_finish = callback_on_draw_finish self.isEmittingPoint = False self.map_visualisation = PolygonDrawMapVisualisation(self.canvas) self.selection_vis = SelectionVisualisation(self.canvas) # self.selection_vis_hover = SelectionVisualisation( # self.canvas, color=Qt.red) self.setButton(button)
def __init__(self, canvas: QgsMapCanvas) -> None: QgsMapTool.__init__(self, canvas) mFillColor = QColor(254, 178, 76, 63) self.canvas = canvas self.active = True self.rubberBand = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rubberBand.setColor(mFillColor) self.rubberBand.setWidth(1) self.reset()
def __init__(self, iface, layer): QgsMapTool.__init__(self, iface.mapCanvas() ) self.iface = iface self.canvas = iface.mapCanvas() self.layer = layer self.rubberband = QgsRubberBand( iface.mapCanvas(), layer.geometryType() ) self.rubberband.setColor( QColor( "#ee5555" ) ) self.rubberband.setWidth( 2 ) self.tempRubberband = QgsRubberBand( iface.mapCanvas(), layer.geometryType() ) self.tempRubberband.setColor( QColor( "#ee5555" ) ) self.tempRubberband.setWidth( 2 ) self.tempRubberband.setLineStyle(Qt.DotLine)
def __init__(self, canvas, iface, selected): QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface l = iface.activeLayer() stra = str(type(self.canvas)) b = str(type(l)) self.exportProgress(stra) self.exportProgress(b) self.canvas = canvas self.selected = selected # keep a record of all features clicked upon self.setCursor(Qt.ArrowCursor) self.exportProgress('Done with __init__')
def __init__(self, canvas): QgsMapTool.__init__(self, canvas) self.dlg = GeometryShapesDialog() self.capturing = False self.startPoint = None self.endPoint = None self.rubberBand = None self.helperBand = None self.canvas = canvas cursor = QgsApplication.getThemeCursor( QgsApplication.Cursor.CapturePoint) self.setCursor(cursor)
def __init__( self, iface, button ): QgsMapTool.__init__( self, iface.mapCanvas() ) self.canvas = iface.mapCanvas() self.cursor = QCursor( Qt.CrossCursor ) self.button = button self.msgBar = iface.messageBar() settings = QSettings() currentProfileColor = settings.value( "/QGEP/CurrentProfileColor", u'#FF9500' ) self.rubberBand = QgsRubberBand( self.canvas ) self.rubberBand.setColor( QColor( currentProfileColor ) ) self.rubberBand.setWidth( 3 )
def __init__(self, iface): self.iface = iface self.canvas = iface.mapCanvas() self.bsplineCanvas = BSplineCanvas(self.canvas) QgsMapTool.__init__(self, self.canvas) # create toolbar self.toolbar = self.iface.addToolBar(u'BSpline') self.toolbar.setObjectName(u'BSpline') # initialize action self.action = None
def __init__(self, iface): self.iface = iface self.canvas = self.iface.mapCanvas() QgsMapTool.__init__(self, self.canvas) # Snapper object that reads the settings from project and applies to the map canvas self._snapper = QgsMapCanvasSnapper(self.canvas) # Dialog for setting textual attributes of the spatial unit being digitized. self._editorWidget = None # Initial context menu state of the map canvas self._mpCanvasContentMenuPolicy = self.canvas.contextMenuPolicy()
def __init__(self, plugin): """Tool initialization """ QgsMapTool.__init__(self, plugin.canvas) self.canvas = plugin.canvas self.plugin = plugin self.featuresFound = [] self.ixFeature = 0 self.__pos = None self.chooserDlg = None self.request = QgsFeatureRequest() self.request.setFlags(QgsFeatureRequest.Flags(QgsFeatureRequest.NoGeometry | QgsFeatureRequest.ExactIntersect))
def __init__(self, iface, button): QgsMapTool.__init__(self, iface.mapCanvas()) self.canvas = iface.mapCanvas() self.cursor = QCursor(Qt.CrossCursor) self.button = button self.msgBar = iface.messageBar() settings = QSettings() current_profile_color = settings.value( "/QGEP/CurrentProfileColor", u'#FF9500') self.rubberBand = QgsRubberBand(self.canvas) self.rubberBand.setColor(QColor(current_profile_color)) self.rubberBand.setWidth(3)
def __init__(self, iface, parent): """ Initialize the draw polygon class :param iface: Interface to be displayed :param parent: Parent dialog, which initialized the class (should be JobAdaptDialog) """ canvas = iface QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.parent = parent self.status = 0 self.rb = QgsRubberBand(self.canvas, QgsWkbTypes.PolygonGeometry) self.rb.setColor(QColor(254, 178, 76, 63))
def __init__(self, iface, settings, action, index_action, controller, srid): ''' Class constructor ''' self.iface = iface self.canvas = self.iface.mapCanvas() self.settings = settings self.index_action = index_action self.controller = controller self.srid = srid self.elem_type_type = self.settings.value('insert_values/'+str(index_action)+'_elem_type_type') self.schema_name = controller.schema_name self.dao = controller.dao self.table_node = self.settings.value('db/table_node', 'v_edit_node') QgsMapTool.__init__(self, self.canvas) self.setAction(action)
def __init__(self, iface): """ Constructor :param iface: interface """ QgsMapTool.__init__(self, iface.mapCanvas()) self.__iface = iface self.icon_path = ':/plugins/VDLTools/icons/intersect_icon.png' self.text = QCoreApplication.translate("VDLTools", "From intersection") self.setCursor(Qt.ArrowCursor) self.__lineLayerID = None self.__pointLayerID = None self.__rubber = None self.ownSettings = None self.__isEditing = False self.__distance = 0
def __init__(self, iface, provinces_layer): """Constructor. :param iface: A QGIS QgisInterface instance. :type iface: QgisInterface :param provinces_layer: A layer containing provincial boundaries. :type provinces_layer: QgsVectorLayer """ canvas = iface.mapCanvas() QgsMapTool.__init__(self, canvas) self.canvas = canvas self.iface = iface self.provinces_layer = provinces_layer self.message_bar = None self.progress_bar = None