86 Commits

Author SHA1 Message Date
Juergen E. Fischer
e451b9ad6f indentation and spelling fixes 2016-07-08 12:59:38 +02:00
Nyall Dawson
1729531773 Don't transform z coordinates by default
Since z coordinates can represent potentially any height
unit and reference point, it's not safe to assume that they
always represent height in metres relative to the ellipsoid.

Instead, leave z values untouched by default with geometry
transforms, and make transforming z an optional parameter

Refs #14702
2016-06-30 07:38:13 +10:00
Matthias Kuhn
c07f02d6dc QgsAbstractGeometryV2::wkbType always returns a valid type 2016-06-07 10:37:20 +02:00
Matthias Kuhn
fdb28c09aa More string comparison fixes 2016-06-07 10:37:20 +02:00
Sandro Mani
f077f1a560 Fix QgsCurvePolygon sip bindings 2016-06-07 07:26:34 +10:00
Sandro Mani
2738c5097e Add provider for ArcGIS Map and Feature REST services 2016-06-02 13:36:08 +02:00
Nyall Dawson
0fcff9f2a0 Allow direct QVariant creation from some QGIS metatypes 2016-05-20 09:48:18 +10:00
Marco Hugentobler
c0d12dcdeb [FEATURE]: possibility to set the segmentation tolerance (maximum angle or maximum difference) 2016-05-19 11:02:43 +02:00
Marco Hugentobler
bd6d22d8b6 Update sip bindings 2016-04-29 11:53:34 +02:00
Nyall Dawson
4c704be606 Add geometry methods for calculating the distance to a specified
vertex from the start of the geometry
2016-04-06 20:55:26 +10:00
Nyall Dawson
3a1f6c429d Improve documentation for QgsGeometry::closestVertex 2016-04-06 20:55:26 +10:00
Juergen E. Fischer
e503c705a1 change QgsAbstractGeometryV2::coordinateSequence() to return a
implicitly shared copy of an internal cache instead of recreating the
coordinate sequence again and again.

