Skip to content
Permalink
Browse files

Merge pull request #3349 from nyalldawson/feature_geom

Mega API break - fix QgsFeature geometry getters/setters
  • Loading branch information
nyalldawson committed Aug 1, 2016
2 parents f7a3fd7 + b7ca001 commit e259e6294126fb2e19c135753f6f9ad974f38074
Showing with 2,862 additions and 3,106 deletions.
  1. +70 −0 doc/api_break.dox
  2. +2 −2 python/analysis/vector/qgsgeometryanalyzer.sip
  3. +8 −0 python/core/__init__.py
  4. +48 −34 python/core/geometry/qgsgeometry.sip
  5. +21 −75 python/core/qgsfeature.sip
  6. +2 −2 python/core/qgsgeometrysimplifier.sip
  7. +1 −1 python/core/qgsmaptopixelgeometrysimplifier.sip
  8. +2 −2 python/core/qgsogcutils.sip
  9. +5 −5 python/core/qgspallabeling.sip
  10. +1 −1 python/core/qgsvectordataprovider.sip
  11. +3 −13 python/core/qgsvectorlayer.sip
  12. +8 −2 python/core/qgsvectorlayereditbuffer.sip
  13. +1 −1 python/core/qgsvectorlayereditpassthrough.sip
  14. +1 −1 python/core/qgsvectorlayereditutils.sip
  15. +1 −1 python/core/qgsvectorlayerundocommand.sip
  16. +15 −1 python/gui/qgshighlight.sip
  17. +3 −3 python/gui/qgsrubberband.sip
  18. +2 −2 python/plugins/db_manager/db_plugins/vlayers/data_model.py
  19. +4 −4 python/plugins/processing/algs/qgis/Buffer.py
  20. +1 −1 python/plugins/processing/algs/qgis/Centroids.py
  21. +2 −2 python/plugins/processing/algs/qgis/CheckValidity.py
  22. +5 −5 python/plugins/processing/algs/qgis/Clip.py
  23. +2 −2 python/plugins/processing/algs/qgis/ConvexHull.py
  24. +2 −2 python/plugins/processing/algs/qgis/Delaunay.py
  25. +1 −1 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  26. +1 −1 python/plugins/processing/algs/qgis/DeleteHoles.py
  27. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometries.py
  28. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
  29. +2 −2 python/plugins/processing/algs/qgis/Difference.py
  30. +5 −5 python/plugins/processing/algs/qgis/Dissolve.py
  31. +3 −3 python/plugins/processing/algs/qgis/Eliminate.py
  32. +1 −2 python/plugins/processing/algs/qgis/FieldsMapper.py
  33. +2 −2 python/plugins/processing/algs/qgis/Intersection.py
  34. +1 −1 python/plugins/processing/algs/qgis/LinesIntersection.py
  35. +1 −1 python/plugins/processing/algs/qgis/OrientedMinimumBoundingBox.py
  36. +1 −1 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  37. +1 −1 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  38. +1 −1 python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py
  39. +1 −1 python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py
  40. +6 −6 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  41. +6 −6 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  42. +3 −3 python/plugins/processing/algs/qgis/ReverseLineDirection.py
  43. +2 −2 python/plugins/processing/algs/qgis/SelectByAttributeSum.py
  44. +1 −1 python/plugins/processing/algs/qgis/SimplifyGeometries.py
  45. +1 −1 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  46. +2 −2 python/plugins/processing/algs/qgis/Smooth.py
  47. +2 −2 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
  48. +2 −2 python/plugins/processing/algs/qgis/SumLines.py
  49. +4 −4 python/plugins/processing/algs/qgis/SymmetricalDifference.py
  50. +5 −5 python/plugins/processing/algs/qgis/Union.py
  51. +1 −1 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  52. +1 −1 python/plugins/processing/tests/ToolsTest.py
  53. +2 −2 python/testing/__init__.py
  54. +1 −2 src/analysis/interpolation/DualEdgeTriangulation.cc
  55. +5 −5 src/analysis/interpolation/qgsinterpolator.cpp
  56. +1 −1 src/analysis/interpolation/qgsinterpolator.h
  57. +4 −4 src/analysis/interpolation/qgstininterpolator.cpp
  58. +8 −8 src/analysis/network/qgslinevectorlayerdirector.cpp
  59. +5 −9 src/analysis/openstreetmap/qgsosmdatabase.cpp
  60. +77 −91 src/analysis/vector/qgsgeometryanalyzer.cpp
  61. +8 −8 src/analysis/vector/qgsgeometryanalyzer.h
  62. +6 −6 src/analysis/vector/qgsoverlayanalyzer.cpp
  63. +5 −9 src/analysis/vector/qgspointsample.cpp
  64. +66 −116 src/analysis/vector/qgstransectsample.cpp
  65. +5 −6 src/analysis/vector/qgstransectsample.h
  66. +13 −15 src/analysis/vector/qgszonalstatistics.cpp
  67. +2 −2 src/analysis/vector/qgszonalstatistics.h
  68. +1 −1 src/app/composer/qgscomposer.cpp
  69. +9 −7 src/app/gps/qgsgpsinformationwidget.cpp
  70. +9 −9 src/app/nodetool/qgsmaptoolnodetool.cpp
  71. +2 −2 src/app/nodetool/qgsmaptoolnodetool.h
  72. +3 −3 src/app/nodetool/qgsnodeeditor.cpp
  73. +8 −8 src/app/nodetool/qgsselectedfeature.cpp
  74. +2 −2 src/app/nodetool/qgsselectedfeature.h
  75. +31 −39 src/app/qgisapp.cpp
  76. +2 −2 src/app/qgisapp.h
  77. +1 −3 src/app/qgsattributetabledialog.cpp
  78. +8 −6 src/app/qgsclipboard.cpp
  79. +1 −1 src/app/qgsfieldcalculator.cpp
  80. +4 −4 src/app/qgsidentifyresultsdialog.cpp
  81. +15 −9 src/app/qgsmaptooladdfeature.cpp
  82. +16 −22 src/app/qgsmaptooldeletepart.cpp
  83. +1 −1 src/app/qgsmaptooldeletepart.h
  84. +25 −29 src/app/qgsmaptooldeletering.cpp
  85. +3 −3 src/app/qgsmaptooldeletering.h
  86. +2 −1 src/app/qgsmaptoolfillring.cpp
  87. +4 −5 src/app/qgsmaptoollabel.cpp
  88. +6 −9 src/app/qgsmaptoolmovefeature.cpp
  89. +33 −48 src/app/qgsmaptooloffsetcurve.cpp
  90. +4 −4 src/app/qgsmaptooloffsetcurve.h
  91. +2 −4 src/app/qgsmaptoolpinlabels.cpp
  92. +5 −5 src/app/qgsmaptoolreshape.cpp
  93. +10 −12 src/app/qgsmaptoolrotatefeature.cpp
  94. +2 −2 src/app/qgsmaptoolselect.cpp
  95. +1 −2 src/app/qgsmaptoolselectfreehand.cpp
  96. +1 −2 src/app/qgsmaptoolselectpolygon.cpp
  97. +1 −2 src/app/qgsmaptoolselectradius.cpp
  98. +1 −3 src/app/qgsmaptoolselectrectangle.cpp
  99. +16 −16 src/app/qgsmaptoolselectutils.cpp
  100. +4 −4 src/app/qgsmaptoolselectutils.h
  101. +3 −3 src/app/qgsmaptoolshowhidelabels.cpp
  102. +15 −16 src/app/qgsmaptoolsimplify.cpp
  103. +1 −1 src/app/qgsmaptoolsimplify.h
  104. +1 −1 src/app/qgsmergeattributesdialog.cpp
  105. +4 −4 src/core/composer/qgsatlascomposition.cpp
  106. +3 −3 src/core/composer/qgscomposerattributetablev2.cpp
  107. +2 −3 src/core/composer/qgscomposermap.cpp
  108. +14 −26 src/core/composer/qgscomposermapgrid.cpp
  109. +3 −2 src/core/dxf/qgsdxfexport.cpp
  110. +168 −147 src/core/geometry/qgsgeometry.cpp
  111. +53 −39 src/core/geometry/qgsgeometry.h
  112. +2 −2 src/core/geometry/qgsgeometryeditutils.cpp
  113. +27 −1 src/core/qgsdistancearea.cpp
  114. +33 −0 src/core/qgsdistancearea.h
  115. +65 −75 src/core/qgsexpression.cpp
  116. +3 −4 src/core/qgsexpressioncontext.cpp
  117. +15 −61 src/core/qgsfeature.cpp
  118. +21 −76 src/core/qgsfeature.h
  119. +5 −18 src/core/qgsfeature_p.h
  120. +1 −1 src/core/qgsfeaturerequest.cpp
  121. +5 −10 src/core/qgsgeometrysimplifier.cpp
  122. +2 −2 src/core/qgsgeometrysimplifier.h
  123. +11 −11 src/core/qgsgml.cpp
  124. +8 −15 src/core/qgsjsonutils.cpp
  125. +3 −4 src/core/qgslabelingenginev2.cpp
  126. +1 −1 src/core/qgsmaphittest.cpp
  127. +3 −9 src/core/qgsmaptopixelgeometrysimplifier.cpp
  128. +1 −1 src/core/qgsmaptopixelgeometrysimplifier.h
  129. +2 −1 src/core/qgsofflineediting.cpp
  130. +63 −68 src/core/qgsogcutils.cpp
  131. +8 −8 src/core/qgsogcutils.h
  132. +5 −5 src/core/qgsogrutils.cpp
  133. +3 −2 src/core/qgsogrutils.h
  134. +52 −80 src/core/qgspallabeling.cpp
  135. +6 −5 src/core/qgspallabeling.h
  136. +16 −12 src/core/qgspointlocator.cpp
  137. +1 −1 src/core/qgspointlocator.h
  138. +6 −8 src/core/qgssnappingutils.cpp
  139. +2 −2 src/core/qgsspatialindex.cpp
  140. +21 −21 src/core/qgstracer.cpp
  141. +1 −1 src/core/qgstracer.h
  142. +3 −3 src/core/qgsvectordataprovider.cpp
  143. +1 −1 src/core/qgsvectordataprovider.h
  144. +22 −18 src/core/qgsvectorfilewriter.cpp
  145. +1 −1 src/core/qgsvectorfilewriter.h
  146. +24 −68 src/core/qgsvectorlayer.cpp
  147. +4 −14 src/core/qgsvectorlayer.h
  148. +3 −3 src/core/qgsvectorlayercache.cpp
  149. +1 −1 src/core/qgsvectorlayercache.h
  150. +11 −11 src/core/qgsvectorlayerdiagramprovider.cpp
  151. +1 −1 src/core/qgsvectorlayereditbuffer.cpp
  152. +8 −2 src/core/qgsvectorlayereditbuffer.h
  153. +3 −3 src/core/qgsvectorlayereditpassthrough.cpp
  154. +1 −1 src/core/qgsvectorlayereditpassthrough.h
  155. +41 −37 src/core/qgsvectorlayereditutils.cpp
  156. +1 −1 src/core/qgsvectorlayereditutils.h
  157. +2 −2 src/core/qgsvectorlayerfeatureiterator.cpp
  158. +6 −4 src/core/qgsvectorlayerimport.cpp
  159. +6 −6 src/core/qgsvectorlayerlabelprovider.cpp
  160. +6 −6 src/core/qgsvectorlayerrenderer.cpp
  161. +22 −26 src/core/qgsvectorlayerundocommand.cpp
  162. +3 −3 src/core/qgsvectorlayerundocommand.h
  163. +2 −2 src/core/symbology-ng/qgsellipsesymbollayerv2.cpp
  164. +2 −2 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  165. +4 −8 src/core/symbology-ng/qgsheatmaprenderer.cpp
  166. +15 −22 src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
  167. +1 −1 src/core/symbology-ng/qgsinvertedpolygonrenderer.h
  168. +2 −2 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  169. +3 −6 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  170. +4 −4 src/core/symbology-ng/qgsnullsymbolrenderer.cpp
  171. +7 −8 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  172. +19 −28 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  173. +30 −35 src/core/symbology-ng/qgssymbolv2.cpp
  174. +5 −6 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  175. +10 −8 src/gui/qgshighlight.cpp
  176. +15 −2 src/gui/qgshighlight.h
  177. +1 −1 src/gui/qgsidentifymenu.cpp
  178. +4 −4 src/gui/qgsmapcanvas.cpp
  179. +7 −13 src/gui/qgsmapcanvassnapper.cpp
  180. +2 −2 src/gui/qgsmaptoolcapture.cpp
  181. +14 −14 src/gui/qgsmaptoolidentify.cpp
  182. +15 −15 src/gui/qgsrubberband.cpp
  183. +3 −3 src/gui/qgsrubberband.h
  184. +2 −2 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  185. +5 −2 src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp
  186. +11 −6 src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp
  187. +13 −6 src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
  188. +8 −6 src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp
  189. +4 −2 src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.cpp
  190. +8 −6 src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp
  191. +5 −2 src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp
  192. +7 −4 src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp
  193. +4 −2 src/plugins/geometry_checker/checks/qgsgeometryholecheck.cpp
  194. +5 −3 src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.cpp
  195. +13 −10 src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp
  196. +5 −2 src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp
  197. +12 −7 src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp
  198. +7 −5 src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp
  199. +1 −1 src/plugins/geometry_checker/qgsgeometrychecker.cpp
  200. +2 −2 src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp
  201. +1 −1 src/plugins/geometry_checker/utils/qgsfeaturepool.cpp
  202. +8 −7 src/plugins/geometry_snapper/qgsgeometrysnapper.cpp
  203. +2 −2 src/plugins/globe/featuresource/qgsglobefeaturesource.cpp
  204. +1 −1 src/plugins/globe/featuresource/qgsglobefeaturesource.h
  205. +4 −4 src/plugins/heatmap/heatmap.cpp
  206. +2 −2 src/plugins/spatialquery/qgsrubberselectid.cpp
  207. +17 −18 src/plugins/spatialquery/qgsspatialquery.cpp
  208. +3 −4 src/plugins/spatialquery/qgsspatialquery.h
  209. +4 −4 src/plugins/spatialquery/qgsspatialquerydialog.cpp
  210. +14 −14 src/plugins/topology/checkDock.cpp
  211. +30 −27 src/plugins/topology/topolError.cpp
  212. +19 −19 src/plugins/topology/topolError.h
  213. +155 −184 src/plugins/topology/topolTest.cpp
  214. +3 −3 src/providers/arcgisrest/qgsafsprovider.cpp
  215. +1 −1 src/providers/arcgisrest/qgsamsprovider.cpp
  216. +4 −4 src/providers/db2/qgsdb2featureiterator.cpp
  217. +2 −2 src/providers/db2/qgsdb2provider.cpp
  218. +15 −17 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  219. +3 −3 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.h
  220. +14 −18 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  221. +1 −1 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  222. +7 −3 src/providers/gpx/qgsgpxfeatureiterator.cpp
  223. +2 −2 src/providers/gpx/qgsgpxprovider.cpp
  224. +13 −13 src/providers/grass/qgis.v.in.cpp
  225. +2 −2 src/providers/grass/qgsgrassfeatureiterator.cpp
  226. +4 −2 src/providers/grass/qgsgrassimport.cpp
  227. +8 −13 src/providers/grass/qgsgrassprovider.cpp
  228. +1 −1 src/providers/grass/qgsgrassprovider.h
  229. +3 −6 src/providers/memory/qgsmemoryfeatureiterator.cpp
  230. +2 −1 src/providers/memory/qgsmemoryfeatureiterator.h
  231. +2 −2 src/providers/memory/qgsmemoryprovider.cpp
  232. +4 −4 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  233. +4 −4 src/providers/mssql/qgsmssqlprovider.cpp
  234. +5 −5 src/providers/ogr/qgsogrfeatureiterator.cpp
  235. +3 −3 src/providers/ogr/qgsogrprovider.cpp
  236. +7 −7 src/providers/oracle/qgsoraclefeatureiterator.cpp
  237. +4 −10 src/providers/oracle/qgsoracleprovider.cpp
  238. +1 −1 src/providers/oracle/qgsoracleprovider.h
  239. +3 −3 src/providers/postgres/qgspostgresfeatureiterator.cpp
  240. +7 −7 src/providers/postgres/qgspostgresprovider.cpp
  241. +1 −1 src/providers/postgres/qgspostgresprovider.h
  242. +5 −5 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  243. +3 −3 src/providers/spatialite/qgsspatialiteprovider.cpp
  244. +1 −1 src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
  245. +1 −1 src/providers/virtual/qgsvirtuallayerprovider.cpp
  246. +3 −3 src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
  247. +20 −18 src/providers/wfs/qgswfsfeatureiterator.cpp
  248. +6 −6 src/providers/wfs/qgswfsprovider.cpp
  249. +13 −14 src/providers/wfs/qgswfsshareddata.cpp
  250. +4 −4 src/providers/wfs/qgswfsutils.cpp
  251. +10 −6 src/providers/wms/qgswmsprovider.cpp
  252. +29 −33 src/server/qgswfsserver.cpp
  253. +8 −8 src/server/qgswmsconfigparser.cpp
  254. +12 −12 src/server/qgswmsserver.cpp
  255. +14 −12 tests/src/app/testqgisappclipboard.cpp
  256. +4 −2 tests/src/app/testqgsattributetable.cpp
  257. +4 −2 tests/src/app/testqgsfieldcalculator.cpp
  258. +9 −6 tests/src/app/testqgsmaptoolidentifyaction.cpp
  259. +4 −2 tests/src/core/testqgsconnectionpool.cpp
  260. +7 −7 tests/src/core/testqgsdistancearea.cpp
  261. +94 −103 tests/src/core/testqgsexpression.cpp
  262. +36 −76 tests/src/core/testqgsfeature.cpp
  263. +135 −133 tests/src/core/testqgsgeometry.cpp
  264. +6 −8 tests/src/core/testqgsgeometryimport.cpp
  265. +75 −75 tests/src/core/testqgsgml.cpp
  266. +15 −9 tests/src/core/testqgslegendrenderer.cpp
  267. +1 −1 tests/src/core/testqgsmaprendererjob.cpp
  268. +7 −7 tests/src/core/testqgsmaptopixelgeometrysimplifier.cpp
  269. +16 −17 tests/src/core/testqgsogcutils.cpp
  270. +24 −21 tests/src/core/testqgsogrutils.cpp
  271. +6 −4 tests/src/core/testqgspointlocator.cpp
  272. +6 −3 tests/src/core/testqgssnappingutils.cpp
  273. +6 −3 tests/src/core/testqgsspatialindex.cpp
  274. +5 −6 tests/src/core/testqgstracer.cpp
  275. +5 −5 tests/src/core/testqgsvectordataprovider.cpp
  276. +6 −25 tests/src/core/testqgsvectorfilewriter.cpp
  277. +14 −14 tests/src/gui/testqgsrubberband.cpp
  278. +12 −9 tests/src/providers/grass/testqgsgrassprovider.cpp
  279. +3 −3 tests/src/python/providertestbase.py
  280. +5 −5 tests/src/python/test_provider_ogr.py
  281. +1 −1 tests/src/python/test_provider_shapefile.py
  282. +1 −1 tests/src/python/test_provider_virtual.py
  283. +2 −2 tests/src/python/test_qgsdelimitedtextprovider.py
  284. +13 −3 tests/src/python/test_qgsgeometry.py
  285. +9 −9 tests/src/python/test_qgsjsonutils.py
