diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-01 13:39:15 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-01 15:10:28 -0800 |
commit | 8afa14fa78e628007a983d00efa336674e499735 (patch) | |
tree | 8a003ea8f9e9739af53858af39feb68b367621ae /platform | |
parent | 8a66b7047f899b781922986b63ecbe9039fcfafc (diff) | |
download | qtlocation-mapboxgl-8afa14fa78e628007a983d00efa336674e499735.tar.gz |
[core] Map::setSprite ⇢ Map::addAnnotationIcon
Fixes #3084
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/jni.cpp | 10 | ||||
-rw-r--r-- | platform/default/glfw_view.cpp | 4 | ||||
-rw-r--r-- | platform/ios/MGLMapView.mm | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/platform/android/jni.cpp b/platform/android/jni.cpp index 79281a0ade..530505149c 100644 --- a/platform/android/jni.cpp +++ b/platform/android/jni.cpp @@ -1195,9 +1195,9 @@ jlongArray JNICALL nativeGetAnnotationsInBounds(JNIEnv *env, jobject obj, jlong return std_vector_uint_to_jobject(env, annotations); } -void JNICALL nativeSetSprite(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, +void JNICALL nativeAddAnnotationIcon(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring symbol, jint width, jint height, jfloat scale, jbyteArray jpixels) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetSprite"); + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddAnnotationIcon"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); @@ -1214,7 +1214,7 @@ void JNICALL nativeSetSprite(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, float(scale), std::move(pixels)); - nativeMapView->getMap().setSprite(symbolName, spriteImage); + nativeMapView->getMap().addAnnotationIcon(symbolName, spriteImage); } void JNICALL nativeSetVisibleCoordinateBounds(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, @@ -1454,7 +1454,7 @@ jdouble JNICALL nativeGetTopOffsetPixelsForAnnotationSymbol(JNIEnv *env, jobject mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetTopOffsetPixelsForAnnotationSymbol"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - return nativeMapView->getMap().getTopOffsetPixelsForAnnotationSymbol(std_string_from_jstring(env, symbolName)); + return nativeMapView->getMap().getTopOffsetPixelsForAnnotationIcon(std_string_from_jstring(env, symbolName)); } @@ -1927,7 +1927,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeRemoveAnnotations", "(J[J)V", reinterpret_cast<void *>(&nativeRemoveAnnotations)}, {"nativeGetAnnotationsInBounds", "(JLcom/mapbox/mapboxsdk/geometry/BoundingBox;)[J", reinterpret_cast<void *>(&nativeGetAnnotationsInBounds)}, - {"nativeSetSprite", "(JLjava/lang/String;IIF[B)V", reinterpret_cast<void *>(&nativeSetSprite)}, + {"nativeAddAnnotationIcon", "(JLjava/lang/String;IIF[B)V", reinterpret_cast<void *>(&nativeAddAnnotationIcon)}, {"nativeSetVisibleCoordinateBounds", "(J[Lcom/mapbox/mapboxsdk/geometry/LatLng;Landroid/graphics/RectF;DJ)V", reinterpret_cast<void *>(&nativeSetVisibleCoordinateBounds)}, {"nativeOnLowMemory", "(J)V", reinterpret_cast<void *>(&nativeOnLowMemory)}, diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index 32fb9af6bb..cf8349d823 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -115,7 +115,7 @@ GLFWView::~GLFWView() { void GLFWView::initialize(mbgl::Map *map_) { View::initialize(map_); - map->setSprite("default_marker", makeSpriteImage(22, 22, 1)); + map->addAnnotationIcon("default_marker", makeSpriteImage(22, 22, 1)); } void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) { @@ -222,7 +222,7 @@ void GLFWView::addRandomCustomPointAnnotations(int count) { for (int i = 0; i < count; i++) { static int spriteID = 1; const auto name = std::string{ "marker-" } + mbgl::util::toString(spriteID++); - map->setSprite(name, makeSpriteImage(22, 22, 1)); + map->addAnnotationIcon(name, makeSpriteImage(22, 22, 1)); spriteIDs.push_back(name); points.emplace_back(makeRandomPoint(), name); } diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index ad9a7e37e8..8e57fc4321 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -2263,7 +2263,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng) // sprite upload NSString *symbolName = [MGLAnnotationSpritePrefix stringByAppendingString:annotationImage.reuseIdentifier]; - _mbglMap->setSprite(symbolName.UTF8String, cSpriteImage); + _mbglMap->addAnnotationIcon(symbolName.UTF8String, cSpriteImage); } - (void)removeAnnotation:(id <MGLAnnotation>)annotation @@ -2397,7 +2397,7 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng) // determine anchor point based on symbol CGPoint calloutAnchorPoint = [self convertCoordinate:annotation.coordinate toPointToView:self]; - double y = _mbglMap->getTopOffsetPixelsForAnnotationSymbol(cSymbolName); + double y = _mbglMap->getTopOffsetPixelsForAnnotationIcon(cSymbolName); calloutBounds = CGRectMake(calloutAnchorPoint.x - 1, calloutAnchorPoint.y + y, 0, 0); } |