338 Commits

Author SHA1 Message Date
Nyall Dawson
3ffbd84f5f Add a bounding box intersection test to QgsGeometry
We only previously had methods for exact intersections - this
commit adds a new QgsGeometry.boundingBoxIntersects() method
which can be used to test if just the bounding boxes of
geometries/rectangles intersect.

It's fast, and doesn't care about invalid geometries (unlike
the exact intersects checks)
2018-02-20 13:20:38 +10:00
Nyall Dawson
3d4f6f82bb Followup 0548f4, fixes to layer metadata and metadata widget
Address outstanding review requests so that this PR can be merged
2018-02-20 11:10:55 +10:00
Blottiere Paul
a6a3e0b1d4 Fix spelling check and sip binding 2018-02-16 10:06:42 +00:00
Blottiere Paul
35d0f57807 Update documentation 2018-02-16 10:06:42 +00:00
Blottiere Paul
76a57b8345 The first point in 3D is used to propagate Z dimension 2018-02-16 10:06:42 +00:00
Nyall Dawson
ff7bb9aa53 Remove inefficient method for creating empty geometry of same
WKB type, and use optimized method instead

Refs #17809
2018-02-12 08:56:12 +10:00
Nyall Dawson
65827adc7d Provide an optimised constructor for a null QgsRectangle
This is used a lot, yet the current constructor calls the
normalize() method which does a bunch of operations for no
result.

So instead provide a simple optimised null QgsRectangle
constructor and save a lot of cycles.

Refs #17809
2018-02-12 08:56:12 +10:00
Denis Rouzaud
0e7cea2244 QgsGeometryUtils: rename 2 methods
- projPointOnSegment has been renamed to projectPointOnSegment
- getSelfIntersections has been renamed to selfIntersections
2018-01-24 03:38:59 -09:00
Denis Rouzaud
0cc29569f5 reformulate doxymentation 2018-01-23 21:28:00 -04:00
Denis Rouzaud
6a2a626926 move QgsCadUtils::lineCircleIntersection to QgsGeometryUtils
also add a test
2018-01-23 15:01:10 -09:00
Denis Rouzaud
7722010ca8 rename *.sip to *.sip.in for the auto generated sip files 2018-01-17 10:16:37 -04:00
Denis Rouzaud
6d94ac9c6c run sipify 2018-01-12 21:10:16 -04:00
Denis Rouzaud
d87c60512c [sipify] fix bad handling of \see within sentences
and other docstrings improvements
2018-01-09 21:40:10 -04:00
Denis Rouzaud
5babec5e07 run sipify 2018-01-09 11:40:39 -04:00
Nyall Dawson
164c439af9 Add missing docs 2018-01-05 10:03:52 +10:00
Nyall Dawson
2d43dac0b5 Refine behavior of QgsGeometry equals tests
Before we had two checks - equals() and isGeosEqual() which
performed the exact same check (since equals() called the geos
equality test)

Since the geos equality test is a slow, topological test, which
considers two geometries equal if their component edges overlap,
but disregards ordering of vertices this is not always what we
want. There's also the issue that geos cannot consider m values
when testing the geometries, so two geometries with different
m values would be reported equal.

So, now calling QgsGeometry::equals performs a very fast, strict
equality test where geometries are only equal if the have exactly
the same vertices, type, and order.

And swap most code which was calling the slow geos test to instead
use the fast strict native test.
2018-01-05 09:59:22 +10:00
Nyall Dawson
13aa5211d1 Expand equality operators for QgsAbstractGeometry subclasses 2018-01-05 09:37:27 +10:00
Nyall Dawson
6ac6939bf8 Sipify 2017-12-23 14:21:32 +10:00
Nyall Dawson
4ff72de62e
Merge pull request #5858 from lbartoletti/segment_intersection
Segment intersection
2017-12-22 21:43:13 +11:00
Denis Rouzaud
5dc9b5869a fix empty lines with spaces 2017-12-19 21:17:29 -04:00
Denis Rouzaud
64c99e054c run sipify for code snippets 2017-12-19 21:17:29 -04:00
Denis Rouzaud
90e5196996 run sipify 2017-12-19 14:55:46 -04:00
Denis Rouzaud
be8d1d7782 run sipify 2017-12-16 10:45:52 -04:00
lbartoletti
313417ddf1 Stop conflicts 2017-12-16 08:48:36 +01:00
lbartoletti
972e7890bc
Merge branch 'master' into segment_intersection 2017-12-16 07:54:03 +01:00
Denis Rouzaud
c604d2dda6 run sipify 2017-12-15 22:13:44 -04:00
Nyall Dawson
9d251198a6
Merge pull request #5870 from nyalldawson/virtual
Drop redundant virtual keywords on overrides
2017-12-16 11:03:04 +11:00
Denis Rouzaud
978d9277cf better argument names for QgsGeometryUtils::lineIntersection 2017-12-15 19:44:59 -04:00
Nyall Dawson
4da1ce8404 Drop redundant virtual keywords on overrides
Run clang-tidy modernize-use-override to remove all the redundant
virtual keywords from overridden methods, and add some missing
overrides.

