當前位置: 首頁>>代碼示例>>Python>>正文


Python Qgis.Info方法代碼示例

本文整理匯總了Python中qgis.core.Qgis.Info方法的典型用法代碼示例。如果您正苦於以下問題:Python Qgis.Info方法的具體用法?Python Qgis.Info怎麽用?Python Qgis.Info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qgis.core.Qgis的用法示例。


在下文中一共展示了Qgis.Info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: canvasReleaseEvent

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def canvasReleaseEvent(self, event):
        '''Capture the coordinate when the mouse button has been released,
        format it, and copy it to the clipboard. pt is QgsPointXY'''
        pt = self.snappoint(event.originalPixelPoint())
        self.removeVertexMarker()
        if settings.captureShowLocation:
            if self.marker is None:
                self.marker = QgsVertexMarker(self.canvas)
                self.marker.setIconSize(18)
                self.marker.setPenWidth(2)
                self.marker.setIconType(QgsVertexMarker.ICON_CROSS)
            self.marker.setCenter(pt)
        else:
            self.removeMarker()

        try:
            msg = self.formatCoord(pt, self.settings.delimiter)
            formatString = self.coordFormatString()
            if msg is not None:
                clipboard = QApplication.clipboard()
                clipboard.setText(msg)
                self.iface.messageBar().pushMessage("", "{} coordinate {} copied to the clipboard".format(formatString, msg), level=Qgis.Info, duration=4)
        except Exception as e:
            self.iface.messageBar().pushMessage("", "Invalid coordinate: {}".format(e), level=Qgis.Warning, duration=4) 
開發者ID:NationalSecurityAgency,項目名稱:qgis-latlontools-plugin,代碼行數:26,代碼來源:copyLatLonTool.py

示例2: log

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def log(message, level_in=0):
    """
    Writes to QGIS inbuilt logger accessible through panel.

    :param message: logging message to write, error or URL.
    :type message: str

    :param level_in: integer representation of logging level.
    :type level_in: int
    """
    if level_in == 0:
        level = Qgis.Info
    elif level_in == 1:
        level = Qgis.Warning
    elif level_in == 2:
        level = Qgis.Critical
    else:
        level = Qgis.Info

    QgsMessageLog.logMessage(message, PLUGIN_NAME.strip(), level) 
開發者ID:GIScience,項目名稱:orstools-qgis-plugin,代碼行數:22,代碼來源:logger.py

示例3: saveInfoToJson

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def saveInfoToJson(self):
        """ Save video Info to json """
        out_json, _ = askForFiles(self, QCoreApplication.translate(
            "QgsFmvPlayer", "Save Json"),
            isSave=True,
            exts="json")

        if not out_json:
            return

        taskSaveInfoToJson = QgsTask.fromFunction('Save Video Info to Json Task',
                                                  self.converter.probeToJson,
                                                  fname=self.fileName, output=out_json,
                                                  on_finished=self.finishedTask,
                                                  flags=QgsTask.CanCancel)

        QgsApplication.taskManager().addTask(taskSaveInfoToJson)
        return 
開發者ID:All4Gis,項目名稱:QGISFMV,代碼行數:20,代碼來源:QgsFmvPlayer.py

示例4: __init__

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def __init__(self, min, max, message, parent=None, timeout = 1.5):
        """
        Constructs a progress widget
        """
        super(self.__class__, self).__init__(parent)
        self.min = min
        self.max = max
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        if parent:
            self.setMinimumSize(parent.width(),40)
        else:
            self.setMinimumSize(766,40)
        self.setSizePolicy(sizePolicy)
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(min)
        self.progressBar.setMaximum(max)
        self.parent = parent
        self.msgBarItem = QgsMessageBarItem(self.tr("INFO: "), message, self.progressBar, level=Qgis.Info, duration=timeout, parent = self.parent)
        self.pushItem(self.msgBarItem)
        self.parent.repaint() 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:22,代碼來源:progressWidget.py

示例5: reclassify

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def reclassify(self):
        """
        Performs the actual reclassification, moving the geometry to the correct layer along with the specified attributes
        """
        if not self.checkConditions():
            return
        #button that sent the signal
        self.buttonName = self.sender().text().split(' [')[0].replace('&', '')
        (reclassificationLayer, self.category, self.edgvClass) = self.getLayerFromButton(self.buttonName)
        if reclassificationLayer is not None:
            reclassificationDict = self.reclassificationDict[self.category][self.edgvClass][self.buttonName]
            reclassifiedFeatures = self.layerHandler.reclassifySelectedFeatures(
                                        reclassificationLayer,
                                        reclassificationDict
                                    )
            self.iface.mapCanvas().refreshAllLayers()
            if reclassifiedFeatures > 0:
                self.iface.messageBar().pushMessage(
                    self.tr('Information!'),
                    self.tr('{} features reclassified with success!').format(reclassifiedFeatures),
                    level=Qgis.Info,
                    duration=3
                ) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:25,代碼來源:field_toolbox.py

