示例#1
0
    def curvify(self):

        if not self.auto_curve_enabled:
            return

        if self._prevent_recursion:
            # Avoiding recursion as the algorithm will also trigger geometryChanged
            return

        # Get custom convert to curve tolerance settings
        params = {
            "DISTANCE":
            QgsSettings().value(
                "/qgis/digitizing/convert_to_curve_distance_tolerance", 1e-6),
            "ANGLE":
            QgsSettings().value(
                "/qgis/digitizing/convert_to_curve_angle_tolerance", 1e-6),
        }

        alg = QgsApplication.processingRegistry().createAlgorithmById(
            'native:converttocurves')
        layer = self.iface.activeLayer()
        layer.selectByIds(self.changed_fids)
        self._prevent_recursion = True
        AlgorithmExecutor.execute_in_place(alg, params)
        self._prevent_recursion = False
        layer.removeSelection()