Trying to setup debug

This commit is contained in:
Victor Shcherb 2011-10-21 19:10:28 +02:00
parent c05f95cf24
commit a7dc62393e
19 changed files with 412 additions and 151 deletions

View file

@ -772,8 +772,6 @@
</group>
<!-- ZM 10 -->
<CssParameter name="stroke">#6c3</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
<filter minzoom="9" shader="nr2" color="#abdf96" tag="leisure" value="nature_reserve"
strokeWidth_2="1" color_2="#66cc33">
<filter nightMode="true" shader="" color="#000034" />

74
OsmAnd/.cproject Normal file
View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.android.toolchain.gcc.128294115">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.android.toolchain.gcc.128294115" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="com.android.toolchain.gcc.128294115" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.android.toolchain.gcc.128294115.2018451624" name="/" resourcePath="">
<toolChain id="com.android.toolchain.gcc.88177390" name="com.android.toolchain.gcc" superClass="com.android.toolchain.gcc">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.android.targetPlatform.998053113" name="Android Platform" osList="all" superClass="com.android.targetPlatform"/>
<builder enableCleanBuild="false" id="com.android.builder.1130188873" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="com.android.builder">
<outputEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="libs"/>
</outputEntries>
</builder>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.2094589046" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="com.android.tool.compiler.g++.1543637239" name="Android G++" superClass="com.android.tool.compiler.g++">
<inputType id="com.android.tool.compiler.g++.input.478508689" superClass="com.android.tool.compiler.g++.input"/>
</tool>
<tool id="com.android.tool.compiler.c.1571517563" name="Android GCC" superClass="com.android.tool.compiler.c">
<option id="gnu.c.compiler.option.include.paths.741601891" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/home/victor/projects/android-ndk-r6b/platforms/android-3/arch-arm/usr/include"/>
</option>
<inputType id="com.android.tool.compiler.c.input.1589735828" superClass="com.android.tool.compiler.c.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1072970274" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1246211237" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2067702743" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.160853213" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2064867964" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="jni"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="OsmAnd.null.100587230" name="OsmAnd"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.2018451624;com.android.tool.compiler.g++.1543637239;com.android.tool.compiler.g++.input.478508689">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.2018451624;com.android.tool.compiler.c.1571517563;com.android.tool.compiler.c.input.1589735828">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/OsmAnd"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

View file

@ -5,6 +5,64 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>?children?</key>
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>ndk-build</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>V=1</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
@ -25,10 +83,20 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>

View file

@ -0,0 +1,7 @@
#Fri Oct 21 17:02:34 CEST 2011
eclipse.preferences.version=1
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-r6b\:/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 +1,2 @@
include $(all-subdir-makefiles)
LOCAL_CFLAGS := -Wall -g g -O0

View file

@ -2,15 +2,16 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
// $(LOCAL_PATH)/../libvorbis-1.3.2/include \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
# $(LOCAL_PATH)/../libvorbis-1.3.2/include
LOCAL_MODULE := osmand
LOCAL_SRC_FILES := rendering.c
# LOCAL_SHARED_LIBRARIES := libvorbis libogg libFLAC
// LOCAL_SHARED_LIBRARIES := libvorbis libogg libFLAC
CFLAGS := -g -O0
LOCAL_CFLAGS := -Wall -g
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog
include $(BUILD_SHARED_LIBRARY)

View file

