Configure native version

This commit is contained in:
Victor Shcherb 2012-03-23 17:44:40 +01:00
parent 99b7616f30
commit 481d5700cd
5 changed files with 11 additions and 117 deletions

View file

@ -1,3 +1,13 @@
#Fri Mar 23 17:29:32 CET 2012
eclipse.preferences.version=1
environment/project/com.android.toolchain.gcc.128294115/ANDROID_NDK/delimiter=\:
environment/project/com.android.toolchain.gcc.128294115/ANDROID_NDK/operation=replace
environment/project/com.android.toolchain.gcc.128294115/ANDROID_NDK/value=/home/victor/projects/android-ndk-r7b/
environment/project/com.android.toolchain.gcc.128294115/OSMAND_USE_PREBUILT/delimiter=\:
environment/project/com.android.toolchain.gcc.128294115/OSMAND_USE_PREBUILT/operation=append
environment/project/com.android.toolchain.gcc.128294115/OSMAND_USE_PREBUILT/value=true
environment/project/com.android.toolchain.gcc.128294115/PATH/delimiter=\:
environment/project/com.android.toolchain.gcc.128294115/PATH/operation=replace
environment/project/com.android.toolchain.gcc.128294115/PATH/value=/home/victor/projects/android-ndk-r7b\:/usr/lib/lightdm/lightdm\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/usr/games
environment/project/com.android.toolchain.gcc.128294115/append=true
environment/project/com.android.toolchain.gcc.128294115/appendContributed=true

View file

@ -1,9 +1,5 @@
OSMAND_MAKEFILES := $(all-subdir-makefiles)
ifdef $(wildcard Local.mk)
include Local.mk
endif
# Protect from previous builds
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a)
OSMAND_BUILDING_NEON_LIBRARY := false

View file

@ -1 +0,0 @@
OSMAND_USE_PREBUILT := true

View file