示例6: flipSelectedLines

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def flipSelectedLines(self):
        """
        Method for flipping all selected lines. Used for button callback.
        """        
        # get all selected features and remove all features that are not lines
        selectedFeatures = self.getAllSelectedLines()
        pop = 0
        for idx, item in enumerate(selectedFeatures):
            if item[2] != 1:
                selectedFeatures.pop(idx-pop)
                pop += 1
        if not selectedFeatures:
            logMsg = self.getLogMessage(None, None)
            self.iface.messageBar().pushMessage(self.tr('Error'), logMsg, level=Qgis.Critical, duration=3)
            # QMessageBox.critical(self, self.tr('Critical!'), logMsg)
            QgsMessageLog.logMessage(logMsg, "DSGTools Plugin", Qgis.Critical)
            return
        # call the method for flipping features from geometry module
        flippedLines, failedLines = self.DsgGeometryHandler.flipFeatureList(featureList=selectedFeatures, debugging=True)
        logMsg = self.getLogMessage(flippedLines, failedLines)
        self.iface.messageBar().pushMessage(self.tr('Success'), logMsg, level=Qgis.Info, duration=3)
        QgsMessageLog.logMessage(logMsg, "DSGTools Plugin", Qgis.Info) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:24,代碼來源:flipLineTool.py

示例7: run

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def run(self, func, action):
        layer = self.canvas.currentLayer()
        if layer in self.iface.editableLayers():
            if layer.geometryType() in [QgsWkbTypes.LineGeometry , QgsWkbTypes.PolygonGeometry]:
                if self.tool:
                    self.tool.deactivate()
                self.tool = func(self.canvas, self.iface, action)
                self.tool.setAction(action)
                self.canvas.setMapTool(self.tool)
            else:
                self.iface.messageBar().pushMessage(self.tr('Warning'), self.tr('Tool not defined for points'),
                                                                    level=Qgis.Info, duration=3)
                self.tool.deactivate() if self.tool else ""
        else:
            self.iface.messageBar().pushMessage(self.tr('Warning'), self.tr('Start editing in current layer!'), level=Qgis.Info, duration=3)
            self.tool.deactivate() if self.tool else "" 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:18,代碼來源:acquisition.py

示例8: log_info

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def log_info(cls, msg):
        QgsMessageLog.logMessage(msg, tag="Raster Vision", level=Qgis.Info) 
開發者ID:azavea,項目名稱:raster-vision-qgis,代碼行數:4,代碼來源:log.py

示例9: copyCanvas

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def copyCanvas(self):
        extent = self.iface.mapCanvas().extent()
        canvasCrs = self.canvas.mapSettings().destinationCrs()
        if settings.bBoxCrs == 0 and canvasCrs != epsg4326:
            transform = QgsCoordinateTransform(canvasCrs, epsg4326, QgsProject.instance())
            p1x, p1y = transform.transform(float(extent.xMinimum()), float(extent.yMinimum()))
            p2x, p2y = transform.transform(float(extent.xMaximum()), float(extent.yMaximum()))
            extent.set(p1x, p1y, p2x, p2y)
        delim = settings.bBoxDelimiter
        prefix = settings.bBoxPrefix
        suffix = settings.bBoxSuffix
        precision = settings.bBoxDigits
        outStr = ''
        minX = extent.xMinimum()
        minY = extent.yMinimum()
        maxX = extent.xMaximum()
        maxY = extent.yMaximum()
        if settings.bBoxFormat == 0:  # minX,minY,maxX,maxY - using the delimiter
            outStr = '{:.{prec}f}{}{:.{prec}f}{}{:.{prec}f}{}{:.{prec}f}'.format(
                minX, delim, minY, delim, maxX, delim, maxY, prec=precision)
        elif settings.bBoxFormat == 1:  # minX,maxX,minY,maxY - Using the selected delimiter'
            outStr = '{:.{prec}f}{}{:.{prec}f}{}{:.{prec}f}{}{:.{prec}f}'.format(
                minX, delim, maxX, delim, minY, delim, maxY, prec=precision)
        elif settings.bBoxFormat == 2:  # x1 y1,x2 y2,x3 y3,x4 y4,x1 y1 - Polygon format
            outStr = '{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f}'.format(
                minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY, prec=precision)
        elif settings.bBoxFormat == 3:  # x1,y1 x2,y2 x3,y3 x4,y4 x1,y1 - Polygon format
            outStr = '{:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f} {:.{prec}f},{:.{prec}f}'.format(
                minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY, prec=precision)
        elif settings.bBoxFormat == 4:  # WKT Polygon
            outStr = extent.asWktPolygon()
        elif settings.bBoxFormat == 5:  # bbox: [minX, minY, maxX, maxY] - MapProxy
            outStr = 'bbox: [{}, {}, {}, {}]'.format(
                minX, minY, maxX, maxY)
        elif settings.bBoxFormat == 6:  # bbox: [minX, minY, maxX, maxY] - MapProxy
            outStr = 'bbox={},{},{},{}'.format(
                minX, minY, maxX, maxY)
        outStr = '{}{}{}'.format(prefix, outStr, suffix)
        clipboard = QApplication.clipboard()
        clipboard.setText(outStr)
        self.iface.messageBar().pushMessage("", "'{}' copied to the clipboard".format(outStr), level=Qgis.Info, duration=4) 
