97 Commits

Author SHA1 Message Date
Matthias Kuhn
7ee55a78f1 [pyqt5] Aliases for indistinguishable method overloads (#3099)
See
https://www.riverbankcomputing.com/pipermail/pyqt/2016-May/037500.html
2016-08-10 20:58:39 +02:00
Juergen E. Fischer
3f22a7a77f another scripts/replacev2.sh with minor manual fixes 2016-08-10 12:12:28 +02:00
Juergen E. Fischer
0688621046 scripts/replacev2.sh run 2016-08-10 12:08:52 +02:00
Juergen E. Fischer
8a4574436f replacev2.sh: replace V2 classes and methods 2016-08-10 12:08:52 +02:00
Matthias Kuhn
bb79d13e82 Remove deprecated Qgis::WKBType and API cleanup (#3325)
* Remove deprecated Qgis::WKBType and API cleanup

Renames QgsWKBTypes to QgsWkbTypes

Replaces usage of the enums:

* Qgis::WKBType with QgsWkbTypes::Type
* Qgis::GeometryType with QgsWkbTypes::GeometryType

Their values should be forward compatible (a fact that was already
explited up to now by casting between the types)

Renames some SSLxxx to SslXxx and URIxxx to UriXxx

* Fix build warnings and simplify type handling

* Add a fixer to rewrite imports

* The forgotten rebase conflictThe forgotten rebase conflicts

* QgsDataSourcURI > QgsDataSourceUri

* QgsWKBTypes > QgsWkbTypes

* Qgis.WKBGeom > QgsWkbTypes.Geom

* Further python fixes

* Guess what... Qgis::wkbDimensions != QgsWkbTypes::wkbDimensions

* Fix tests

* Python 3 updates

* [travis] pull request caching cannot be disabled

so at least use it in r/w mode

* Fix python3 print in plugins
2016-08-04 09:10:08 +02:00
Nyall Dawson
d075b128a8 Add missing docs 2016-08-02 07:26:11 +10:00
Nyall Dawson
4b78b1c208 Make all QgsGeometry methods return values, not pointers
Reduces likelihood of crashes and leaks
2016-08-01 22:41:55 +10:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Nyall Dawson
10c92394e7 [FEATURE] API + expression function for merging linestrings
Adds a new method to QgsGeometry for merging linestrings.
By passing a multilinestring, any connected lines will
be joined into single linestrings. Behind the scenes this
uses GEOS' line merge.

A corresponding expression function "line_merge" has also
been added.
2016-07-28 20:33:27 +10:00
Nyall Dawson
85f37eebb3 Add method to QgsAbstractGeometryV2 for boundary
Returns the closure of the combinatorial boundary of the
geometry (ie the topological boundary of the geometry).
For instance, a polygon geometry will have a boundary
consisting of the linestrings for each ring in the polygon.

Follows OGC / SQL/MM specs for boundary calculation
2016-07-28 08:16:57 +10:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
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