QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
Contains methods for converting coordinates for display in various formats. More...
#include <qgscoordinateformatter.h>
Public Types | |
enum | Format { FormatPair , FormatDegreesMinutesSeconds , FormatDegreesMinutes , FormatDecimalDegrees } |
Available formats for displaying coordinates. More... | |
enum | FormatFlag { FlagDegreesUseStringSuffix = 1 << 1 , FlagDegreesPadMinutesSeconds = 1 << 2 } |
Flags for controlling formatting of coordinates. More... | |
typedef QFlags< FormatFlag > | FormatFlags |
Static Public Member Functions | |
static QString | asPair (double x, double y, int precision=12, Qgis::CoordinateOrder order=Qgis::CoordinateOrder::XY) |
Formats coordinates as an "\a x,\a y" pair, with optional decimal precision (number of decimal places to include). | |
static QString | format (const QgsPointXY &point, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix, Qgis::CoordinateOrder order=Qgis::CoordinateOrder::XY) |
Formats a point according to the specified parameters. | |
static QString | formatX (double x, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix) |
Formats an x coordinate value according to the specified parameters. | |
static QString | formatY (double y, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix) |
Formats a y coordinate value according to the specified parameters. | |
static QChar | separator () |
Returns the character used as X/Y separator, this is a , on locales that do not use , as decimal separator, it is a space otherwise. | |
Friends | |
class | QgsCoordinateUtils |
Contains methods for converting coordinates for display in various formats.
QgsCoordinateFormatter contains static methods for converting numeric coordinates into different formats, for instance as degrees, minutes, seconds values. Note that QgsCoordinateFormatter has no consideration for the validity of converting coordinates to the various display formats, and it is up to the caller to ensure that sensible formats are used for particular coordinates. For instance, ensuring that only geographic coordinates and not projected coordinates are formatted to degree based formats.
Definition at line 39 of file qgscoordinateformatter.h.
typedef QFlags< FormatFlag > QgsCoordinateFormatter::FormatFlags |
Definition at line 62 of file qgscoordinateformatter.h.
Available formats for displaying coordinates.
Definition at line 46 of file qgscoordinateformatter.h.
Flags for controlling formatting of coordinates.
Definition at line 57 of file qgscoordinateformatter.h.
|
static |
Formats coordinates as an "\a x,\a y" pair, with optional decimal precision (number of decimal places to include).
Since QGIS 3.26 the optional order argument can be used to control the order of the coordinates.
Definition at line 79 of file qgscoordinateformatter.cpp.
|
static |
Formats a point according to the specified parameters.
The format argument indicates the desired display format for the coordinate.
The precision argument gives the number of decimal places to include for coordinates.
Optional flags can be specified to control the output format.
Since QGIS 3.26 the optional order argument can be used to control the order of the coordinates.
Definition at line 62 of file qgscoordinateformatter.cpp.
|
static |
Formats an x coordinate value according to the specified parameters.
The format argument indicates the desired display format for the coordinate.
The precision argument gives the number of decimal places to include for coordinates.
Optional flags can be specified to control the output format.
Definition at line 24 of file qgscoordinateformatter.cpp.
|
static |
Formats a y coordinate value according to the specified parameters.
The format argument indicates the desired display format for the coordinate.
The precision argument gives the number of decimal places to include for coordinates.
Optional flags can be specified to control the output format.
Definition at line 43 of file qgscoordinateformatter.cpp.
|
static |
Returns the character used as X/Y separator, this is a ,
on locales that do not use ,
as decimal separator, it is a space otherwise.
Definition at line 96 of file qgscoordinateformatter.cpp.
|
friend |
Definition at line 131 of file qgscoordinateformatter.h.