Fix native rendering

This commit is contained in:
Victor Shcherb 2012-04-18 23:26:57 +02:00
parent ad350f003f
commit b1cee69f3a
4 changed files with 16 additions and 13 deletions

View file

@ -46,7 +46,7 @@ public class BinaryInspector {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
inspector(args); inspector(args);
// test cases show info // test cases show info
// inspector(new String[]{"-vpoi", "/home/victor/projects/OsmAnd/data/osm-gen/Luxembourg_poi.obf"}); // inspector(new String[]{"/home/victor/projects/OsmAnd/data/osm-gen/Luxembourg.obf"});
// test case extract parts // test case extract parts

View file

@ -1,13 +1,13 @@
#Fri Mar 23 17:29:32 CET 2012 #Wed Apr 18 11:27:32 CEST 2012
eclipse.preferences.version=1 eclipse.preferences.version=1
environment/project/com.android.toolchain.gcc.128294115/ANDROID_NDK/delimiter=\: 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/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/ANDROID_NDK/value=/home/victor/projects/android-ndk-r7c/
environment/project/com.android.toolchain.gcc.128294115/OSMAND_USE_PREBUILT/delimiter=\: 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/operation=append
environment/project/com.android.toolchain.gcc.128294115/OSMAND_USE_PREBUILT/value=true 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/delimiter=\:
environment/project/com.android.toolchain.gcc.128294115/PATH/operation=replace 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/PATH/value=/home/victor/projects/android-ndk-r7c\:/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/append=true
environment/project/com.android.toolchain.gcc.128294115/appendContributed=true environment/project/com.android.toolchain.gcc.128294115/appendContributed=true

View file

@ -267,11 +267,10 @@ bool readMapLevel(io::CodedInputStream* input, MapRoot* root) {
break; break;
} }
case OsmAndMapIndex_MapRootLevel::kBoxesFieldNumber: { case OsmAndMapIndex_MapRootLevel::kBoxesFieldNumber: {
uint32 length;
readInt(input, &length);
int filePointer = input->getTotalBytesRead();
int oldLimit = input->PushLimit(length);
MapTreeBounds bounds; MapTreeBounds bounds;
readInt(input, &bounds.length);
bounds.filePointer = input->getTotalBytesRead();
int oldLimit = input->PushLimit(bounds.length);
readMapTreeBounds(input, &bounds, root); readMapTreeBounds(input, &bounds, root);
root->bounds.push_back(bounds); root->bounds.push_back(bounds);
input->Skip(input->BytesUntilLimit()); input->Skip(input->BytesUntilLimit());
@ -399,6 +398,7 @@ bool initMapStructure(io::CodedInputStream* input, BinaryMapFile* file) {
readInt(input, &mapIndex.length); readInt(input, &mapIndex.length);
mapIndex.filePointer = input->getTotalBytesRead(); mapIndex.filePointer = input->getTotalBytesRead();
int oldLimit = input->PushLimit(mapIndex.length); int oldLimit = input->PushLimit(mapIndex.length);
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Map index %d length %d", mapIndex.filePointer, mapIndex.length);
readMapIndex(input, &mapIndex); readMapIndex(input, &mapIndex);
input->PopLimit(oldLimit); input->PopLimit(oldLimit);
input->Seek(mapIndex.filePointer + mapIndex.length); input->Seek(mapIndex.filePointer + mapIndex.length);
@ -496,7 +496,7 @@ bool acceptTypes(SearchQuery* req, std::vector<tag_value>& types, MapIndex* root
MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tree, SearchQuery* req, MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tree, SearchQuery* req,
MapIndex* root) { MapIndex* root) {
uint32 tag = input->ReadTag(); uint32 tag = WireFormatLite::GetTagFieldNumber(input->ReadTag());
bool area = MapData::kAreaCoordinatesFieldNumber == tag; bool area = MapData::kAreaCoordinatesFieldNumber == tag;
if(!area && MapData::kCoordinatesFieldNumber != tag) { if(!area && MapData::kCoordinatesFieldNumber != tag) {
return NULL; return NULL;
@ -538,6 +538,7 @@ MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tre
maxY = max(maxY, y); maxY = max(maxY, y);
} }
} }
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Object %d %d %d %d", maxX, minX, minY, maxY);
if (!contains) { if (!contains) {
if (maxX >= req->left && minX <= req->right && minY <= req->bottom && maxY >= req->top) { if (maxX >= req->left && minX <= req->right && minY <= req->bottom && maxY >= req->top) {
contains = true; contains = true;
@ -725,9 +726,9 @@ bool searchMapTreeBounds(io::CodedInputStream* input, MapTreeBounds* current, Ma
child->ocean = current->ocean; child->ocean = current->ocean;
} }
searchMapTreeBounds(input, child, current, req, foundSubtrees); searchMapTreeBounds(input, child, current, req, foundSubtrees);
delete child;
input->PopLimit(oldLimit); input->PopLimit(oldLimit);
input->Seek(child->filePointer + child->length); input->Seek(child->filePointer + child->length);
delete child;
break; break;
} }
default: { default: {
@ -784,7 +785,6 @@ bool readMapDataBlocks(io::CodedInputStream* input, SearchQuery* req, MapTreeBou
uint32 length; uint32 length;
DO_((WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(input, &length))); DO_((WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(input, &length)));
int oldLimit = input->PushLimit(length); int oldLimit = input->PushLimit(length);
MapDataObject* mapObject = readMapDataObject(input, tree, req, root); MapDataObject* mapObject = readMapDataObject(input, tree, req, root);
if (mapObject != NULL) { if (mapObject != NULL) {
mapObject->id += baseId; mapObject->id += baseId;
@ -827,6 +827,7 @@ void searchMapData(io::CodedInputStream* input, MapRoot* root, MapIndex* ind, Se
searchMapTreeBounds(input, i, root, req, &foundSubtrees); searchMapTreeBounds(input, i, root, req, &foundSubtrees);
input->PopLimit(oldLimit); input->PopLimit(oldLimit);
sort(foundSubtrees.begin(), foundSubtrees.end(), sortTreeBounds); sort(foundSubtrees.begin(), foundSubtrees.end(), sortTreeBounds);
uint32 length; uint32 length;
for (std::vector<MapTreeBounds>::iterator tree = foundSubtrees.begin(); for (std::vector<MapTreeBounds>::iterator tree = foundSubtrees.begin();
@ -835,7 +836,7 @@ void searchMapData(io::CodedInputStream* input, MapRoot* root, MapIndex* ind, Se
return; return;
} }
input->Seek(tree->mapDataBlock); input->Seek(tree->mapDataBlock);
WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(input, &tree->mapDataBlock); WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(input, &length);
int oldLimit = input->PushLimit(length); int oldLimit = input->PushLimit(length);
readMapDataBlocks(input, req, tree, ind); readMapDataBlocks(input, req, tree, ind);
input->PopLimit(oldLimit); input->PopLimit(oldLimit);
@ -905,6 +906,8 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
// } // }
// //
// proccessMultiPolygons(multyPolygons, q.left, q.right, q.bottom, q.top, q.zoom, result->result); // proccessMultiPolygons(multyPolygons, q.left, q.right, q.bottom, q.top, q.zoom, result->result);
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees,
q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size());
if(q.result.size() > 0) { if(q.result.size() > 0) {
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees, __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ", q.numberOfReadSubtrees,
q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size()); q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects, result->result.size());

View file

@ -190,7 +190,7 @@ public:
R_POINT = storage->getProperty("point"); R_POINT = storage->getProperty("point");
R_AREA = storage->getProperty("area"); R_AREA = storage->getProperty("area");
R_CYCLE = storage->getProperty("cycle"); R_CYCLE = storage->getProperty("cycle");
R_CYCLE = storage->getProperty("nameTag"); R_NAME_TAG = storage->getProperty("nameTag");
} }