59 Commits

Author SHA1 Message Date
Nyall Dawson
c975764c12 Port processing oriented minimum bounding box alg to QgsGeometry 2016-12-07 20:13:29 +10:00
Nyall Dawson
45a52dfacd Rename minimum area paremeter, fix docs for QgsCurvePolygon::removeInteriorRing 2016-11-29 08:43:23 +10:00
Nyall Dawson
57f482e2d9 Add method to QgsGeometry to remove interior rings from a polygon
With an optional area threshold
2016-11-28 12:08:21 +10:00
Nyall Dawson
b44093914b Fix test failure, report distance from pole 2016-11-14 15:52:41 +10:00
Nyall Dawson
d6f09c012e [FEATURE] Add method to calculate pole of inaccessibility for polygons
Implements a method in QgsGeometry and a processing algorithm to
calculate the pole of inaccessibility for a surface, which is the
most distant internal point from the boundary of the surface. This function
uses the 'polylabel' algorithm (Vladimir Agafonkin, 2016), which is an iterative
approach guaranteed to find the true pole of inaccessibility within a specified
tolerance. More precise tolerances require more iterations and will take longer
to calculate.
2016-11-14 15:52:41 +10:00
Martin Dobias
9872b4848d Remove caching of GEOS representation within QgsGeometry (legacy) 2016-11-14 13:36:12 +08: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
f9bb230665 Avoid some QgsGeometry pointer use in QgsGeometry API 2016-11-08 11:09:19 +10:00
Martin Dobias
24fbe1a080 Fix crash in node tool after deleting the whole geometry (fixes #15659)
Made sure that both closestVertex() and closestSegment() return negative
distance on error (e.g. with null or emtpy geometry).

Also fixes snapping when dealing with layers with null/invalid geometries

(cherry picked from commit c093d5188fad685c4a596ff23c27aad7d151dac2)
2016-10-31 12:51:21 +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
3c4f46dc79 Remove more code disabled under Qt5
Add todo note for QgsHttpTransaction and disable under docs and
sip bindings
2016-09-21 09:12:54 +10:00
Nyall Dawson
4d60d0cdb5 [FEATURE] Add option to QgsGeometry::smooth to not smooth
segments shorter than a certain threshold or sharp corners
with an angle exceeding a threshold

Expose the angle threshold to processing smooth algorithm

Also:
- optimise QgsGeometry::smooth for new geometry classes
- Fix smooth does not work with geometries containing Z/M
2016-09-03 08:31:33 +10:00
Nyall Dawson
986b5313ed Add QgsGeometry method to get bisector of angle at vertex
Sponsored by Andreas Neumann
2016-08-29 11:01:52 +10:00
Nyall Dawson
93c7f5f8b2 Add geometry methods for interpolating angle along geometry
Sponsored by Andreas Neumann
2016-08-29 08:57:10 +10:00
nirvn
2a326ef8ad [FEATURE] support aggregation of geometry
This feature adds a 'collect' aggregation method resulting in a
single multipart geometry from a list of geometries. This is exposed
in the expression engine via the existing aggregate() function,
as well as a new collect() function.
2016-08-24 08:39:05 +07:00
Nyall Dawson
409dfdf539 [FEATURE] Expose GEOS linear referencing function to QgsGeometry
Adds a new QgsGeometry::lineLocatePoint() function for
retrieving the distance along a linestring to the nearest
position on the linestring to a given point.
2016-08-21 20:48:54 +10:00
Nyall Dawson
e3f0d3d88f [FEATURE] Expose GEOS single sided buffer through QgsGeometry
Makes it easy for PyQGIS code to perform a single sided buffer
operation
2016-08-17 06:43:02 +10:00
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
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
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
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Nyall Dawson
0fcff9f2a0 Allow direct QVariant creation from some QGIS metatypes 2016-05-20 09:48:18 +10: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
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +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
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
Juergen E. Fischer
71dc339106 more stl to qt ports and size_t => int fixups 2015-12-26 00:59:09 +01: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
5654eeca55 Fix area calculation when OTF active and no ellipsoid (fix #13601) 2015-10-15 17:51:07 +11:00
Nyall Dawson
ad10b5264e Fix using add part tool to add part to geometryless rows
(fix #12885, #11319)

Also fix some potential crashes with edit tools and null geometry
2015-10-13 16:59:52 +11:00
Sandro Mani
c927073e20 Add some docstrings 2015-10-08 11:28:32 +02:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00
Nyall Dawson
0caf944747 Misc optimisations identified by clazy:
- call reserve on container classes where applicable
- make sure Q_FOREACH uses references
- remove dynamic casts to base classes
- fix some implicit bool conversions
2015-10-05 18:43:18 +11:00
Sandro Mani
e9e638f6f4 Geometry Checker and Geometry Snapper plugins 2015-09-21 10:03:24 +02:00
Nyall Dawson
8ce9930f4a Fix leak in add map tool 2015-09-01 16:07:10 +10:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Marco Hugentobler
39f8bd9eb9 Add factory annotation 2015-06-25 11:34:36 +02:00
Marco Hugentobler
7b31f8a02f Remove python bindings for QgsGeos, move createGeometryEngine() from edit utils to QgsGeometry class 2015-06-25 10:45:53 +02:00
Nyall Dawson
e53debe215 Update doxygen comments for QgsGeometry, reflecting that QgsGeometry
is a generic geometry container from >= 2.10.
2015-06-22 21:29:51 +10:00