summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-31 14:38:10 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-31 14:38:10 (GMT)
commit1a11520817ffeebbfc6c482eff1a5c5a019a9d81 (patch)
tree28f53ae74540b8ad874409cabe7eeaa9abb3e4bc
parent690fcf380985c5fefbb8531fbeb54a1432b49044 (diff)
Avoid creating multiple string copies of new styleurls
-rw-r--r--src/lib/marble/FileLoader.cpp4
-rw-r--r--src/lib/marble/MarbleModel.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/marble/FileLoader.cpp b/src/lib/marble/FileLoader.cpp
index 11b0fd0..8f64e52 100644
--- a/src/lib/marble/FileLoader.cpp
+++ b/src/lib/marble/FileLoader.cpp
@@ -239,6 +239,8 @@ void FileLoaderPrivate::documentParsed( GeoDataDocument* doc, const QString& err
void FileLoaderPrivate::createFilterProperties( GeoDataContainer *container )
{
+ const QString styleUrl = QLatin1Char('#') + m_styleMap->id();
+
QVector<GeoDataFeature*>::Iterator i = container->begin();
QVector<GeoDataFeature*>::Iterator const end = container->end();
for (; i != end; ++i ) {
@@ -264,7 +266,7 @@ void FileLoaderPrivate::createFilterProperties( GeoDataContainer *container )
placemark->geometry()->nodeType() != GeoDataTypes::GeoDataPointType
&& m_documentRole == MapDocument
&& m_style ) {
- placemark->setStyleUrl(QLatin1Char('#') + m_styleMap->id());
+ placemark->setStyleUrl(styleUrl);
}
// Mountain (H), Volcano (V), Shipwreck (W)
diff --git a/src/lib/marble/MarbleModel.cpp b/src/lib/marble/MarbleModel.cpp
index 08d125f..3d50537 100644
--- a/src/lib/marble/MarbleModel.cpp
+++ b/src/lib/marble/MarbleModel.cpp
@@ -480,6 +480,7 @@ void MarbleModelPrivate::assignNewStyle( const QString &filePath, const GeoDataS
addHighlightStyle( doc );
+ const QString styleUrl = QLatin1Char('#') + styleMap.id();
QVector<GeoDataFeature*>::iterator iter = doc->begin();
QVector<GeoDataFeature*>::iterator const end = doc->end();
@@ -490,7 +491,7 @@ void MarbleModelPrivate::assignNewStyle( const QString &filePath, const GeoDataS
if ( placemark->geometry()->nodeType() != GeoDataTypes::GeoDataTrackType &&
placemark->geometry()->nodeType() != GeoDataTypes::GeoDataPointType )
{
- placemark->setStyleUrl(QLatin1Char('#') + styleMap.id());
+ placemark->setStyleUrl(styleUrl);
}
}
}
@@ -871,6 +872,7 @@ void MarbleModelPrivate::assignFillColors( const QString &filePath ) {
doc->addStyle( style );
doc->addStyleMap( styleMap );
+ const QString styleUrl = QLatin1Char('#') + styleMap.id();
QVector<GeoDataFeature*>::iterator iter = doc->begin();
QVector<GeoDataFeature*>::iterator const end = doc->end();
@@ -881,7 +883,7 @@ void MarbleModelPrivate::assignFillColors( const QString &filePath ) {
if ( placemark->geometry()->nodeType() != GeoDataTypes::GeoDataTrackType &&
placemark->geometry()->nodeType() != GeoDataTypes::GeoDataPointType )
{
- placemark->setStyleUrl(QLatin1Char('#') + styleMap.id());
+ placemark->setStyleUrl(styleUrl);
}
}
}