QGIS API Documentation
4.0.0-Norrköping (1ddcee3d0e4)
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
const
QString
QgsDartMeasurement::toString
()
const
30
{
31
QString elementName = u
"DartMeasurement"
_s;
32
if
( mType ==
ImagePng
)
33
{
34
elementName = u
"DartMeasurementFile"
_s;
35
}
36
37
QString dashMessage = u
"<%1 name=\"%2\" type=\"%3\">%4</%1>"
_s.arg( elementName, mName,
typeToString
( mType ), mValue );
38
return
dashMessage;
39
}
40
41
void
QgsDartMeasurement::send
()
const
42
{
43
QTextStream out( stdout );
44
out <<
toString
() << Qt::endl;
45
}
46
47
const
QString
QgsDartMeasurement::typeToString
(
QgsDartMeasurement::Type
type )
48
{
49
QString str;
50
51
switch
( type )
52
{
53
case
Text
:
54
str = u
"text/text"
_s;
55
break
;
56
57
case
ImagePng
:
58
str = u
"image/png"
_s;
59
break
;
60
61
case
Integer
:
62
str = u
"numeric/integer"
_s;
63
break
;
64
}
65
66
return
str;
67
}
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:47
QgsDartMeasurement::toString
const QString toString() const
Definition
qgsdartmeasurement.cpp:29
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:41
qgsdartmeasurement.h
Generated on
for QGIS API Documentation by
1.15.0