diff options
author | kevin <kevin.li@mapbox.com> | 2020-03-24 10:39:36 +0800 |
---|---|---|
committer | kevin <kevin.li@mapbox.com> | 2020-03-24 11:46:55 +0800 |
commit | bf50d79cf3495d9b5fcb68421d16beca647838df (patch) | |
tree | 31d3d4ced5b4004ee1a3ea27d683a148c04cbe22 | |
parent | c7bf0a6b641c979179855e1a498af43585e8b51f (diff) | |
download | qtlocation-mapboxgl-upstream/kl-styleable-snapshotter.tar.gz |
FIx review commentsupstream/kl-styleable-snapshotter
-rw-r--r-- | platform/android/src/snapshotter/map_snapshotter.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index adf654cb10..5bccbd1ba8 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -225,35 +225,35 @@ void MapSnapshotter::addLayerBelow(JNIEnv& env, jlong nativeLayerPtr, const jni: void MapSnapshotter::addLayerAbove(JNIEnv& env, jlong nativeLayerPtr, const jni::String& above) { assert(nativeLayerPtr != 0); - auto* layer = reinterpret_cast<Layer*>(nativeLayerPtr); + auto* newLayer = reinterpret_cast<Layer*>(nativeLayerPtr); // Find the sibling - const auto layers = snapshotter->getStyle().getLayers(); + const auto snapshotterLayers = snapshotter->getStyle().getLayers(); auto siblingId = jni::Make<std::string>(env, above); size_t index = 0; - for (auto* l : layers) { + for (auto* snapshotterLayer : snapshotterLayers) { ++index; - if (l->getID() == siblingId) { + if (snapshotterLayer->getID() == siblingId) { break; } } // Check if we found a sibling to place before mbgl::optional<std::string> before; - if (index > layers.size()) { + if (index > snapshotterLayers.size()) { // Not found jni::ThrowNew(env, jni::FindClass(env, "com/mapbox/mapboxsdk/style/layers/CannotAddLayerException"), std::string("Could not find layer: ").append(siblingId).c_str()); - } else if (index < layers.size()) { + } else if (index < snapshotterLayers.size()) { // Place before the sibling - before = {layers.at(index)->getID()}; + before = {snapshotterLayers.at(index)->getID()}; } // Add the layer try { - layer->addToStyle(snapshotter->getStyle(), before); + newLayer->addToStyle(snapshotter->getStyle(), before); } catch (const std::runtime_error& error) { jni::ThrowNew( env, jni::FindClass(env, "com/mapbox/mapboxsdk/style/layers/CannotAddLayerException"), error.what()); @@ -276,7 +276,7 @@ void MapSnapshotter::addImages(JNIEnv& env, const jni::Array<jni::Object<mbgl::a jni::NullCheck(env, &jimages); std::size_t len = jimages.Length(env); - for (std::size_t i = 0; i < len; i++) { + for (std::size_t i = 0; i < len; ++i) { auto image = mbgl::android::Image::getImage(env, jimages.Get(env, i)); snapshotter->getStyle().addImage(std::make_unique<mbgl::style::Image>(image)); } |