Another benefit is that this has also added the overrides
on destructors, which will cause a build failure if a base
class is missing a virtual destructor.
2017-12-16 08:49:36 +10:00
lbartoletti
c5d9663191
Merge branch 'master' into segment_intersection 2017-12-15 20:42:00 +01:00
lbartoletti
72f5adf368 Add default value to epsilon.
Change example for python.
2017-12-15 20:36:57 +01:00
Denis Rouzaud
f2b3ed0a9b run sipify 2017-12-15 11:12:19 -04:00
Etienne Trimaille
abdd8759a0 add constructor to QgsBox3d with a QgsRectangle 2017-12-15 12:14:05 +11:00
lbartoletti
03d8565e2a - Update api_break.dox
- rename isIntersect to isIntersection
- rename inter to intersectionPoint
2017-12-13 14:03:55 +01:00
lbartoletti
c6838fdec6 Update doc 2017-12-13 09:55:56 +01:00
lbartoletti
342985f162 improve segmentIntersection 2017-12-12 21:36:30 +01:00
Denis Rouzaud
e48cf98edb run sipify 2017-12-06 07:19:50 -04:00
Nyall Dawson
e12621ce2a Add API method to remove duplicate nodes from geometries
Removes duplicate nodes from the geometry, wherever removing the
nodes does not result in a degenerate geometry.

By default, z values are not considered when detecting duplicate
nodes. E.g. two nodes with the same x and y coordinate but
different z values will still be considered duplicate and one
will be removed. If useZValues is true, then the z values are
also tested and nodes with the same x and y but different z
will be maintained.

Note that duplicate nodes are not tested between different
parts of a multipart geometry. E.g. a multipoint geometry
with overlapping points will not be changed by this method.

The function will return true if nodes were removed, or false
if no duplicate nodes were found.

Includes unit tests and a processing algorithm which exposes
this functionality.
2017-12-03 14:58:21 +10:00
Nyall Dawson
0b452cabbb Spelling 2017-12-03 08:03:30 +10:00
Nyall Dawson
3341a3e91e Unify behavior of various geometry API leftOf tests
Now instead of mixing bools/numeric returns, we always use
ints, where:
-1 = left
0 = test failed, e.g. point on line
1 = right

Also fix a bunch of extra issues identified with left of tests
as a result of these changes
2017-11-29 10:04:20 +10:00
Radim Blazek
2f43deb9da closestSegmentWithContext() doc and test fix 2017-11-29 09:14:11 +10:00
Radim Blazek
07fd713647 fixed closestSegmentWithContext() paramas in Python 2017-11-29 09:14:07 +10:00
Nyall Dawson
e34d7fb636 Fix left of test for linestrings
The test was returning invalid results for certain geometries
2017-11-29 06:45:33 +11:00
Alessandro Pasotti
72553a60a9
Merge pull request #5710 from elpaso/api-code-cleaning-int-2-enums
QgsVectorLayer code cleaning use enums instead of int
2017-11-24 16:16:26 +01:00
Nyall Dawson
dd223d9b08 Allow transform methods in QgsAbstractGeometry/QgsGeometry to also
transform z/m values via scale/translate arguments
2017-11-24 15:34:35 +10:00
Alessandro Pasotti
def85fa202 QgsVectorLayer code cleaning use enums instead of int
It was one of the TODOs for QGIS 3
2017-11-23 12:09:30 +01:00
Nyall Dawson
75885d70d5 Rename various WKT/WKB/GeoJSON/GML methods for consistency
and consistent capitalisation
2017-11-15 20:51:05 +10:00
Nyall Dawson
fc6c69bedf Fix calculation of distance to vertex for multi part, multi ring
and curved geometries
2017-11-14 21:52:28 +11:00
Nyall Dawson
5d476e51df Use QVector where possible in geometry classes 2017-11-14 21:52:09 +11:00
Nyall Dawson
871f71305d Use clang-tidy modernize-use-default-member-init to modernize initializers 2017-11-11 10:54:44 +10:00