QGIS API Documentation
3.99.0-Master (09f76ad7019)
Loading...
Searching...
No Matches
src
core
qgsdartmeasurement.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsdartmeasurement.cpp
3
--------------------------------------
4
Date : 8.11.2014
5
Copyright : (C) 2014 Matthias Kuhn
6
Email : matthias at opengis dot ch
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
16
#include "
qgsdartmeasurement.h
"
17
18
#include <QString>
19
#include <QTextStream>
20
21
using namespace
Qt::StringLiterals;
22
23
QgsDartMeasurement::QgsDartMeasurement
(
const
QString &name,
Type
type,
const
QString &value )
24
: mName( name )
25
, mType( type )
26
, mValue( value )
27
{
28
}
29
30
const
QString
QgsDartMeasurement::toString
()
const
31
{
32
QString elementName = u
"DartMeasurement"
_s;
33
if
( mType ==
ImagePng
)
34
{
35
elementName = u
"DartMeasurementFile"
_s;
36
}
37
38
QString dashMessage = u
"<%1 name=\"%2\" type=\"%3\">%4</%1>"
_s
39
.arg( elementName,
40
mName,
41
typeToString
( mType ),
42
mValue );
43
return
dashMessage;
44
}
45
46
void
QgsDartMeasurement::send
()
const
47
{
48
QTextStream out( stdout );
49
out <<
toString
() << Qt::endl;
50
}
51
52
const
QString
QgsDartMeasurement::typeToString
(
QgsDartMeasurement::Type
type )
53
{
54
QString str;
55
56
switch
( type )
57
{
58
case
Text
:
59
str = u
"text/text"
_s;
60
break
;
61
62
case
ImagePng
:
63
str = u
"image/png"
_s;
64
break
;
65
66
case
Integer
:
67
str = u
"numeric/integer"
_s;
68
break
;
69
}
70
71
return
str;
72
}
QgsDartMeasurement::typeToString
static const QString typeToString(QgsDartMeasurement::Type type)
Convert a QgsDartMeasurement::Type enum to a string that is understood by the system.
Definition
qgsdartmeasurement.cpp:52
QgsDartMeasurement::toString
const QString toString() const
Definition
qgsdartmeasurement.cpp:30
QgsDartMeasurement::QgsDartMeasurement
QgsDartMeasurement()=default
QgsDartMeasurement::Type
Type
Definition
qgsdartmeasurement.h:32
QgsDartMeasurement::Integer
@ Integer
Definition
qgsdartmeasurement.h:35
QgsDartMeasurement::Text
@ Text
Definition
qgsdartmeasurement.h:33
QgsDartMeasurement::ImagePng
@ ImagePng
Definition
qgsdartmeasurement.h:34
QgsDartMeasurement::send
void send() const
Definition
qgsdartmeasurement.cpp:46
qgsdartmeasurement.h
Generated on
for QGIS API Documentation by
1.15.0