1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/vector/qgsgeometrysnapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsGeometrySnapper : QObject
{
%Docstring(signature="appended")
:py:class:`QgsGeometrySnapper` allows a geometry to be snapped to the
geometries within a different reference layer. Vertices in the
geometries will be modified to match the reference layer features within
a specified snap tolerance.
%End
%TypeHeaderCode
#include "qgsgeometrysnapper.h"
%End
public:
enum SnapMode /BaseType=IntEnum/
{
PreferNodes,
PreferClosest,
PreferNodesNoExtraVertices,
PreferClosestNoExtraVertices,
EndPointPreferNodes,
EndPointPreferClosest,
EndPointToEndPoint,
};
QgsGeometrySnapper( QgsFeatureSource *referenceSource );
%Docstring
Constructor for QgsGeometrySnapper. A reference feature source which
contains geometries to snap to must be set. It is assumed that all
geometries snapped using this object will have the same CRS as the
reference source (ie, no reprojection is performed).
%End
QgsGeometry snapGeometry( const QgsGeometry &geometry, double snapTolerance, SnapMode mode = PreferNodes ) const;
%Docstring
Snaps a geometry to the reference layer and returns the result. The
geometry must be in the same CRS as the reference layer, and must have
the same type as the reference layer geometry. The snap tolerance is
specified in the layer units for the reference layer.
%End
QgsFeatureList snapFeatures( const QgsFeatureList &features, double snapTolerance, SnapMode mode = PreferNodes );
%Docstring
Snaps a set of features to the reference layer and returns the result.
This operation is multithreaded for performance. The
:py:func:`~QgsGeometrySnapper.featureSnapped` signal will be emitted
each time a feature is processed. The snap tolerance is specified in the
layer units for the reference layer.
%End
static QgsGeometry snapGeometry( const QgsGeometry &geometry, double snapTolerance, const QList<QgsGeometry> &referenceGeometries, SnapMode mode = PreferNodes );
%Docstring
Snaps a single geometry against a list of reference geometries.
%End
signals:
void featureSnapped();
%Docstring
Emitted each time a feature has been processed when calling
:py:func:`~QgsGeometrySnapper.snapFeatures`
%End
};
class QgsInternalGeometrySnapper
{
%Docstring(signature="appended")
:py:class:`QgsInternalGeometrySnapper` allows a set of geometries to be
snapped to each other. It can be used to close gaps in layers.
To use :py:class:`QgsInternalGeometrySnapper`, first construct the
snapper using the desired snap parameters. Then, features are fed to to
the snapper one-by-one by calling :py:func:`~snapFeature`. Each feature
passed by calling :py:func:`~snapFeature` will be snapped to any
features which have already been processed by the snapper.
After processing all desired features, the results can be fetched by
calling :py:func:`~snappedGeometries`. The returned
:py:class:`QgsGeometryMap` can be passed to
:py:func:`QgsVectorDataProvider.changeGeometryValues()` to save the
snapped geometries back to the source layer.
%End
%TypeHeaderCode
#include "qgsgeometrysnapper.h"
%End
public:
QgsInternalGeometrySnapper( double snapTolerance, QgsGeometrySnapper::SnapMode mode = QgsGeometrySnapper::PreferNodes );
%Docstring
Constructor for QgsInternalGeometrySnapper. The ``snapTolerance`` and
``mode`` parameters dictate how geometries will be snapped by the
snapper.
%End
QgsGeometry snapFeature( const QgsFeature &feature );
%Docstring
Snaps a single feature's geometry against all feature geometries already
processed by calls to :py:func:`~QgsInternalGeometrySnapper.snapFeature`
in this object, and returns the snapped geometry.
%End
QgsGeometryMap snappedGeometries() const;
%Docstring
Returns a :py:class:`QgsGeometryMap` of all feature geometries snapped
by this object.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/vector/qgsgeometrysnapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|