@ -8,101 +8,11 @@
#include "mapObjects.h"
jclass MultiPolygonClass;
jmethodID MultiPolygon_getTag;
jmethodID MultiPolygon_getValue;
jmethodID MultiPolygon_getLayer;
jmethodID MultiPolygon_getPoint31XTile;
jmethodID MultiPolygon_getPoint31YTile;
jmethodID MultiPolygon_getBoundsCount;
jmethodID MultiPolygon_getBoundPointsCount;
jmethodID MultiPolygon_getName;
jclass BinaryMapDataObjectClass;
jmethodID BinaryMapDataObject_getPointsLength;
jmethodID BinaryMapDataObject_getPoint31YTile;
jmethodID BinaryMapDataObject_getPoint31XTile;
jmethodID BinaryMapDataObject_getHighwayAttributes;
jmethodID BinaryMapDataObject_getTypes;
jmethodID BinaryMapDataObject_getName;
jmethodID BinaryMapDataObject_getTagValue;
jclass TagValuePairClass;
jfieldID TagValuePair_tag;
jfieldID TagValuePair_value;
std::vector <BaseMapDataObject* > marshalObjects(jobjectArray binaryMapDataObjects)
{
std::vector<BaseMapDataObject*> v;
const size_t size = getGlobalJniEnv()->GetArrayLength(binaryMapDataObjects);
size_t i = 0;
for (; i < size; i++) {
jobject binaryMapDataObject = (jobject) getGlobalJniEnv()->GetObjectArrayElement(binaryMapDataObjects, i);
if (getGlobalJniEnv()->IsInstanceOf(binaryMapDataObject, MultiPolygonClass)) {
MultiPolygonObject* o = new MultiPolygonObject();
v.push_back((BaseMapDataObject* )o);
o->layer = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, MultiPolygon_getLayer);
o->tag = getStringMethod(binaryMapDataObject, MultiPolygon_getTag);
o->value = getStringMethod(binaryMapDataObject, MultiPolygon_getValue);
int boundsCount = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, MultiPolygon_getBoundsCount);
for (int ji = 0; ji < boundsCount; ji++) {
int cnt = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, MultiPolygon_getBoundPointsCount, ji);
std::vector<std::pair<int, int> > vs;
for (int js = 0; js < cnt; js++) {
int xt = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, MultiPolygon_getPoint31XTile, js, ji);
int yt = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, MultiPolygon_getPoint31YTile, js, ji);
vs.push_back( std::pair<int, int> (xt, yt) );
}
o->points.push_back(vs);
o->names.push_back(getStringMethod(binaryMapDataObject, MultiPolygon_getName, ji));
}
} else {
jintArray types = (jintArray) getGlobalJniEnv()->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTypes);
if (types != NULL) {
MapDataObject* o = new MapDataObject();
jint sizeTypes = getGlobalJniEnv()->GetArrayLength(types);
jint* els = getGlobalJniEnv()->GetIntArrayElements(types, NULL);
int j = 0;
for (; j < sizeTypes; j++) {
int wholeType = els[j];
o->types.push_back(wholeType);
jobject pair = getGlobalJniEnv()->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTagValue, j);
if (pair != NULL) {
std::string tag = getStringField(pair, TagValuePair_tag);
std::string value = getStringField(pair, TagValuePair_value);
o->tagValues.push_back( std::pair<std:: string, std::string>(tag, value));
getGlobalJniEnv()->DeleteLocalRef(pair);
} else {
o->tagValues.push_back( std::pair<std:: string, std::string>(std::string(), std::string()));
}
}
jint sizePoints = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getPointsLength);
for (j = 0; j < sizePoints; j++) {
int tx = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getPoint31XTile, j);
int ty = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getPoint31YTile, j);
o->points.push_back(std::pair<int, int>(tx, ty));
}
o->name = getStringMethod(binaryMapDataObject, BinaryMapDataObject_getName);
o->highwayAttributes = getGlobalJniEnv()->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getHighwayAttributes);
getGlobalJniEnv()->ReleaseIntArrayElements(types, els, JNI_ABORT);
getGlobalJniEnv()->DeleteLocalRef(types);
v.push_back((BaseMapDataObject* )o);
}
}
getGlobalJniEnv()->DeleteLocalRef(binaryMapDataObject);
}
return v;
}
void deleteObjects(std::vector <BaseMapDataObject* > & v)
{
for(size_t i = 0; i< v.size(); i++)
@ -115,25 +25,6 @@ void deleteObjects(std::vector <BaseMapDataObject* > & v)
void loadJniMapObjects()
{
MultiPolygonClass = findClass("net/osmand/osm/MultyPolygon");
MultiPolygon_getTag = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getTag", "()Ljava/lang/String;");
MultiPolygon_getValue = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getValue", "()Ljava/lang/String;");
MultiPolygon_getName = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getName", "(I)Ljava/lang/String;");
MultiPolygon_getLayer = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getLayer", "()I");
MultiPolygon_getPoint31XTile = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getPoint31XTile", "(II)I");
MultiPolygon_getPoint31YTile = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getPoint31YTile", "(II)I");
MultiPolygon_getBoundsCount = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getBoundsCount", "()I");
MultiPolygon_getBoundPointsCount = getGlobalJniEnv()->GetMethodID(MultiPolygonClass, "getBoundPointsCount", "(I)I");
BinaryMapDataObjectClass = findClass("net/osmand/binary/BinaryMapDataObject");
BinaryMapDataObject_getPointsLength = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getPointsLength", "()I");
BinaryMapDataObject_getPoint31YTile = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getPoint31YTile", "(I)I");
BinaryMapDataObject_getPoint31XTile = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getPoint31XTile", "(I)I");
BinaryMapDataObject_getHighwayAttributes = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getHighwayAttributes", "()I");
BinaryMapDataObject_getTypes = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getTypes", "()[I");
BinaryMapDataObject_getName = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getName", "()Ljava/lang/String;");
BinaryMapDataObject_getTagValue = getGlobalJniEnv()->GetMethodID(BinaryMapDataObjectClass, "getTagValue",
"(I)Lnet/osmand/binary/BinaryMapIndexReader$TagValuePair;");
TagValuePairClass = findClass("net/osmand/binary/BinaryMapIndexReader$TagValuePair");
TagValuePair_tag = getGlobalJniEnv()->GetFieldID(TagValuePairClass, "tag", "Ljava/lang/String;");
@ -144,8 +35,6 @@ void loadJniMapObjects()
void unloadJniMapObjects()
{
getGlobalJniEnv()->DeleteGlobalRef( MultiPolygonClass );
getGlobalJniEnv()->DeleteGlobalRef( BinaryMapDataObjectClass );
getGlobalJniEnv()->DeleteGlobalRef( TagValuePairClass );
}

View file

@ -54,7 +54,7 @@ public:
};
std::vector <BaseMapDataObject* > marshalObjects(jobjectArray binaryMapDataObjects);
//std::vector <BaseMapDataObject* > marshalObjects(jobjectArray binaryMapDataObjects);
void deleteObjects(std::vector <BaseMapDataObject* > & v);