427 Commits

Author SHA1 Message Date
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
be8dce7d0d Valid improvements from new sipify 2024-08-13 20:28:55 +10:00
Nyall Dawson
6f652d251b Drop no-value copy constructor dox 2024-07-25 04:02:55 +10:00
Nyall Dawson
28943f9c1b Remove a bunch of useless default constructor doxygen 2024-07-23 02:08:28 +10:00
Jean Felder
849df1bae4 qgsbox3d: Add support for set method 2024-07-11 17:43:00 +02:00
Jean Felder
180e2bd3e3 qgsbox3d: Add support for area method 2024-07-11 17:43:00 +02: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
d4ddd04efe Add missing HOLDGIL annotation for QgsGeometry::isEmpty 2024-06-12 13:50:13 +02: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
Jacky Volpes
ab663b485b Use WkbType instead of GeometryType enum for addPart
Deprecating QgsGeometry::addPart in favor of QgsGeometry::addPartV2
to use Qgis::WkbType instead of Qgis::GeometryType because the latter
can't handle curved geometries (not specific enough).

Fixes #57255
2024-06-03 19:40:48 +02:00
Nyall Dawson
b43537680c Add API to add list of geometries to collections
More efficient then adding one by one, and allows for efficient
transferral of geometries when pared with the new takeGeometries
method.
2024-06-03 14:38:57 +10:00
Nyall Dawson
27a2bcf064 Add API to take geometries from a collection
Removes the geometries from the collection and returns ownership
to the caller.

Can be used to avoid clones in some scenarios.
2024-06-03 14:38:57 +10:00
Nyall Dawson
94b6003e3c Add list constructor for QgsMultiLineString too 2024-06-01 19:28:50 +10:00
Nyall Dawson
2871f5b8af Add constructor to directly create QgsMultiPolygon from list of polygons 2024-06-01 19:28:50 +10:00
Germán Carrillo
2768e41f0a Adjust docstring in qgsgeometryutils_base.h 2024-05-24 07:30:09 +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
Jean Felder
1a4e1a77e7 qgsgeometry: Add contains method from x,y coordinates 2024-04-03 20:38:40 +02:00
uclaros
9796d3766b update topological point snap threshold 2024-03-13 15:37:06 +01:00
uclaros
bf8433bf6d Fix splitting when snapping to segment is used 2024-03-12 09:13:51 +01:00
Even Rouault
a68422b982 Various typo fixes
Including 3 public methods, which are deprecated by this commit and replaced by a typo-fixed version
2024-02-29 06:03:03 +10:00
Nyall Dawson
80c0c385f8 Use better python repr for null QgsRectangle 2024-02-28 13:00:01 +10:00
Even Rouault
f3ef66d073
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-19 11:35:07 +01: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
Even Rouault
a5c8f01003
Header files: remove all mentions of '\since QGIS 1.' 2024-02-18 20:46:00 +01:00
Nyall Dawson
45e51c2a55 Expose GEOS constrainedDelaunayTriangulation to QgsGeometry
Allows calling this method when QGIS is built against supported
GEOS versions (>= 3.11)
2024-02-10 08:04:51 +10:00
Nyall Dawson
fa6c41fd74 Add QgsGeometryCollection::extractPartsByType
Allows extraction of matching parts from a collection, returning
the corresponding collection subclass.

  mixed_collection = QgsGeometryCollection()
  mixed_collection.addGeometry(... mix of geometry types ...)

  multi_line_string = mixed_collection.extractPartsByType(Qgis.WkbType.LineString)

