summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-01-13 12:02:31 +0100
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-01-13 13:04:59 -0800
commitcef05b9017d4e54e61354a278120ff67879f2acb (patch)
treee7d5a7e6c8c7a4f57b99f86d0acd1405d7d4fea2 /src/mbgl/style
parent8cca5c89b20aa950ffe184316d135ea7c3e1abfd (diff)
downloadqtlocation-mapboxgl-cef05b9017d4e54e61354a278120ff67879f2acb.tar.gz
[core] move invariant Source ID from SourceInfo to Source
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/style.cpp6
-rw-r--r--src/mbgl/style/style_parser.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 5c6869ac77..fbca01311b 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -194,7 +194,7 @@ void Style::recalculate(float z) {
Source* Style::getSource(const std::string& id) const {
const auto it = std::find_if(sources.begin(), sources.end(), [&](const auto& source) {
- return source->info.source_id == id;
+ return source->id == id;
});
return it != sources.end() ? it->get() : nullptr;
@@ -331,7 +331,7 @@ void Style::onSourceLoaded(Source& source) {
void Style::onSourceError(Source& source, std::exception_ptr error) {
lastError = error;
Log::Error(Event::Style, "Failed to load source %s: %s",
- source.info.source_id.c_str(), util::toString(error).c_str());
+ source.id.c_str(), util::toString(error).c_str());
observer->onSourceError(source, error);
observer->onResourceError(error);
}
@@ -348,7 +348,7 @@ void Style::onTileLoaded(Source& source, const TileID& tileID, bool isNewTile) {
void Style::onTileError(Source& source, const TileID& tileID, std::exception_ptr error) {
lastError = error;
Log::Error(Event::Style, "Failed to load tile %s for source %s: %s",
- std::string(tileID).c_str(), source.info.source_id.c_str(), util::toString(error).c_str());
+ std::string(tileID).c_str(), source.id.c_str(), util::toString(error).c_str());
observer->onTileError(source, tileID, error);
observer->onResourceError(error);
}
diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp
index 4c3061dcb4..6878907cd1 100644
--- a/src/mbgl/style/style_parser.cpp
+++ b/src/mbgl/style/style_parser.cpp
@@ -68,8 +68,8 @@ void StyleParser::parseSources(const JSValue& value) {
}
const auto type = SourceTypeClass({ typeVal.GetString(), typeVal.GetStringLength() });
- std::unique_ptr<Source> source = std::make_unique<Source>(type);
- source->info.source_id = { nameVal.GetString(), nameVal.GetStringLength() };
+ const std::string id { nameVal.GetString(), nameVal.GetStringLength() };
+ std::unique_ptr<Source> source = std::make_unique<Source>(type, id);
switch (type) {
case SourceType::Vector:
@@ -91,7 +91,7 @@ void StyleParser::parseSources(const JSValue& value) {
Log::Warning(Event::ParseStyle, "source type %s is not supported", type.c_str());
}
- sourcesMap.emplace(source->info.source_id, source.get());
+ sourcesMap.emplace(id, source.get());
sources.emplace_back(std::move(source));
}
}