27 Commits

Author SHA1 Message Date
Nyall Dawson
379e7a42e6 Add some more QgsVector operators, allow use of QgsVector with QgsPointV2 2016-12-09 08:13:48 +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
983fe24806 Port some API from QgsPoint to QgsPointV2 2016-11-07 12:20:59 +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
Juergen E. Fischer
0688621046 scripts/replacev2.sh run 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
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
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
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
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
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
85eebff69b Avoid some unnecessary object conversion during point rendering 2015-12-15 22:36:49 +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
d388a4f1a4 [geometry] Add method to drop z/m values from a geometry 2015-12-01 16:33:44 +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
Nyall Dawson
a333fc8248 Add method to geometries for adding z/m dimension, initialized
to a specified value
2015-10-14 08:39:05 +11:00
Sandro Mani
e9e638f6f4 Geometry Checker and Geometry Snapper plugins 2015-09-21 10:03:24 +02:00
Marco Hugentobler
8e1a19a9cc Documentation 2015-09-04 17:23:41 +02:00
Marco Hugentobler
56316ddcad Consider curved geometries in marker line symbol layer 2015-09-04 14:53:06 +02:00
Marco Hugentobler
68fe5f5791 [FEATURE:] New geometry classes 2015-05-25 08:53:49 +02:00