コード例 #1
0
std::array<mbgl::LatLng, 4> LatLngQuad::getLatLngArray(jni::JNIEnv& env, jni::Object<LatLngQuad> quad) {
    static auto topLeftField = LatLngQuad::javaClass.GetField <jni::Object<LatLng>>(env, "topLeft");
    static auto topRightField = LatLngQuad::javaClass.GetField <jni::Object<LatLng>>(env, "topRight");
    static auto bottomRightField = LatLngQuad::javaClass.GetField <jni::Object<LatLng>>(env, "bottomRight");
    static auto bottomLeftField = LatLngQuad::javaClass.GetField <jni::Object<LatLng>>(env, "bottomLeft");

    return std::array < mbgl::LatLng, 4 > {{
        LatLng::getLatLng(env, quad.Get(env, topLeftField)),
        LatLng::getLatLng(env, quad.Get(env, topRightField)),
        LatLng::getLatLng(env, quad.Get(env, bottomRightField)),
        LatLng::getLatLng(env, quad.Get(env, bottomLeftField))
    }};
}
コード例 #2
0
mapbox::geojson::geometry Geometry::convert(jni::JNIEnv &env, jni::Object<Geometry> jGeometry) {
    auto type = Geometry::getType(env, jGeometry);
    if (type == Point::Type()) {
        return { Point::convert(env, jni::Object<Point>(jGeometry.Get())) };
    } else if (type == MultiPoint::Type()) {
        return { MultiPoint::convert(env, jni::Object<MultiPoint>(jGeometry.Get())) };
    } else if (type == LineString::Type()) {
        return { LineString::convert(env, jni::Object<LineString>(jGeometry.Get())) };
    } else if (type == MultiLineString::Type()) {
        return { MultiLineString::convert(env, jni::Object<MultiLineString>(jGeometry.Get())) };
    } else if (type == Polygon::Type()) {
        return { Polygon::convert(env, jni::Object<Polygon>(jGeometry.Get())) };
    } else if (type == MultiPolygon::Type()) {
        return { MultiPolygon::convert(env, jni::Object<MultiPolygon>(jGeometry.Get())) };
    }

    throw std::runtime_error(std::string {"Unsupported GeoJSON type: " } + type);
}
コード例 #3
0
mbgl::Color Polygon::getOutlineColor(jni::JNIEnv& env, jni::Object<Polygon> polygon) {
    static auto field = Polygon::javaClass.GetField<int>(env, "strokeColor");
    return *conversion::convert<mbgl::Color, int>(env, polygon.Get(env, field));
}
コード例 #4
0
float Polygon::getOpacity(jni::JNIEnv& env, jni::Object<Polygon> polygon) {
    static auto field = Polygon::javaClass.GetField<float>(env, "alpha");
    return polygon.Get(env, field);
}
コード例 #5
0
jni::Object<java::util::List> Polygon::getHoles(jni::JNIEnv& env, jni::Object<Polygon> polygon) {
    static auto field = Polygon::javaClass.GetField<jni::Object<java::util::List>>(env, "holes");
    return polygon.Get(env, field);
}
コード例 #6
0
ファイル: rectf.cpp プロジェクト: BharathMG/mapbox-gl-native
float RectF::getLeft(jni::JNIEnv& env, const jni::Object<RectF>& rectf) {
    static auto& javaClass = jni::Class<RectF>::Singleton(env);
    static auto field = javaClass.GetField<float>(env, "left");
    return rectf.Get(env, field);
}
コード例 #7
0
MapRenderer::MapRenderer(jni::JNIEnv& _env, jni::Object<MapRenderer> obj,
                         jni::Object<FileSource> _fileSource, jni::jfloat pixelRatio_,
                         jni::String programCacheDir_,
                         jni::String localIdeographFontFamily_)
        : javaPeer(SeizeGenericWeakRef(_env, jni::Object<MapRenderer>(jni::NewWeakGlobalRef(_env, obj.Get()).release()))), pixelRatio(pixelRatio_)
        , fileSource(FileSource::getDefaultFileSource(_env, _fileSource))
        , programCacheDir(jni::Make<std::string>(_env, programCacheDir_))
        , localIdeographFontFamily(localIdeographFontFamily_ == nullptr ? optional<std::string>{} : jni::Make<std::string>(_env, localIdeographFontFamily_ ))
        , threadPool(sharedThreadPool())
        , mailbox(std::make_shared<Mailbox>(*this)) {
}