Skip to content
Permalink
Browse files

bugfixes and functions returning master / user's style file path

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@10779 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed May 13, 2009
1 parent eed03a2 commit b5d6a9e5ac43580df65079d320e00189234e6359
@@ -272,6 +272,16 @@ const QString QgsApplication::svgPath()
return mPkgDataPath + QString( "/svg/" );
}

const QString QgsApplication::userStyleV2Path()
{
return qgisSettingsDirPath() + QString( "symbology-ng-style.xml" );
}

const QString QgsApplication::defaultStyleV2Path()
{
return mPkgDataPath + QString( "/resources/symbology-ng-style.xml" );
}

QgsApplication::endian_t QgsApplication::endian()
{
return ( htonl( 1 ) == 1 ) ? XDR : NDR ;
@@ -111,6 +111,12 @@ class CORE_EXPORT QgsApplication: public QApplication
//! Returns the path to the default theme directory.
static const QString defaultThemePath();

//! Returns the path to user's style. Added in QGIS 1.2
static const QString userStyleV2Path();

//! Returns the path to default style (works as a starting point). Added in QGIS 1.2
static const QString defaultStyleV2Path();

//! Alters prefix path - used by 3rd party apps
static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = FALSE );

@@ -4,6 +4,7 @@

#include "qgsrendercontext.h"
#include "qgsapplication.h"
#include "qgslogger.h"

#include <QPainter>
#include <QSvgRenderer>
@@ -43,7 +44,7 @@ QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::create(const QgsStringMap& props
if (props.contains("size"))
size = props["size"].toDouble();
if (props.contains("angle"))
size = props["angle"].toDouble();
angle = props["angle"].toDouble();

return new QgsSimpleMarkerSymbolLayerV2(name, color, borderColor, size, angle);
}
@@ -253,7 +254,7 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::create(const QgsStringMap& props)
if (props.contains("size"))
size = props["size"].toDouble();
if (props.contains("angle"))
size = props["angle"].toDouble();
angle = props["angle"].toDouble();

return new QgsSvgMarkerSymbolLayerV2(name, size, angle);
}
@@ -411,7 +411,7 @@ bool QgsStyleV2::save(QString filename)

// save
QFile f(filename);
if (!f.open(QFile::ReadWrite))
if (!f.open(QFile::WriteOnly))
{
mErrorString = "Couldn't open file for writing: "+filename;
return false;
@@ -198,6 +198,19 @@ void QgsSymbolV2::dump()
}
}

QgsSymbolLayerV2List QgsSymbolV2::cloneLayers() const
{
QgsSymbolLayerV2List lst;
for (QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it)
{
QgsSymbolLayerV2* layer = (*it)->clone();
layer->setLocked( (*it)->isLocked() );
lst.append( layer );
}
return lst;
}


///////////////////


@@ -263,10 +276,7 @@ void QgsMarkerSymbolV2::renderPoint(const QPointF& point, QgsRenderContext& cont

QgsSymbolV2* QgsMarkerSymbolV2::clone() const
{
QgsSymbolLayerV2List lst;
for (QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it)
lst.append( (*it)->clone() );
return new QgsMarkerSymbolV2(lst);
return new QgsMarkerSymbolV2( cloneLayers() );
}


@@ -315,10 +325,7 @@ void QgsLineSymbolV2::renderPolyline(const QPolygonF& points, QgsRenderContext&

QgsSymbolV2* QgsLineSymbolV2::clone() const
{
QgsSymbolLayerV2List lst;
for (QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it)
lst.append( (*it)->clone() );
return new QgsLineSymbolV2(lst);
return new QgsLineSymbolV2( cloneLayers() );
}

///////////////////
@@ -343,8 +350,5 @@ void QgsFillSymbolV2::renderPolygon(const QPolygonF& points, QList<QPolygonF>* r

QgsSymbolV2* QgsFillSymbolV2::clone() const
{
QgsSymbolLayerV2List lst;
for (QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it)
lst.append( (*it)->clone() );
return new QgsFillSymbolV2(lst);
return new QgsFillSymbolV2( cloneLayers() );
}
@@ -70,6 +70,8 @@ class QgsSymbolV2

protected:
QgsSymbolV2(SymbolType type, QgsSymbolLayerV2List layers); // can't be instantiated

QgsSymbolLayerV2List cloneLayers() const;

SymbolType mType;
QgsSymbolLayerV2List mLayers;

0 comments on commit b5d6a9e

Please sign in to comment.
You can’t perform that action at this time.