QGIS/python/core/auto_generated/qgspointlocator.sip.in

274 lines
8.3 KiB
Plaintext
Raw Normal View History

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgspointlocator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsPointLocator : QObject
{
%Docstring
The class defines interface for querying point location:
2017-12-15 10:36:55 -04:00
- query nearest vertices / edges to a point
- query vertices / edges in rectangle
- query areas covering a point
2017-12-15 10:36:55 -04:00
Works with one layer.
.. versionadded:: 2.8
%End
%TypeHeaderCode
#include "qgspointlocator.h"
%End
public:
explicit QgsPointLocator( QgsVectorLayer *layer, const QgsCoordinateReferenceSystem &destinationCrs = QgsCoordinateReferenceSystem(),
const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext(),
const QgsRectangle *extent = 0,
bool asynchronous = false );
%Docstring
2017-12-15 10:36:55 -04:00
Construct point locator for a ``layer``.
2017-10-05 13:40:11 +10:00
2017-12-15 10:36:55 -04:00
If a valid QgsCoordinateReferenceSystem is passed for ``destinationCrs`` then the locator will
do the searches on data reprojected to the given CRS. For accurate reprojection it is important
to set the correct ``transformContext`` if a ``destinationCrs`` is specified. This is usually taken
from the current :py:func:`QgsProject.transformContext()`
2017-10-05 13:40:11 +10:00
2019-09-03 16:46:40 +02:00
if ``asynchronous`` is ``False``, point locator init() method will block until point locator index
is completely built. if ``True``, index building will be done in another thread and init() method returns
immediately. initFinished() signal will be emitted once the initialization is over.
If ``extent`` is not ``None``, the locator will index only a subset of the layer which falls within that extent.
%End
~QgsPointLocator();
QgsVectorLayer *layer() const;
%Docstring
Gets associated layer
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.14
%End
QgsCoordinateReferenceSystem destinationCrs() const;
%Docstring
Gets destination CRS - may be an invalid QgsCoordinateReferenceSystem if not doing OTF reprojection
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.14
%End
const QgsRectangle *extent() const;
%Docstring
Gets extent of the area point locator covers - if ``None`` then it caches the whole layer
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.14
%End
void setExtent( const QgsRectangle *extent );
%Docstring
Configure extent - if not ``None``, it will index only that area
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.14
2018-03-20 19:08:04 +01:00
%End
void setRenderContext( const QgsRenderContext *context );
2018-03-20 19:08:04 +01:00
%Docstring
Configure render context - if not ``None``, it will use to index only visible feature
2018-03-20 19:08:04 +01:00
.. versionadded:: 3.2
%End
2016-02-14 03:50:23 +01:00
enum Type
{
Invalid,
Vertex,
Edge,
Area,
All
2016-02-14 03:50:23 +01:00
};
2015-09-26 13:21:56 +02:00
typedef QFlags<QgsPointLocator::Type> Types;
bool init( int maxFeaturesToIndex = -1 );
%Docstring
2017-12-15 10:36:55 -04:00
Prepare the index for queries. Does nothing if the index already exists.
If the number of features is greater than the value of maxFeaturesToIndex, creation of index is stopped
2019-08-23 15:52:08 +02:00
to make sure we do not run out of memory. If maxFeaturesToIndex is -1, no limits are used.
2019-09-04 13:32:02 +02:00
This method is either blocking or non blocking according to ``asynchronous`` parameter passed
in the constructor.
Returns false if the creation of index is blocking and has been prematurely stopped due to the limit of features, otherwise true
2019-09-04 13:32:02 +02:00
.. seealso:: :py:class:`QgsPointLocator`
%End
bool hasIndex() const;
%Docstring
Indicate whether the data have been already indexed
%End
struct Match
{
Match();
%Docstring
construct invalid match
%End
Match( QgsPointLocator::Type t, QgsVectorLayer *vl, QgsFeatureId fid, double dist, const QgsPointXY &pt, int vertexIndex = 0, QgsPointXY *edgePoints = 0 );
QgsPointLocator::Type type() const;
bool isValid() const;
bool hasVertex() const;
bool hasEdge() const;
bool hasArea() const;
2015-02-03 02:21:52 +01:00
double distance() const;
%Docstring
2017-12-15 10:36:55 -04:00
for vertex / edge match
units depending on what class returns it (geom.cache: layer units, map canvas snapper: dest crs units)
%End
QgsPointXY point() const;
%Docstring
2017-12-15 10:36:55 -04:00
for vertex / edge match
coords depending on what class returns it (geom.cache: layer coords, map canvas snapper: dest coords)
%End
int vertexIndex() const;
%Docstring
for vertex / edge match (first vertex of the edge)
%End
QgsVectorLayer *layer() const;
%Docstring
2017-12-15 10:36:55 -04:00
The vector layer where the snap occurred.
Will be ``None`` if the snap happened on an intersection.
%End
QgsFeatureId featureId() const;
%Docstring
2017-12-15 10:36:55 -04:00
The id of the feature to which the snapped geometry belongs.
%End
void edgePoints( QgsPointXY &pt1 /Out/, QgsPointXY &pt2 /Out/ ) const;
%Docstring
Only for a valid edge match - obtain endpoints of the edge
%End
bool operator==( const QgsPointLocator::Match &other ) const;
protected:
};
typedef QList<QgsPointLocator::Match> MatchList;
struct MatchFilter
{
2015-11-02 18:07:16 +11:00
virtual ~MatchFilter();
virtual bool acceptMatch( const QgsPointLocator::Match &match ) = 0;
};
Match nearestVertex( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Find nearest vertex to the specified point - up to distance specified by tolerance
Optional filter may discard unwanted matches.
%End
Match nearestEdge( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Find nearest edge to the specified point - up to distance specified by tolerance
Optional filter may discard unwanted matches.
%End
Match nearestArea( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
Find nearest area to the specified point - up to distance specified by tolerance
Optional filter may discard unwanted matches.
This will first perform a pointInPolygon and return first result.
If no match is found and tolerance is not 0, it will return nearestEdge.
.. versionadded:: 3.0
%End
MatchList edgesInRect( const QgsRectangle &rect, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Find edges within a specified recangle
Optional filter may discard unwanted matches.
%End
MatchList edgesInRect( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
Override of edgesInRect that construct rectangle from a center point and tolerance
%End
MatchList verticesInRect( const QgsRectangle &rect, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
Find vertices within a specified recangle
Optional filter may discard unwanted matches.
.. versionadded:: 3.6
%End
MatchList verticesInRect( const QgsPointXY &point, double tolerance, QgsPointLocator::MatchFilter *filter = 0 );
%Docstring
Override of verticesInRect that construct rectangle from a center point and tolerance
.. versionadded:: 3.6
%End
MatchList pointInPolygon( const QgsPointXY &point );
%Docstring
find out if the point is in any polygons
%End
int cachedGeometryCount() const;
%Docstring
Returns how many geometries are cached in the index
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.14
2019-09-04 13:32:02 +02:00
%End
bool isIndexing() const;
%Docstring
Returns ``True`` if the point locator is currently indexing the data.
2019-09-04 15:10:27 +02:00
This method is useful if constructor parameter ``asynchronous`` is ``True``
2019-09-04 13:32:02 +02:00
.. seealso:: :py:class:`QgsPointLocator`
2019-08-23 15:52:08 +02:00
%End
signals:
void initFinished( bool ok );
%Docstring
Emitted whenever index has been built and initialization is finished
:param ok: ``False`` if the creation of index has been prematurely stopped due to the limit of
features, otherwise ``True``
%End
2015-02-03 02:21:52 +01:00
protected:
bool rebuildIndex( int maxFeaturesToIndex = -1 );
2019-09-04 13:32:02 +02:00
protected slots:
2015-02-03 02:21:52 +01:00
void destroyIndex();
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgspointlocator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/