@@ -224,12 +224,50 @@ attributeIndexes(), pkAttributeIndexes(), isSaveAndLoadStyleToDBSupported()</li>
</li>
</ul>

\subsection qgis_api_break_3_0_QgsFeature QgsFeature

<ul>
<li>geometryAndOwnership() has been removed. Use geometry() instead.</li>
<li>setGeometryAndOwnership() has been removed. Use setGeometry() instead.</li>
<li>The setGeometry( QgsGeometry* ) method has been removed, use setGeometry( const QgsGeometry& ) instead.</li>
<li>The geometry() method now returns a copy of the geometry, not a pointer. Since QgsGeometry objects are
implicitly shared this is a low-cost copy, and avoids ownership and dangling pointer issues. <b>Very important: Testing that
a feature has a geometry is now done using the new hasGeometry() method. Any code which compares QgsFeature::geometry() to
None will need to be modified, as the method will return an empty geometry if the feature has no geometry.</b></li>
<li>The temporary constGeometry() method has been removed. Use geometry() instead.</li>
<li>setFields( const QgsFields*, bool ) has been removed, use setFields( const QgsFields&, bool ) instead.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGeometry QgsGeometry

<ul>
<li>All QgsGeometry methods now accept geometry references instead of pointers, and return a QgsGeometry
value instead of a pointer. The biggest impact with this change is that PyQGIS code should not compare a geometry
result to None, but instead either use a boolean test (`if g.buffer(10):`) or explicitly use the isEmpty()
method to determine if a geometry is valid.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGeometryAnalyzer QgsGeometryAnalyzer

