Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #352 - Added feature objects for multi variants, added supp…
Browse files Browse the repository at this point in the history
…ort in jni
  • Loading branch information
tobrun committed Jul 26, 2016
1 parent f2f836c commit 73fe2ce
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mapbox.mapboxsdk.annotations;

import java.util.Map;

public class MultiPointFeature extends MultiPoint implements Feature {

private long featureId;
private Map<String, Object> attributes;

public MultiPointFeature() {
}

@Override
public long getFeatureId() {
return featureId;
}

@Override
public Map<String, Object> getAttributes() {
return attributes;
}

@Override
public Object getAttribute(String key) {
return attributes.get(key);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mapbox.mapboxsdk.annotations;

import java.util.List;
import java.util.Map;

public class MultiPolygonFeature extends MultiPolygon implements Feature{
private long featureId;
private Map<String, Object> attributes;

public MultiPolygonFeature(List<Polygon> polygonList) {
super(polygonList);
}

@Override
public long getFeatureId() {
return featureId;
}

@Override
public Map<String, Object> getAttributes() {
return attributes;
}

@Override
public Object getAttribute(String key) {
return attributes.get(key);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mapbox.mapboxsdk.annotations;

import java.util.List;
import java.util.Map;

public class MultiPolylineFeature extends MultiPolyline implements Feature {
private long featureId;
private Map<String, Object> attributes;

public MultiPolylineFeature(List<Polyline> polylineList) {
super(polylineList);
}

@Override
public long getFeatureId() {
return featureId;
}

@Override
public Map<String, Object> getAttributes() {
return attributes;
}

@Override
public Object getAttribute(String key) {
return attributes.get(key);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mapbox.mapboxsdk.annotations;

import java.util.List;
import java.util.Map;

public class ShapeCollectionFeature extends ShapeCollection implements Feature {
private long featureId;
private Map<String, Object> attributes;

public ShapeCollectionFeature(List<Shape> shapeList) {
super(shapeList);
}

@Override
public long getFeatureId() {
return featureId;
}

@Override
public Map<String, Object> getAttributes() {
return attributes;
}

@Override
public Object getAttribute(String key) {
return attributes.get(key);
}
}
31 changes: 31 additions & 0 deletions platform/android/src/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,24 @@ jni::jmethodID* offlineRegionDeleteOnErrorId = nullptr;
jni::jclass* polygonFeatureClass = nullptr;
jni::jmethodID* polygonFeatureConstructorId = nullptr;

//jni::jclass* multiPolygonFeatureClass = nullptr;
//jni::jmethodID* multiPolygonFeatureConstructorId = nullptr;

jni::jclass* polylineFeatureClass = nullptr;
jni::jmethodID* polylineFeatureConstructorId = nullptr;

//jni::jclass* multiPolylineFeatureClass = nullptr;
//jni::jmethodID* multiPolylineFeatureConstructorId = nullptr;

jni::jclass* pointFeatureClass = nullptr;
jni::jmethodID* pointFeatureConstructorId = nullptr;

//jni::jclass* multiPointFeatureClass = nullptr;
//jni::jmethodID* multiPointFeatureConstructorId = nullptr;

//jni::jclass* shapeCollectionFeatureClass = nullptr;
//jni::jmethodID* shapeCollectionFeatureConstructorId = nullptr;

jni::jclass* featureWrapperClass = nullptr;
jni::jmethodID* featureWrapperConstructorId = nullptr;
jni::jmethodID* featureWrapperAddId = nullptr;
Expand Down Expand Up @@ -1672,10 +1687,26 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
polygonFeatureClass = jni::NewGlobalRef(env, polygonFeatureClass).release();
polygonFeatureConstructorId = &jni::GetMethodID(env, *polygonFeatureClass, "<init>", "()V");

//multiPolygonFeatureClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/MultiPolygonFeature");
//multiPolygonFeatureClass = jni::NewGlobalRef(env, multiPolygonFeatureClass).release();
//multiPolygonFeatureConstructorId = &jni::GetMethodID(env, *multiPolygonFeatureClass, "<init>", "()V");

polylineFeatureClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/PolylineFeature");
polylineFeatureClass = jni::NewGlobalRef(env, polylineFeatureClass).release();
polylineFeatureConstructorId = &jni::GetMethodID(env, *polylineFeatureClass, "<init>", "()V");

//multiPolylineFeatureClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/MultiPolylineFeature");
//multiPolylineFeatureClass = jni::NewGlobalRef(env, multiPolylineFeatureClass).release();
//multiPolylineFeatureConstructorId = &jni::GetMethodID(env, *multiPolylineFeatureClass, "<init>", "()V");

pointFeatureClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/PointFeature");
pointFeatureClass = jni::NewGlobalRef(env, pointFeatureClass).release();
pointFeatureConstructorId = &jni::GetMethodID(env, *pointFeatureClass, "<init>", "()V");

//multiPointFeatureClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/MultiPointFeature");
//multiPointFeatureClass = jni::NewGlobalRef(env, multiPointFeatureClass).release();
//multiPointFeatureConstructorId = &jni::GetMethodID(env, *multiPointFeatureClass, "<init>", "()V");

featureWrapperClass = &jni::FindClass(env, "com/mapbox/mapboxsdk/annotations/FeatureWrapper");
featureWrapperClass = jni::NewGlobalRef(env, featureWrapperClass).release();
featureWrapperConstructorId = &jni::GetMethodID(env, *featureWrapperClass, "<init>", "()V");;
Expand Down

0 comments on commit 73fe2ce

Please sign in to comment.