Also add unit tests for measure tool length and area measurement
to ensure they return the same results as field calculator
and identify tool
Refs #13209, #4252
ton of available area units (eg m2, km2, mi2, ft2, yd2, ha, ac,
etc)
Adds a new option in both the QGIS setting and project properties to
set the units used for area measurements. Just like the distance
setting, this defaults to the units set in QGIS options, but can
then be overridden for specific projects.
The setting is respected for area calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
Also adds unit tests to ensure that area calculated by attribute table
update bar, field calculator and identify tool are consistent wrt
ellipsoidal calculations and area units.
TODO: make measure tool respect area setting
(refs #13209, #4252 and fixes#12939, #2402, #4857)
Adds a new option in project properties to set the units used for
distance measurements. This setting defaults to the units set in
QGIS options, but can then be overridden for specific projects.
The setting is respected for length and perimeter calculations in:
- Attribute table field update bar
- Field calculator calculations
- Identify tool derived length and perimeter values
- Default unit shown in measure dialog
Also adds unit tests to ensure that length and perimeter calculated
by attribute table update bar, field calculator and identify tool
are consistent wrt ellipsoidal calculations and distance units.
(refs #13209, #12939, #2402, #4857, #4252)
- Remove existing (confusing and totally useless) "canvas units"
setting. This setting was supposed to be used for a confusing number
of totally different uses, eg changing the coordinate display
format and changing the default measurement units, but it was
so broken it did none of these things except change the
coordinate display and it only did that if OTF was off.
- Add a new "coordinate display" section in project settings,
which allows choice of format for coordinate display via a
combo box (this will also make it easy to add additional custom
formats in future), and make this setting work regardless of
whether OTF is on or off. This setting applies to both the
coordinate display in the status bar and coordinates shown
via the identify tool
(refs #13209, fixes#9730)
Avoid iterating over keys() and then later retrieving the matching
values, and instead use QMap/QHash iterators to retrieve both the
keys and values at the same time
- avoid Q_FOREACH( ..., QMap.values() ) as it allocates an unnecessary
list
- use .endsWith( ... , Qt::CaseInsensitive) instead of
.lower().endsWith( ... ) as it avoids an extra QString allocation
calculations for $length, $area, $perimeter (refs #13209)
ie, the default is now to use planimeteric calculations unless
a geomCalculator has been explicitly set