@ -10,14 +10,38 @@
JNIEnv* env;
jclass MultiPolygonClass;
jclass PathClass;
jmethodID Path_init;
jmethodID Path_moveTo;
jmethodID Path_lineTo;
jclass CanvasClass;
jmethodID Canvas_drawPath;
jclass PaintClass;
jclass PaintClass_setStrokeWidth;
jclass PaintClass_setColor;
jclass MapRenderingTypesClass;
jmethodID MapRenderingTypes_getMainObjectType;
jmethodID MapRenderingTypes_getObjectSubType;
jmethodID MapRenderingTypes_getNegativeWayLayer;
jclass BinaryMapDataObjectClass;
jmethodID BinaryMapDataObject_getPointsLength;
jmethodID BinaryMapDataObject_getPoint31YTile;
jmethodID BinaryMapDataObject_getPoint31XTile;
jmethodID BinaryMapDataObject_getTypes;
jmethodID BinaryMapDataObject_getTagValue;
jclass RenderingContextClass;
jfieldID RenderingContextClass_interrupted;
typedef struct RenderingContext {
// TODO check interrupted
jobject originalRC;
jfieldID interrupted;
// public boolean interrupted = false;
// boolean highResMode = false;
@ -55,15 +79,9 @@ typedef struct RenderingContext {
} RenderingContext;
jmethodID getMid(jobject obj, char* methodName, char* sig )
{
jclass cls = (*env)->GetObjectClass(env, obj);
return (*env)->GetMethodID(env, cls, methodName, sig);
}
jfieldID getFid(jobject obj, char* fieldName, char* sig )
jfieldID getFid(jclass cls, char* fieldName, char* sig )
{
jclass cls = (*env)->GetObjectClass(env, obj);
return (*env)->GetFieldID(env, cls, fieldName, sig);
}
@ -72,10 +90,10 @@ jfieldID getFid(jobject obj, char* fieldName, char* sig )
{
rc -> pointCount ++;
float tx = (*env)->CallFloatMethod(env, mapObject, getMid(mapObject, "getPoint31XTile", "(I)[F" ),
ind ) / (rc -> tileDivisor);
float ty = (*env)->CallFloatMethod(env, mapObject, getMid(mapObject, "getPoint31YTile", "(I)[F" ),
ind ) / (rc -> tileDivisor);
float tx = (*env)->CallFloatMethod(env, mapObject, BinaryMapDataObject_getPoint31XTile, ind )
/ (rc -> tileDivisor);
float ty = (*env)->CallFloatMethod(env, mapObject, BinaryMapDataObject_getPoint31YTile, ind )
/ (rc -> tileDivisor);
float dTileX = tx - rc -> leftX;
float dTileY = ty - rc -> topY;
@ -88,12 +106,49 @@ jfieldID getFid(jobject obj, char* fieldName, char* sig )
}
}
void drawPolyline(jobject binaryMapDataObject, jobject renderingRuleSearch, jobject cv, jobject paint,
RenderingContext* rc, jobject pair, int layer, int drawOnlyShadow)
{
rc -> visible++;
jint length = (*env)->CallIntMethod(env, binaryMapDataObject, BinaryMapDataObject_getPointsLength);
jobject path;
int i = 0;
for(; i< length ; i++)
{
calcPoint(binaryMapDataObject, i, rc);
if (!path) {
path = (*env)->NewObject( env, PathClass, Path_init);
(*env)->CallObjectMethod(env, path, Path_moveTo, rc->calcX, rc->calcY);
} else {
(*env)->CallObjectMethod(env, path, Path_lineTo, rc->calcX, rc->calcY);
}
}
if (path) {
if (drawOnlyShadow) {
//int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
//int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS);
//drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius);
} else {
(*env)->CallObjectMethod(env, paint, PaintClass_setColor, (jint) -3355444);
(*env)->CallObjectMethod(env, paint, PaintClass_setStrokeWidth, 3.5f);
(*env)->CallObjectMethod(env, cv, Canvas_drawPath, path, paint);
//if (updatePaint(render, paint, 1, false, rc)) {
// canvas.drawPath(path, paint);
// if (updatePaint(render, paint, 2, false, rc)) {
// canvas.drawPath(path, paint);
// }
//}
}
(*env)->DeleteLocalRef(env, path);
}
}
void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv,
jobject renderingRuleSearchRequest, int l) {
jobject renderingRuleSearch, jobject paint, int l, int renderText, int drawOnlyShadow) {
rc -> allObjects++;
if ((*env)->IsInstanceOf(env, binaryMapDataObject, MultiPolygonClass)) {
//if(!drawOnlyShadow){
// drawMultiPolygon(obj, render, canvas, rc);
@ -101,8 +156,7 @@ void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv,
return;
}
jintArray types = (*env)->CallObjectMethod(env, binaryMapDataObject,
getMid(binaryMapDataObject, "getTypes", "()[I" ) );
jintArray types = (*env)->CallObjectMethod(env, binaryMapDataObject, BinaryMapDataObject_getTypes);
jint mainType;
(*env)->GetIntArrayRegion(env, types, l, 1, &mainType);
int t = mainType & 3;
@ -110,60 +164,51 @@ void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv,
jint type = (*env)->CallStaticIntMethod(env, MapRenderingTypesClass, MapRenderingTypes_getMainObjectType, mainType);
jint subtype = (*env)->CallStaticIntMethod(env, MapRenderingTypesClass, MapRenderingTypes_getObjectSubType, mainType);
// TODO
//TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
if( t == 1) {
jobject pair = (*env)->CallObjectMethod(env, binaryMapDataObject, BinaryMapDataObject_getTagValue, mainType);
if( t == 1 && !drawOnlyShadow) {
// point
// drawPoint(obj, render, canvas, rc, pair, renderText);
} else if(t == 2) {
// polyline
} else if(t == 3) {
int layer = (*env)->CallStaticIntMethod(env, MapRenderingTypesClass,
MapRenderingTypes_getNegativeWayLayer, mainType);
drawPolyline(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair, layer, drawOnlyShadow);
} else if(t == 3 && !drawOnlyShadow) {
// polygon
// drawPolygon(obj, render, canvas, rc, pair);
}
/*
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
if (t == MapRenderingTypes.POINT_TYPE && !drawOnlyShadow) {
drawPoint(obj, render, canvas, rc, pair, renderText);
} else if (t == MapRenderingTypes.POLYLINE_TYPE) {
int layer = MapRenderingTypes.getNegativeWayLayer(mainType);
drawPolyline(obj, render, canvas, rc, pair, layer, drawOnlyShadow);
} else if (t == MapRenderingTypes.POLYGON_TYPE && !drawOnlyShadow) {
drawPolygon(obj, render, canvas, rc, pair);
} else {
if (t == MapRenderingTypes.MULTY_POLYGON_TYPE && !(obj instanceof MultyPolygon)) {
// log this situation
return;
}
}
} */
(*env)->DeleteLocalRef(env, pair);
}
void copyRenderingContext(jobject orc, RenderingContext* rc)
{
rc->leftX = (*env)->GetFloatField(env, orc, getFid( orc, "leftX", "F" ) );
rc->topY = (*env)->GetFloatField(env, orc, getFid( orc, "topY", "F" ) );
rc->width = (*env)->GetIntField(env, orc, getFid( orc, "width", "I" ) );
rc->height = (*env)->GetIntField(env, orc, getFid( orc, "height", "I" ) );
rc->leftX = (*env)->GetFloatField(env, orc, getFid( RenderingContextClass, "leftX", "F" ) );
rc->topY = (*env)->GetFloatField(env, orc, getFid( RenderingContextClass, "topY", "F" ) );
rc->width = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "width", "I" ) );
rc->height = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "height", "I" ) );
rc->zoom = (*env)->GetIntField(env, orc, getFid( orc, "zoom", "I" ) );
rc->rotate = (*env)->GetFloatField(env, orc, getFid( orc, "rotate", "F" ) );
rc->tileDivisor = (*env)->GetFloatField(env, orc, getFid( orc, "tileDivisor", "F" ) );
rc->zoom = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "zoom", "I" ) );
rc->rotate = (*env)->GetFloatField(env, orc, getFid( RenderingContextClass, "rotate", "F" ) );
rc->tileDivisor = (*env)->GetFloatField(env, orc, getFid( RenderingContextClass, "tileDivisor", "F" ) );
rc->pointCount = (*env)->GetIntField(env, orc, getFid( orc, "pointCount", "I" ) );
rc->pointInsideCount = (*env)->GetIntField(env, orc, getFid( orc, "pointInsideCount", "I" ) );
rc->visible = (*env)->GetIntField(env, orc, getFid( orc, "visible", "I" ) );
rc->allObjects = (*env)->GetIntField(env, orc, getFid( orc, "allObjects", "I" ) );
rc->pointCount = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "pointCount", "I" ) );
rc->pointInsideCount = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "pointInsideCount", "I" ) );
rc->visible = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "visible", "I" ) );
rc->allObjects = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "allObjects", "I" ) );
rc->shadowRenderingMode = (*env)->GetIntField(env, orc, getFid( orc, "shadowRenderingMode", "I" ) );
rc->shadowLevelMin = (*env)->GetIntField(env, orc, getFid( orc, "shadowLevelMin", "I" ) );
rc->shadowLevelMax = (*env)->GetIntField(env, orc, getFid( orc, "shadowLevelMax", "I" ) );
rc->shadowRenderingMode = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "shadowRenderingMode", "I" ) );
rc->shadowLevelMin = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "shadowLevelMin", "I" ) );
rc->shadowLevelMax = (*env)->GetIntField(env, orc, getFid( RenderingContextClass, "shadowLevelMax", "I" ) );
rc->interrupted = getFid( orc, "interrupted", "B" );
rc->originalRC = orc;
}
@ -171,57 +216,116 @@ void copyRenderingContext(jobject orc, RenderingContext* rc)
void mergeRenderingContext(jobject orc, RenderingContext* rc)
{
(*env)->SetIntField(env, orc, getFid(orc, "pointCount", "I" ) , rc->pointCount);
(*env)->SetIntField(env, orc, getFid(orc, "pointInsideCount", "I" ) , rc->pointInsideCount);
(*env)->SetIntField(env, orc, getFid(orc, "visible", "I" ) , rc->visible);
(*env)->SetIntField(env, orc, getFid(orc, "allObjects", "I" ) , rc->allObjects);
(*env)->SetIntField(env, orc, getFid(RenderingContextClass, "pointCount", "I" ) , rc->pointCount);
(*env)->SetIntField(env, orc, getFid(RenderingContextClass, "pointInsideCount", "I" ) , rc->pointInsideCount);
(*env)->SetIntField(env, orc, getFid(RenderingContextClass, "visible", "I" ) , rc->visible);
(*env)->SetIntField(env, orc, getFid(RenderingContextClass, "allObjects", "I" ) , rc->allObjects);
}
void initLibrary()
void initLibrary(jobject rc)
{
MultiPolygonClass = (*env)->FindClass(env, "net/osmand/osm/MultyPolygon");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "1");
PathClass = (*env)->FindClass(env, "android/graphics/Path");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "2");
Path_init = (*env)->GetMethodID(env, PathClass, "<init>", "()V" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "3");
Path_moveTo = (*env)->GetMethodID(env, PathClass, "moveTo", "(F,F)" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "4");
Path_lineTo = (*env)->GetMethodID(env, PathClass, "lineTo", "(F,F)" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "5");
CanvasClass = (*env)->FindClass(env, "android/graphics/Canvas");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "6");
Canvas_drawPath = (*env)->GetMethodID(env, CanvasClass, "drawPath",
"(Landroid/graphics/Path;,Landroid/graphics/Paint;)V" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "7");
PaintClass = (*env)->FindClass(env, "android/graphics/Paint");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "8");
PaintClass_setColor = (*env)->GetMethodID(env, PaintClass, "setColor", "(I)V" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "9");
PaintClass_setStrokeWidth = (*env)->GetMethodID(env, PaintClass, "setStrokeWidth", "(F)V" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "10");
RenderingContextClass = (*env)->GetObjectClass(env, rc);
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "11");
RenderingContextClass_interrupted = getFid( RenderingContextClass, "interrupted", "Z" );
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "12");
MapRenderingTypesClass = (*env)->FindClass(env, "net/osmand/osm/MapRenderingTypes");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "13");
MapRenderingTypes_getMainObjectType = (*env)->GetStaticMethodID(env, MapRenderingTypesClass,"getMainObjectType","(I)I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "14");
MapRenderingTypes_getObjectSubType = (*env)->GetStaticMethodID(env, MapRenderingTypesClass, "getObjectSubType","(I)I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "15");
MapRenderingTypes_getNegativeWayLayer = (*env)->GetMethodID(env, MapRenderingTypesClass,"getNegativeWayLayer","(I)I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "16");
BinaryMapDataObjectClass = (*env)->FindClass(env, "net/osmand/binary/BinaryMapDataObject");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "17");
BinaryMapDataObject_getPointsLength = (*env)->GetMethodID(env, BinaryMapDataObjectClass,"getPointsLength","()I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "18");
BinaryMapDataObject_getPoint31YTile = (*env)->GetMethodID(env, BinaryMapDataObjectClass,"getPoint31YTile","(I)I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "19");
BinaryMapDataObject_getPoint31XTile = (*env)->GetMethodID(env, BinaryMapDataObjectClass,"getPoint31XTile","(I)I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "20");
BinaryMapDataObject_getTypes = (*env)->GetMethodID(env, BinaryMapDataObjectClass,"getTypes","()[I");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "21");
BinaryMapDataObject_getTagValue = (*env)->GetMethodID(env, BinaryMapDataObjectClass,"getTagValue",
"(I)Lnet/osmand/binary/BinaryMapIndexReader$TagValuePair;");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "22");
}
void unloadLibrary()
{
(*env)->DeleteLocalRef( env, MultiPolygonClass );
(*env)->DeleteLocalRef( env, MapRenderingTypesClass );
(*env)->DeleteLocalRef( env, PathClass );
(*env)->DeleteLocalRef( env, CanvasClass );
(*env)->DeleteLocalRef( env, PaintClass );
(*env)->DeleteLocalRef( env, RenderingContextClass );
(*env)->DeleteLocalRef( env, BinaryMapDataObjectClass );
}
JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRendering( JNIEnv* ienv,
jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject cv,
jboolean useEnglishNames, jobject renderingRuleSearchRequest) {
jboolean useEnglishNames, jobject renderingRuleSearchRequest, jobject paint) {
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering");
int i = 0;
if(!env) {
//if(!env) {
env = ienv;
initLibrary();
}
env = ienv;
const size_t size = (*env)->GetArrayLength(env,binaryMapDataObjects);
initLibrary(renderingContext);
//}
//env = ienv;
const size_t size = (*env)->GetArrayLength(env, binaryMapDataObjects);
char szResult[1024];
RenderingContext rc;
// copyRenderingContext(renderingContext, &rc);
copyRenderingContext(renderingContext, &rc);
// szResult = malloc(sizeof(szFormat) + 20);
__android_log_print(ANDROID_LOG_INFO, "net.osmand", "Rendering cpp");
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Rendering image");
for(; i < size; i++)
{
jobject binaryMapDataObject = (jobject) (*env)->GetObjectArrayElement(env, binaryMapDataObjects, i);
drawObject(&rc, binaryMapDataObject, cv, renderingRuleSearchRequest, 0);
// drawObject(&rc, binaryMapDataObject, cv, renderingRuleSearchRequest, paint, 0, 1, 0);
(*env)->DeleteLocalRef(env, binaryMapDataObject);
}
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image");
sprintf(szResult, "Hello android %d", size);
// get an object string
@ -230,7 +334,9 @@ JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_genera
// cleanup
// free(szResult);
// mergeRenderingContext(renderingContext, &rc);
mergeRenderingContext(renderingContext, &rc);
unloadLibrary();
return result;

View file

@ -1,2 +1,2 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd//obj/local/armeabi
directory /home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd//jni/osmand /home/victor/projects/OsmAnd/git/OsmAnd//jni/osmand/../libvorbis-1.3.2/include /home/victor/projects/ndk/sources/cxx-stl/system
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand /home/victor/projects/android-ndk-r6b/sources/cxx-stl/system

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand /home/victor/projects/android-ndk-r6b/sources/cxx-stl/system
file /home/victor/projects/OsmAnd/git/OsmAnd//obj/local/armeabi/app_process
target remote :5039

View file

@ -0,0 +1,3 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand
file /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/app_process

Binary file not shown.

View file

@ -1,86 +1,86 @@
/home/victor/projects/OsmAnd/git/OsmAnd//obj/local/armeabi/objs-debug/osmand/rendering.o: \
/home/victor/projects/OsmAnd/git/OsmAnd//jni/osmand/rendering.c \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/jni.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/android/log.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/time.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/cdefs.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/time.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdint.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/_types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/machine/_types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/posix_types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/stddef.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/compiler.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/posix_types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/types.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/machine/kernel.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/time.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/siginfo.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdio.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdlib.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/string.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/malloc.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/alloca.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/strings.h \
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/memory.h
/home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/objs-debug/osmand/rendering.o: \
/home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand/rendering.c \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/jni.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/android/log.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/cdefs.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdint.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/machine/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/stddef.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/compiler.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/machine/kernel.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/linux/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdio.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/stdlib.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/string.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/malloc.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/alloca.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/strings.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h:
/home/victor/projects/ndk/platforms/android-8/arch-arm/usr/include/memory.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h:

View file

@ -52,6 +52,10 @@ public class MainMenuActivity extends Activity {
private ProgressDialog startProgressDialog;
static {
System.loadLibrary("osmand");
}
public void checkPreviousRunsForExceptions(boolean firstTime) {
long size = getPreferences(MODE_WORLD_READABLE).getLong(EXCEPTION_FILE_SIZE, 0);

View file

@ -1,20 +1,15 @@
package net.osmand.plus.render;
import java.util.List;
import net.osmand.binary.BinaryMapDataObject;
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.render.RenderingRuleSearchRequest;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
public class NativeOsmandLibrary {
static {
System.loadLibrary("osmand");
}
public static native String generateRendering(RenderingContext rc, BinaryMapDataObject[] objects, Canvas cv,
boolean useEnglishNames, RenderingRuleSearchRequest render);
boolean useEnglishNames, RenderingRuleSearchRequest render, Paint paint);
}

View file

@ -301,7 +301,7 @@ public class OsmandRenderer {
} else {
long time = System.currentTimeMillis() - now;
BinaryMapDataObject[] array = objects.toArray(new BinaryMapDataObject[objects.size()]);
String res = NativeOsmandLibrary.generateRendering(rc, array, cv, useEnglishNames, render);
String res = NativeOsmandLibrary.generateRendering(rc, array, cv, useEnglishNames, render, paint);
rc.renderingDebugInfo = String.format("Rendering done in %s (%s text) ms\n"
+ "(%s points, %s points inside, %s objects visile from %s)\n" + res,//$NON-NLS-1$
time, 0, rc.pointCount, rc.pointInsideCount, rc.visible, rc.allObjects);