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


Python QgsWkbTypes.PointGeometry方法代码示例

本文整理汇总了Python中qgis.core.QgsWkbTypes.PointGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python QgsWkbTypes.PointGeometry方法的具体用法?Python QgsWkbTypes.PointGeometry怎么用?Python QgsWkbTypes.PointGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsWkbTypes的用法示例。


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

示例1: enableTools

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def enableTools(self):
        self.digitizeAction.setEnabled(False)
        self.lineDigitizeAction.setEnabled(False)
        self.flipHorizontalAction.setEnabled(False)
        self.flipVerticalAction.setEnabled(False)
        self.rotate180Action.setEnabled(False)
        self.rotate90CWAction.setEnabled(False)
        self.rotate90CCWAction.setEnabled(False)
        layer = self.iface.activeLayer()

        if not layer or not layer.isValid() or (layer.type() != QgsMapLayer.VectorLayer) or not layer.isEditable():
            return
        wkbtype = layer.wkbType()
        geomtype = QgsWkbTypes.geometryType(wkbtype)
        self.lineDigitizeAction.setEnabled(True)
        if geomtype == QgsWkbTypes.PointGeometry or geomtype == QgsWkbTypes.LineGeometry:
            self.digitizeAction.setEnabled(True)
        if geomtype == QgsWkbTypes.LineGeometry or geomtype == QgsWkbTypes.PolygonGeometry:
            self.flipHorizontalAction.setEnabled(True)
            self.flipVerticalAction.setEnabled(True)
            self.rotate180Action.setEnabled(True)
            self.rotate90CWAction.setEnabled(True)
            self.rotate90CCWAction.setEnabled(True) 
开发者ID:NationalSecurityAgency,项目名称:qgis-shapetools-plugin,代码行数:25,代码来源:shapeTools.py

示例2: enableScale

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def enableScale(self):
        """
        The scale combo should only be enabled for point layers
        """
        currentLayer = self.getIterateLayer()
        if QgsMapLayer is not None and currentLayer:
                if currentLayer.type() == QgsMapLayer.VectorLayer:
                    if currentLayer.geometryType() == QgsWkbTypes.PointGeometry:
                        self.mScaleWidget.setEnabled(True)
                        self.mScaleWidget.show()
                        self.zoomPercentageSpinBox.setEnabled(False)
                        self.zoomPercentageSpinBox.hide()
                    else:
                        self.mScaleWidget.setEnabled(False)
                        self.mScaleWidget.hide()
                        self.zoomPercentageSpinBox.setEnabled(True)
                        self.zoomPercentageSpinBox.show() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:19,代码来源:inspectFeatures.py

示例3: zoomFeature

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def zoomFeature(self, zoom, idDict = None):
        """
        Zooms to current layer selected features according to a specific zoom
        zoom: zoom to be applied
        """
        idDict = dict() if idDict is None else idDict
        currentLayer = self.getIterateLayer()
        if idDict == {}:
            self.zoomToLayer(currentLayer, zoom=float(zoom))
        else:
            id = idDict['id']
            lyr = idDict['lyr']
            selectIdList = lyr.selectedFeatureIds()
            lyr.removeSelection()
            lyr.selectByIds([id])
            self.zoomToLayer(layer = lyr, zoom=float(zoom))
            lyr.selectByIds(selectIdList)

        if self.getIterateLayer().geometryType() == QgsWkbTypes.PointGeometry:
            self.iface.mapCanvas().zoomScale(float(zoom)) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:22,代码来源:inspectFeatures.py

