Skip to content

Commit

Permalink
Upgrade point size when reading old project to make it look the same.…
Browse files Browse the repository at this point in the history
… Also change default point size to same loko as previously

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7962 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Jan 14, 2008
1 parent efdd0f9 commit 438e5bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/core/qgsprojectfiletransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,35 @@ void QgsProjectFileTransform::transform091to092()
rasterProperty.namedItem("grayBandNameQString").toElement().setTagName("mGrayBandName");
}

// Changing symbol size for hard: symbols
QDomNodeList symbolPropertyList = mDom.elementsByTagName("symbol");
for (int i = 0; i < symbolPropertyList.count(); i++)
{
// Get the <poinmtsymbol> to check for 'hard:' for each <symbol>
QDomNode symbolProperty = symbolPropertyList.item(i);

QDomElement pointSymbol = symbolProperty.firstChildElement("pointsymbol");
if ( pointSymbol.text().startsWith("hard:") )
{
// Get pointsize and line width
int lineWidth = symbolProperty.firstChildElement("outlinewidth").text().toInt();
int pointSize = symbolProperty.firstChildElement("pointsize").text().toInt();
// Just a precaution, checking for 0
if (pointSize != 0)
{
// int r = (s-2*lw)/2-1 --> 2r = (s-2*lw)-2 --> 2r+2 = s-2*lw
// --> 2r+2+2*lw = s
// where '2r' is the old size.
pointSize = pointSize+2+2*lineWidth;
QgsDebugMsg(QString("Setting point size to %1").arg(pointSize));
QDomElement newPointSizeProperty=mDom.createElement("pointsize");
QDomText newPointSizeTxt=mDom.createTextNode( QString::number(pointSize) );
newPointSizeProperty.appendChild(newPointSizeTxt);
symbolProperty.replaceChild(newPointSizeProperty, pointSymbol);
}
}
}

}
return;

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgssymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ QgsSymbol::QgsSymbol(QGis::VectorType t, QString lvalue, QString uvalue, QString
mLabel(label),
mType(t),
mPointSymbolName( "hard:circle" ),
mPointSize( 11 ),
mPointSize( 10 ),
mPointSymbolImage(1,1, QImage::Format_ARGB32_Premultiplied),
mWidthScale(1.0),
mCacheUpToDate( false ),
Expand Down

0 comments on commit 438e5bf

Please sign in to comment.