Confiure workspace

This commit is contained in:
Victor Shcherb 2012-04-30 13:33:05 +02:00
parent 272d52f0a0
commit ebaaf33a41
12 changed files with 200 additions and 53 deletions

View file

@ -29,14 +29,23 @@
<tool id="com.android.tool.compiler.g++.1543637239" name="Android G++" superClass="com.android.tool.compiler.g++">
<option id="gnu.cpp.compiler.option.include.paths.757537552" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include"/>
<listOptionValue builtIn="false" value="/home/victor/projects/android-ndk-r7c/sources/cxx-stl/stlport/stlport"/>
<listOptionValue builtIn="false" value="/usr/include/linux"/>
<listOptionValue builtIn="false" value="/usr/include/i386-linux-gnu"/>
<listOptionValue builtIn="false" value="/usr/include/c++/4.6"/>
<listOptionValue builtIn="false" value="/usr/include/c++/4.6/i686-linux-gnu"/>
<listOptionValue builtIn="false" value="/usr/include/c++/4.6/backward"/>
<listOptionValue builtIn="false" value="/usr/include/c++/4.6/tr1"/>
<listOptionValue builtIn="false" value="/usr/lib/gcc/i686-linux-gnu/4.6/include/"/>
<listOptionValue builtIn="false" value="/usr/lib/jvm/java-6-sun-1.6.0.26/include"/>
<listOptionValue builtIn="false" value="/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/protobuf/}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/cpufeatures_proxy}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/jpeg/jpeg_library}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/skia/skia_library}&quot;"/>
<listOptionValue builtIn="false" value="/home/victor/projects/android-ndk-r7c/platforms/android-3/arch-arm/usr/include"/>
<listOptionValue builtIn="false" value="/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux"/>
</option>
<option id="gnu.cpp.compiler.option.preprocessor.def.1044210753" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX_BUILD=true"/>
</option>
<inputType id="com.android.tool.compiler.g++.input.478508689" superClass="com.android.tool.compiler.g++.input"/>
</tool>
@ -58,6 +67,24 @@
</tool>
</toolChain>
</folderInfo>
<fileInfo id="com.android.toolchain.gcc.128294115.1197161253" name="common.cpp" rcbsApplicability="disable" resourcePath="osmand/common.cpp" toolsToInvoke="com.android.tool.compiler.g++.1543637239.697408162">
<tool id="com.android.tool.compiler.g++.1543637239.697408162" name="Android G++" superClass="com.android.tool.compiler.g++.1543637239">
<option id="gnu.cpp.compiler.option.include.paths.816070414" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/include/linux/"/>
<listOptionValue builtIn="false" value="/usr/include"/>
<listOptionValue builtIn="false" value="/home/victor/projects/android-ndk-r7c/sources/cxx-stl/stlport/stlport"/>
<listOptionValue builtIn="false" value="/usr/lib/jvm/java-6-sun-1.6.0.26/include"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/protobuf/}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/cpufeatures_proxy}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/jpeg/jpeg_library}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Osmand-kernel/skia/skia_library}&quot;"/>
<listOptionValue builtIn="false" value="/home/victor/projects/android-ndk-r7c/platforms/android-3/arch-arm/usr/include"/>
<listOptionValue builtIn="false" value="/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux"/>
<listOptionValue builtIn="false" value="/usr/lib/gcc/i686-linux-gnu/4.6.3/include"/>
</option>
<inputType id="com.android.tool.compiler.g++.input.311247229" superClass="com.android.tool.compiler.g++.input"/>
</tool>
</fileInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
@ -79,16 +106,7 @@
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.2047610242;com.android.tool.compiler.g++.592567664;com.android.tool.compiler.g++.input.893364443">
<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.724578803;com.android.tool.compiler.c.1707562195;com.android.tool.compiler.c.input.1747499585">
<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.2047610242;com.android.tool.compiler.c.720867356;com.android.tool.compiler.c.input.1326523466">
<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.1436946720;com.android.tool.compiler.g++.1800289881;com.android.tool.compiler.g++.input.1857432244">
<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.1436946720;com.android.tool.compiler.c.935108432;com.android.tool.compiler.c.input.446006655">
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.1197161253;com.android.tool.compiler.g++.1543637239.697408162;com.android.tool.compiler.g++.input.311247229">
<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.g++.1543637239;com.android.tool.compiler.g++.input.478508689">
@ -97,8 +115,20 @@
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.724578803;com.android.tool.compiler.g++.1036636492;com.android.tool.compiler.g++.input.325212280">
<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.2047610242;com.android.tool.compiler.c.720867356;com.android.tool.compiler.c.input.1326523466">
<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.1436946720;com.android.tool.compiler.c.935108432;com.android.tool.compiler.c.input.446006655">
<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>
<scannerConfigBuildInfo instanceId="com.android.toolchain.gcc.128294115;com.android.toolchain.gcc.128294115.724578803;com.android.tool.compiler.c.1707562195;com.android.tool.compiler.c.input.1747499585">
<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.1436946720;com.android.tool.compiler.g++.1800289881;com.android.tool.compiler.g++.input.1857432244">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

