76 Commits

Author SHA1 Message Date
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
Nyall Dawson
1c94f6b941 Dox++ 2021-04-27 14:53:20 +10:00
Nyall Dawson
729792d981 Add QgsCurve::indexOf to retrieve index of a specified QgsPoint
within the curve
2021-04-27 11:26:49 +10:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
7c410120e3 Super-optimised version of geometry bounding box intersects test
Apply some fancy logic to make this test as cheap as possible
to run
2021-03-12 05:46:14 +10:00
Nyall Dawson
7fb3c83e76 Sipify 2021-03-12 05:46:14 +10:00
Nyall Dawson
6ab4ecfa58 Another attempt 2021-02-25 11:08:56 +10:00
Nyall Dawson
73658c5910 Fix mac build 2021-02-25 11:08:56 +10:00
Nyall Dawson
bd82925df3 Replace qgis::make_unique with std::make_unique
Now that we require c++14 features, we don't need to use the custom
backported version anymore...
2021-02-25 11:08:56 +10:00
Nyall Dawson
6f4b32f658 Create class QgsAbstractGeometryTransformer, which can be used
to transform the vertices of a QgsAbstractGeometry

E.g.

        class Transformer(QgsAbstractGeometryTransformer):

            def transformPoint(self, x, y, z, m):
                return True, x * 2, y + 1, z, m

        transformer = Transformer()
        g = QgsGeometry.fromWkt('LineString(3 0, 10 0, 10 10)')
        g.get().transform(transformer)
        print(g.asWkt()) # 'LineString (6 1, 20 1, 20 11)'
2021-02-08 12:12:53 +10:00
Loïc Bartoletti
0f292cfb36
[API] Improve isValid method for curve type 2020-12-02 06:32:54 +10:00
Even Rouault
7ac4b51885 Add QgsGeometry::wkbSize() 2020-10-19 09:25:10 +10:00
Nyall Dawson
41a30ac2e4 Better duplicate node detection/removal handling 2020-10-16 12:18:33 +10:00
Nyall Dawson
73b0e68eb2 Extract logic from QgsLineString::removeDuplicateNodes to a highly optimised check for duplicate nodes QgsLineString::hasDuplicateNodes 2020-10-16 12:18:33 +10:00
Nyall Dawson
fe70bb2440 Dox 2020-09-18 11:50:27 +10:00
Nyall Dawson
fe5615ea44 Hold the GIL for more geometry related methods 2020-09-18 11:50:27 +10:00
Nyall Dawson
f496173bd7 Fix messy doxygen blocks which mess with sipify script
Fixes #38291
2020-08-20 17:01:35 +10:00
Denis Rouzaud
044a05d828 run sipify 2020-06-19 08:47:23 +10:00
Nyall Dawson
81a9db9f57 [sipify] Fix creation of cross references 2020-06-15 13:43:58 +10:00
Nyall Dawson
d3a54eed6f Add flags to control geometry to WKB export behavior
With initial flag to force conversion of triangle types to polygons
2020-06-11 05:32:26 +10:00
Nyall Dawson
17c8a59e4e Refactor QgsLineString::interpolatePoint to extract segment traversal
to a separate visitor function

This allows other code paths to utilise this same logic in an efficient
way
2020-04-30 08:23:43 +10:00
Sandro Mani
6c32a6ae85 Add QgsAbstractGeometry::asKml 2020-01-16 14:36:31 +01:00
Nyall Dawson
8f40c8d1c5 Add QgsLineString::fromQPolygonF 2019-10-07 07:03:34 +10:00
Nyall Dawson
f4d407d9ee Add fromBezierCurve method to QgsLineString
Returns a new QgsLineString as a segmentized version of a bezier curve.
2019-09-13 05:37:37 +10:00