当前位置: 首页>>代码示例>>Python>>正文


Python gui.QgsMapTool类代码示例

本文整理汇总了Python中qgis.gui.QgsMapTool的典型用法代码示例。如果您正苦于以下问题:Python QgsMapTool类的具体用法?Python QgsMapTool怎么用?Python QgsMapTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QgsMapTool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    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()
开发者ID:piMoll,项目名称:SEILAPLAN,代码行数:26,代码来源:ptmaptool.py

示例2: __init__

    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
开发者ID:norBIT,项目名称:alkisplugin,代码行数:28,代码来源:qgisclasses.py

示例3: __init__

 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
开发者ID:lcoandrade,项目名称:DsgTools,代码行数:27,代码来源:multiLayerSelect.py

示例4: activate

 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
开发者ID:lucasAlonso,项目名称:intersectit,代码行数:29,代码来源:dimensioneditmaptool.py

示例5: activate

 def activate(self):
     """
     Gets called when the tool is activated
     """
     QgsMapTool.activate(self)
     self.canvas.setCursor(self.cursor)
     self.button.setChecked(True)
开发者ID:QGEP,项目名称:qgepplugin,代码行数:7,代码来源:qgepmaptools.py

示例6: __init__

 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",
         "                ",
         "       +.+      ",
         "      ++.++     ",
         "     +.....+    ",
         "    +.     .+   ",
         "   +.   .   .+  ",
         "  +.    .    .+ ",
         " ++.    .    .++",
         " ... ...+... ...",
         " ++.    .    .++",
         "  +.    .    .+ ",
         "   +.   .   .+  ",
         "   ++.     .+   ",
         "    ++.....+    ",
         "      ++.++     ",
         "       +.+      "]))
开发者ID:GEO-IASS,项目名称:Roam,代码行数:35,代码来源:inspectiontool.py

示例7: __init__

 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
开发者ID:gusthiot,项目名称:VDLTools,代码行数:34,代码来源:drawndown_tool.py

示例8: __init__

 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
开发者ID:gusthiot,项目名称:VDLTools,代码行数:34,代码来源:profile_tool.py

示例9: deactivate

 def deactivate(self):
     self.initVariable()
     if self.toolAction:
         self.toolAction.setChecked(False)
     if self is not None:
         QgsMapTool.deactivate(self)
         self.canvas.unsetMapTool(self)
开发者ID:lcoandrade,项目名称:DsgTools,代码行数:7,代码来源:geometricaAquisition.py

示例10: deactivate

 def deactivate(self):
     """
     When the action is deselected
     """
     if self.__dockWdg is not None:
         self.__dockWdg.close()
     QgsMapTool.deactivate(self)
开发者ID:gusthiot,项目名称:VDLTools,代码行数:7,代码来源:drawndown_tool.py

示例11: deactivate

 def deactivate(self):
     """
     Disable the tool.
     """
     self.rubber_band.reset(QGis.Polygon)
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
开发者ID:easmetz,项目名称:inasafe,代码行数:7,代码来源:rectangle_map_tool.py

示例12: __init__

    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()
开发者ID:Giswater,项目名称:giswater_qgis_plugin,代码行数:29,代码来源:parent.py

示例13: __init__

 def __init__(self, canvas, layer):
     """ Constructor.
     """
     QgsMapTool.__init__(self, canvas)
     self.canvas = canvas
     self.layer = layer
     self.setCursor(Qt.CrossCursor)
开发者ID:wqjzzgci,项目名称:pyqgis-samples,代码行数:7,代码来源:qgis-sample-QgsMapTool.py

示例14: __init__

 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",
                                    "                ",
                                    "       +.+      ",
                                    "      ++.++     ",
                                    "     +.....+    ",
                                    "    +.  .  .+   ",
                                    "   +.   .   .+  ",
                                    "  +.    .    .+ ",
                                    " ++.    .    .++",
                                    " ... ...+... ...",
                                    " ++.    .    .++",
                                    "  +.    .    .+ ",
                                    "   +.   .   .+  ",
                                    "   ++.  .  .+   ",
                                    "    ++.....+    ",
                                    "      ++.++     ",
                                    "       +.+      "]))
开发者ID:sagost,项目名称:VideoUavTracker,代码行数:30,代码来源:AddPoint.py

示例15: deactivate

 def deactivate(self):
     """
     Disable the tool.
     """
     self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
     QgsMapTool.deactivate(self)
     self.deactivated.emit()
开发者ID:inasafe,项目名称:inasafe,代码行数:7,代码来源:rectangle_map_tool.py


注:本文中的qgis.gui.QgsMapTool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。