View file

@ -0,0 +1,66 @@
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
org.eclipse.cdt.codan.checkers.errreturnvalue.params={}
org.eclipse.cdt.codan.checkers.noreturn=Error
org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=-Error
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=-Error
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=-Error
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={macro\=>true,exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=-Info
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
useParentScope=false

View file

@ -1,4 +1,4 @@
_ANDROID_BUILD := true
ANDROID_BUILD := true
OSMAND_MAKEFILES := $(all-subdir-makefiles)
# By default, include makefiles only once

View file

@ -8,8 +8,17 @@
#include <fstream>
#include <algorithm>
#include <map>
#include <string>
#ifdef LINUX_BUILD
#include <ext/hash_map>
#include <ext/hash_set>
using namespace __gnu_cxx;
#else
#include <hash_map>
#include <hash_set>
#endif
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/wire_format_lite.h"
#include "google/protobuf/wire_format_lite.cc"
@ -127,7 +136,7 @@ struct MapIndex {
std::string name;
vector<MapRoot> levels;
std::hash_map<int, tag_value > decodingRules;
hash_map<int, tag_value > decodingRules;
// DEFINE hash
//std::hash_map<tag_value, int> encodingRules;
@ -138,8 +147,8 @@ struct MapIndex {
int landEncodingType;
int onewayAttribute ;
int onewayReverseAttribute ;
std::hash_set< int > positiveLayers;
std::hash_set< int > negativeLayers;
hash_set< int > positiveLayers;
hash_set< int > negativeLayers;
MapIndex(){
nameEncodingType = refEncodingType = coastlineBrokenEncodingType = coastlineEncodingType = -1;
@ -559,10 +568,10 @@ MapDataObject* readMapDataObject(io::CodedInputStream* input, MapTreeBounds* tre
}
// READ types
std::vector< coordinates > innercoordinates;
std::vector< tag_value > additionalTypes;
std::vector< tag_value > types;
std::hash_map< std::string, unsigned int> stringIds;
vector< coordinates > innercoordinates;
vector< tag_value > additionalTypes;
vector< tag_value > types;
hash_map< std::string, unsigned int> stringIds;
bool loop = true;
while (loop) {
uint32 t = input->ReadTag();
@ -773,14 +782,14 @@ bool readMapDataBlocks(io::CodedInputStream* input, SearchQuery* req, MapTreeBou
DO_((WireFormatLite::ReadPrimitive<uint32, WireFormatLite::TYPE_UINT32>(input, &length)));
int oldLimit = input->PushLimit(length);
if(results.size() > 0) {
std::vector<std::string> stringTable;
vector<std::string> stringTable;
readStringTable(input, stringTable);
MapDataObject* o;
for (std::vector<MapDataObject*>::iterator obj = results.begin(); obj != results.end(); obj++) {
if ((*obj)->stringIds.size() > 0) {
std::hash_map<std::string, unsigned int >::iterator val=(*obj)->stringIds.begin();
hash_map<std::string, unsigned int >::iterator val=(*obj)->stringIds.begin();
while(val != (*obj)->stringIds.end()){
(*obj)->objectNames[val->first]=stringTable.at(val->second);
(*obj)->objectNames[val->first]=stringTable[val->second];
val++;
}
}
@ -869,8 +878,8 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
q.zoom = zoom;
SearchResult* searchRes = new SearchResult();
std::map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
std::hash_set<long long> ids;
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
hash_set<long long> ids;
int count = 0;
bool ocean = false;
std::vector<MapDataObject*> basemapResult;
@ -910,7 +919,7 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_plus_render_NativeOsmandLibrar
}
if (!q.isCancelled()) {
std::vector<MapDataObject*>::iterator r = q.result.begin();
tempResult.reserve(q.result.size() + tempResult.size());
tempResult.reserve((size_t)(q.result.size() + tempResult.size()));
for (; r != q.result.end(); r++) {
// TODO skip duplicates doesn't work correctly with basemap (id < 0?)
if (skipDuplicates && (*r)->id > 0 && false) {

View file

@ -5,6 +5,12 @@
#include <SkBitmap.h>
#include <SkImageDecoder.h>
#include <jni.h>
#include <time.h>
// constant CLOCK_MONOTONIC is included in linux time.h
#ifdef LINUX_BUILD
#include <linux/time.h>
#endif
#include "common.h"
#include "osmand_log.h"
@ -314,7 +320,7 @@ SkBitmap* getCachedBitmap(RenderingContext* rc, const std::string& bitmapResourc
return NULL;
jbyte* bitmapBuffer = env->GetByteArrayElements(javaIconRawData, NULL);
size_t bufferLen = env->GetArrayLength(javaIconRawData);
jint bufferLen = env->GetArrayLength(javaIconRawData);
// Decode bitmap
SkBitmap* iconBitmap = new SkBitmap();

View file

@ -4,7 +4,11 @@
#include <jni.h>
#include <string>
#include <vector>
#ifdef LINUX_BUILD
#include <ext/hash_map>
#else
#include <hash_map>
#endif
#include <SkPath.h>
#include <SkBitmap.h>

View file

@ -3,14 +3,20 @@
#include <jni.h>
#include <vector>
#ifdef LINUX_BUILD
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
using namespace std;
#endif
#include <string>
#include "common.h"
typedef std::pair<std::string, std::string> tag_value;
typedef std::pair<int, int> int_pair;
typedef std::vector< std::pair<int, int> > coordinates;
typedef pair<std::string, std::string> tag_value;
typedef pair<int, int> int_pair;
typedef vector< pair<int, int> > coordinates;
class MapDataObject
@ -24,9 +30,9 @@ public:
coordinates points;
std::vector < coordinates > polygonInnerCoordinates;
std::hash_map< std::string, unsigned int> stringIds;
hash_map< std::string, unsigned int> stringIds;
std::hash_map< std::string, std::string > objectNames;
hash_map< std::string, std::string > objectNames;
bool area;
long long id;

View file

@ -2,7 +2,11 @@
#include <stdio.h>
#include <map>
#include <set>
#ifdef LINUX_BUILD
#include <ext/hash_map>
#else
#include <hash_map>
#endif
#include "renderRules.h"

View file

@ -2,7 +2,7 @@
#define _OSMAND_LOG_CPP
#ifdef _ANDROID_BUILD
#ifdef ANDROID_BUILD
#include <android/log.h>
const char* const LOG_TAG = "net.osmand:native";

View file

@ -6,7 +6,12 @@
#include <iterator>
#include <string>
#include <vector>
#ifdef LINUX_BUILD
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
#endif
#include "renderRules.h"
#include "common.h"
@ -51,7 +56,7 @@ RenderingRuleProperty* RenderingRulesStorage::getProperty(int i) {
}
RenderingRule* RenderingRulesStorage::getRule(int state, int itag, int ivalue) {
std::hash_map<int, RenderingRule>::iterator it = (tagValueGlobalRules[state]).find(
hash_map<int, RenderingRule>::iterator it = (tagValueGlobalRules[state]).find(
(itag << SHIFT_TAG_VAL) | ivalue);
if (it == tagValueGlobalRules[state].end()) {
return NULL;
@ -60,7 +65,7 @@ RenderingRule* RenderingRulesStorage::getRule(int state, int itag, int ivalue) {
}
RenderingRuleProperty* RenderingRulesStorage::getProperty(const char* st) {
std::hash_map<std::string, RenderingRuleProperty*>::iterator i = propertyMap.find(st);
hash_map<std::string, RenderingRuleProperty*>::iterator i = propertyMap.find(st);
if (i == propertyMap.end()) {
return NULL;
}

View file

@ -1,6 +1,5 @@
#include <jni.h>
#include "osmand_log.h"
#include <android/bitmap.h>
#include <dlfcn.h>
#include <math.h>
@ -8,7 +7,12 @@
#include <vector>
#include <algorithm>
#include <set>
#ifdef LINUX_BUILD
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
#endif
#include <time.h>
#include <SkTypes.h>
@ -186,7 +190,7 @@ int updatePaint(RenderingRuleSearchRequest* req, SkPaint* paint, int ind, int ar
void renderText(MapDataObject* obj, RenderingRuleSearchRequest* req, RenderingContext* rc, std::string tag,
std::string value, float xText, float yText, SkPath* path) {
std::hash_map<std::string, std::string>::iterator it = obj->objectNames.begin();
hash_map<std::string, std::string>::iterator it = obj->objectNames.begin();
while (it != obj->objectNames.end()) {
if (it->second.length() > 0) {
std::string name = it->second;
@ -542,9 +546,9 @@ std::hash_map<int, std::vector<int> > sortObjectsByProperOrder(std::vector <MapD
void doRendering(std::vector <MapDataObject* > mapDataObjects, SkCanvas* canvas, SkPaint* paint,
RenderingRuleSearchRequest* req, RenderingContext* rc) {
// put in order map
std::hash_map<int, std::vector<int> > orderMap = sortObjectsByProperOrder(mapDataObjects, req, rc);
hash_map<int, std::vector<int> > orderMap = sortObjectsByProperOrder(mapDataObjects, req, rc);
std::set<int> keys;
std::hash_map<int, std::vector<int> >::iterator it = orderMap.begin();
hash_map<int, std::vector<int> >::iterator it = orderMap.begin();
while(it != orderMap.end())
{
keys.insert(it->first);
@ -603,6 +607,9 @@ void loadJniRendering(JNIEnv* env)
jmethod_JUnidecode_unidecode = env->GetStaticMethodID(jclass_JUnidecode, "unidecode", "(Ljava/lang/String;)Ljava/lang/String;");
}
#ifdef ANDROID_BUILD
#include <android/bitmap.h>
extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRendering_1Direct( JNIEnv* ienv, jobject obj,
jobject renderingContext, jint searchResult,
jobject targetBitmap,
@ -697,7 +704,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
pushToJavaRenderingContext(ienv, renderingContext, &rc);
osmand_log_print(LOG_INFO, "End Rendering image");
if(dl_AndroidBitmap_unlockPixels(ienv, targetBitmap) != ANDROID_BITMAP_RESUT_SUCCESS) {
osmand_log_print(LOG_ERROR, "Failed to execute AndroidBitmap_unlockPixels");
osmand_log_print(LOG_ERROR, "Failed to execute AndroidBitmap_unlockPixels");
}
// delete variables
@ -722,6 +729,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
return resultObject;
}
#endif
void* bitmapData = NULL;
size_t bitmapDataSize = 0;

View file

@ -1,7 +1,13 @@
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#ifdef LINUX_BUILD
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
#endif
#include <time.h>
#include <jni.h>
#include "SkTypes.h"
@ -24,7 +30,7 @@ private :
SkRect bounds;
node(SkRect& b) : bounds(b) {
std::memset(children,0,4*sizeof(node*));
memset(children,0,4*sizeof(node*));
}
~node() {
@ -211,7 +217,7 @@ bool calculatePathToRotate(RenderingContext* rc, TextDrawInfo* p) {
py += points[i].fY - points[i - 1].fY;
}
if (px != 0 || py != 0) {
p->pathRotate = std::atan2(py, px);
p->pathRotate = atan2(py, px);
}
return true;
}
@ -231,7 +237,7 @@ bool calculatePathToRotate(RenderingContext* rc, TextDrawInfo* p) {
bool inside = points[i].fX >= 0 && points[i].fX <= rc->width &&
points[i].fY >= 0 && points[i].fY <= rc->height;
if (i > 0) {
float d = std::sqrt(
float d = sqrt(
(points[i].fX - points[i - 1].fX) * (points[i].fX - points[i - 1].fX)
+ (points[i].fY - points[i - 1].fY) * (points[i].fY - points[i - 1].fY));
distances.push_back(d);
@ -302,12 +308,12 @@ bool calculatePathToRotate(RenderingContext* rc, TextDrawInfo* p) {
py += points[i].fY - points[i - 1].fY;
}
float scale = 0.5f;
float plen = std::sqrt(px * px + py * py);
float plen = sqrt(px * px + py * py);
// vector ox,oy orthogonal to px,py to measure height
float ox = -py;
float oy = px;
if(plen > 0) {
float rot = std::atan2(py, px);
float rot = atan2(py, px);
if (rot < 0) rot += M_PI * 2;
if (rot > M_PI_2 && rot < 3 * M_PI_2) {
rot += M_PI;
@ -400,7 +406,10 @@ bool intersects(SkRect tRect, float tRot, TextDrawInfo* s)
bool intersects(TextDrawInfo* t, TextDrawInfo* s) {
return intersects(t->bounds, t->pathRotate, s);
}
std::vector<TextDrawInfo*> search;
inline float max(float a, float b) {
return a > b ? a : b;
}
vector<TextDrawInfo*> searchText;
bool findTextIntersection(SkCanvas* cv, RenderingContext* rc, quad_tree<TextDrawInfo*>& boundIntersections, TextDrawInfo* text,
SkPaint* paintText, SkPaint* paintIcon) {
paintText->measureText(text->text.c_str(), text->text.length(), &text->bounds);
@ -422,20 +431,20 @@ bool findTextIntersection(SkCanvas* cv, RenderingContext* rc, quad_tree<TextDraw
// for text purposes
// drawTestBox(cv, &text->bounds, text->pathRotate, paintIcon, text->text, NULL/*paintText*/);
boundIntersections.query_in_box(text->bounds, search);
for (uint i = 0; i < search.size(); i++) {
TextDrawInfo* t = search.at(i);
boundIntersections.query_in_box(text->bounds, searchText);
for (uint i = 0; i < searchText.size(); i++) {
TextDrawInfo* t = searchText.at(i);
if (intersects(text, t)) {
return true;
}
}
if(text->minDistance > 0) {
SkRect boundsSearch = text->bounds;
boundsSearch.inset(-getDensityValue(rc, std::max(5.0f, text->minDistance)), -getDensityValue(rc, 15));
boundIntersections.query_in_box(boundsSearch, search);
boundsSearch.inset(-getDensityValue(rc, max(5.0f, text->minDistance)), -getDensityValue(rc, 15));
boundIntersections.query_in_box(boundsSearch, searchText);
// drawTestBox(cv, &boundsSearch, text->pathRotate, paintIcon, text->text, paintText);
for (uint i = 0; i < search.size(); i++) {
TextDrawInfo* t = search.at(i);
for (uint i = 0; i < searchText.size(); i++) {
TextDrawInfo* t = searchText.at(i);
if (t->minDistance > 0 && t->text == text->text && intersects(boundsSearch, text->pathRotate, t)) {
return true;
}