示例4: resetEditingSignals

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def resetEditingSignals(self, currentLayer):
        """
        Disconnects editing signal from previously selected layer and connects it to newly selected layer.
        Method is called whenever currentlLayerChanged signal is emitted.
        """
        # get previous selected layer
        prevLayer = self.currentLayer
        # update current selected layer
        if not currentLayer:
            self.currentLayer = currentLayer
        self.activateAlias = partial(self.activateValueSetter, True)
        self.deactivateAlias = partial(self.activateValueSetter, False)
        if prevLayer:
            try:
                # if there was a previous selection, signals must be disconnected from it before connecting to the new layer
                prevLayer.editingStarted.disconnect(self.activateAlias)
                prevLayer.editingStopped.disconnect(self.deactivateAlias)
            except:
                # in case signal is not yet connected, somehow
                pass
        # connecting signals to new layer
        if isinstance(self.currentLayer, QgsVectorLayer):
            if self.currentLayer.geometryType() == QgsWkbTypes.PointGeometry:
                self.currentLayer.editingStarted.connect(self.activateAlias)
                self.currentLayer.editingStopped.connect(self.deactivateAlias) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:27,代码来源:dsgRasterInfoTool.py

示例5: sortFeatures

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def sortFeatures(self, geom, features):
        """
        Sorts features according to the distance
        """
        #sorting by distance
        distances = []
        
        firstPoint = geom.asPolyline()[0]
        pointGeom = QgsGeometry.fromPointXY(firstPoint)

        for intersected in features:
            intersection = geom.intersection(intersected.geometry())
            if intersection.type() == QgsWkbTypes.PointGeometry:
                distance = intersection.distance(pointGeom)
                distances.append((distance, intersected))
        
        ordered = sorted(distances, key=self.getKey)
        #returning a list of tuples (distance, feature)
        return ordered 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:21,代码来源:contour_tool.py

示例6: enableDigitizeTool

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def enableDigitizeTool(self):
        self.digitizeAction.setEnabled(False)
        layer = self.iface.activeLayer()

        if layer is not None and isinstance(layer, QgsVectorLayer) and (layer.geometryType() == QgsWkbTypes.PointGeometry) and layer.isEditable():
            self.digitizeAction.setEnabled(True)
        else:
            if self.digitizerDialog is not None:
                self.digitizerDialog.close() 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:11,代码来源:latLonTools.py

示例7: RemoveCanvasRubberbands

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def RemoveCanvasRubberbands(self):
        ''' Remove Canvas Rubberbands '''
        self.poly_Canvas_RubberBand.reset()
        self.Track_Canvas_RubberBand.reset(QgsWkbTypes.LineGeometry)
        self.Cursor_Canvas_RubberBand.reset(QgsWkbTypes.PointGeometry) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:7,代码来源:QgsVideo.py

示例8: leaveEvent

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def leaveEvent(self, _):
        """
        @type _: QEvent
        @param _:
        @return:
        """
        # Remove coordinates label value
        self.parent.lb_cursor_coord.setText("")
        # Change cursor
        self.setCursor(QCursor(Qt.ArrowCursor))
        # Reset mouse rubberband
        self.Cursor_Canvas_RubberBand.reset(QgsWkbTypes.PointGeometry) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:14,代码来源:QgsVideo.py

示例9: setNewId

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def setNewId(self, newId):
        if not isinstance(self.sender(), QSpinBox):
            self.idSpinBox.setValue(newId)
        else:
            currentLayer = self.getIterateLayer()
            lyrName = currentLayer.name()
            if lyrName not in list(self.allLayers.keys()):
                self.allLayers[lyrName] = 0
                return
            oldIndex = self.allLayers[lyrName]
            if oldIndex == 0:
                return
            featIdList = self.getFeatIdList(currentLayer)
            if oldIndex not in featIdList:
                oldIndex = 0
            zoom = self.mScaleWidget.scale() if currentLayer.geometryType() == QgsWkbTypes.PointGeometry else self.zoomPercentageSpinBox.value()
            if oldIndex == newId:
                # self.iface.messageBar().pushMessage(self.tr('Warning!'), self.tr('Selected id does not exist in layer {0}. Returned to previous id.').format(lyrName), level=Qgis.Warning, duration=2)
                return
            try:
                index = featIdList.index(newId)
                self.allLayers[lyrName] = index
                self.makeZoom(zoom, currentLayer, newId)
                self.idSpinBox.setSuffix(' ({0}/{1})'.format(index+1,len(featIdList)))
            except:
                # self.iface.messageBar().pushMessage(self.tr('Warning!'), self.tr('Selected id does not exist in layer {0}. Returned to previous id.').format(lyrName), level=Qgis.Warning, duration=2)
                self.idSpinBox.setValue(oldIndex)
                self.makeZoom(zoom, currentLayer, oldIndex) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:30,代码来源:inspectFeatures.py

