QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 dot kuhn at gmx 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 <QDebug>
19 
20 QgsDartMeasurement::QgsDartMeasurement( const QString& name, Type type, const QString& value )
21  : mName( name )
22  , mType( type )
23  , mValue( value )
24 {
25 }
26 
27 const QString QgsDartMeasurement::toString() const
28 {
29  QString elementName = "DartMeasurement";
30  if ( mType == ImagePng )
31  {
32  elementName = "DartMeasurementFile";
33  }
34 
35  QString dashMessage = QString( "<%1 name=\"%2\" type=\"%3\">%4</%1>" )
36  .arg( elementName )
37  .arg( mName )
38  .arg( typeToString( mType ) )
39  .arg( mValue );
40  return dashMessage;
41 }
42 
44 {
45  qDebug() << toString() + "\n";
46 }
47 
49 {
50  QString str;
51 
52  switch ( type )
53  {
54  case Text:
55  str = "text/text";
56  break;
57 
58  case ImagePng:
59  str = "image/png";
60  break;
61 
62  case Integer:
63  str = "numeric/integer";
64  break;
65  }
66 
67  return str;
68 }