開發者ID:NationalSecurityAgency,項目名稱:qgis-latlontools-plugin,代碼行數:43,代碼來源:latLonTools.py

示例10: proto_method

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def proto_method(self, endpoint, **kwargs):
        kwargs['client_id'] =  CLIENT_ID
        res = requests.get(ROOT+endpoint, params=kwargs, proxies=getProxiesConf())
        if res.status_code == 200:
            return res.json()
        else:
            QgsMessageLog.logMessage("mapillary connection error: %d" % res.status_code, tag="go2mapillary",level=Qgis.Info) 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:9,代碼來源:mapillary_api.py

示例11: start

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def start(self,max=0, msg = ''):
        self.widget = self.iface.messageBar().createMessage(self.title,msg)
        self.progressBar = QProgressBar()
        self.progressBar.setRange(0,max)
        self.progressBar.setValue(0)
        self.progressBar.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.widget.layout().addWidget(self.progressBar)
        QApplication.processEvents()
        self.iface.messageBar().pushWidget(self.widget, Qgis.Info, 50)
        QApplication.processEvents() 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:12,代碼來源:mapillary_coverage.py

示例12: stop

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def stop(self, msg = ''):
        '''
        the progressbar is stopped with a succes message
        :param msg: string
        :return:
        '''
        self.iface.messageBar().clearWidgets()
        message = self.iface.messageBar().createMessage(self.title,msg)
        self.iface.messageBar().pushWidget(message, Qgis.Info, 2) 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:11,代碼來源:mapillary_coverage.py

示例13: __init__

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def __init__(self,module):
        self.module = module
        self.iface = module.iface
        self.cache_dir = os.path.join(tempfile.gettempdir(),'go2mapillary')
        QgsMessageLog.logMessage("CACHE_DIR"+self.cache_dir, tag="go2mapillary",level=Qgis.Info)
        if not os.path.exists(self.cache_dir):
            os.makedirs(self.cache_dir)
        self.setDefaultLayers()
        self.actual_ranges = None 
開發者ID:enricofer,項目名稱:go2mapillary,代碼行數:11,代碼來源:mapillary_coverage.py

示例14: showVideoInfo

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def showVideoInfo(self):
        ''' Show default probe info '''
        taskSaveInfoToJson = QgsTask.fromFunction('Show Video Info Task',
                                                  self.converter.probeShow,
                                                  fname=self.fileName,
                                                  on_finished=self.finishedTask,
                                                  flags=QgsTask.CanCancel)

        QgsApplication.taskManager().addTask(taskSaveInfoToJson)
        return 
開發者ID:All4Gis,項目名稱:QGISFMV,代碼行數:12,代碼來源:QgsFmvPlayer.py

示例15: updateDurationInfo

# 需要導入模塊: from qgis.core import Qgis [as 別名]
# 或者: from qgis.core.Qgis import Info [as 別名]
def updateDurationInfo(self, currentInfo):
        '''Update labels duration Info and CallBack Metadata
        @type currentInfo: String
        @param currentInfo: Current time value
        '''
        duration = self.duration
        self.currentInfo = currentInfo
        if currentInfo or duration:

            totalTime = _seconds_to_time(duration)
            currentTime = _seconds_to_time(currentInfo)
            tStr = currentTime + " / " + totalTime
            currentTimeInfo = _seconds_to_time_frac(currentInfo)

            if self.isStreaming:
                # get last metadata available
                self.get_metadata_from_buffer()
                # qgsu.showUserAndLogMessage("", "Streaming on ", onlyLog=True)
                # nextTime = currentInfo + self.pass_time / 1000
                # nextTimeInfo = _seconds_to_time_frac(nextTime)
                # self.callBackMetadata(currentTimeInfo, nextTimeInfo)
            elif self.islocal:
                self.readLocal(currentInfo)
            else:
                # Get Metadata from buffer
                self.get_metadata_from_buffer(currentTimeInfo)

        else:
            tStr = ""

        self.labelDuration.setText(tStr) 
開發者ID:All4Gis,項目名稱:QGISFMV,代碼行數:33,代碼來源:QgsFmvPlayer.py


注:本文中的qgis.core.Qgis.Info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。