99 Commits

Author SHA1 Message Date
Nyall Dawson
403bdbd405 Don't allow qgsgeometry_cast to cast away const 2025-03-12 11:05:35 +10:00
Julien Cabieces
ed64834106 api(deprecated): add message to deprecated SIP annotation 2024-12-17 09:06:42 +01:00
Nyall Dawson
37478db0c1 Fix more function links 2024-12-03 12:57:44 +10:00
Nyall Dawson
8d60d4f6d7 Make some factories return unique_ptr 2024-12-03 07:06:02 +10:00
David Koňařík
8039ccb50d Fix elevation profile on intersecting polyline 2024-10-24 09:52:58 +10:00
Nyall Dawson
f2e4c3dfb7 Don't mangle http see links in PyQGIS docs 2024-09-04 06:32:03 +10:00
Nyall Dawson
534ca73c59 Fix missing see also trailing notes in PyQGIS documentation 2024-09-04 06:32:03 +10:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
765cbb32db Standardise some deprecated annotations 2024-09-02 11:42:12 +10:00
Nyall Dawson
5c1427c807 Add QgsLineString::lineLocationPointByM
This method attempts to interpolate the point on a linestringM
where a specified m value falls. It does this by interpolating
M values along the line string segments, finding the first
segment at which the target M value falls. If the M value
corresponds to a part of the line with constant m values, then
the center point of this constant m value portion will be
returned.
2024-08-25 12:34:38 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
102874e6d2 Port geos simplify linestring
Add QgsAbstractGeometry::simplifyByDistance, which is a direct
port of GEOS Douglas Peucker algorithm.

This is a trivial algorithm to implement, and we benefit from
avoiding the conversion to/from GEOS geometries.
2024-06-20 05:41:37 +10:00
Nyall Dawson
9626644c7c Add option to remove redundant vertices in QgsAbstractGeometry::snappedToGrid
If opted in, then vertices which form a midpoint of a straight line segment will be removed in the output
2024-06-04 21:33:29 +10:00
Nyall Dawson
2860f23fa3 Add QgsLineString method to interpolate nan m values along line
Fills in any nan m values by interpolating from non-nan values
in neighbouring vertices
2024-05-11 08:33:21 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
Even Rouault
02caeb9db7
Header files: remove all mentions of '\since QGIS 2.' 2024-02-18 20:46:01 +01:00
Loïc Bartoletti
c6eca9361f QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8
The comparisons among QGIS were conducted on coordinates using a fixed epsilon:
specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 *
DBL_EPSILON.

Initially, I've standardized its use to 1e-8 universally; it's already
significantly adequate for our Cartesian cases (1e-3 should suffice for many),
potentially fitting just right for geographical contexts.

Furthermore, in response to precision concerns, we're using the fuzzyEqual
and fuzzyDistanceEqual methods. These methods enable users/developers to
compare geometries more easily and with a given precision.

The API remains intact as operator==/equals() have been shifted into fuzzyEqual
(with an epsilon of 1e-8).

To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper
functions, fuzzyHelpers, have been introduced following the logic of the
respective segments to be executed.
2024-01-12 07:10:37 +10:00
Loïc Bartoletti
2910e24d87 Add const SIP_FACTORY for measuredLine methods 2023-12-14 05:52:21 +10:00
Loïc Bartoletti
6cb243571f QgsLineString: add method measuredLine 2023-12-14 05:52:21 +10:00
Jean Felder
d7bdfe000c geometry: Remove duplicated 2d boundingbox logic 2023-09-02 12:38:44 +10:00
bdm-oslandia
40089e6230 qgsabstractgeometry: Add support for box3d intersection 2023-09-02 12:38:44 +10:00
bdm-oslandia
5774acf8d0 qgsabstractgeometry: Add boundingBox3D logic
With this change `QgsAbstractGeometry::calculateBoundingBox()` is now
computed from `QgsAbstractGeometry::calculateBoundingBox3D()`.
2023-09-02 12:38:44 +10:00
Nyall Dawson
5967344117 Rename QgsBox3d to QgsBox3D for consistency, monkey patch in old
name for PyQGIS compatibility
2023-07-20 15:31:00 +10:00
Nyall Dawson
046883fa9c Promote QgsWkbTypes enums to enum class, move to Qgis 2023-02-22 12:39:21 +10:00
Julien Cabieces
22d2a32e22 Fixes #50742 : keep ZM coordinates when simplifying geometry 2023-02-01 18:54:07 +01:00
Tomas Johansson
95e00c50d2
Resolves 'Delete holes' bug when 'area' argument is used
Fixes #49578
2022-10-03 07:58:31 +10:00
Nyall Dawson
f439a649d6 Optimise 3d clipping to work directly with coordinate arrays, so that
we avoid the (signficant) overhead of point conversion and sequence
allocations
2022-05-26 06:20:32 +10:00
Nyall Dawson
e912f29415 Hide QgsLineString::setPoints from python (raw pointers to arrays cannot be used through the bindings), dox update 2022-05-26 06:20:32 +10:00
bdm-oslandia
f8139e1df8 fixes from review and rebase to master 2022-05-26 06:20:32 +10:00
bdm-oslandia
eba8ff58b2 rebase from master 2022-05-26 06:20:32 +10:00
bdm-oslandia
52e130f699 Minor fixes
* QgsBox3d: fix scale function
* QgsLineString:
  - add setPoints function with data arrays
  - improve calculateBoundingBox3d
