mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix incorrect display of coordinates in status bar
This commit is contained in:
parent
017b9343ce
commit
66c8a85b88
@ -61,7 +61,7 @@ QString QgsCoordinateFormatter::formatY( double y, QgsCoordinateFormatter::Forma
|
|||||||
QString QgsCoordinateFormatter::format( const QgsPointXY &point, QgsCoordinateFormatter::Format format, int precision, FormatFlags flags )
|
QString QgsCoordinateFormatter::format( const QgsPointXY &point, QgsCoordinateFormatter::Format format, int precision, FormatFlags flags )
|
||||||
{
|
{
|
||||||
return QStringLiteral( "%1,%2" ).arg( formatX( point.x(), format, precision, flags ),
|
return QStringLiteral( "%1,%2" ).arg( formatX( point.x(), format, precision, flags ),
|
||||||
formatY( point.x(), format, precision, flags ) );
|
formatY( point.y(), format, precision, flags ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsCoordinateFormatter::asPair( double x, double y, int precision )
|
QString QgsCoordinateFormatter::asPair( double x, double y, int precision )
|
||||||
|
@ -14,7 +14,7 @@ __revision__ = '$Format:%H$'
|
|||||||
|
|
||||||
import qgis
|
import qgis
|
||||||
from qgis.testing import unittest
|
from qgis.testing import unittest
|
||||||
from qgis.core import QgsCoordinateFormatter
|
from qgis.core import QgsCoordinateFormatter, QgsPointXY
|
||||||
|
|
||||||
|
|
||||||
class TestQgsCoordinateFormatter(unittest.TestCase):
|
class TestQgsCoordinateFormatter(unittest.TestCase):
|
||||||
@ -48,6 +48,11 @@ class TestQgsCoordinateFormatter(unittest.TestCase):
|
|||||||
self.assertEqual(QgsCoordinateFormatter.asPair(20, 10, 2), '20.00,10.00')
|
self.assertEqual(QgsCoordinateFormatter.asPair(20, 10, 2), '20.00,10.00')
|
||||||
self.assertEqual(QgsCoordinateFormatter.asPair(20, -10, 2), '20.00,-10.00')
|
self.assertEqual(QgsCoordinateFormatter.asPair(20, -10, 2), '20.00,-10.00')
|
||||||
|
|
||||||
|
def testFormat(self):
|
||||||
|
self.assertEqual(QgsCoordinateFormatter.format(QgsPointXY(20.1, 30.2), QgsCoordinateFormatter.FormatPair, 0), '20,30')
|
||||||
|
self.assertEqual(QgsCoordinateFormatter.format(QgsPointXY(20.1, 30.2), QgsCoordinateFormatter.FormatPair, 1), '20.1,30.2')
|
||||||
|
self.assertEqual(QgsCoordinateFormatter.format(QgsPointXY(20, 30), QgsCoordinateFormatter.FormatDegreesMinutesSeconds, 0), '20°0′0″E,30°0′0″N')
|
||||||
|
|
||||||
def testFormatXFormatDegreesMinutesSeconds(self):
|
def testFormatXFormatDegreesMinutesSeconds(self):
|
||||||
"""Test formatting x as DMS"""
|
"""Test formatting x as DMS"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user