<ul>
<li>locateBetweenMeasures() and locateAlongMeasure() now take geometry references, not pointers, and return
a QgsGeometry value rather than a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsGroupWMSDataDialog QgsGroupWMSDataDialog

<ul>
<li>QgsGroupWMSDataDialo has been renamed to QgsGroupWmsDataDialog</li>
</ul>

\subsection qgis_api_break_3_0_QgsHighlight QgsHighlight

<ul>
<li>The QgsHighlight constructor now takes a geometry reference, not a pointer.</li>
</ul>



\subsection qgis_api_break_3_0_QgsVectorDataProvider QgsVectorDataProvider

<ul>
@@ -239,6 +277,7 @@ only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
<li>The SaveAsShapefile, SelectGeometryAtId, RandomSelectGeometryAtId and SequentialSelectGeometryAtId
capabilities have been removed, as they were unused and had no effect.</li>
<li>capabilities() now returns a typesafe QgsVectorDataProvider::Capabilities object, not an integer.</li>
<li>convertToProviderType() now takes a geometry reference, not a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsLabelingEngineInterface QgsLabelingEngineInterface
@@ -334,6 +373,7 @@ be returned instead of a null pointer if no transformation is required.</li>

<ul>
<li>init(QgsMapRenderer*) has been removed. Use init(const QgsMapSettings&) instead.</li>
<li>prepareGeometry and geometryRequiresPreparation now take geometry references, not pointers.</li>
</ul>

