- prefer to use initializers over ctor body initialization

- more robust handling of handling legacy project files


git-svn-id: http://svn.osgeo.org/qgis/trunk@3098 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mcoletti 2005-04-08 18:26:28 +00:00
parent 4a2ac17aab
commit 9ed75f6aef

View File

@ -34,30 +34,32 @@
#include <qpointarray.h>
QgsSymbol::QgsSymbol()
{
mPointSymbolName = "hard:circle";
mPointSize = 6;
mPointSymbolPixmap.resize(1,1);
mCacheUpToDate = mCacheUpToDate2 = false;
mOversampling = 1;
mWidthScale = 1.;
}
: mPointSymbolName( "hard:circle" ),
mPointSize( 6 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mPointSymbolPixmap(1,1),
mOversampling(1),
mWidthScale(1.0)
{}
QgsSymbol::QgsSymbol(QColor c)
{
mPointSymbolName = "hard:circle";
mPen.setColor(c);
mBrush.setColor(c);
mPointSize = 6;
mPointSymbolPixmap.resize(1,1);
mCacheUpToDate = mCacheUpToDate2 = false;
mOversampling = 1;
mWidthScale = 1.;
}
: mPen( c ),
mBrush( c ),
mPointSymbolName( "hard:circle" ),
mPointSize( 6 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mPointSymbolPixmap(1,1),
mOversampling(1),
mWidthScale(1.0)
{}
QgsSymbol::~QgsSymbol()
{
}
{}
QColor QgsSymbol::color() const
{
return mPen.color();
@ -286,13 +288,24 @@ bool QgsSymbol::writeXML( QDomNode & item, QDomDocument & document )
bool QgsSymbol::readXML( QDomNode & synode )
{
// Legacy project file formats didn't have support for pointsymbol nor
// pointsize DOM elements. Therefore we should check whether these
// actually exist.
QDomNode psymbnode = synode.namedItem("pointsymbol");
QDomElement psymbelement = psymbnode.toElement();
setNamedPointSymbol( psymbelement.text() );
if ( ! psymbnode.isNull() )
{
QDomElement psymbelement = psymbnode.toElement();
setNamedPointSymbol( psymbelement.text() );
}
QDomNode psizenode = synode.namedItem("pointsize");
QDomElement psizeelement = psizenode.toElement();
setPointSize( psizeelement.text().toInt() );
if ( ! psizenode.isNull() )
{
QDomElement psizeelement = psizenode.toElement();
setPointSize( psizeelement.text().toInt() );
}
QDomNode outlcnode = synode.namedItem("outlinecolor");
QDomElement oulcelement = outlcnode.toElement();