Improves performance of the nodetool on large features a lot (refs #13963)

Also introduce Qgs(Coordinate|Ring|Point)SequenceV2 typedefs.
2016-02-21 21:49:51 +01:00
Nyall Dawson
6116fdcdb4 Add a bunch of missing geometry cache clears 2016-02-21 19:55:15 +11:00
Nyall Dawson
50f01a2ac8 Optimise storage/calculation of geometry bounding boxes
- removes storage of bounding box from QgsPointV2 (gives significant
decrease in size of object)
- more efficient calculation of bounding box for linestrings

Additionally, this commit moves the bounding box invalidation to a
virtual QgsAbstractGeometryV2::clearCache() method, so that other
non-bounding box caches can also be cleared when the geometry
is modified.
2016-02-21 16:26:45 +11:00
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +01:00
Juergen E. Fischer
2ea3d7744d port more WKB parsing to Qgs(Const)WkbPtr including bounds checking 2016-02-09 14:20:07 +01:00
Hugo Mercier
e2123c79e5 Fix addFeature and addPart maptool for layers with a Z 2016-02-09 10:44:41 +01:00
Nyall Dawson
c3a57434d9 Fix clazy 'pass small and trivially-copyable type by value' warnings 2016-02-02 19:47:21 +11:00
Juergen E. Fischer
4dd76da7f8 geometry sip sync and some cosmetics 2016-01-28 10:31:08 +01:00
Nyall Dawson
c38ee41f5b Fix rendering of CurvePolygons without curved segments (fix #14028) 2016-01-21 21:44:40 +11:00
Nyall Dawson
275eb9463d [FEATURE] Add closest_point and shortest_line expression functions
closest_point: returns closest point a geometry to a second geometry
shortest_line: returns the shortest possible line joining two
geometries
2016-01-15 12:50:17 +11:00
Nyall Dawson
c0f4fb1466 Followup e48d8b, fix typo 2016-01-15 08:34:42 +11:00
Matthias Kuhn
542541007c Add extrude function to QgsGeometry 2016-01-14 12:28:31 +01:00
Matthias Kuhn
e351d24a7d More types support for QgsVectorFileWriter 2016-01-12 12:58:47 +01:00
Nyall Dawson
881074b194 Boost coverage of SIP bindings
Now all classes and members are either exposed to bindings or marked
as "not available in Python bindings" in the docs.

Drop test thresholds to 0. Now it should be much easier to determine
what missing members have been added which are causing test
failures.
2016-01-05 11:16:15 +11:00
Juergen E. Fischer
71dc339106 more stl to qt ports and size_t => int fixups 2015-12-26 00:59:09 +01:00
Nyall Dawson
6122f0462d Remove unimplemented QgsSurfaceV2::pointOnSurface method
Was always returning a point not on the surface! (0,0). Use the
GEOS method instead.
2015-12-22 16:50:37 +11:00
Nyall Dawson
85eebff69b Avoid some unnecessary object conversion during point rendering 2015-12-15 22:36:49 +11:00
Nyall Dawson
4e18d54555 Tests and fixes for QgsPolygonV2
- Setting exterior ring will force all interior rings to match
dimensionality of exterior ring
- add equality operator
- use correct WKB types for rings when creating polygon from WKB
- segmentize curves when setting exterior ring with curved segments
- fix export to GML2/3 (should use LinearRing, not LineString as
ring element tag)
2015-12-15 22:36:41 +11:00
Nyall Dawson
c176e3f41e Fix documentation test failure 2015-12-11 19:30:15 +11:00
Nyall Dawson
233f67b419 QgsPolygonV2 tests and fixes
- fixes for handling Polygon25D
- add QgsAbstractGeometryV2::convertTo( QgsWKBTypes::Type type ) for
easy conversion between geometry types
- fix crash when calculating perimeter with no exterior ring
- ensure that added rings respect dimensionality of polygon (avoids
issues such as polygons with z having a ring without z, or a
Polygon25D with LineStringZ rings)
- if a curved ring is added to a polygon then a segmentized version
of the ring is used (can't have a Polygon with a CircularString
ring)
- when calling setInteriorRings, make sure empty rings are skipped
and that all rings are converted to correct type for polygon
- don't crash when requesting or removing interior ring with
index < 0
2015-12-11 18:40:11 +11:00
Nyall Dawson
d2bf8d8923 Add equality operators to QgsLineStringV2 2015-12-11 18:40:11 +11:00
Nyall Dawson
d388a4f1a4 [geometry] Add method to drop z/m values from a geometry 2015-12-01 16:33:44 +11:00
Nyall Dawson
a3d780cb4e [geometry] Add method to drop z/m from wkb types 2015-12-01 16:33:13 +11:00
Nyall Dawson
7eb1133bc5 Make QgsLineStringV2::fromWkbPoints private 2015-11-27 16:32:47 +11:00
Nyall Dawson
1f33011960 Add more tests to QgsLineStringV2, fix vertexAngle calculation 2015-11-27 16:32:09 +11:00
Nyall Dawson
74ca290bd3 QgsLineStringV2 fixes
- fix incorrect centroid calculation (was always returning 0,0)
- fix closestSegment when numPoints < 2
- fix broken leftOf calculation for closestSegment
- area calculation when numPoints < 2

Plus add more unit tests
2015-11-26 16:56:30 +11:00
Nyall Dawson
f3a5dcc98b Fix build 2015-11-19 20:37:47 +11:00
Nyall Dawson
8c0fe47d8e Add tests for QgsPointV2, fix some issues:
- prevent creation of a QgsPointV2 with a non-point WKB type
- fix bounding box was not invalidated for some modification routines
- if WKT type is PointZ/M/ZM and not enough coordinates specified,
initialise extra coordinates to 0
2015-11-19 19:48:42 +11:00
Nyall Dawson
5019fe244c Add methods to directly retrieve/set coordinates for linestring nodes
Also add method to create QgsPointV2 from a QPointF
2015-11-18 21:49:02 +11:00
Nyall Dawson
86c1ffa0aa Add reversed method to QgsCurveV2
Also clean up and add missing docs for QgsLineStringV2
2015-11-18 16:24:27 +11:00
Nyall Dawson
9cfbba1647 Add rx(), ry(), ... methods to QgsPointV2, add missing docs to class
Allows for directly modifying point's coordinates in place
2015-11-18 16:24:08 +11:00
Matthias Kuhn
56ccb2b858 sipClass_Klass is deprecated for a long time: replace with sipType_Klass 2015-11-11 23:22:51 +01:00
Nyall Dawson
87168c14a5 100% test coverage for QgsWKBTypes, add missing docs 2015-11-11 19:51:42 +11:00
Nyall Dawson
719ff408a5 Add some missing SIP bindings, comment some classes as not available
in Python
2015-11-10 17:08:27 +11:00
Nyall Dawson
da942233e7 Add DE-9IM variant which tests against a specified pattern
(available in PyQGIS/expression engine)
2015-11-04 16:03:55 +11:00
Matthias Kuhn
cd0eb05ded [py3] Some compatibility fixes for python 3 2015-10-24 13:47:32 +02:00
Juergen E. Fischer
bf64f8d0a0 spelling fixes and indentation update 2015-10-22 21:56:54 +02:00
Nyall Dawson
5f1bb6cf1f Geometry fixes:
- when creating geometry from WKT, upgrade dimensionality of geometry
if coordinates are 3/4 dimensional
- match dimensionality of collections to child dimensionality
- fix area of curves was non-zero if curve is closed
- don't consider m values when testing for curve closedness
- add unit tests for closedness
- add unit tests for CircularStrings, CompoundCurves, CurvePolygon,
tests with geometries with Z/M values
2015-10-18 21:03:15 +11:00
Nyall Dawson
8c5f3f88a9 [geometry] Fix calculation of length/perimeter for collections
Split length from perimeter calculation in geometry API, as
returning perimeter for length for polygons is misleading and
results in incorrect length/perimeter calculations for mixed
geometry collections.

Enable length & perimeter unit tests against reference geometries.
Now the length & perimeter values match those calculated by
PostGIS.
2015-10-17 15:40:36 +11:00