示例10: canvasMoveEvent

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def canvasMoveEvent(self, event):
        if self.snapCursorRubberBand:
            self.snapCursorRubberBand.hide()
            self.snapCursorRubberBand.reset(geometryType=QgsWkbTypes.PointGeometry)
            self.snapCursorRubberBand = None
        oldPoint = QgsPointXY(event.mapPoint())
        event.snapPoint()
        point = QgsPointXY(event.mapPoint())
        if oldPoint != point:
            self.createSnapCursor(point)
        if self.startPoint:
            self.endPoint = QgsPointXY(event.mapPoint())
            self.showCircle(self.startPoint, self.endPoint) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:15,代码来源:circle.py

示例11: canvasMoveEvent

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def canvasMoveEvent(self, event):
        if self.snapCursorRubberBand:
            self.snapCursorRubberBand.hide()
            self.snapCursorRubberBand.reset(geometryType=QgsWkbTypes.PointGeometry)
            self.snapCursorRubberBand = None
        oldPoint = QgsPointXY(event.mapPoint())
        event.snapPoint()
        point = QgsPointXY(event.mapPoint())
        if oldPoint != point:
            self.createSnapCursor(point)
        if self.rubberBand:
            if self.qntPoint == 1:
                self.distanceToolTip.canvasMoveEvent(self.geometry[0], point)
                geom = QgsGeometry.fromPolylineXY([self.geometry[0], point])
                self.rubberBand.setToGeometry(geom, None)
            elif self.qntPoint >= 2:                
                if self.free:
                    self.distanceToolTip.canvasMoveEvent(self.geometry[-1], point)
                    geom = QgsGeometry.fromPolygonXY([self.geometry+[QgsPointXY(point.x(), point.y())]])
                    self.rubberBand.setToGeometry(geom, None)
                else:   
                    if (self.qntPoint % 2 == 1): 
                        self.setAvoidStyleSnapRubberBand()
                    else:
                        self.setAllowedStyleSnapRubberBand()     
                    projectedMousePoint = self.projectPoint(self.geometry[-2], self.geometry[-1], point)
                    self.distanceToolTip.canvasMoveEvent(self.geometry[-1], projectedMousePoint)
                    if projectedMousePoint:
                        geom, pf = self.completePolygon(self.geometry, projectedMousePoint)
                        self.rubberBand.setToGeometry(geom, None)
        else:
            self.initVariable() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:34,代码来源:polygon.py

示例12: setToolEnabled

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def setToolEnabled(self):
        layer = self.iface.activeLayer()  
        if not isinstance(layer, QgsVectorLayer) or layer.geometryType() == QgsWkbTypes.PointGeometry or not layer.isEditable():
            enabled = False
        else:
            enabled = True
        if not enabled and self.tool:
            self.tool.deactivate()
        if self.polygonAction:
            self.polygonAction.setEnabled(enabled)
        if self.circleAction:
            self.circleAction.setEnabled(enabled)
        return enabled 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:15,代码来源:acquisition.py

