QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
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... | |
Static Public Member Functions | |
static QString | asPair (double x, double y, int precision=12) |
Formats coordinates as an "\a x,\a y" pair, with optional decimal precision (number of decimal places to include). More... | |
static QString | format (const QgsPointXY &point, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix) |
Formats a point according to the specified parameters. More... | |
static QString | formatX (double x, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix) |
Formats an x coordinate value according to the specified parameters. More... | |
static QString | formatY (double y, Format format, int precision=12, FormatFlags flags=FlagDegreesUseStringSuffix) |
Formats a y coordinate value according to the specified parameters. More... | |
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 40 of file qgscoordinateformatter.h.
Available formats for displaying coordinates.
Definition at line 47 of file qgscoordinateformatter.h.
Flags for controlling formatting of coordinates.
Definition at line 58 of file qgscoordinateformatter.h.
|
static |
Formats coordinates as an "\a x,\a y" pair, with optional decimal precision (number of decimal places to include).
Definition at line 67 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.
Definition at line 61 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 23 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 42 of file qgscoordinateformatter.cpp.