2022-05-26 06:20:32 +10:00
bdm-oslandia
07d26a6e2f fix qgslinestring bbox calculation and qgsbox3d tests 2022-05-26 06:20:32 +10:00
bdm-oslandia
8e6a8fc8bb fix clipping for geocentric projections 2022-05-26 06:20:32 +10:00
Juergen E. Fischer
c6008b7ee1 fix MSVC build: reverts fee62e4, dff05dd and e3a77b9484c effectivly
reverting 3fb0f66 (followup #45348)

Using --no-public-is-protected (default on Windows) also works on Linux
and fixes #45331 too
2021-10-21 23:03:48 +02:00
nirvn
ef84e48a09 Run sipify_all.sh 2021-10-12 16:34:05 +10:00
Denis Rouzaud
ec16736306 run sipify 2021-10-12 16:34:05 +10:00
Nyall Dawson
e733b517b3 Split QgsVertexId out to own file, promote type to enum class 2021-10-12 14:54:26 +10:00
Nyall Dawson
e6b39077a2
Promote QgsCoordinateTransform::TransformDirection to enum class, move to Qgis
This enum was forcing an include of qgscoordinatetransform.h within the
widely used qgsabstractgeometry.h header, causing an absolute explosion
of includes of a bunch of very heavy header classes all across QGIS. By
removing the forced include we can avoid a ton of unwanted includes
and make wider use of forward declarations...
2021-09-22 16:40:49 +10:00
Nyall Dawson
01e3e1dddc [api] Move QgsGeometry enums to Qgis, promote to enum classes 2021-08-04 09:54:32 +10:00
Nyall Dawson
711a615be3 Fix raises sphinx format 2021-06-25 10:50:04 +10:00
Nyall Dawson
4ff3f447dc Don't try to insert links in raises blocks in PyQGIS docs
These aren't formatted correctly if we do
2021-06-10 11:03:43 +10:00
Nyall Dawson
8359281012 Fix formatting of exception blocks in PyQGIS docs 2021-06-10 11:03:43 +10:00
Loïc Bartoletti
17d1443ace is2DClosed -> isClosed2D and fix a typo 2021-06-08 14:26:20 +10:00
Loïc Bartoletti
df02c00f13 sipify 2021-06-08 14:26:20 +10:00
Nyall Dawson
615bbd8163 Fix SIP_HOLDGIL annotations 2021-05-25 21:07:50 +10:00
Nyall Dawson
2b6c3c1db2 Fix PyQGIS QgsLineString constructor only accepts lists of QgsPoint,
not QgsPointXY as indicated by the documentation

Also add support for constructing QgsLineString using arrays of
arrays of floats, given that we're having to hand-roll sip conversion
code anyway!

Now the following is supported:

  line = QgsLineString([[1,2], [3,4], [5,6]])

which is much nicer and more "pythonic" then the explicit
QgsPoint/QgsPointXY sequences!

Fixes #43200
2021-05-25 21:07:50 +10:00
Nyall Dawson
1c11a91811 Add QgsGeometry::normalize()
A port of the equivalent method from GEOS, but with added support
for curved geometries and M values

Reorganizes the geometry into a normalized form (or "canonical" form).

Polygon rings will be rearranged so that their starting vertex is
the lower left and ring orientation follows the right hand rule, collections
are ordered by geometry type, and other normalization techniques are applied.
The resultant geometry will be geometrically equivalent to the original geometry.
2021-04-29 05:33:25 +10:00
Nyall Dawson
e3a73a1ac5 Add method to "scroll" the vertices of a closed curve geometry,
so that a particular vertex is the first one
2021-04-29 05:33:25 +10:00
Nyall Dawson
9c53fb8635 Add QgsAbstractGeometry::compareTo( QgsAbstractGeometry*)
Allows for comparison of geometry objects, e.g. to allow for stable
sorting of them.

Ported from the GEOS equivalent method, but with addition of support
for M values and curved geometry types
2021-04-27 21:13:22 +10:00
Nyall Dawson
36e52f8514 Add method to split QgsCurve geometries into two parts at a specific
vertex index
2021-04-27 19:15:51 +10:00