QGIS/python/core/qgscoordinateformatter.sip

93 lines
3.2 KiB
Plaintext
Raw Normal View History

2017-11-15 07:58:29 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgscoordinateformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsCoordinateFormatter
{
2017-11-15 07:58:29 +10:00
%Docstring
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.
2017-11-15 08:08:26 +10:00
.. versionadded:: 3.0
%End
2017-11-15 07:58:29 +10:00
%TypeHeaderCode
#include "qgscoordinateformatter.h"
%End
public:
enum Format
{
2017-11-15 08:08:26 +10:00
FormatPair,
FormatDegreesMinutesSeconds,
FormatDegreesMinutes,
FormatDecimalDegrees,
};
enum FormatFlag
{
2017-11-15 08:08:26 +10:00
FlagDegreesUseStringSuffix,
FlagDegreesPadMinutesSeconds,
};
typedef QFlags<QgsCoordinateFormatter::FormatFlag> FormatFlags;
2017-11-15 07:58:29 +10:00
2017-11-15 08:08:26 +10:00
static QString formatX( double x, Format format, int precision = 12, FormatFlags flags = FlagDegreesUseStringSuffix );
2017-11-15 07:58:29 +10:00
%Docstring
2017-11-15 08:08:26 +10:00
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.
.. seealso:: formatY()
2017-11-15 07:58:29 +10:00
:rtype: str
%End
2017-11-15 08:08:26 +10:00
static QString formatY( double y, Format format, int precision = 12, FormatFlags flags = FlagDegreesUseStringSuffix );
2017-11-15 07:58:29 +10:00
%Docstring
2017-11-15 08:08:26 +10:00
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.
.. seealso:: formatX()
2017-11-15 07:58:29 +10:00
:rtype: str
%End
static QString asPair( double x, double y, int precision = 12 );
2017-11-15 07:58:29 +10:00
%Docstring
2017-11-15 08:08:26 +10:00
Formats coordinates as an "``x``,``y``" pair, with optional decimal ``precision`` (number
of decimal places to include).
2017-11-15 07:58:29 +10:00
:rtype: str
%End
};
2017-11-15 07:58:29 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgscoordinateformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/