Fix build
This commit is contained in:
parent
a85dd4ba00
commit
86f3b5ffee
6 changed files with 109 additions and 98 deletions
|
@ -20,7 +20,7 @@
|
||||||
<folderInfo id="com.android.toolchain.gcc.128294115.2018451624" name="/" resourcePath="">
|
<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">
|
<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"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.android.targetPlatform.998053113" name="Android Platform" osList="all" superClass="com.android.targetPlatform"/>
|
||||||
<builder arguments="${ANDROID_NDK}/ndk-build" command="sh" enableCleanBuild="false" enabledIncrementalBuild="true" id="com.android.builder.1130188873" incrementalBuildTarget="V=1" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="com.android.builder">
|
<builder arguments="${ANDROID_NDK}/ndk-build" command="sh" enableCleanBuild="false" enabledIncrementalBuild="false" id="com.android.builder.1130188873" incrementalBuildTarget="V=1" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="com.android.builder">
|
||||||
<outputEntries>
|
<outputEntries>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="libs"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="libs"/>
|
||||||
</outputEntries>
|
</outputEntries>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
<triggers>full,incremental,</triggers>
|
<triggers></triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>?children?</key>
|
<key>?children?</key>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||||
<value>true</value>
|
<value>false</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||||
|
|
|
@ -20,8 +20,8 @@ CPPFLAGS := \
|
||||||
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
|
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
|
||||||
-DSK_RELEASE \
|
-DSK_RELEASE \
|
||||||
-DGR_RELEASE=1 \
|
-DGR_RELEASE=1 \
|
||||||
-c -fpic -I$(JAVA_HOME)/include \
|
-c -Fpic -I$(JAVA_HOME)/include \
|
||||||
-DHAVING_HASH \
|
-DHASH_MAP_GNU \
|
||||||
$(C_INCLUDES)
|
$(C_INCLUDES)
|
||||||
|
|
||||||
target : ../$(RUNFILE)
|
target : ../$(RUNFILE)
|
||||||
|
|
|
@ -2,29 +2,26 @@
|
||||||
#define _OSMAND_BINARY_READ
|
#define _OSMAND_BINARY_READ
|
||||||
|
|
||||||
#include "binaryRead.h"
|
#include "binaryRead.h"
|
||||||
#include "osmand_log.h"
|
#include <algorithm>
|
||||||
#include "google/protobuf/io/zero_copy_stream_impl.h"
|
|
||||||
#include "google/protobuf/wire_format_lite.h"
|
#include "google/protobuf/wire_format_lite.h"
|
||||||
|
#include "google/protobuf/io/zero_copy_stream_impl.h"
|
||||||
#include "google/protobuf/wire_format_lite.cc"
|
#include "google/protobuf/wire_format_lite.cc"
|
||||||
|
|
||||||
#include "renderRules.h"
|
|
||||||
#include "common.h"
|
|
||||||
#include "mapObjects.h"
|
|
||||||
#include "multipolygons.h"
|
|
||||||
#include "proto/osmand_odb.pb.h"
|
#include "proto/osmand_odb.pb.h"
|
||||||
using namespace std;
|
#include "osmand_log.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
|
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
|
||||||
using namespace google::protobuf;
|
using google::protobuf::io::CodedInputStream;
|
||||||
using namespace google::protobuf::internal;
|
using google::protobuf::io::FileInputStream;
|
||||||
|
using google::protobuf::internal::WireFormatLite;
|
||||||
|
//using namespace google::protobuf::internal;
|
||||||
|
|
||||||
static const int MAP_VERSION = 2;
|
static const int MAP_VERSION = 2;
|
||||||
static const int BASEMAP_ZOOM = 11;
|
static const int BASEMAP_ZOOM = 11;
|
||||||
|
|
||||||
struct BinaryMapFile;
|
|
||||||
std::map< std::string, BinaryMapFile* > openFiles;
|
std::map< std::string, BinaryMapFile* > openFiles;
|
||||||
|
|
||||||
inline bool readInt(io::CodedInputStream* input, uint32* sz) {
|
inline bool readInt(CodedInputStream* input, uint32* sz ){
|
||||||
uint8 buf[4];
|
uint8 buf[4];
|
||||||
if (!input->ReadRaw(buf, 4)) {
|
if (!input->ReadRaw(buf, 4)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -33,7 +30,7 @@ inline bool readInt(io::CodedInputStream* input, uint32* sz) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool skipFixed32(io::CodedInputStream* input) {
|
bool skipFixed32(CodedInputStream* input) {
|
||||||
uint32 sz;
|
uint32 sz;
|
||||||
if (!readInt(input, &sz)) {
|
if (!readInt(input, &sz)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -41,7 +38,7 @@ bool skipFixed32(io::CodedInputStream* input) {
|
||||||
return input->Skip(sz);
|
return input->Skip(sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool skipUnknownFields(io::CodedInputStream* input, int tag) {
|
bool skipUnknownFields(CodedInputStream* input, int tag) {
|
||||||
if (WireFormatLite::GetTagWireType(tag) == WireFormatLite::WIRETYPE_FIXED32_LENGTH_DELIMITED) {
|
if (WireFormatLite::GetTagWireType(tag) == WireFormatLite::WIRETYPE_FIXED32_LENGTH_DELIMITED) {
|
||||||
if (!skipFixed32(input)) {
|
if (!skipFixed32(input)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -92,7 +89,7 @@ struct SearchQuery {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool readMapTreeBounds(io::CodedInputStream* input, MapTreeBounds* tree, MapRoot* root) {
|
bool readMapTreeBounds(CodedInputStream* input, MapTreeBounds* tree, MapRoot* root) {
|
||||||
int init = 0;
|
int init = 0;
|
||||||
int tag;
|
int tag;
|
||||||
int32 si;
|
int32 si;
|
||||||
|
@ -139,7 +136,7 @@ bool readMapTreeBounds(io::CodedInputStream* input, MapTreeBounds* tree, MapRoot
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readMapLevel(io::CodedInputStream* input, MapRoot* root) {
|
bool readMapLevel(CodedInputStream* input, MapRoot* root) {
|
||||||
int tag;
|
int tag;
|
||||||
int si;
|
int si;
|
||||||
while ((tag = input->ReadTag()) != 0) {
|
while ((tag = input->ReadTag()) != 0) {
|
||||||
|
@ -203,7 +200,7 @@ bool readMapLevel(io::CodedInputStream* input, MapRoot* root) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readMapEncodingRule(io::CodedInputStream* input, MapIndex* index, uint32 id) {
|
bool readMapEncodingRule(CodedInputStream* input, MapIndex* index, uint32 id) {
|
||||||
int tag;
|
int tag;
|
||||||
std::string tagS;
|
std::string tagS;
|
||||||
std::string value;
|
std::string value;
|
||||||
|
@ -242,7 +239,7 @@ bool readMapEncodingRule(io::CodedInputStream* input, MapIndex* index, uint32 id
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readMapIndex(io::CodedInputStream* input, MapIndex* mapIndex) {
|
bool readMapIndex(CodedInputStream* input, MapIndex* mapIndex) {
|
||||||
uint32 tag;
|
uint32 tag;
|
||||||
uint32 defaultId = 1;
|
uint32 defaultId = 1;
|
||||||
while ((tag = input->ReadTag()) != 0) {
|
while ((tag = input->ReadTag()) != 0) {
|
||||||
|
@ -288,7 +285,7 @@ bool readMapIndex(io::CodedInputStream* input, MapIndex* mapIndex) {
|
||||||
|
|
||||||
//display google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
|
//display google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
|
||||||
// display google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)
|
// display google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)
|
||||||
bool initMapStructure(io::CodedInputStream* input, BinaryMapFile* file) {
|
bool initMapStructure(CodedInputStream* input, BinaryMapFile* file) {
|
||||||
uint32 tag;
|
uint32 tag;
|
||||||
uint32 version = -1;
|
uint32 version = -1;
|
||||||
uint32 versionConfirm = -2;
|
uint32 versionConfirm = -2;
|
||||||
|
@ -347,7 +344,7 @@ extern "C" JNIEXPORT void JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readStringTable(io::CodedInputStream* input, std::vector<std::string>& list) {
|
bool readStringTable(CodedInputStream* input, std::vector<std::string>& list) {
|
||||||
uint32 tag;
|
uint32 tag;
|
||||||
while ((tag = input->ReadTag()) != 0) {
|
while ((tag = input->ReadTag()) != 0) {
|
||||||
switch (WireFormatLite::GetTagFieldNumber(tag)) {
|
switch (WireFormatLite::GetTagFieldNumber(tag)) {
|
||||||
|
@ -395,7 +392,7 @@ bool acceptTypes(SearchQuery* req, std::vector<tag_value>& types, MapIndex* root
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tree, SearchQuery* req,
|
MapDataObject* readMapDataObject(CodedInputStream* input, MapTreeBounds* tree, SearchQuery* req,
|
||||||
MapIndex* root) {
|
MapIndex* root) {
|
||||||
uint32 tag = WireFormatLite::GetTagFieldNumber(input->ReadTag());
|
uint32 tag = WireFormatLite::GetTagFieldNumber(input->ReadTag());
|
||||||
bool area = MapData::kAreaCoordinatesFieldNumber == tag;
|
bool area = MapData::kAreaCoordinatesFieldNumber == tag;
|
||||||
|
@ -557,7 +554,7 @@ MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tre
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool searchMapTreeBounds(io::CodedInputStream* input, MapTreeBounds* current, MapTreeBounds* parent,
|
bool searchMapTreeBounds(CodedInputStream* input, MapTreeBounds* current, MapTreeBounds* parent,
|
||||||
SearchQuery* req, std::vector<MapTreeBounds>* foundSubtrees) {
|
SearchQuery* req, std::vector<MapTreeBounds>* foundSubtrees) {
|
||||||
int init = 0;
|
int init = 0;
|
||||||
int tag;
|
int tag;
|
||||||
|
@ -645,7 +642,7 @@ bool searchMapTreeBounds(io::CodedInputStream* input, MapTreeBounds* current, Ma
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readMapDataBlocks(io::CodedInputStream* input, SearchQuery* req, MapTreeBounds* tree, MapIndex* root) {
|
bool readMapDataBlocks(CodedInputStream* input, SearchQuery* req, MapTreeBounds* tree, MapIndex* root) {
|
||||||
long long baseId = 0;
|
long long baseId = 0;
|
||||||
int tag;
|
int tag;
|
||||||
std::vector< MapDataObject* > results;
|
std::vector< MapDataObject* > results;
|
||||||
|
@ -711,7 +708,7 @@ bool readMapDataBlocks(io::CodedInputStream* input, SearchQuery* req, MapTreeBou
|
||||||
|
|
||||||
bool sortTreeBounds (const MapTreeBounds& i,const MapTreeBounds& j) { return (i.mapDataBlock<j.mapDataBlock); }
|
bool sortTreeBounds (const MapTreeBounds& i,const MapTreeBounds& j) { return (i.mapDataBlock<j.mapDataBlock); }
|
||||||
|
|
||||||
void searchMapData(io::CodedInputStream* input, MapRoot* root, MapIndex* ind, SearchQuery* req) {
|
void searchMapData(CodedInputStream* input, MapRoot* root, MapIndex* ind, SearchQuery* req) {
|
||||||
// search
|
// search
|
||||||
for (std::vector<MapTreeBounds>::iterator i = root->bounds.begin();
|
for (std::vector<MapTreeBounds>::iterator i = root->bounds.begin();
|
||||||
i != root->bounds.end(); i++) {
|
i != root->bounds.end(); i++) {
|
||||||
|
@ -746,9 +743,7 @@ void searchMapData(io::CodedInputStream* input, MapRoot* root, MapIndex* ind, Se
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_searchNativeObjectsForRendering(JNIEnv* ienv,
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_searchNativeObjectsForRendering(JNIEnv* ienv,
|
|
||||||
jobject obj, jint sleft, jint sright, jint stop, jint sbottom, jint zoom,
|
jobject obj, jint sleft, jint sright, jint stop, jint sbottom, jint zoom,
|
||||||
jobject renderingRuleSearchRequest, bool skipDuplicates, jobject objInterrupted, jstring msgNothingFound) {
|
jobject renderingRuleSearchRequest, bool skipDuplicates, jobject objInterrupted, jstring msgNothingFound) {
|
||||||
RenderingRuleSearchRequest* req = initSearchRequest(ienv, renderingRuleSearchRequest);
|
RenderingRuleSearchRequest* req = initSearchRequest(ienv, renderingRuleSearchRequest);
|
||||||
|
@ -759,6 +754,14 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
SearchQuery q(sleft, sright, stop, sbottom, req, objInterrupted, interruptedField, ienv);
|
SearchQuery q(sleft, sright, stop, sbottom, req, objInterrupted, interruptedField, ienv);
|
||||||
q.zoom = zoom;
|
q.zoom = zoom;
|
||||||
|
|
||||||
|
SearchResult* res = searchObjectsForRendering(&q, req, skipDuplicates, getString(ienv, msgNothingFound));
|
||||||
|
delete req;
|
||||||
|
return (jint) res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SearchResult* searchObjectsForRendering(SearchQuery* q, RenderingRuleSearchRequest* req,
|
||||||
|
bool skipDuplicates, std::string msgNothingFound) {
|
||||||
SearchResult* searchRes = new SearchResult();
|
SearchResult* searchRes = new SearchResult();
|
||||||
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
|
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
|
||||||
HMAP::hash_set<long long> ids;
|
HMAP::hash_set<long long> ids;
|
||||||
|
@ -769,40 +772,40 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
std::vector<MapDataObject*> coastLines;
|
std::vector<MapDataObject*> coastLines;
|
||||||
std::vector<MapDataObject*> basemapCoastLines;
|
std::vector<MapDataObject*> basemapCoastLines;
|
||||||
|
|
||||||
for (; i != openFiles.end() && !q.isCancelled(); i++) {
|
for (; i != openFiles.end() && !q->isCancelled(); i++) {
|
||||||
BinaryMapFile* file = i->second;
|
BinaryMapFile* file = i->second;
|
||||||
fseek(file->f, 0, 0);
|
fseek(file->f, 0, 0);
|
||||||
io::FileInputStream input(fileno(file->f));
|
FileInputStream input(fileno(file->f));
|
||||||
input.SetCloseOnDelete(false);
|
input.SetCloseOnDelete(false);
|
||||||
io::CodedInputStream cis(&input);
|
CodedInputStream cis(&input);
|
||||||
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
||||||
if (req != NULL) {
|
if (req != NULL) {
|
||||||
req->clearState();
|
req->clearState();
|
||||||
}
|
}
|
||||||
q.result.clear();
|
q->result.clear();
|
||||||
for (std::vector<MapIndex>::iterator mapIndex = file->mapIndexes.begin(); mapIndex != file->mapIndexes.end();
|
for (std::vector<MapIndex>::iterator mapIndex = file->mapIndexes.begin(); mapIndex != file->mapIndexes.end();
|
||||||
mapIndex++) {
|
mapIndex++) {
|
||||||
for (std::vector<MapRoot>::iterator mapLevel = mapIndex->levels.begin(); mapLevel != mapIndex->levels.end();
|
for (std::vector<MapRoot>::iterator mapLevel = mapIndex->levels.begin(); mapLevel != mapIndex->levels.end();
|
||||||
mapLevel++) {
|
mapLevel++) {
|
||||||
if (q.isCancelled()) {
|
if (q->isCancelled()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mapLevel->minZoom <= zoom && mapLevel->maxZoom >= zoom) {
|
if (mapLevel->minZoom <= q->zoom && mapLevel->maxZoom >= q->zoom) {
|
||||||
if (mapLevel->right >= q.left && q.right >= mapLevel->left && mapLevel->bottom >= q.top
|
if (mapLevel->right >= q->left && q->right >= mapLevel->left && mapLevel->bottom >= q->top
|
||||||
&& q.bottom >= mapLevel->top) {
|
&& q->bottom >= mapLevel->top) {
|
||||||
osmand_log_print(LOG_INFO, "Search map %s", mapIndex->name.c_str());
|
osmand_log_print(LOG_INFO, "Search map %s", mapIndex->name.c_str());
|
||||||
searchMapData(&cis, &(*mapLevel), &(*mapIndex), &q);
|
searchMapData(&cis, &(*mapLevel), &(*mapIndex), q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q.ocean) {
|
if (q->ocean) {
|
||||||
ocean = true;
|
ocean = true;
|
||||||
}
|
}
|
||||||
if (!q.isCancelled()) {
|
if (!q->isCancelled()) {
|
||||||
std::vector<MapDataObject*>::iterator r = q.result.begin();
|
std::vector<MapDataObject*>::iterator r = q->result.begin();
|
||||||
tempResult.reserve((size_t)(q.result.size() + tempResult.size()));
|
tempResult.reserve((size_t)(q->result.size() + tempResult.size()));
|
||||||
for (; r != q.result.end(); r++) {
|
for (; r != q->result.end(); r++) {
|
||||||
// TODO skip duplicates doesn't work correctly with basemap (id < 0?)
|
// TODO skip duplicates doesn't work correctly with basemap (id < 0?)
|
||||||
if (skipDuplicates && (*r)->id > 0 && false) {
|
if (skipDuplicates && (*r)->id > 0 && false) {
|
||||||
if (ids.find((*r)->id) != ids.end()) {
|
if (ids.find((*r)->id) != ids.end()) {
|
||||||
|
@ -829,24 +832,24 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q.isCancelled()) {
|
if (q->isCancelled()) {
|
||||||
deleteObjects(coastLines);
|
deleteObjects(coastLines);
|
||||||
deleteObjects(tempResult);
|
deleteObjects(tempResult);
|
||||||
deleteObjects(basemapCoastLines);
|
deleteObjects(basemapCoastLines);
|
||||||
deleteObjects(basemapResult);
|
deleteObjects(basemapResult);
|
||||||
} else {
|
} else {
|
||||||
bool addBasemapCoastlines = true;
|
bool addBasemapCoastlines = true;
|
||||||
bool emptyData = zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
|
bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
|
||||||
if (!coastLines.empty()) {
|
if (!coastLines.empty()) {
|
||||||
std::vector<MapDataObject*> pcoastlines;
|
std::vector<MapDataObject*> pcoastlines;
|
||||||
processCoastlines(coastLines, sleft, sright, sbottom, stop, zoom, basemapCoastLines.empty(), pcoastlines);
|
processCoastlines(coastLines, q->left, q->right, q->bottom, q->top, q->zoom, basemapCoastLines.empty(), pcoastlines);
|
||||||
addBasemapCoastlines = pcoastlines.empty() || zoom <= BASEMAP_ZOOM;
|
addBasemapCoastlines = pcoastlines.empty() || q->zoom <= BASEMAP_ZOOM;
|
||||||
tempResult.insert(tempResult.end(), pcoastlines.begin(), pcoastlines.end());
|
tempResult.insert(tempResult.end(), pcoastlines.begin(), pcoastlines.end());
|
||||||
}
|
}
|
||||||
if (addBasemapCoastlines) {
|
if (addBasemapCoastlines) {
|
||||||
addBasemapCoastlines = false;
|
addBasemapCoastlines = false;
|
||||||
std::vector<MapDataObject*> pcoastlines;
|
std::vector<MapDataObject*> pcoastlines;
|
||||||
processCoastlines(basemapCoastLines, sleft, sright, sbottom, stop, zoom, true, pcoastlines);
|
processCoastlines(basemapCoastLines, q->left, q->right, q->bottom, q->top, q->zoom, true, pcoastlines);
|
||||||
addBasemapCoastlines = pcoastlines.empty();
|
addBasemapCoastlines = pcoastlines.empty();
|
||||||
tempResult.insert(tempResult.end(), pcoastlines.begin(), pcoastlines.end());
|
tempResult.insert(tempResult.end(), pcoastlines.begin(), pcoastlines.end());
|
||||||
}
|
}
|
||||||
|
@ -855,11 +858,11 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
deleteObjects(coastLines);
|
deleteObjects(coastLines);
|
||||||
if (addBasemapCoastlines) {
|
if (addBasemapCoastlines) {
|
||||||
MapDataObject* o = new MapDataObject();
|
MapDataObject* o = new MapDataObject();
|
||||||
o->points.push_back(int_pair(sleft, stop));
|
o->points.push_back(int_pair(q->left, q->top));
|
||||||
o->points.push_back(int_pair(sright, stop));
|
o->points.push_back(int_pair(q->right, q->top));
|
||||||
o->points.push_back(int_pair(sright, sbottom));
|
o->points.push_back(int_pair(q->right, q->bottom));
|
||||||
o->points.push_back(int_pair(sleft, sbottom));
|
o->points.push_back(int_pair(q->left, q->bottom));
|
||||||
o->points.push_back(int_pair(sleft, stop));
|
o->points.push_back(int_pair(q->left, q->top));
|
||||||
if (ocean) {
|
if (ocean) {
|
||||||
o->types.push_back(tag_value("natural", "coastline"));
|
o->types.push_back(tag_value("natural", "coastline"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -871,22 +874,21 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
|
||||||
// message
|
// message
|
||||||
// avoid overflow int errors
|
// avoid overflow int errors
|
||||||
MapDataObject* o = new MapDataObject();
|
MapDataObject* o = new MapDataObject();
|
||||||
o->points.push_back(int_pair(sleft + (sright - sleft) / 2, stop + (sbottom - stop) / 2));
|
o->points.push_back(int_pair(q->left + (q->right - q->left) / 2, q->top + (q->bottom - q->top) / 2));
|
||||||
o->types.push_back(tag_value("natural", "coastline"));
|
o->types.push_back(tag_value("natural", "coastline"));
|
||||||
o->objectNames["name"] = getString(ienv, msgNothingFound);
|
o->objectNames["name"] = msgNothingFound;
|
||||||
tempResult.push_back(o);
|
tempResult.push_back(o);
|
||||||
}
|
}
|
||||||
if (zoom <= BASEMAP_ZOOM || emptyData) {
|
if (q->zoom <= BASEMAP_ZOOM || emptyData) {
|
||||||
tempResult.insert(tempResult.end(), basemapResult.begin(), basemapResult.end());
|
tempResult.insert(tempResult.end(), basemapResult.begin(), basemapResult.end());
|
||||||
}
|
}
|
||||||
searchRes->result.insert(searchRes->result.end(), tempResult.begin(), tempResult.end());
|
searchRes->result.insert(searchRes->result.end(), tempResult.begin(), tempResult.end());
|
||||||
osmand_log_print(LOG_INFO,
|
osmand_log_print(LOG_INFO,
|
||||||
"Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ",
|
"Search : tree - read( %d), accept( %d), objs - visit( %d), accept(%d), in result(%d) ",
|
||||||
q.numberOfReadSubtrees, q.numberOfAcceptedSubtrees, q.numberOfVisitedObjects, q.numberOfAcceptedObjects,
|
q->numberOfReadSubtrees, q->numberOfAcceptedSubtrees, q->numberOfVisitedObjects, q->numberOfAcceptedObjects,
|
||||||
searchRes->result.size());
|
searchRes->result.size());
|
||||||
}
|
}
|
||||||
delete req;
|
return searchRes;
|
||||||
return (jint) searchRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_closeBinaryMapFile(JNIEnv* ienv,
|
extern "C" JNIEXPORT void JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_closeBinaryMapFile(JNIEnv* ienv,
|
||||||
|
@ -925,9 +927,9 @@ BinaryMapFile* initBinaryMapFile(std::string inputName) {
|
||||||
}
|
}
|
||||||
BinaryMapFile* mapFile = new BinaryMapFile();
|
BinaryMapFile* mapFile = new BinaryMapFile();
|
||||||
mapFile->f = file;
|
mapFile->f = file;
|
||||||
io::FileInputStream input(fileno(file));
|
FileInputStream input(fileno(file));
|
||||||
input.SetCloseOnDelete(false);
|
input.SetCloseOnDelete(false);
|
||||||
io::CodedInputStream cis(&input);
|
CodedInputStream cis(&input);
|
||||||
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
||||||
if (!initMapStructure(&cis, mapFile)) {
|
if (!initMapStructure(&cis, mapFile)) {
|
||||||
osmand_log_print(LOG_ERROR, "File not initialised : %s", inputName.c_str());
|
osmand_log_print(LOG_ERROR, "File not initialised : %s", inputName.c_str());
|
||||||
|
@ -939,6 +941,5 @@ BinaryMapFile* initBinaryMapFile(std::string inputName) {
|
||||||
openFiles.insert(std::pair<std::string, BinaryMapFile*>(inputName, mapFile));
|
openFiles.insert(std::pair<std::string, BinaryMapFile*>(inputName, mapFile));
|
||||||
return mapFile;
|
return mapFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DO_
|
#undef DO_
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,15 +3,19 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "google/protobuf/wire_format_lite.h"
|
|
||||||
#include "common.h"
|
|
||||||
#include "mapObjects.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "mapObjects.h"
|
||||||
|
#include "multipolygons.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "mapObjects.h"
|
||||||
|
#include "renderRules.h"
|
||||||
|
|
||||||
|
|
||||||
struct MapTreeBounds {
|
struct MapTreeBounds {
|
||||||
uint32 length;
|
uint32 length;
|
||||||
|
@ -116,9 +120,19 @@ struct BinaryMapFile {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SearchQuery;
|
||||||
|
struct SearchResult;
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_initBinaryMapFile(JNIEnv* ienv,
|
extern "C" JNIEXPORT jboolean JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_initBinaryMapFile(JNIEnv* ienv,
|
||||||
jobject obj, jobject path);
|
jobject obj, jobject path);
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_searchNativeObjectsForRendering(JNIEnv* ienv,
|
||||||
|
jobject obj, jint sleft, jint sright, jint stop, jint sbottom, jint zoom,
|
||||||
|
jobject renderingRuleSearchRequest, bool skipDuplicates, jobject objInterrupted, jstring msgNothingFound);
|
||||||
|
|
||||||
|
SearchResult* searchObjectsForRendering(SearchQuery* q, RenderingRuleSearchRequest* req,
|
||||||
|
bool skipDuplicates, std::string msgNothingFound);
|
||||||
|
|
||||||
BinaryMapFile* initBinaryMapFile(std::string inputName);
|
BinaryMapFile* initBinaryMapFile(std::string inputName);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,10 +7,33 @@
|
||||||
|
|
||||||
#include <hash_map>
|
#include <hash_map>
|
||||||
#include <hash_set>
|
#include <hash_set>
|
||||||
|
#include <SkPath.h>
|
||||||
|
#include <SkBitmap.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
typedef __int8 int8;
|
||||||
|
typedef __int16 int16;
|
||||||
|
typedef __int32 int32;
|
||||||
|
typedef __int64 int64;
|
||||||
|
|
||||||
#ifdef HAVING_HASH
|
typedef unsigned __int8 uint8;
|
||||||
|
typedef unsigned __int16 uint16;
|
||||||
|
typedef unsigned __int32 uint32;
|
||||||
|
typedef unsigned __int64 uint64;
|
||||||
|
#else
|
||||||
|
typedef int8_t int8;
|
||||||
|
typedef int16_t int16;
|
||||||
|
typedef int32_t int32;
|
||||||
|
typedef int64_t int64;
|
||||||
|
|
||||||
|
typedef uint8_t uint8;
|
||||||
|
typedef uint16_t uint16;
|
||||||
|
typedef uint32_t uint32;
|
||||||
|
typedef uint64_t uint64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HASH_MAP_GNU
|
||||||
|
|
||||||
#define HMAP __gnu_cxx
|
#define HMAP __gnu_cxx
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
|
@ -40,28 +63,6 @@ namespace __gnu_cxx {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef __int8 int8;
|
|
||||||
typedef __int16 int16;
|
|
||||||
typedef __int32 int32;
|
|
||||||
typedef __int64 int64;
|
|
||||||
|
|
||||||
typedef unsigned __int8 uint8;
|
|
||||||
typedef unsigned __int16 uint16;
|
|
||||||
typedef unsigned __int32 uint32;
|
|
||||||
typedef unsigned __int64 uint64;
|
|
||||||
#else
|
|
||||||
typedef int8_t int8;
|
|
||||||
typedef int16_t int16;
|
|
||||||
typedef int32_t int32;
|
|
||||||
typedef int64_t int64;
|
|
||||||
|
|
||||||
typedef uint8_t uint8;
|
|
||||||
typedef uint16_t uint16;
|
|
||||||
typedef uint32_t uint32;
|
|
||||||
typedef uint64_t uint64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -71,8 +72,6 @@ typedef uint64_t uint64;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <SkPath.h>
|
|
||||||
#include <SkBitmap.h>
|
|
||||||
|
|
||||||
#ifdef PROFILE_NATIVE_OPERATIONS
|
#ifdef PROFILE_NATIVE_OPERATIONS
|
||||||
#define PROFILE_NATIVE_OPERATION(rc, op) rc->nativeOperations.pause(); op; rc->nativeOperations.start()
|
#define PROFILE_NATIVE_OPERATION(rc, op) rc->nativeOperations.pause(); op; rc->nativeOperations.start()
|
||||||
|
@ -83,9 +82,6 @@ using namespace std;
|
||||||
struct RenderingContext;
|
struct RenderingContext;
|
||||||
|
|
||||||
|
|
||||||
// Android helpers
|
|
||||||
extern const char* const LOG_TAG;
|
|
||||||
|
|
||||||
// JNI Helpers
|
// JNI Helpers
|
||||||
void throwNewException(JNIEnv* env, const char* msg);
|
void throwNewException(JNIEnv* env, const char* msg);
|
||||||
jclass findClass(JNIEnv* env, const char* className, bool mustHave = true);
|
jclass findClass(JNIEnv* env, const char* className, bool mustHave = true);
|
||||||
|
|
Loading…
Reference in a new issue