true"WGS84"//test that measuring an empty polygon doesn't crashmeasurePolygon 示例3: addPoint ▲点赞 5▼ voidQgsMeasureDialog::addPoint( QgsPoint &point ) { QSettings settings;intdecimalPlaces = settings.value("/qgis/measure/decimalplaces","3").toInt();// Create QgsDistance Area for cus...
# 需要导入模块: from qgis.core import QgsDistanceArea [as 别名]# 或者: from qgis.core.QgsDistanceArea importmeasure[as 别名]defloopThruPolygons(self, inLayer, numRand, design):sProvider = inLayer.dataProvider() sFeat = QgsFeature() sGeom = QgsGeometry() sPoints = []ifdesign == self....
idx1 =-1idx2 =-1fields = layer.pendingFields()ifgeometryType == QGis.Polygon: idx1, fields = utils.findOrCreateField(layer, fields,"area",21,6) idx2, fields = utils.findOrCreateField(layer, fields,"perimeter",21,6)elifgeometryType == QGis.Line: idx1, fields = utils.findOrCreate...
QSettings settings;intdecimalPlaces = settings.value("/qgis/measure/decimalplaces","3").toInt();// Create QgsDistance Area for customization ProjectionEnabled settingQgsDistanceArea myDa; configureDistanceArea( myDa );// show current distance/area while moving the point// by creating a temporary ...
}elseif( geometryType == QGis::Polygon ) {doublearea = calc.measureArea( feature->constGeometry() );doubleperimeter = calc.measurePerimeter( feature->constGeometry() ); QGis::UnitType myDisplayUnits; convertMeasurement( calc, area, myDisplayUnits,true);// area and myDisplayUnits are out pa...
fields = layer.pendingFields()ifgeometryType == QGis.Polygon: areaName = vector.createUniqueFieldName('area', fields) fields.append(QgsField(areaName, QVariant.Double)) perimeterName = vector.createUniqueFieldName('perimeter', fields) fields.append(QgsField(perimeterName, QVariant.Double))elifgeo...