~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgsmarkersymbol.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          qgsmarkersymbol.cpp  -  description
3
 
                             -------------------
4
 
    begin                : March 2004
5
 
    copyright            : (C) 2004 by Marco Hugentobler
6
 
    email                : mhugent@geo.unizh.ch
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
/* $Id */
18
 
 
19
 
#include "qgsmarkersymbol.h"
20
 
#include "qpainter.h"
21
 
#include "qgssymbologyutils.h"
22
 
 
23
 
void QgsMarkerSymbol::setPicture(const QString& svgpath)
24
 
{
25
 
    mSvgPath=svgpath;
26
 
}
27
 
 
28
 
bool QgsMarkerSymbol::writeXML( QDomNode & item, QDomDocument & document )
29
 
{
30
 
    bool returnval = false;
31
 
    returnval = true; // remove this if anyone ever adds checking here
32
 
    QDomElement markersymbol=document.createElement("markersymbol");
33
 
    item.appendChild(markersymbol);
34
 
    QDomElement svgpath=document.createElement("svgpath");
35
 
    QDomText svgpathtxt=document.createTextNode(mSvgPath);
36
 
    svgpath.appendChild(svgpathtxt);
37
 
    markersymbol.appendChild(svgpath);
38
 
    QDomElement scalefactor=document.createElement("scalefactor");
39
 
    QDomText scalefactortxt=document.createTextNode(QString::number(mScaleFactor,'f',2));
40
 
    scalefactor.appendChild(scalefactortxt);
41
 
    markersymbol.appendChild(scalefactor);
42
 
    markersymbol.appendChild(scalefactor);
43
 
    QDomElement outlinecolor=document.createElement("outlinecolor");
44
 
    outlinecolor.setAttribute("red",QString::number(mPen.color().red()));
45
 
    outlinecolor.setAttribute("green",QString::number(mPen.color().green()));
46
 
    outlinecolor.setAttribute("blue",QString::number(mPen.color().blue()));
47
 
    markersymbol.appendChild(outlinecolor);
48
 
    QDomElement outlinestyle=document.createElement("outlinestyle");
49
 
    QDomText outlinestyletxt=document.createTextNode(QgsSymbologyUtils::penStyle2QString(mPen.style()));
50
 
    outlinestyle.appendChild(outlinestyletxt);
51
 
    markersymbol.appendChild(outlinestyle);
52
 
    QDomElement outlinewidth=document.createElement("outlinewidth");
53
 
    QDomText outlinewidthtxt=document.createTextNode(QString::number(mPen.width()));
54
 
    outlinewidth.appendChild(outlinewidthtxt);
55
 
    markersymbol.appendChild(outlinewidth);
56
 
    QDomElement fillcolor=document.createElement("fillcolor");
57
 
    fillcolor.setAttribute("red",QString::number(mBrush.color().red()));
58
 
    fillcolor.setAttribute("green",QString::number(mBrush.color().green()));
59
 
    fillcolor.setAttribute("blue",QString::number(mBrush.color().blue()));
60
 
    markersymbol.appendChild(fillcolor);
61
 
    QDomElement fillpattern=document.createElement("fillpattern");
62
 
    QDomText fillpatterntxt=document.createTextNode(QgsSymbologyUtils::brushStyle2QString(mBrush.style()));
63
 
    fillpattern.appendChild(fillpatterntxt);
64
 
    markersymbol.appendChild(fillpattern);
65
 
    fillpattern.appendChild(fillpatterntxt);
66
 
    return returnval;
67
 
}
68
 
    
69