\subsection qgis_api_break_3_0_QgsOSMElement QgsOSMElement
@@ -396,6 +436,12 @@ be returned instead of a null pointer if no transformation is required.</li>
<li>setCoordinateTransform() now takes a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.</li>
</ul>

\subsection qgis_api_break_3_0_QgsRubberBand QgsRubberBand

<ul>
<li>setToGeometry() and addGeometry() now take geometry references, not pointers.</li>
</ul>

\subsection qgis_api_break_3_0_QgsPalLayerSettings QgsPalLayerSettings

<ul>
@@ -430,6 +476,23 @@ plugins calling this method will need to be updated.</li>
setExcludeAttributesWms()</li>
<li>excludeAttributesWFS() and setExcludeAttributesWFS() have been renamed to excludeAttributesWfs() and
setExcludeAttributesWfs()</li>
<li>changeGeometry() now accepts a geometry reference, not a pointer.</li>
<li>The geometryChanged() signal now uses a const QgsGeometry reference.</li>
<li>The deprecated removePolygonIntersections has been removed.</li>
<li>addTopologicalPoints() now takes a geometry reference, not a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerEditBuffer QgsVectorLayerEditBuffer

<ul>
<li>changeGeometry() now accepts a geometry reference, not a pointer.</li>
<li>The geometryChanged() signal now uses a const QgsGeometry reference.</li>
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerEditUtils QgsVectorLayerEditUtils

