133 Commits

Author SHA1 Message Date
Nyall Dawson
d19e70700f Ensure all pointer variables are initialized to nullptr 2017-02-18 20:23:18 +10:00
Nyall Dawson
bfdd9dc0b0 Fix some coverity null pointer dereference issues 2017-01-27 16:54:03 +10:00
Denis Rouzaud
958dff9d82 spelling fixes 2017-01-25 17:38:01 +01:00
Juergen E. Fischer
6a56cb0dd0 updates and fixes for windows qt5/py3 build 2017-01-24 01:25:59 +01:00
Denis Rouzaud
6c74e4ea5d spelling fixes 2017-01-12 22:01:50 +01:00
Nyall Dawson
e656c63ab7 Remove duplicate QgsFeature::setFeatureId method
Leave just QgsFeature::setId and document api break
2017-01-11 10:05:31 +01:00
Matthias Kuhn
8b9857079a Use qgis_grass_lib.h import for GRASS_LIB_EXPORT macro 2017-01-05 00:12:11 +01:00
Matthias Kuhn
0302719cf0 Add qgis_core.h to with CORE_EXPORT macro
This removes complexity from the compiler flags because defines
happen in a file.
2017-01-05 00:12:11 +01:00
Matthias Kuhn
dfd9833467 Let all tests work with a proper QgsApplication instance 2016-12-20 01:20:08 +01:00
Martin Dobias
c143be7a73 QgsMapSettings and QgsComposerMap store layers for rendering as weak pointers
... instead of using layer IDs which need to be resolved using QgsProject
2016-12-10 18:50:52 +08:00
Martin Dobias
d56a97d4fe Merge QgsMapLayerRegistry into QgsProject
All methods/signals of QgsMapLayerRegistry moved verbatim to QgsProject.
2016-12-10 15:18:12 +08: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
f2672151c2 Fix clazy qfileinfo-exists warnings
From the clazy docs:

Finds places using QFileInfo("foo").exists() instead of the faster
version QFileInfo::exists("foo"). According to Qt's docs: "Using
this function is faster than using QFileInfo(file).exists() for
file system access."
2016-10-22 22:46:14 +10:00
Nyall Dawson
83ad380bd6 Switch QT4_* macros to QT5 2016-09-21 09:12:54 +10:00
Nyall Dawson
8746932193 Merge pull request #3467 from pvalsecc/arrays
[FEATURE] Add support for array attributes
2016-09-16 06:13:34 +10:00
Nyall Dawson
06d2d79185 Make sure files are truncated before writing 2016-09-14 15:12:36 +10:00
Patrick Valsecchi
abc55f4c42 Add support for arrays in PostgresQL
Fix parsing of PostgresQL hstore. Had problems when the key or values were
containing comas.
2016-09-12 10:33:00 +02:00
Patrick Valsecchi
3d6e7c8bdb Add hstore support to the postgres provider 2016-09-08 09:51:46 +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
Nyall Dawson
967d37adc7 QgsFeature::fields() returns a value, not a pointer
Also remove all other QgsFields pointers and replace with
references/values, since QgsFields objects are implicitly shared
2016-08-05 06:07:02 +10: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
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
aceddae65a QgsFeature cleanup, part 1
Deprecate some QgsFeature methods which take or return pointers,
update other classes as required
2016-07-31 21:23:07 +10:00
Martin Dobias
ab4a83b49b Goodbye to QgsMapRenderer (#3333)
For the time being the class is kept in the server code while it is still being used there.
2016-07-24 22:40:52 +02:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Nyall Dawson
4cfacf14e3 Make API more consistent
- rename methods with XML to Xml, CRS to Crs, WMS to Wms, ID to Id
- rename methods with SRS to Crs
- rename methods with abbreviations like "dest" to "destination"
- rename methods with abbreviations like "src" to "source"
2016-07-21 08:40:50 +10:00
Nyall Dawson
c628c0f434 Rework includes to forward declare as much as possible
Should speed up recompilation when headers change
2016-07-18 19:10:19 +10:00
Matthias Kuhn
c63b910d75 Remove debug noise 2016-06-12 16:01:51 +02:00
Juergen E. Fischer
6e66eef1ef add missing copyright headers 2016-06-03 10:33:09 +02:00
Even Rouault
73ab289e1b Fix Coverity warnings in testqgsogcutils.cpp and testqgsgdalprovider.cpp 2016-06-01 19:20:15 +02:00
Even Rouault
4b130cbf42 Merge pull request #3134 from rouault/do_not_write_nodata_if_not_existing
Nodata related fixes
2016-05-30 17:45:48 +02:00
Even Rouault
f3b635dcbb [GDAL provider] Ignore nodata value that are not representable in the data type.
This is related to commit e0d38ba3f912b7ae6b34e66a44e529ec37394458. In case
we have to deal with an inconsitent raster where the nodata value is set to
a value not representable in the data type, ignore it. Otherwise, a NaN value
in a Byte raster would be cast as 0.
2016-05-29 12:55:23 +02:00
Patrick Valsecchi
69bed21837 WMS: Better logic to pick the legend URL
QGIS had two problems:
1) It was using the specified legend URL only if its mime type was matching
   the layer's mime type. There is no reason for that.
2) When QGIS was using the default layer (empty string), it was not even
   trying to find out in what style to pick the legend URL.
2016-05-29 12:47:57 +02:00
Patrick Valsecchi
e79a327ab7 WMS GetCapabilities: override parent's style if they have the same name
When there is a layer group with several sub-layers, the group has a
"default" style and the sub-layers each have a "default" layer. QGIS
was showing two "default" styles for the sub-layers, which would be
confusing to the user and could pick the wrong legend for the
sub-layer if the user picked the wrong entry (the first one).

Had to create a static lib for wmsprovider in order to unittest it.
2016-05-29 12:47:57 +02:00
Juergen E. Fischer
b514f521e6 cppcheck fixes 2016-05-16 14:14:14 +02:00
Nyall Dawson
ccebd83aa4 Standardise format of initializer lists 2016-05-03 09:38:04 +10:00
Juergen E. Fischer
ea4a0e27d9 testqgswcspublicservers: also update network timeout (followup 3894159) 2016-03-24 18:39:00 +01:00
Nyall Dawson
884c3ba8dd Use constGeometry to avoid some QgsFeature detachments 2016-01-14 09:58:23 +11:00
Nyall Dawson
87c58f4541 Mark more includes as system includes 2016-01-08 16:43:27 +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
013d6d3331 Fix more warnings 2015-12-21 19:30:32 +11:00
Nyall Dawson
ee720796a3 Change size()/count() == 0 and count() > 0 to isEmpty() checks
Because:
- easier to read
- follows recommendations by clazy/KDAB
- potentially performance benefits
2015-12-08 22:45:06 +11:00
Radim Blazek
f3d9e752b2 [GRASS] added (disabled) test for #13739 2015-11-02 19:42:54 +01: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
Radim Blazek
5f9611e37c [GRASS] add test for #13726 (new line attributes lost) 2015-11-01 21:01:23 +01:00
Radim Blazek
968e55cb11 [GRASS] fixed test 2015-11-01 20:24:14 +01:00
Radim Blazek
16e902b3c1 [GRASS] coverity fixes 2015-10-30 11:20:21 +01:00
Radim Blazek
86505e0fb8 [GRASS] more edit tests 2015-10-21 20:02:22 +02:00