324 Commits

Author SHA1 Message Date
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
Nyall Dawson
53c877963a Add method to create QgsRectangle from center and size 2017-11-07 11:32:38 +10:00
Matthias Kuhn
e0025b65b1
Rename QgsGeometry::fromPoint to QgsGeometry::fromPointXY
Also introduces the from[Geometry]XY for QgsGeometryFactory
2017-10-30 09:14:06 +01:00
Matthias Kuhn
82e6d1219f
Rename from[GeometryType] to from[GeometryType]XY
- QgsGeometry::fromPoint() was renamed to fromPointXY()
- QgsGeometry::fromMultiPoint() was renamed to fromMultiPointXY()
- QgsGeometry::fromMultiPolyline() was renamed to fromMultiPolylineXY()
- QgsGeometry::fromPolygon() was renamed to fromPolygonXY()
- QgsGeometry::fromMultiPolygon() was renamed to fromMultiPolygonXY()
2017-10-30 09:14:06 +01:00
Matthias Kuhn
ca74e391cd
Rename QgsGeometry.addPoints with XY / V2-less versions 2017-10-30 09:14:05 +01:00
Matthias Kuhn
e19f6482ca
Various fixes to dropping V2 suffix 2017-10-30 09:14:05 +01:00
Matthias Kuhn
7f3ad76882
Rename QgsMultiPolygonV2 to QgsMultiPolygon 2017-10-30 09:14:04 +01:00
Matthias Kuhn
3fcdcd87af
Rename QgsMultiPointV2 to QgsMultiPoint 2017-10-30 09:14:04 +01:00
Matthias Kuhn
b6f46eae11
Rename QgsPolygonV2 to QgsPolygon 2017-10-30 09:14:04 +01:00
Matthias Kuhn
9a57bae6f4
Rename QgsMultiPolygon to QgsMultiPolygonXY 2017-10-30 09:14:04 +01:00
Matthias Kuhn
b7908744e3
Rename QgsMultiPolyline to QgsMultiPolylineXY 2017-10-30 09:14:03 +01:00
Matthias Kuhn
29e65ed087
Rename QgsMultiPoint to QgsMultiPointXY 2017-10-30 09:14:03 +01:00
Matthias Kuhn
becf86cf6c
Rename QgsPolygon to QgsPolygonXY 2017-10-30 09:14:03 +01:00
Nyall Dawson
4372ac2658 [FEATURE][processing] Native c++ snap to grid algorithm
With support for snapping Z/M values, keeping curves
2017-10-27 15:16:15 +10:00
Nyall Dawson
c67e39812d Improvements to QgsAbstractGeometry::snappedToGrid
- Fix loss of coordinates when not rounding a particular dimension
- Don't segmentize curved geometries
- Add extra unit tests
- Make createEmptyWithSameType() protected and skip from Python bindings.
This method relies on low-level manipulation of the returned geometry
which we do not want to expose as public/fixed API
2017-10-27 14:37:35 +10:00