Example #1
0
    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()
Example #2
0
    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
Example #3
0
 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
Example #4
0
 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",
                                    "                ",
                                    "       +.+      ",
                                    "      ++.++     ",
                                    "     +.....+    ",
                                    "    +.  .  .+   ",
                                    "   +.   .   .+  ",
                                    "  +.    .    .+ ",
                                    " ++.    .    .++",
                                    " ... ...+... ...",
                                    " ++.    .    .++",
                                    "  +.    .    .+ ",
                                    "   +.   .   .+  ",
                                    "   ++.  .  .+   ",
                                    "    ++.....+    ",
                                    "      ++.++     ",
                                    "       +.+      "]))
Example #5
0
 def deactivate(self):
     """
     When the action is deselected
     """
     if self.__dockWdg is not None:
         self.__dockWdg.close()
     QgsMapTool.deactivate(self)
Example #6
0
    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()
Example #7
0
 def activate(self):
     """
     Gets called when the tool is activated
     """
     QgsMapTool.activate(self)
     self.canvas.setCursor(self.cursor)
     self.button.setChecked(True)
Example #8
0
 def __init__(self, iface):
     """
     Constructor
     :param iface: interface
     """
     QgsMapTool.__init__(self, iface.mapCanvas())
     self.__clear()
 def activate(self):
     QgsMapTool.activate(self)
     self.lineRubber.setWidth(self.settings.value("rubberWidth"))
     self.lineRubber.setColor(self.settings.value("rubberColor"))
     layerid = self.settings.value("dimension"+self.observationType+"Layer")
     layer = QgsMapLayerRegistry.instance().mapLayer(layerid)
     if layer is None:
         self.iface.messageBar().pushMessage("Intersect It", "Dimension layer must defined.",
                                             QgsMessageBar.WARNING, 3)
         self.mapCanvas.unsetMapTool(self)
         return
     if not layer.isEditable():
         self.iface.messageBar().pushMessage("Intersect It", "Dimension layer must be editable to edit arcs.",
                                             QgsMessageBar.WARNING, 3)
         self.mapCanvas.unsetMapTool(self)
         return
     # unset this tool if the layer is removed
     layer.layerDeleted.connect(self.unsetMapTool)
     # create snapper for this layer
     self.snapLayer = QgsSnapper.SnapLayer()
     self.snapLayer.mLayer = layer
     self.snapLayer.mSnapTo = QgsSnapper.SnapToVertexAndSegment
     self.snapLayer.mTolerance = self.settings.value("selectTolerance")
     if self.settings.value("selectUnits") == "map":
         self.snapLayer.mUnitType = QgsTolerance.MapUnits
     else:
         self.snapLayer.mUnitType = QgsTolerance.Pixels
     self.editing = False
     self.drawObject = None
Example #10
0
 def activate(self):
     """
     Activate tool.
     """
     if self.toolAction:
         self.toolAction.setChecked(True)
     QgsMapTool.activate(self)
Example #11
0
 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
Example #12
0
 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
Example #13
0
 def deactivate(self):
     """
     Disable the tool.
     """
     self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
Example #14
0
 def deactivate(self):
     """
     When the action is deselected
     """
     self.__cancel()
     self.__rubber = None
     QgsMapTool.deactivate(self)
Example #15
0
 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):
     """ Constructor.
     """
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.layer = layer
     self.setCursor(Qt.CrossCursor)
Example #17
0
 def deactivate(self):
     """
     Disable the tool.
     """
     self.rubber_band.reset(QGis.Polygon)
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
 def deactivate(self):
     self.initVariable()
     if self.toolAction:
         self.toolAction.setChecked(False)
     if self is not None:
         QgsMapTool.deactivate(self)
         self.canvas.unsetMapTool(self)
Example #19
0
 def canvasDoubleClickEvent(self,event):
     self.points.append(QgsPoint( self.toMapCoordinates( event.pos()) ))
     if len(self.points) <= 1 : return
   
     self.rubberBand.setToGeometry( QgsGeometry.fromPolyline(self.points), None )
     self.callback( self.rubberBand )
     QgsMapTool.deactivate(self)
 def deactivate(self):
     self.lineRubber.reset()
     if self.layer is not None:
         try:
             self.layer.layerDeleted.disconnect(self.unsetMapTool)
         except TypeError:
             pass
     QgsMapTool.deactivate(self)
Example #21
0
 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)
Example #22
0
 def activate(self):
     """
     Activates tool.
     """
     if self.toolAction:
         self.activated = True
     QgsMapTool.activate(self)
     self.canvas.setMapTool(self)
 def activate(self):
     QgsMapTool.activate(self)
     self.rubber.setWidth(self.settings.value("rubberWidth"))
     self.rubber.setColor(self.settings.value("rubberColor"))
     self.updateSnapperList()
     self.mapCanvas.layersChanged.connect(self.updateSnapperList)
     self.mapCanvas.scaleChanged.connect(self.updateSnapperList)
     self.checkLayer()
Example #24
0
 def deactivate(self):
     """
     Deactivates the tool and hides the rubber band
     """
     self.rubberBand.hide()
     QgsMapTool.deactivate(self)
     # restore mouse in case tool is disabled right after rotation
     QtGui.QApplication.restoreOverrideCursor()
Example #25
0
 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
