QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsbearingnumericformat.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsbearingnumericformat.h
3 --------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSBEARINGNUMERICFORMAT_H
16#define QGSBEARINGNUMERICFORMAT_H
17
18#include "qgis_core.h"
19#include "qgis_sip.h"
21
29{
30 public:
31
37 {
38 UseRange0To180WithEWDirectionalSuffix = 0,
41 };
42
47
48 QString id() const override;
49 QString visibleName() const override;
50 int sortKey() override;
51 double suggestSampleValue() const override;
52 QString formatDouble( double value, const QgsNumericFormatContext &context ) const override;
54 QgsNumericFormat *create( const QVariantMap &configuration, const QgsReadWriteContext &context ) const override SIP_FACTORY;
55 QVariantMap configuration( const QgsReadWriteContext &context ) const override;
56
63 FormatDirectionOption directionFormat() const;
64
71 void setDirectionFormat( FormatDirectionOption format );
72
73 void setConfiguration( const QVariantMap &configuration, const QgsReadWriteContext &context ) override;
74
75 private:
76
77 FormatDirectionOption mDirectionFormat = UseRange0To180WithEWDirectionalSuffix;
78
79};
80
81#endif // QGSBEARINGNUMERICFORMAT_H
A numeric formatter which returns a simple text representation of a value.
QString id() const override
Returns a unique id for this numeric format.
QString visibleName() const override
Returns the translated, user-visible name for this format.
int sortKey() override
Returns a sorting key value, where formats with a lower sort key will be shown earlier in lists.
QgsNumericFormat * clone() const override
Clones the format, returning a new object.
QString formatDouble(double value, const QgsNumericFormatContext &context) const override
Returns a formatted string representation of a numeric double value.
A numeric formatter which returns a text representation of a direction/bearing.
FormatDirectionOption
Directional formatting option, which controls how bearing direction is described in the returned stri...
@ UseRange0To360
Return values between 0 to 360.
@ UseRangeNegative180ToPositive180
Return values between -180 and 180.
A context for numeric formats.
A numeric formatter allows for formatting a numeric value for display, using a variety of different f...
virtual double suggestSampleValue() const
Returns a suggested sample value which nicely represents the current format configuration.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_FACTORY
Definition: qgis_sip.h:76