summaryrefslogtreecommitdiff
path: root/platform/android/src/style/sources
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/style/sources')
-rw-r--r--platform/android/src/style/sources/custom_geometry_source.cpp8
-rw-r--r--platform/android/src/style/sources/geojson_source.cpp14
-rw-r--r--platform/android/src/style/sources/image_source.cpp8
-rw-r--r--platform/android/src/style/sources/raster_dem_source.cpp2
-rw-r--r--platform/android/src/style/sources/raster_source.cpp2
-rw-r--r--platform/android/src/style/sources/source.cpp12
-rw-r--r--platform/android/src/style/sources/source.hpp2
-rw-r--r--platform/android/src/style/sources/vector_source.cpp4
8 files changed, 26 insertions, 26 deletions
diff --git a/platform/android/src/style/sources/custom_geometry_source.cpp b/platform/android/src/style/sources/custom_geometry_source.cpp
index 057f5c99ba..b835e05134 100644
--- a/platform/android/src/style/sources/custom_geometry_source.cpp
+++ b/platform/android/src/style/sources/custom_geometry_source.cpp
@@ -133,17 +133,17 @@ namespace android {
// Update the core source if not cancelled
if (!isCancelled(z, x ,y)) {
- source.as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::setTileData(CanonicalTileID(z, x, y), GeoJSON(geometry));
+ source->as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::setTileData(CanonicalTileID(z, x, y), GeoJSON(geometry));
}
}
void CustomGeometrySource::invalidateTile(jni::JNIEnv&, jni::jint z, jni::jint x, jni::jint y) {
- source.as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::invalidateTile(CanonicalTileID(z, x, y));
+ source->as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::invalidateTile(CanonicalTileID(z, x, y));
}
void CustomGeometrySource::invalidateBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& jBounds) {
auto bounds = LatLngBounds::getLatLngBounds(env, jBounds);
- source.as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::invalidateRegion(bounds);
+ source->as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::invalidateRegion(bounds);
}
jni::Local<jni::Array<jni::Object<geojson::Feature>>> CustomGeometrySource::querySourceFeatures(jni::JNIEnv& env,
@@ -153,7 +153,7 @@ namespace android {
std::vector<mbgl::Feature> features;
if (rendererFrontend) {
- features = rendererFrontend->querySourceFeatures(source.getID(), { {}, toFilter(env, jfilter) });
+ features = rendererFrontend->querySourceFeatures(source->getID(), { {}, toFilter(env, jfilter) });
}
return Feature::convert(env, features);
}
diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp
index a9307afe67..106da3bd42 100644
--- a/platform/android/src/style/sources/geojson_source.cpp
+++ b/platform/android/src/style/sources/geojson_source.cpp
@@ -87,11 +87,11 @@ namespace android {
void GeoJSONSource::setURL(jni::JNIEnv& env, const jni::String& url) {
// Update the core source
- source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setURL(jni::Make<std::string>(env, url));
+ source->as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setURL(jni::Make<std::string>(env, url));
}
jni::Local<jni::String> GeoJSONSource::getURL(jni::JNIEnv& env) {
- optional<std::string> url = source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::getURL();
+ optional<std::string> url = source->as<mbgl::style::GeoJSONSource>()->GeoJSONSource::getURL();
return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>();
}
@@ -102,7 +102,7 @@ namespace android {
std::vector<mbgl::Feature> features;
if (rendererFrontend) {
- features = rendererFrontend->querySourceFeatures(source.getID(),
+ features = rendererFrontend->querySourceFeatures(source->getID(),
{ {}, toFilter(env, jfilter) });
}
return Feature::convert(env, features);
@@ -115,7 +115,7 @@ namespace android {
if (rendererFrontend) {
mbgl::Feature _feature = Feature::convert(env, feature);
_feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>());
- const auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "children", {});
+ const auto featureExtension = rendererFrontend->queryFeatureExtensions(source->getID(), _feature, "supercluster", "children", {});
if (featureExtension.is<mbgl::FeatureCollection>()) {
return Feature::convert(env, featureExtension.get<mbgl::FeatureCollection>());
}
@@ -132,7 +132,7 @@ namespace android {
_feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>());
const std::map<std::string, mbgl::Value> options = { {"limit", static_cast<uint64_t>(limit)},
{"offset", static_cast<uint64_t>(offset)} };
- auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "leaves", options);
+ auto featureExtension = rendererFrontend->queryFeatureExtensions(source->getID(), _feature, "supercluster", "leaves", options);
if (featureExtension.is<mbgl::FeatureCollection>()) {
return Feature::convert(env, featureExtension.get<mbgl::FeatureCollection>());
}
@@ -147,7 +147,7 @@ namespace android {
if (rendererFrontend) {
mbgl::Feature _feature = Feature::convert(env, feature);
_feature.properties["cluster_id"] = static_cast<uint64_t>(_feature.properties["cluster_id"].get<double>());
- auto featureExtension = rendererFrontend->queryFeatureExtensions(source.getID(), _feature, "supercluster", "expansion-zoom", {});
+ auto featureExtension = rendererFrontend->queryFeatureExtensions(source->getID(), _feature, "supercluster", "expansion-zoom", {});
if (featureExtension.is<mbgl::Value>()) {
auto value = featureExtension.get<mbgl::Value>();
if (value.is<uint64_t>()) {
@@ -186,7 +186,7 @@ namespace android {
android::UniqueEnv _env = android::AttachEnv();
// Update the core source
- source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setGeoJSON(geoJSON);
+ source->as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setGeoJSON(geoJSON);
// if there is an awaiting update, execute it, otherwise, release resources
if (awaitingUpdate) {
diff --git a/platform/android/src/style/sources/image_source.cpp b/platform/android/src/style/sources/image_source.cpp
index b42e0e5a51..8550100791 100644
--- a/platform/android/src/style/sources/image_source.cpp
+++ b/platform/android/src/style/sources/image_source.cpp
@@ -33,20 +33,20 @@ namespace android {
void ImageSource::setURL(jni::JNIEnv& env, const jni::String& url) {
// Update the core source
- source.as<mbgl::style::ImageSource>()->ImageSource::setURL(jni::Make<std::string>(env, url));
+ source->as<mbgl::style::ImageSource>()->ImageSource::setURL(jni::Make<std::string>(env, url));
}
jni::Local<jni::String> ImageSource::getURL(jni::JNIEnv& env) {
- optional<std::string> url = source.as<mbgl::style::ImageSource>()->ImageSource::getURL();
+ optional<std::string> url = source->as<mbgl::style::ImageSource>()->ImageSource::getURL();
return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>();
}
void ImageSource::setImage(jni::JNIEnv& env, const jni::Object<Bitmap>& bitmap) {
- source.as<mbgl::style::ImageSource>()->setImage(Bitmap::GetImage(env, bitmap));
+ source->as<mbgl::style::ImageSource>()->setImage(Bitmap::GetImage(env, bitmap));
}
void ImageSource::setCoordinates(jni::JNIEnv& env, const jni::Object<LatLngQuad>& coordinatesObject) {
- source.as<mbgl::style::ImageSource>()->setCoordinates(
+ source->as<mbgl::style::ImageSource>()->setCoordinates(
LatLngQuad::getLatLngArray(env, coordinatesObject));
}
diff --git a/platform/android/src/style/sources/raster_dem_source.cpp b/platform/android/src/style/sources/raster_dem_source.cpp
index f60526a9b7..e3acaa5c86 100644
--- a/platform/android/src/style/sources/raster_dem_source.cpp
+++ b/platform/android/src/style/sources/raster_dem_source.cpp
@@ -32,7 +32,7 @@ namespace android {
RasterDEMSource::~RasterDEMSource() = default;
jni::Local<jni::String> RasterDEMSource::getURL(jni::JNIEnv& env) {
- optional<std::string> url = source.as<mbgl::style::RasterDEMSource>()->RasterDEMSource::getURL();
+ optional<std::string> url = source->as<mbgl::style::RasterDEMSource>()->RasterDEMSource::getURL();
return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>();
}
diff --git a/platform/android/src/style/sources/raster_source.cpp b/platform/android/src/style/sources/raster_source.cpp
index 535f899c99..cd03452189 100644
--- a/platform/android/src/style/sources/raster_source.cpp
+++ b/platform/android/src/style/sources/raster_source.cpp
@@ -31,7 +31,7 @@ namespace android {
RasterSource::~RasterSource() = default;
jni::Local<jni::String> RasterSource::getURL(jni::JNIEnv& env) {
- optional<std::string> url = source.as<mbgl::style::RasterSource>()->RasterSource::getURL();
+ optional<std::string> url = source->as<mbgl::style::RasterSource>()->RasterSource::getURL();
return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>();
}
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp
index e13f55aff1..b1b4f4f76f 100644
--- a/platform/android/src/style/sources/source.cpp
+++ b/platform/android/src/style/sources/source.cpp
@@ -56,14 +56,14 @@ namespace android {
}
Source::Source(jni::JNIEnv& env, mbgl::style::Source& coreSource, const jni::Object<Source>& obj, AndroidRendererFrontend& frontend)
- : source(coreSource)
+ : source(&coreSource)
, javaPeer(jni::NewGlobal(env, obj))
, rendererFrontend(&frontend) {
}
Source::Source(jni::JNIEnv&, std::unique_ptr<mbgl::style::Source> coreSource)
: ownedSource(std::move(coreSource))
- , source(*ownedSource) {
+ , source(coreSource.release()) {
}
Source::~Source() {
@@ -85,11 +85,11 @@ namespace android {
}
jni::Local<jni::String> Source::getId(jni::JNIEnv& env) {
- return jni::Make<jni::String>(env, source.getID());
+ return jni::Make<jni::String>(env, source->getID());
}
jni::Local<jni::String> Source::getAttribution(jni::JNIEnv& env) {
- auto attribution = source.getAttribution();
+ auto attribution = source->getAttribution();
return attribution ? jni::Make<jni::String>(env, attribution.value()) : jni::Make<jni::String>(env,"");
}
@@ -103,7 +103,7 @@ namespace android {
map.getStyle().addSource(std::move(ownedSource));
// Add peer to core source
- source.peer = std::unique_ptr<Source>(this);
+ (*source).peer = std::unique_ptr<Source>(this);
// Add strong reference to java source
javaPeer = jni::NewGlobal(env, obj);
@@ -118,7 +118,7 @@ namespace android {
}
// Remove the source from the map and take ownership
- ownedSource = map.getStyle().removeSource(source.getID());
+ ownedSource = map.getStyle().removeSource(source->getID());
// The source may not be removed if any layers still reference it
return ownedSource != nullptr;
diff --git a/platform/android/src/style/sources/source.hpp b/platform/android/src/style/sources/source.hpp
index 93b706425a..a010aa8f55 100644
--- a/platform/android/src/style/sources/source.hpp
+++ b/platform/android/src/style/sources/source.hpp
@@ -48,7 +48,7 @@ protected:
std::unique_ptr<mbgl::style::Source> ownedSource;
// Raw pointer that is valid at all times.
- mbgl::style::Source& source;
+ mbgl::style::Source* source;
// Set when the source is added to a map.
jni::Global<jni::Object<Source>> javaPeer;
diff --git a/platform/android/src/style/sources/vector_source.cpp b/platform/android/src/style/sources/vector_source.cpp
index e46fc1a94e..3b66d171f2 100644
--- a/platform/android/src/style/sources/vector_source.cpp
+++ b/platform/android/src/style/sources/vector_source.cpp
@@ -39,7 +39,7 @@ namespace android {
VectorSource::~VectorSource() = default;
jni::Local<jni::String> VectorSource::getURL(jni::JNIEnv& env) {
- optional<std::string> url = source.as<mbgl::style::VectorSource>()->VectorSource::getURL();
+ optional<std::string> url = source->as<mbgl::style::VectorSource>()->VectorSource::getURL();
return url ? jni::Make<jni::String>(env, *url) : jni::Local<jni::String>();
}
@@ -51,7 +51,7 @@ namespace android {
std::vector<mbgl::Feature> features;
if (rendererFrontend) {
- features = rendererFrontend->querySourceFeatures(source.getID(),
+ features = rendererFrontend->querySourceFeatures(source->getID(),
{ toVector(env, jSourceLayerIds), toFilter(env, jfilter) });
}
return Feature::convert(env, features);