mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[processing][needs-docs] Drop Fixed Distance Buffer algorithm
Since it's functionality is a subset of the native c++ "buffer" algorithm, it's no longer required.
This commit is contained in:
parent
9db2d64d52
commit
95db682acf
@ -1,125 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
FixedDistanceBuffer.py
|
||||
---------------------
|
||||
Date : August 2012
|
||||
Copyright : (C) 2012 by Victor Olaya
|
||||
Email : volayaf at gmail dot com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
|
||||
from qgis.core import (QgsWkbTypes,
|
||||
QgsProcessing,
|
||||
QgsProcessingParameterFeatureSource,
|
||||
QgsProcessingParameterNumber,
|
||||
QgsProcessingParameterBoolean,
|
||||
QgsProcessingParameterEnum,
|
||||
QgsProcessingParameterFeatureSink)
|
||||
|
||||
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
|
||||
|
||||
from . import Buffer as buff
|
||||
|
||||
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
|
||||
|
||||
|
||||
class FixedDistanceBuffer(QgisAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
OUTPUT = 'OUTPUT'
|
||||
FIELD = 'FIELD'
|
||||
DISTANCE = 'DISTANCE'
|
||||
SEGMENTS = 'SEGMENTS'
|
||||
DISSOLVE = 'DISSOLVE'
|
||||
END_CAP_STYLE = 'END_CAP_STYLE'
|
||||
JOIN_STYLE = 'JOIN_STYLE'
|
||||
MITER_LIMIT = 'MITER_LIMIT'
|
||||
|
||||
def icon(self):
|
||||
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'buffer.png'))
|
||||
|
||||
def group(self):
|
||||
return self.tr('Vector geometry')
|
||||
|
||||
def groupId(self):
|
||||
return 'vectorgeometry'
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def initAlgorithm(self, config=None):
|
||||
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
|
||||
self.tr('Input layer')))
|
||||
|
||||
self.addParameter(QgsProcessingParameterNumber(self.DISTANCE,
|
||||
self.tr('Distance'), type=QgsProcessingParameterNumber.Double,
|
||||
defaultValue=10.0))
|
||||
self.addParameter(QgsProcessingParameterNumber(self.SEGMENTS,
|
||||
self.tr('Segments'), type=QgsProcessingParameterNumber.Integer,
|
||||
minValue=1, defaultValue=5))
|
||||
self.addParameter(QgsProcessingParameterBoolean(self.DISSOLVE,
|
||||
self.tr('Dissolve result'), defaultValue=False))
|
||||
self.end_cap_styles = [self.tr('Round'),
|
||||
'Flat',
|
||||
'Square']
|
||||
self.addParameter(QgsProcessingParameterEnum(
|
||||
self.END_CAP_STYLE,
|
||||
self.tr('End cap style'),
|
||||
options=self.end_cap_styles, defaultValue=0))
|
||||
self.join_styles = [self.tr('Round'),
|
||||
'Miter',
|
||||
'Bevel']
|
||||
self.addParameter(QgsProcessingParameterEnum(
|
||||
self.JOIN_STYLE,
|
||||
self.tr('Join style'),
|
||||
options=self.join_styles, defaultValue=0))
|
||||
self.addParameter(QgsProcessingParameterNumber(self.MITER_LIMIT,
|
||||
self.tr('Miter limit'), type=QgsProcessingParameterNumber.Double,
|
||||
minValue=0, defaultValue=2))
|
||||
|
||||
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Buffer'), QgsProcessing.TypeVectorPolygon))
|
||||
|
||||
def name(self):
|
||||
return 'fixeddistancebuffer'
|
||||
|
||||
def displayName(self):
|
||||
return self.tr('Fixed distance buffer')
|
||||
|
||||
def processAlgorithm(self, parameters, context, feedback):
|
||||
source = self.parameterAsSource(parameters, self.INPUT, context)
|
||||
|
||||
distance = self.parameterAsDouble(parameters, self.DISTANCE, context)
|
||||
dissolve = self.parameterAsBool(parameters, self.DISSOLVE, context)
|
||||
segments = self.parameterAsInt(parameters, self.SEGMENTS, context)
|
||||
end_cap_style = self.parameterAsEnum(parameters, self.END_CAP_STYLE, context) + 1
|
||||
join_style = self.parameterAsEnum(parameters, self.JOIN_STYLE, context) + 1
|
||||
miter_limit = self.parameterAsDouble(parameters, self.MITER_LIMIT, context)
|
||||
|
||||
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
|
||||
source.fields(), QgsWkbTypes.Polygon, source.sourceCrs())
|
||||
|
||||
buff.buffering(feedback, context, sink, distance, None, False, source, dissolve, segments, end_cap_style,
|
||||
join_style, miter_limit)
|
||||
|
||||
return {self.OUTPUT: dest_id}
|
@ -69,7 +69,6 @@ from .FieldPyculator import FieldsPyculator
|
||||
from .FieldsCalculator import FieldsCalculator
|
||||
from .FieldsMapper import FieldsMapper
|
||||
from .FindProjection import FindProjection
|
||||
from .FixedDistanceBuffer import FixedDistanceBuffer
|
||||
from .GeometryConvert import GeometryConvert
|
||||
from .GeometryByExpression import GeometryByExpression
|
||||
from .GridLine import GridLine
|
||||
@ -192,7 +191,6 @@ class QgisAlgorithmProvider(QgsProcessingProvider):
|
||||
FieldsMapper(),
|
||||
FieldsPyculator(),
|
||||
FindProjection(),
|
||||
FixedDistanceBuffer(),
|
||||
GeometryByExpression(),
|
||||
GeometryConvert(),
|
||||
GridLine(),
|
||||
|
@ -556,7 +556,7 @@ tests:
|
||||
geometry:
|
||||
precision: 7
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Basic polygon buffer
|
||||
params:
|
||||
DISSOLVE: 'False'
|
||||
@ -573,7 +573,7 @@ tests:
|
||||
geometry:
|
||||
precision: 7
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Polygon buffer with dissolve
|
||||
params:
|
||||
DISSOLVE: 'True'
|
||||
@ -1007,7 +1007,7 @@ tests:
|
||||
geometry:
|
||||
precision: 7
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Buffer polygons using bevel
|
||||
params:
|
||||
DISSOLVE: false
|
||||
@ -1024,7 +1024,7 @@ tests:
|
||||
name: expected/buffer_polys_bevel.gml
|
||||
type: vector
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Buffer polygons using miter
|
||||
params:
|
||||
DISSOLVE: false
|
||||
@ -1041,7 +1041,7 @@ tests:
|
||||
name: expected/buffer_polys_miter.gml
|
||||
type: vector
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Buffer lines
|
||||
params:
|
||||
DISSOLVE: false
|
||||
@ -1061,7 +1061,7 @@ tests:
|
||||
geometry:
|
||||
precision: 7
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Buffer lines (flat)
|
||||
params:
|
||||
DISSOLVE: false
|
||||
@ -1081,7 +1081,7 @@ tests:
|
||||
geometry:
|
||||
precision: 7
|
||||
|
||||
- algorithm: qgis:fixeddistancebuffer
|
||||
- algorithm: native:buffer
|
||||
name: Buffer lines (square)
|
||||
params:
|
||||
DISSOLVE: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user