示例13: __init__

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def __init__(self, parent=None):
        ''' Constructor '''
        super().__init__(parent)
        self.surface = VideoWidgetSurface(self)
        self.setAttribute(Qt.WA_OpaquePaintEvent)

        self.Tracking_Video_RubberBand = QRubberBand(QRubberBand.Rectangle, self)
        self.Censure_RubberBand = QRubberBand(QRubberBand.Rectangle, self)

        color_blue = QColor(Qt.blue)
        color_black = QColor(Qt.black)
        color_amber = QColor(252, 215, 108)

        pal_blue = QPalette()
        pal_blue.setBrush(QPalette.Highlight, QBrush(color_blue))
        self.Tracking_Video_RubberBand.setPalette(pal_blue)

        pal_black = QPalette()
        pal_black.setBrush(QPalette.Highlight, QBrush(color_black))
        self.Censure_RubberBand.setPalette(pal_black)

        self._interaction = InteractionState()
        self._filterSatate = FilterState()

        self._isinit = False
        self._MGRS = False
        self.gt = None

        self.drawCesure = []
        self.poly_coordinates, self.drawPtPos, self.drawLines, self.drawMeasureDistance, self.drawMeasureArea, self.drawPolygon = [], [], [], [], [], []
        # Draw Polygon Canvas Rubberband
        self.poly_Canvas_RubberBand = QgsRubberBand(
            iface.mapCanvas(), True)  # Polygon type
        # set rubber band style
        self.poly_Canvas_RubberBand.setColor(color_amber)
        self.poly_Canvas_RubberBand.setWidth(3)

        # Tracking Canvas Rubberband
        self.Track_Canvas_RubberBand = QgsRubberBand(
            iface.mapCanvas(), QgsWkbTypes.LineGeometry)
        # set rubber band style
        self.Track_Canvas_RubberBand.setColor(color_blue)
        self.Track_Canvas_RubberBand.setWidth(5)

        # Cursor Canvas Rubberband
        self.Cursor_Canvas_RubberBand = QgsRubberBand(
            iface.mapCanvas(), QgsWkbTypes.PointGeometry)
        self.Cursor_Canvas_RubberBand.setWidth(4)
        self.Cursor_Canvas_RubberBand.setColor(QColor(255, 100, 100, 250))
        self.Cursor_Canvas_RubberBand.setIcon(QgsRubberBand.ICON_FULL_DIAMOND)

        self.parent = parent.parent()

        palette = self.palette()
        palette.setColor(QPalette.Background, Qt.transparent)
        self.setPalette(palette)

        self.origin, self.dragPos = QPoint(), QPoint()
        self.tapTimer = QBasicTimer()
        self.brush = QBrush(color_black)
        self.blue_Pen = QPen(color_blue, 3) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:63,代码来源:QgsVideo.py

示例14: iterateFeature

# 需要导入模块: from qgis.core import QgsWkbTypes [as 别名]
# 或者: from qgis.core.QgsWkbTypes import PointGeometry [as 别名]
def iterateFeature(self, method):
        """
        Iterates over the features selecting and zooming to the desired one
        method: method used to determine the desired feature index
        """
        currentLayer = self.getIterateLayer()
        lyrName = currentLayer.name()
        
        zoom = self.mScaleWidget.scale() if currentLayer.geometryType() == QgsWkbTypes.PointGeometry else self.zoomPercentageSpinBox.value()
        
        featIdList = self.getFeatIdList(currentLayer)
        
        if currentLayer and len(featIdList) > 0:
            #checking if this is the first time for this layer (currentLayer)
            first = False
            if lyrName not in list(self.allLayers.keys()):
                self.allLayers[lyrName] = 0
                first = True

            #getting the current index
            index = self.allLayers[lyrName]

            #getting max and min ids
            #this was made because the list is already sorted, there's no need to calculate max and min
            maxIndex = len(featIdList) - 1
            minIndex = 0
            
            self.idSpinBox.setMaximum(featIdList[maxIndex])
            self.idSpinBox.setMinimum(featIdList[minIndex])

            #getting the new index
            if not first:
                index = method(index, maxIndex, minIndex)
            self.idSpinBox.setSuffix(' ({0}/{1})'.format(index+1,len(featIdList)))
            self.allLayers[lyrName] = index

            #getting the new feature id
            id = featIdList[index]

            #adjustin the spin box value
            self.idxChanged.emit(id)

            self.makeZoom(zoom, currentLayer, id)
            self.selectLayer(id, currentLayer)
        else:
            self.errorMessage() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:48,代码来源:inspectFeatures.py


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