summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-03 00:22:01 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-03 01:49:47 (GMT)
commit342a17a31b94d8c97f6ef511f11537c97125bb7f (patch)
treef3fc7b62482bb0210c0630b2ef2586f885094b23
parentaba0b56fa291e0c9f7cb39a7237ad53570f5567c (diff)
Use QStringLiteral with OsmPlacemarkData::tagValue/containsTagKey/containsTag
-rw-r--r--src/lib/marble/StyleBuilder.cpp48
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp26
-rw-r--r--src/lib/marble/osm/OsmRelationEditorDialog.cpp4
-rw-r--r--src/lib/marble/osm/OsmRelationManagerWidget.cpp8
-rw-r--r--src/lib/marble/osm/OsmRelationManagerWidget_p.cpp4
-rw-r--r--src/plugins/runner/json/JsonParser.cpp4
6 files changed, 48 insertions, 46 deletions
diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp
index bb03b21..bd23c47 100644
--- a/src/lib/marble/StyleBuilder.cpp
+++ b/src/lib/marble/StyleBuilder.cpp
@@ -1245,7 +1245,7 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
GeoDataPolyStyle polyStyle = style->polyStyle();
GeoDataLineStyle lineStyle = style->lineStyle();
if (visualCategory == GeoDataFeature::NaturalWater) {
- if( osmData.containsTag("salt","yes") ){
+ if (osmData.containsTag(QStringLiteral("salt"), QStringLiteral("yes"))) {
polyStyle.setColor("#ffff80");
lineStyle.setPenStyle(Qt::DashLine);
lineStyle.setWidth(2);
@@ -1253,8 +1253,8 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
}
}
else if (visualCategory == GeoDataFeature::Bathymetry) {
- if (osmData.containsTagKey("ele")) {
- QString elevation = osmData.tagValue("ele");
+ if (osmData.containsTagKey(QStringLiteral("ele"))) {
+ QString elevation = osmData.tagValue(QStringLiteral("ele"));
if (elevation == QLatin1String("4000")) {
polyStyle.setColor("#a5c9c9");
lineStyle.setColor("#a5c9c9");
@@ -1263,13 +1263,13 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
}
}
else if (visualCategory == GeoDataFeature::AmenityGraveyard || visualCategory == GeoDataFeature::LanduseCemetery) {
- if( osmData.containsTag("religion","jewish") ){
+ if (osmData.containsTag(QStringLiteral("religion"), QStringLiteral("jewish"))) {
polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_jewish.png"));
adjustStyle = true;
- } else if( osmData.containsTag("religion","christian") ){
+ } else if (osmData.containsTag(QStringLiteral("religion"), QStringLiteral("christian"))) {
polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_christian.png"));
adjustStyle = true;
- } else if( osmData.containsTag("religion","INT-generic") ){
+ } else if (osmData.containsTag(QStringLiteral("religion"), QStringLiteral("INT-generic"))) {
polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_generic.png"));
adjustStyle = true;
}
@@ -1300,10 +1300,10 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
lineStyle.setCosmeticOutline(true);
if(visualCategory == GeoDataFeature::AdminLevel2){
- if (osmData.containsTag("maritime", "yes") ) {
+ if (osmData.containsTag(QStringLiteral("maritime"), QStringLiteral("yes"))) {
lineStyle.setColor("#88b3bf");
polyStyle.setColor("#88b3bf");
- if( osmData.containsTag("marble:disputed", "yes") ){
+ if (osmData.containsTag(QStringLiteral("marble:disputed"), QStringLiteral("yes"))) {
lineStyle.setPenStyle( Qt::DashLine );
}
}
@@ -1321,13 +1321,14 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
lineStyle.setPhysicalWidth(0.0);
lineStyle.setWidth(4.0);
} else {
- if (osmData.containsTagKey("width")) {
- QString const widthValue = osmData.tagValue("width").remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
+ if (osmData.containsTagKey(QStringLiteral("width"))) {
+ QString const widthValue = osmData.tagValue(QStringLiteral("width")).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
bool ok;
float const width = widthValue.toFloat(&ok);
lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f) : 0.0f);
} else {
- bool const isOneWay = osmData.containsTag("oneway", "yes") || osmData.containsTag("oneway", "-1");
+ bool const isOneWay = osmData.containsTag(QStringLiteral("oneway"), QStringLiteral("yes")) ||
+ osmData.containsTag(QStringLiteral("oneway"), QStringLiteral("-1"));
int const lanes = isOneWay ? 1 : 2; // also for motorway which implicitly is one way, but has two lanes and each direction has its own highway
double const laneWidth = 3.0;
double const margins = visualCategory == GeoDataFeature::HighwayMotorway ? 2.0 : (isOneWay ? 1.0 : 0.0);
@@ -1336,7 +1337,7 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
}
}
- QString const accessValue = osmData.tagValue("access");
+ QString const accessValue = osmData.tagValue(QStringLiteral("access"));
if (accessValue == QLatin1String("private") ||
accessValue == QLatin1String("no") ||
accessValue == QLatin1String("agricultural") ||
@@ -1367,7 +1368,7 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
lineStyle.setWidth(2);
lineStyle.setPhysicalWidth(0.0);
} else {
- QString const widthValue = osmData.tagValue("width").remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
+ QString const widthValue = osmData.tagValue(QStringLiteral("width")).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
bool ok;
float const width = widthValue.toFloat(&ok);
lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f) : 0.0f);
@@ -1389,8 +1390,8 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters &paramete
GeoDataLineStyle lineStyle = style->lineStyle();
bool adjustStyle = false;
if (visualCategory == GeoDataFeature::Bathymetry) {
- if (osmData.containsTagKey("ele")) {
- QString elevation = osmData.tagValue("ele");
+ if (osmData.containsTagKey(QStringLiteral("ele"))) {
+ QString elevation = osmData.tagValue(QStringLiteral("ele"));
if (elevation == QLatin1String("4000")) {
polyStyle.setColor("#a5c9c9");
lineStyle.setColor("#a5c9c9");
@@ -1937,16 +1938,16 @@ QStringList StyleBuilder::buildingValues()
GeoDataFeature::GeoDataVisualCategory StyleBuilder::determineVisualCategory(const OsmPlacemarkData &osmData)
{
- if (osmData.containsTagKey("area:highway") || // Not supported yet
+ if (osmData.containsTagKey(QStringLiteral("area:highway")) || // Not supported yet
osmData.containsTag("boundary", "protected_area") || // Not relevant for the default map
osmData.containsTag("boundary", "postal_code") ||
osmData.containsTag("boundary", "aerial_views") || // Created by OSM editor(s) application for digitalization
- osmData.containsTagKey("closed:highway") ||
- osmData.containsTagKey("abandoned:highway") ||
- osmData.containsTagKey("abandoned:natural") ||
- osmData.containsTagKey("abandoned:building") ||
- osmData.containsTagKey("abandoned:leisure") ||
- osmData.containsTagKey("disused:highway") ||
+ osmData.containsTagKey(QStringLiteral("closed:highway")) ||
+ osmData.containsTagKey(QStringLiteral("abandoned:highway")) ||
+ osmData.containsTagKey(QStringLiteral("abandoned:natural")) ||
+ osmData.containsTagKey(QStringLiteral("abandoned:building")) ||
+ osmData.containsTagKey(QStringLiteral("abandoned:leisure")) ||
+ osmData.containsTagKey(QStringLiteral("disused:highway")) ||
osmData.containsTag("highway", "razed")) {
return GeoDataFeature::None;
}
@@ -1955,7 +1956,8 @@ GeoDataFeature::GeoDataVisualCategory StyleBuilder::determineVisualCategory(cons
return GeoDataFeature::None;
}
- if (osmData.containsTagKey("building") && buildingValues().contains(osmData.tagValue("building")) ) {
+ if (osmData.containsTagKey(QStringLiteral("building")) &&
+ buildingValues().contains(osmData.tagValue(QStringLiteral("building"))) ) {
return GeoDataFeature::Building;
}
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
index 39a10c8..054642e 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
@@ -99,8 +99,8 @@ int GeoPolygonGraphicsItem::extractBathymetryElevation(const GeoDataFeature *fea
if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
- if (placemark->osmData().containsTagKey("ele")) {
- elevation = placemark->osmData().tagValue("ele").toInt();
+ if (placemark->osmData().containsTagKey(QStringLiteral("ele"))) {
+ elevation = placemark->osmData().tagValue(QStringLiteral("ele")).toInt();
}
}
@@ -253,17 +253,17 @@ double GeoPolygonGraphicsItem::extractBuildingHeight(const GeoDataFeature *featu
if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
- if (placemark->osmData().containsTagKey("height")) {
+ if (placemark->osmData().containsTagKey(QStringLiteral("height"))) {
/** @todo Also parse non-SI units, see https://wiki.openstreetmap.org/wiki/Key:height#Height_of_buildings */
- QString const heightValue = placemark->osmData().tagValue("height").remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
+ QString const heightValue = placemark->osmData().tagValue(QStringLiteral("height")).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
bool extracted = false;
double extractedHeight = heightValue.toDouble(&extracted);
if (extracted) {
height = extractedHeight;
}
- } else if (placemark->osmData().containsTagKey("building:levels")) {
- int const levels = placemark->osmData().tagValue("building:levels").toInt();
- int const skipLevels = placemark->osmData().tagValue("building:min_level").toInt();
+ } else if (placemark->osmData().containsTagKey(QStringLiteral("building:levels"))) {
+ int const levels = placemark->osmData().tagValue(QStringLiteral("building:levels")).toInt();
+ int const skipLevels = placemark->osmData().tagValue(QStringLiteral("building:min_level")).toInt();
/** @todo Is 35 as an upper bound for the number of levels sane? */
height = 3.0 * qBound(1, 1+levels-skipLevels, 35);
}
@@ -279,10 +279,10 @@ QString GeoPolygonGraphicsItem::extractBuildingLabel(const GeoDataFeature *featu
if (!placemark->name().isEmpty()) {
return placemark->name();
- } else if (placemark->osmData().containsTagKey("addr:housename")) {
- return placemark->osmData().tagValue("addr:housename");
- } else if (placemark->osmData().containsTagKey("addr:housenumber")) {
- return placemark->osmData().tagValue("addr:housenumber");
+ } else if (placemark->osmData().containsTagKey(QStringLiteral("addr:housename"))) {
+ return placemark->osmData().tagValue(QStringLiteral("addr:housename"));
+ } else if (placemark->osmData().containsTagKey(QStringLiteral("addr:housenumber"))) {
+ return placemark->osmData().tagValue(QStringLiteral("addr:housenumber"));
}
}
@@ -298,10 +298,10 @@ QVector<GeoPolygonGraphicsItem::NamedEntry> GeoPolygonGraphicsItem::extractNamed
const auto end = placemark->osmData().nodeReferencesEnd();
for (auto iter = placemark->osmData().nodeReferencesBegin(); iter != end; ++iter) {
- if (iter.value().containsTagKey("addr:housenumber")) {
+ if (iter.value().containsTagKey(QStringLiteral("addr:housenumber"))) {
NamedEntry entry;
entry.point = iter.key();
- entry.label = iter.value().tagValue("addr:housenumber");
+ entry.label = iter.value().tagValue(QStringLiteral("addr:housenumber"));
entries.push_back(entry);
}
}
diff --git a/src/lib/marble/osm/OsmRelationEditorDialog.cpp b/src/lib/marble/osm/OsmRelationEditorDialog.cpp
index 96b87bb..37395fa 100644
--- a/src/lib/marble/osm/OsmRelationEditorDialog.cpp
+++ b/src/lib/marble/osm/OsmRelationEditorDialog.cpp
@@ -40,7 +40,7 @@ OsmRelationEditorDialog::OsmRelationEditorDialog( OsmPlacemarkData *relationData
QHBoxLayout *nameLayout = new QHBoxLayout();
QLabel *nameLabel = new QLabel( tr( "Name" ), this );
m_nameLineEdit = new QLineEdit( this );
- m_nameLineEdit->setText( relationData->tagValue( "name" ) );
+ m_nameLineEdit->setText(relationData->tagValue(QStringLiteral("name")));
nameLayout->addWidget( nameLabel );
nameLayout->addWidget( m_nameLineEdit );
layout->addLayout( nameLayout );
@@ -87,7 +87,7 @@ void OsmRelationEditorDialog::checkFields()
tr( "No name specified" ),
tr( "Please specify a name for this relation." ) );
}
- else if ( !m_dummyPlacemark->osmData().containsTagKey( "type" ) ) {
+ else if (!m_dummyPlacemark->osmData().containsTagKey(QStringLiteral("type"))) {
QMessageBox::warning( this,
tr( "No type tag specified" ),
tr( "Please add a type tag for this relation." ) );
diff --git a/src/lib/marble/osm/OsmRelationManagerWidget.cpp b/src/lib/marble/osm/OsmRelationManagerWidget.cpp
index 8c771f5..bb031d9 100644
--- a/src/lib/marble/osm/OsmRelationManagerWidget.cpp
+++ b/src/lib/marble/osm/OsmRelationManagerWidget.cpp
@@ -80,8 +80,8 @@ void OsmRelationManagerWidget::addRelation( QAction *relationAction )
delete relationEditor;
QTreeWidgetItem *newRelationItem = new QTreeWidgetItem();
- newRelationItem->setText( Column::Name, relationData.tagValue( "name" ) );
- newRelationItem->setText( Column::Type, relationData.tagValue( "type" ) );
+ newRelationItem->setText(Column::Name, relationData.tagValue(QStringLiteral("name")));
+ newRelationItem->setText(Column::Type, relationData.tagValue(QStringLiteral("type")));
newRelationItem->setData( Column::Name, Qt::UserRole, relationData.id() );
d->m_currentRelations->addTopLevelItem( newRelationItem );
@@ -96,8 +96,8 @@ void OsmRelationManagerWidget::addRelation( QAction *relationAction )
qint64 id = relationAction->data().toLongLong();
OsmPlacemarkData relationData = d->m_allRelations->value( id );
QTreeWidgetItem *newRelationItem = new QTreeWidgetItem();
- newRelationItem->setText( Column::Name, relationData.tagValue( "name" ) );
- newRelationItem->setText( Column::Type, relationData.tagValue( "type" ) );
+ newRelationItem->setText(Column::Name, relationData.tagValue(QStringLiteral("name")));
+ newRelationItem->setText(Column::Type, relationData.tagValue(QStringLiteral("type")));
newRelationItem->setData( Column::Name, Qt::UserRole, relationData.id() );
d->m_currentRelations->addTopLevelItem( newRelationItem );
diff --git a/src/lib/marble/osm/OsmRelationManagerWidget_p.cpp b/src/lib/marble/osm/OsmRelationManagerWidget_p.cpp
index 1b9aef4..1b8074d 100644
--- a/src/lib/marble/osm/OsmRelationManagerWidget_p.cpp
+++ b/src/lib/marble/osm/OsmRelationManagerWidget_p.cpp
@@ -60,8 +60,8 @@ void OsmRelationManagerWidgetPrivate::populateRelationsList()
const OsmPlacemarkData &relationData = m_allRelations->value( it.key() );
QTreeWidgetItem *newItem = new QTreeWidgetItem();
- QString name = relationData.tagValue( "name" );
- QString type = relationData.tagValue( "type" );
+ QString name = relationData.tagValue(QStringLiteral("name"));
+ QString type = relationData.tagValue(QStringLiteral("type"));
QString role = it.value();
newItem->setText( Column::Name, name );
newItem->setText( Column::Type, type );
diff --git a/src/plugins/runner/json/JsonParser.cpp b/src/plugins/runner/json/JsonParser.cpp
index 0ffad46..21e4288 100644
--- a/src/plugins/runner/json/JsonParser.cpp
+++ b/src/plugins/runner/json/JsonParser.cpp
@@ -259,9 +259,9 @@ bool JsonParser::read( QIODevice* device )
}
// If the property read, is the features name
- if (osmData.containsTagKey(QLatin1String("name"))) {
+ if (osmData.containsTagKey(QStringLiteral("name"))) {
for (int pl = 0 ; pl < placemarkList.length(); ++pl) {
- placemarkList.at(pl)->setName(osmData.tagValue(QLatin1String("name")));
+ placemarkList.at(pl)->setName(osmData.tagValue(QStringLiteral("name")));
}
}