<ul>
<li>addTopologicalPoints() now accepts a geometry reference, not a pointer.</li>
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerImport QgsVectorLayerImport
@@ -441,6 +504,13 @@ pointers makes for more robust, safer code. Use an invalid (default constructed)
in code which previously passed a null pointer to QgsVectorLayerImport.</li>
</ul>

\subsection qgis_api_break_3_0_QgsVectorLayerUndoCommand QgsVectorLayerUndoCommand

<ul>
<li>QgsVectorLayerUndoCommandChangeGeometry constructor now accepts a geometry reference, not a pointer.</li>
</ul>


\subsection qgis_api_break_3_0_QgsPointLocator QgsPointLocator

<ul>
@@ -95,10 +95,10 @@ class QgsGeometryAnalyzer
bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = 0, QProgressDialog* p = 0 );

/** Returns linear reference geometry as a multiline (or 0 if no match). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)*/
QgsGeometry* locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry* lineGeom );
QgsGeometry locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry& lineGeom );
/** Returns linear reference geometry. Unlike the PostGIS function, this method always returns multipoint or 0 if no match (not geometry collection).
* Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)
*/
QgsGeometry* locateAlongMeasure( double measure, const QgsGeometry* lineGeom );
QgsGeometry locateAlongMeasure( double measure, const QgsGeometry& lineGeom );

};
@@ -29,6 +29,14 @@
import string
from qgis._core import *