Example #26
0
 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 deactivate(self):
     self.lineRubber.reset()
     layer = QgsMapLayerRegistry.instance().mapLayer(self.settings.value("dimension"+self.observationType+"Layer"))
     if layer is not None:
         try:
             layer.layerDeleted.disconnect(self.unsetMapTool)
         except TypeError:
             pass
     QgsMapTool.deactivate(self)
Example #28
0
 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
Example #29
0
 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()
Example #30
0
 def deactivate(self):
     """
     When the action is deselected
     """
     self.canvas().scene().removeItem(self.__rubberLine)
     self.__rubberLine = None
     if self.__dockWdg is not None:
         self.__dockWdg.close()
     QgsMapTool.deactivate(self)
Example #31
0
 def deactivate(self):
     QgsMapTool.deactivate(self)
     # noinspection PyUnresolvedReferences
     self.deactivated.emit()
Example #32
0
def __init__(self, iface):
    print "init"

    canvas = iface.mapCanvas()
    QgsMapTool.__init__(self,canvas)
    self.canvas = canvas
 def deactivate(self):
     self.rb.reset(True)
     QgsMapTool.deactivate(self)
Example #34
0
 def __init__(self, canvas):
     # print "SpectralAngleMapTool"
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.cursor = QtGui.QCursor(QtCore.Qt.CrossCursor)
Example #35
0
 def activate(self):
     QgsMapTool.activate(self)
     self.canvas.setCursor(self.cursor)
     self.button.setCheckable(True)
     self.button.setChecked(True)
Example #36
0
 def __init__(self, iface, aoi_list, WSM):
     QgsMapTool.__init__(self, iface.mapCanvas())
     self.iface = iface
     self.aoi_list = aoi_list
     self.WSM = WSM
 def __init__(self, canvas):
     self.mCanvas = canvas
     QgsMapTool.__init__(self, self.mCanvas)
     self.mCurrentMoveAction = QgsAnnotationItem.NoAction
     self.mLastMousePosition = QPointF(0, 0)
     self.mCursor = QCursor(Qt.ArrowCursor)
 def deactivate(self) -> None:
     self.rubberBand.hide()
     QgsMapTool.deactivate(self)
Example #39
0
    def __init__(self, canvas):
        QgsMapTool.__init__(self, canvas)

        self.canvas = canvas
        self.cursor = Qt.CrossCursor
Example #40
0
 def __init__(self, canvas):
     QgsMapTool.__init__(self, canvas)
     self.setCursor(Qt.CrossCursor)
     apiKey = pluginSetting("apiKey")
     self.w3w = what3words(apikey=apiKey)
Example #41
0
 def __init__(self, canvas):
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.iface = iface
 def deactivate(self):
     """
     Disable the tool.
     """
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
Example #43
0
 def wheelEvent(self, event):
    QgsMapTool.wheelEvent(self, event)
    self.__csrRubberBand.moveEvent(self.toMapCoordinates(event.pos()))
Example #44
0
 def deactivate(self):
     self.rubberBandPt.reset(QGis.Point)
     #         self.rubberBand.reset(QGis.Line)
     QgsMapTool.deactivate(self)
     self.emit(SIGNAL("deactivated()"))
Example #45
0
 def deactivate(self):
     # self.emit( SIGNAL("deactivate") )
     # self.canvas.setCursor( QCursor(Qt.ArrowCursor))
     QgsMapTool.deactivate(self)
Example #46
0
 def __init__(self, canvas, municipios_layer):
     QgsMapTool.__init__(self, canvas)
     self.municipios_layer = municipios_layer
     self.canvas = canvas
Example #47
0
 def activate(self):
     QgsMapTool.activate(self)
     self.canvas.setCursor(self.cursor)
Example #48
0
 def __init__(self, canvas, button):
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.cursor = QCursor(Qt.CrossCursor)
     self.button = button
Example #49
0
 def __init__(self, canvas, gui):
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.gui = gui
Example #50
0
 def activate(self):
     QgsMapTool.activate(self)
Example #51
0
 def deactivate(self):
     QgsMapTool.deactivate(self)
     self.canvas.unsetMapTool(self)
Example #52
0
 def deactivate(self):
     self.desactivate.emit()
     QgsMapTool.deactivate(self)
Example #53
0
 def activate(self):
     """
     Activates the tool
     """
     QgsMapTool.activate(self)
 def __init__(self, iface, parent):
     QgsMapTool.__init__(self, iface.mapCanvas())
     self.iface = iface
     self.canvas = iface.mapCanvas()
     self.measureDialog = GeodesicMeasureDialog(iface, parent)
Example #55
0
 def deactivate(self):
     self.rb.reset(QgsWkbTypes.PolygonGeometry)
     QgsMapTool.deactivate(self)
Example #56
0
 def deactivate(self):
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
Example #57
0
 def __init__(self, canvas):
     # logger.debug("SpectralAngleMapTool")
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.cursor = QtGui.QCursor(QtCore.Qt.CrossCursor)
Example #58
0
 def __init__(self, canvas, button):
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     # self.cursor = QCursor(Qt.CrossCursor)
     self.cursor = QCursor(QPixmap(identify_cursor), 1, 1)
     self.button = button
 def deactivate(self):
     QgsMapTool.deactivate(self)
     self.emit(SIGNAL("deactivated()"))
Example #60
0
 def deactivate(self):
     self.rubber_band.hide()
     QgsMapTool.deactivate(self)