In this case multi_line_string will be a QgsMultiLineString object,
containing just the line string parts from mixed_collection
2024-02-10 08:04:51 +10:00
Alessandro Pasotti
f2f2840173
Merge pull request #55588 from elpaso/mssql-log-query-when-update-geometry-value
MSSQL: fix add/fill ring
2024-02-06 13:47:01 +01:00
Loïc Bartoletti
67ea128ee0 DOX: better wording for createGeometryEngine
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
2024-02-06 10:28:53 +01:00
Loïc Bartoletti
f5db8a765f QgsGeos: Add precision when createGeometryEngine 2024-02-06 10:28:53 +01:00
Loïc Bartoletti
7bdf16d976 QgsAbstractGeometry: Update dox for fuzzyEqual and fix \see tags 2024-01-12 07:10:37 +10:00
Loïc Bartoletti
c16938c683 DOX: add a more descriptive information on fuzzyDistanceEqual. What is a 'distance comparison' 2024-01-12 07:10:37 +10: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
c9d4a02d96 dox: Adds a \warning tag. Adds a mention about caller's responsibility and adds a \since tag 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
a590b0e4c6 QgsGeometryUtils: add sqrDistance3D and distance3d for QgsPoint using QgsGeometryUtilsBase functions 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
2fdcc3c01e QgsGeometryUtilsBase: add sqrDistance3D and distance3D
As for the sqrDistance and Distance 2D functions, this adds functions for 3D.
To maintain the lowest level, the specific case where a Z could be NaN
is not handled.
It is left to the responsibility of other methods using these functions.
2024-01-11 05:23:39 +10:00
Loïc Bartoletti
491d133a05 QgsGeometryUtilsBase: Add a fuzzy compare method for comparing pairs
This method will be used where multiple calls to `qgsDoubleNear(x1, y1, eps) &&
qgsDoubleNear(x2, y2, eps) && ... && qgsDoubleNear(xn, yn, eps)` are possible.
2023-12-14 20:17:25 +01:00
Loïc Bartoletti
2910e24d87 Add const SIP_FACTORY for measuredLine methods 2023-12-14 05:52:21 +10:00
Loïc Bartoletti
a93136c313 QgsMultiLineString: add method measuredLine 2023-12-14 05:52:21 +10:00
Loïc Bartoletti
6cb243571f QgsLineString: add method measuredLine 2023-12-14 05:52:21 +10:00
Alessandro Pasotti
ce4c5bd7de MSSQL: fix add/fill ring
Fix #53698

Funded by: All My Favourite Things ♬
2023-12-13 11:24:57 +01:00
Loïc Bartoletti
4a353d1a12 Marks deprecated methods in QgsGeometryUtils redundant with QgsGeometryUtilsBase 2023-12-01 11:17:11 +01:00
Loïc Bartoletti
8025f72fa7 QgsGeometryUtils_base: add this class available in Python binding 2023-12-01 11:17:11 +01:00
Loïc Bartoletti
ac3e73e25c [refacto] QgsGeometryUtils: move base methods to a dedicated class
Refactor QgsGeometryUtils to separate "basic" methods from those involving QGIS
composite types.
By "basic" methods, we refer to those that only require doubles or (qgs)vectors.
These methods are now encapsulated in their dedicated classes and can be called
from anywhere to prevent duplications in certain methods (in particular Cartesian distance calculation).

To maintain API compatibility, all methods are also accessible in QgsGeometryUtils
which acts as a pass-through to QgsGeometryUtilsBase.
2023-12-01 11:17:11 +01:00
Loïc Bartoletti
3ab676e603 QgsGeometryUtils: move 2D distance code into QgsGeometryUtils.h and uses it 2023-12-01 11:17:11 +01:00
Loïc Bartoletti
361fbded94 QgsGeometry: use NoOrientation enum and fix some possible nullptr uses 2023-11-24 09:18:02 +00:00
Loïc Bartoletti
0f27fd3b1e QgsGeometry: add methods to return orientation 2023-11-24 07:43:24 +00:00
dubravat
e1ba6f5272 Mistype in QgsGeometryUtils::segmentSide description was fixed 2023-11-23 08:28:20 +10:00
Nyall Dawson
25b75353b5 Add coverage union algorithm 2023-11-02 22:03:20 +10:00
Nyall Dawson
c8eefd0558 Expose GEOS coverage simplify as a processing algorithm 2023-11-02 22:03:20 +10:00