30 Commits

Author SHA1 Message Date
Denis Rouzaud
c604d2dda6 run sipify 2017-12-15 22:13:44 -04:00
Denis Rouzaud
f2b3ed0a9b run sipify 2017-12-15 11:12:19 -04: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
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
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
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
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
Martí Angelats i Ribera
3f5b11bffe Make asGridified and newSameType (helper function) 2017-10-27 11:22:47 +10:00
Nyall Dawson
01d34ede9d Sip sync 2017-09-25 17:12:03 +10:00
Nyall Dawson
9e61cd63df Move overriden methods from headers to cpp files
Since they can't be inlined anyway
2017-09-19 17:22:33 +10:00
Nyall Dawson
bb425e4540 Cleaner signature for QgsAbstractGeometry::closestSegment 2017-09-19 17:22:33 +10:00
Nyall Dawson
54c988f918 Make QgsAbstractGeometry::toCurveType pure virtual, and implement
for all geometry types

Previously this method would return nullptrs for many geometry
types
2017-09-19 17:22:33 +10:00
Nyall Dawson
a15340fc2c Extend geometry test coverage 2017-09-19 17:22:32 +10:00
Matthias Kuhn
a3f14df367 Update docstrings 2017-06-26 08:21:11 +02:00
Matthias Kuhn
75e5726fe4 Improve API docstrings 2017-06-26 08:21:11 +02:00
Martin Dobias
2964c33d63 Reshape tool: use default Z value for 3D geometries 2017-06-08 21:56:21 +02:00
Matthias Kuhn
a9d7630a69 Rename QgsPointV2 to QgsPoint and QgsPoint to QgsPointXY
Because 3D coordinates should be the default.

References https://github.com/qgis/qgis3.0_api/issues/36
2017-06-02 19:53:37 +02:00
Matthias Kuhn
28a21209b9 [sipify] seealso 2017-04-30 16:52:05 +02:00
Denis Rouzaud
897e2f0410 [sipify] do not take // comments into docstrings 2017-04-30 16:34:08 +02:00
Denis Rouzaud
b0d4a4c201 sipify geometry classes 2017-04-30 11:29:45 +02:00
Nyall Dawson
51035cfb67 Add optimised constructors for QgsLineString
Instead of requiring all linestrings to be constructed by
first creating QgsPointSequence (requiring creation or
conversion of points to QgsPointV2), allow construction
of LineStrings directly from vectors of values (fastest!)
or lists of QgsPoint.

Likely results in speedups for lots of geometry operations,
but using the same layer as earlier tested for densify
improvements the densify operation time dropped further
from 25 seconds to 15 seconds.
2017-03-25 20:44:31 +10:00
Nyall Dawson
af0d68b882 Implement QgsGeometry::isEmpty()
Faster than QgsGeometry::isGeosEmpty() because it avoids the
conversion to GEOS geometries and just uses the QgsAbstractGeometry
subclasses directly.

Also implements faster isEmpty() overrides for specific
QgsAbstractGeometry subclasses.
2017-01-31 07:15:51 +10:00
Martin Dobias
d729951dcd Remove caching of WKB from QgsGeometry (was kept just for compatibility)
Also improves the API to export/import WKB as QByteArray
2016-11-14 13:36:12 +08:00
Nyall Dawson
ef34e393dc Add method to QgsGeometry to extend the start/end of a linestring 2016-10-31 07:56:24 +10:00
Nyall Dawson
49432a8468 Optimise QgsAbstractGeometry
Make nCoordinates virtual, and provide shortcuts for some
geometry types. The base method which calls coordinateSequence()
is quite slow in certain circumstances.

Speeds up rendering point layers by ~25%, also likely to
speed up lots of geometry heavy operations throughout QGIS

Refs #15752
2016-10-26 17:22:09 +10:00
Patrick Valsecchi
db91330b66 Avoid back and forth with WKB in rendering 2016-08-29 06:55:52 +02:00
Juergen E. Fischer
3f22a7a77f another scripts/replacev2.sh with minor manual fixes 2016-08-10 12:12:28 +02:00