@@ -12,7 +12,6 @@ namespace android {
|
||||
|
||||
class Marker : private mbgl::util::noncopyable {
|
||||
public:
|
||||
|
||||
static constexpr auto Name() { return "com/mapbox/mapboxsdk/annotations/Marker"; };
|
||||
|
||||
static mbgl::Point<double> getPosition(jni::JNIEnv&, const jni::Object<Marker>&);
|
||||
@@ -20,9 +19,7 @@ public:
|
||||
static std::string getIconId(jni::JNIEnv&, const jni::Object<Marker>&);
|
||||
|
||||
static void registerNative(jni::JNIEnv&);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
@@ -10,24 +10,22 @@ namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
class MultiPoint : protected mbgl::util::noncopyable {
|
||||
|
||||
protected:
|
||||
template <class Geometry>
|
||||
static Geometry toGeometry(JNIEnv& env, const jni::Object<java::util::List>& pointsList) {
|
||||
auto jarray = java::util::List::toArray<LatLng>(env, pointsList);
|
||||
|
||||
template <class Geometry>
|
||||
static Geometry toGeometry(JNIEnv& env, const jni::Object<java::util::List>& pointsList) {
|
||||
auto jarray = java::util::List::toArray<LatLng>(env, pointsList);
|
||||
std::size_t size = jarray.Length(env);
|
||||
|
||||
std::size_t size = jarray.Length(env);
|
||||
Geometry geometry;
|
||||
geometry.reserve(size);
|
||||
|
||||
Geometry geometry;
|
||||
geometry.reserve(size);
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
geometry.push_back(LatLng::getGeometry(env, jarray.Get(env, i)));
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
geometry.push_back(LatLng::getGeometry(env, jarray.Get(env, i)));
|
||||
}
|
||||
|
||||
return geometry;
|
||||
}
|
||||
return geometry;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -13,9 +13,7 @@ mbgl::FillAnnotation Polygon::toAnnotation(jni::JNIEnv& env, const jni::Object<P
|
||||
static auto fillColor = javaClass.GetField<int>(env, "fillColor");
|
||||
static auto strokeColor = javaClass.GetField<int>(env, "strokeColor");
|
||||
|
||||
mbgl::Polygon<double> geometry {
|
||||
MultiPoint::toGeometry<mbgl::LinearRing<double>>(env, polygon.Get(env, points))
|
||||
};
|
||||
mbgl::Polygon<double> geometry{MultiPoint::toGeometry<mbgl::LinearRing<double>>(env, polygon.Get(env, points))};
|
||||
|
||||
auto jHoleListsArray = java::util::List::toArray<java::util::List>(env, polygon.Get(env, holes));
|
||||
|
||||
@@ -24,7 +22,7 @@ mbgl::FillAnnotation Polygon::toAnnotation(jni::JNIEnv& env, const jni::Object<P
|
||||
geometry.push_back(MultiPoint::toGeometry<mbgl::LinearRing<double>>(env, jHoleListsArray.Get(env, i)));
|
||||
}
|
||||
|
||||
mbgl::FillAnnotation annotation { geometry };
|
||||
mbgl::FillAnnotation annotation{geometry};
|
||||
annotation.opacity = polygon.Get(env, alpha);
|
||||
annotation.color = *conversion::convert<mbgl::Color>(env, polygon.Get(env, fillColor));
|
||||
annotation.outlineColor = *conversion::convert<mbgl::Color>(env, polygon.Get(env, strokeColor));
|
||||
|
||||
@@ -16,6 +16,5 @@ public:
|
||||
static void registerNative(jni::JNIEnv&);
|
||||
};
|
||||
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
@@ -12,9 +12,7 @@ mbgl::LineAnnotation Polyline::toAnnotation(jni::JNIEnv& env, const jni::Object<
|
||||
static auto color = javaClass.GetField<int>(env, "color");
|
||||
static auto width = javaClass.GetField<float>(env, "width");
|
||||
|
||||
mbgl::LineAnnotation annotation {
|
||||
MultiPoint::toGeometry<mbgl::LineString<double>>(env, polyline.Get(env, points))
|
||||
};
|
||||
mbgl::LineAnnotation annotation{MultiPoint::toGeometry<mbgl::LineString<double>>(env, polyline.Get(env, points))};
|
||||
|
||||
annotation.opacity = polyline.Get(env, alpha);
|
||||
annotation.color = *conversion::convert<mbgl::Color>(env, polyline.Get(env, color));
|
||||
|
||||
@@ -16,6 +16,5 @@ public:
|
||||
static void registerNative(jni::JNIEnv&);
|
||||
};
|
||||
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
Reference in New Issue
Block a user