# Boolean evaluation of QgsGeometry


def _geometryNonZero(self):
return not self.isEmpty()
QgsGeometry.__nonzero__ = _geometryNonZero
QgsGeometry.__bool__ = _geometryNonZero


def register_function(function, arg_count, group, usesgeometry=False, referenced_columns=[QgsFeatureRequest.AllAttributes], **kwargs):
"""
@@ -65,21 +65,21 @@ class QgsGeometry
bool isEmpty() const;

/** Creates a new geometry from a WKT string */
static QgsGeometry* fromWkt( const QString& wkt ) /Factory/;
static QgsGeometry fromWkt( const QString& wkt );
/** Creates a new geometry from a QgsPoint object*/
static QgsGeometry* fromPoint( const QgsPoint& point ) /Factory/;
static QgsGeometry fromPoint( const QgsPoint& point );
/** Creates a new geometry from a QgsMultiPoint object */
static QgsGeometry* fromMultiPoint( const QgsMultiPoint& multipoint ) /Factory/;
static QgsGeometry fromMultiPoint( const QgsMultiPoint& multipoint );
/** Creates a new geometry from a QgsPolyline object */
static QgsGeometry* fromPolyline( const QgsPolyline& polyline ) /Factory/;
static QgsGeometry fromPolyline( const QgsPolyline& polyline );
/** Creates a new geometry from a QgsMultiPolyline object*/
static QgsGeometry* fromMultiPolyline( const QgsMultiPolyline& multiline ) /Factory/;
static QgsGeometry fromMultiPolyline( const QgsMultiPolyline& multiline );
/** Creates a new geometry from a QgsPolygon */
static QgsGeometry* fromPolygon( const QgsPolygon& polygon ) /Factory/;
static QgsGeometry fromPolygon( const QgsPolygon& polygon );
/** Creates a new geometry from a QgsMultiPolygon */
static QgsGeometry* fromMultiPolygon( const QgsMultiPolygon& multipoly ) /Factory/;
static QgsGeometry fromMultiPolygon( const QgsMultiPolygon& multipoly );
/** Creates a new geometry from a QgsRectangle */
static QgsGeometry* fromRect( const QgsRectangle& rect ) /Factory/;
static QgsGeometry fromRect( const QgsRectangle& rect );

/**
* Set the geometry, feeding in a geometry in GEOS format.
@@ -393,49 +393,57 @@ class QgsGeometry
*/
int makeDifference( const QgsGeometry* other );

/** Returns the geometry formed by modifying this geometry such that it does not
* intersect the other geometry.
* @param other geometry that should not be intersect
* @return difference geometry, or empty geometry if difference could not be calculated
* @note added in QGIS 3.0
*/
QgsGeometry makeDifference( const QgsGeometry& other ) const;

/** Returns the bounding box of this feature*/
QgsRectangle boundingBox() const;

/** Test for intersection with a rectangle (uses GEOS) */
bool intersects( const QgsRectangle& r ) const;

/** Test for intersection with a geometry (uses GEOS) */
bool intersects( const QgsGeometry* geometry ) const;
bool intersects( const QgsGeometry& geometry ) const;

/** Test for containment of a point (uses GEOS) */
bool contains( const QgsPoint* p ) const;

/** Test for if geometry is contained in another (uses GEOS)
* @note added in 1.5 */
bool contains( const QgsGeometry* geometry ) const;
bool contains( const QgsGeometry& geometry ) const;

/** Test for if geometry is disjoint of another (uses GEOS)
* @note added in 1.5 */
bool disjoint( const QgsGeometry* geometry ) const;
bool disjoint( const QgsGeometry& geometry ) const;

/** Test for if geometry equals another (uses GEOS)
* @note added in 1.5 */
bool equals( const QgsGeometry* geometry ) const;
bool equals( const QgsGeometry& geometry ) const;

/** Test for if geometry touch another (uses GEOS)
* @note added in 1.5 */
bool touches( const QgsGeometry* geometry ) const;
bool touches( const QgsGeometry& geometry ) const;

/** Test for if geometry overlaps another (uses GEOS)
* @note added in 1.5 */
bool overlaps( const QgsGeometry* geometry ) const;
bool overlaps( const QgsGeometry& geometry ) const;

/** Test for if geometry is within another (uses GEOS)
* @note added in 1.5 */
bool within( const QgsGeometry* geometry ) const;
bool within( const QgsGeometry& geometry ) const;

/** Test for if geometry crosses another (uses GEOS)
* @note added in 1.5 */
bool crosses( const QgsGeometry* geometry ) const;
bool crosses( const QgsGeometry& geometry ) const;

/** Returns a buffer region around this geometry having the given width and with a specified number
of segments used to approximate curves */
QgsGeometry* buffer( double distance, int segments ) const /Factory/;
QgsGeometry buffer( double distance, int segments ) const;

/** Returns a buffer region around the geometry, with additional style options.
* @param distance buffer distance
@@ -446,44 +454,44 @@ class QgsGeometry
* @note added in 2.4
* @note needs GEOS >= 3.3 - otherwise always returns 0
*/
QgsGeometry* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit ) const /Factory/;
QgsGeometry buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit ) const;

/** Returns an offset line at a given distance and side from an input line.
* See buffer() method for details on parameters.
* @note added in 2.4
* @note needs GEOS >= 3.3 - otherwise always returns 0
*/
QgsGeometry* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const /Factory/;
QgsGeometry offsetCurve( double distance, int segments, int joinStyle, double mitreLimit ) const;

/** Returns a simplified version of this geometry using a specified tolerance value */
QgsGeometry* simplify( double tolerance ) const /Factory/;
QgsGeometry simplify( double tolerance ) const;

/** Returns the center of mass of a geometry
* @note for line based geometries, the center point of the line is returned,
* and for point based geometries, the point itself is returned
*/
QgsGeometry* centroid() const /Factory/;
QgsGeometry centroid() const;

/** Returns a point within a geometry */
QgsGeometry* pointOnSurface() const /Factory/;
QgsGeometry pointOnSurface() const;

/** Returns the smallest convex polygon that contains all the points in the geometry. */
QgsGeometry* convexHull() const /Factory/;
QgsGeometry convexHull() const;

/**
* Return interpolated point on line at distance
* @note added in 1.9
*/
QgsGeometry* interpolate( double distance ) /Factory/;
QgsGeometry interpolate( double distance );

/** Returns a geometry representing the points shared by this geometry and other. */
QgsGeometry* intersection( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry intersection( const QgsGeometry& geometry ) const;

/** Returns a geometry representing all the points in this geometry and other (a
* union geometry operation).
* @note this operation is not called union since its a reserved word in C++.
*/
QgsGeometry* combine( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry combine( const QgsGeometry& geometry ) const;

/** Merges any connected lines in a LineString/MultiLineString geometry and
* converts them to single line strings.
@@ -495,10 +503,10 @@ class QgsGeometry
QgsGeometry mergeLines() const;

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* difference( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry difference( const QgsGeometry& geometry ) const;

/** Returns a geometry representing the points making up this geometry that do not make up other. */
QgsGeometry* symDifference( const QgsGeometry* geometry ) const /Factory/;
QgsGeometry symDifference( const QgsGeometry& geometry ) const;

/** Returns an extruded version of this geometry. */
QgsGeometry extrude( double x, double y );
@@ -523,7 +531,7 @@ class QgsGeometry
* @return the converted geometry or nullptr if the conversion fails.
* @note added in 2.2
*/
QgsGeometry* convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const /Factory/;
QgsGeometry convertToType( Qgis::GeometryType destType, bool destMultipart = false ) const;

/* Accessor functions for getting geometry data */

@@ -556,7 +564,7 @@ class QgsGeometry

/** Return contents of the geometry as a list of geometries
@note added in version 1.1 */
QList<QgsGeometry*> asGeometryCollection() const /Factory/;
QList<QgsGeometry> asGeometryCollection() const;

/** Return contents of the geometry as a QPointF if wkbType is WKBPoint,
* otherwise returns a null QPointF.
@@ -635,7 +643,7 @@ class QgsGeometry
* @param geometryList a list of QgsGeometry* as input
* @returns the new computed QgsGeometry, or null
*/
static QgsGeometry *unaryUnion( const QList<QgsGeometry*>& geometryList ) /Factory/;
static QgsGeometry unaryUnion( const QList<QgsGeometry>& geometryList );

/** Converts the geometry to straight line segments, if it is a curved geometry type.
* @note added in QGIS 2.10
@@ -696,15 +704,15 @@ class QgsGeometry
* @param point source QPointF
* @note added in QGIS 2.7
*/
static QgsGeometry* fromQPointF( QPointF point ) /Factory/;
static QgsGeometry fromQPointF( QPointF point );

/** Construct geometry from a QPolygonF. If the polygon is closed than
* the resultant geometry will be a polygon, if it is open than the
* geometry will be a polyline.
* @param polygon source QPolygonF
* @note added in QGIS 2.7
*/
static QgsGeometry* fromQPolygonF( const QPolygonF& polygon ) /Factory/;
static QgsGeometry fromQPolygonF( const QPolygonF& polygon );

/** Creates a QgsPolyline from a QPolygonF.
* @param polygon source polygon
@@ -760,7 +768,7 @@ class QgsGeometry
* of the geometry for each iteration. Smaller values result in "tighter" smoothing.
* @note added in 2.9
*/
QgsGeometry* smooth( const unsigned int iterations, const double offset ) const;
QgsGeometry smooth( const unsigned int iterations, const double offset ) const;

/** Smooths a polygon using the Chaikin algorithm*/
QgsPolygon smoothPolygon( const QgsPolygon &polygon, const unsigned int iterations = 1, const double offset = 0.25 ) const;
@@ -786,5 +794,11 @@ class QgsGeometry
//! Allows direct construction of QVariants from geometry.
operator QVariant() const;

/** Returns true if the geometry is non empty (ie, isEmpty() returns false),
* or false if it is an empty, uninitialised geometry (ie, ieEmpty() returns true).
* @note added in QGIS 3.0
*/
operator bool() const;

}; // class QgsGeometry

0 comments on commit e259e62

Please sign in to comment.
You can’t perform that action at this time.