150 Commits

Author SHA1 Message Date
Nyall Dawson
1367fd09fc Prepare commit converts single line doxygen block format
Flips single line doxygen comments to use the proper single line
format:

/*!< comment */   to   //!< Comment

and

/** comment */    to   //! Comment
2016-10-25 09:17:39 +10:00
Nyall Dawson
4166a3ea62 Fix most clazy qstring-unneeded-heap-allocations warnings
By flipping string literals to QStringLiteral/QLatin1String

see

https://woboq.com/blog/qstringliteral.html
2016-10-24 15:26:24 +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
Martin Dobias
b6d03209b9 Fix closest segment for points (#3383)
* Make closestSegment() behave as expected by QgsGeometry::closestSegmentWithContext

This fixes a bug that QgsPointLocator::nearestEdge() would return valid match even for point layers.

* Shortcut if using QgsPointLocator with a wrong layer type
2016-08-11 17:23:01 +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
2374f7978b TestQgsGeometry renames:
lineStringV2() to lineString()
pointV2() to point()
polygonV2() to polygon()
2016-08-10 12:12:28 +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
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
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
Nyall Dawson
b61641dc72 Fix crash in QgsGeometry::unaryUnion with empty geometries 2016-07-14 08:24:47 +10:00
Nyall Dawson
e95a8a979a Followup 172953, add unit tests 2016-06-30 07:38:23 +10:00
Even Rouault
83683be3dc Adjust testqgsgeometry expected results after af2993e97b5a4ab98107bdce86780d11dca91109 2016-06-27 13:37:45 +02:00
Matthias Kuhn
c07f02d6dc QgsAbstractGeometryV2::wkbType always returns a valid type 2016-06-07 10:37:20 +02:00
Marco Hugentobler
daabda8ca7 Add test to make sure the curve point is part of the segmented result 2016-05-10 11:53:06 +02:00
Nyall Dawson
1f032aa563 Fix potential crash while creating geometry from WKB with bad header 2016-05-02 09:40:33 +10:00
rldhont
f48e74f33c [BUGFIX] QgsGeometry exportToGeoJSON return 'null' for null Geometry 2016-04-29 14:25:41 +02:00
Sandro Mani
1e90786be7 Extend TestQgsGeometry::isEmpty to also test empty geometry collection 2016-03-06 12:29:48 +01: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
Sandro Santilli
e8be21ad61 Add test for premature WKB end in QgsGeometry::asWkt
See #14182
2016-02-09 14:20:07 +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
6a91603fe7 Merge pull request #2730 from PeterPetrik/13669_duplicate_circular_string_nodes
fix #13669 (Circular string generates duplicated nodes)
2016-01-31 11:28:26 +11:00
Peter Petrik
86e67713d6 fix #13669 (Circular string generates duplicated nodes) 2016-01-28 11:04:40 +01:00
Juergen E. Fischer
4dd76da7f8 geometry sip sync and some cosmetics 2016-01-28 10:31:08 +01:00
mhugent
cbd29e5fd5 Merge pull request #2632 from mhugent/nodetool_remove_lines
Remove all vertices if removing second to last line point / fourth to last ring point
2016-01-04 13:42:00 +01:00
Marco Hugentobler
d01990058a Unit tests 2015-12-28 19:29:16 +01:00
Nyall Dawson
856be9ba44 Ensure that rings are closed when adding to polygons 2015-12-22 16:51:41 +11:00
Juergen E. Fischer
8214608169 more nullptr updates (folloup 320c696) 2015-12-16 16:29:29 +01: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
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
3910c457b1 Consolidate QgsGeometryUtils tests 2015-12-01 06:26:45 +11:00
Nyall Dawson
052fd7937d Followup c14352f, tweaked Coverity fixes 2015-11-30 07:39:16 +11:00
Juergen E. Fischer
c14352fa55 coverity fixes 2015-11-29 17:04:56 +01: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
6ab718d6ac QgsGeometryUtils fixes
- add QgsGeometryUtils::normalizedAngle for restricting an angle
to [0, 2PI)
- fix calculations of QgsGeometryUtils::averageAngle, was returning
perpendicular angle and angles > 2Pi
- improve docs and add unit tests
2015-11-27 16:31:41 +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
f3507747a7 QgsLineStringV2: better handling of LineString25D, more tests 2015-11-25 17:00:55 +11:00
Nyall Dawson
ff36573a74 Fix crash in QgsLineStringV2::append if non z/m line appended
to a LineString with z/m

Add a bunch of unit tests for QgsLineStringV2 and fix some other
minor issues which they identified.
2015-11-24 16:38:40 +11:00
Nyall Dawson
7443431ee4 Fix incorrect GML from QgsPointV2::asGML3
Also finish unit tests for QgsPointV2 and mark as a critical class
2015-11-24 16:22:55 +11:00
rldhont
00ea968347 [BUGFIX] Multipoint asJSON
Fixes #13855
Multipoint asJSON made MultiPoint as Multilinestring with only 1 point by linestring.

This bugfix adds tests.
2015-11-20 11:01:27 +01: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
b7e1cae4f0 Switch double quoted single character to single quotes for some
QString methods

Using single quotes is a significant performance boost. Rough
benchmarks indicate the QString single quote methods take
about 15% of the time the double quote variants take.
2015-11-02 17:55:08 +11: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
a954c3f2bb Fix some memory leaks 2015-08-25 21:39:33 +10:00