Fix issue 469, additional multipolygon check (fix on client side)

This commit is contained in:
Victor Shcherb 2011-06-24 16:18:56 +02:00
parent 9a2e4001e5
commit 003e5e9ecc
6 changed files with 357 additions and 5 deletions

View file

@ -984,6 +984,11 @@ public class BinaryMapIndexReader {
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public String toString() {
return "TagValuePair : " + tag + " - " + value;
}
@Override
public boolean equals(Object obj) {

View file

@ -184,7 +184,7 @@ public class MapAlgorithms {
return longitude;
}
// that tested on all cases (left/right)
double lon = b.getLongitude()+
double lon = b.getLongitude() -
(b.getLatitude() - latitude) * (b.getLongitude() - a.getLongitude()) / (b.getLatitude() - a.getLatitude());
if (lon <= longitude) {
return lon;
@ -228,6 +228,6 @@ public class MapAlgorithms {
}
}
}
}

View file

@ -41,7 +41,9 @@ public class IndexPoiCreator extends AbstractIndexPartCreator {
// load data for way (location etc...)
ctx.loadEntityData(e, false);
for (Amenity a : tempAmenityList) {
checkEntity(e);
// do not add that check because it is too much printing for batch creation
// by statistic < 1% creates maps manually
// checkEntity(e);
a.setEntity(e);
if (a.getLocation() != null) {
// do not convert english name

254
OsmAnd/hs_err_pid22046.log Normal file
View file

@ -0,0 +1,254 @@
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3494), pid=22046, tid=3077839728
# Error: ShouldNotReachHere()
#
# JRE version: 6.0_22-b22
# Java VM: OpenJDK Server VM (20.0-b11 mixed mode linux-x86 )
# Derivative: IcedTea6 1.10.2
# Distribution: Ubuntu 11.04, package 6b22-1.10.2-0ubuntu1~11.04.1
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
#
--------------- T H R E A D ---------------
Current thread (0x08c3b400): JavaThread "Unknown thread" [_thread_in_vm, id=22051, stack(0xb76f1000,0xb7742000)]
Stack: [0xb76f1000,0xb7742000], sp=0xb7740840, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x65618f] VMError::report(outputStream*)+0x145f
V [libjvm.so+0x656472] VMError::report_and_die()+0x192
V [libjvm.so+0x29b3fe] report_vm_error(char const*, int, char const*, char const*)+0x3e
V [libjvm.so+0x29b529] report_should_not_reach_here(char const*, int)+0x29
V [libjvm.so+0x235508] ClassFileParser::parseClassFile(symbolHandle, Handle, Handle, KlassHandle, GrowableArray<Handle>*, symbolHandle&, bool, Thread*)+0x2278
V [libjvm.so+0x23941b] ClassLoader::load_classfile(symbolHandle, Thread*)+0x20b
V [libjvm.so+0x5eac0d] SystemDictionary::load_instance_class(symbolHandle, Handle, Thread*)+0x48d
V [libjvm.so+0x5e941d] SystemDictionary::resolve_instance_class_or_null(symbolHandle, Handle, Handle, Thread*)+0x70d
V [libjvm.so+0x5e9c44] SystemDictionary::resolve_or_null(symbolHandle, Handle, Handle, Thread*)+0x44
V [libjvm.so+0x5eb210] SystemDictionary::resolve_or_fail(symbolHandle, Handle, Handle, bool, Thread*)+0x30
V [libjvm.so+0x5eb2da] SystemDictionary::resolve_or_fail(symbolHandle, bool, Thread*)+0x2a
V [libjvm.so+0x5eb36d] SystemDictionary::initialize_wk_klass(SystemDictionary::WKID, int, Thread*)+0x8d
V [libjvm.so+0x5eb3c5] SystemDictionary::initialize_wk_klasses_until(SystemDictionary::WKID, SystemDictionary::WKID&, Thread*)+0x55
V [libjvm.so+0x5eed05] SystemDictionary::initialize_wk_klasses_through(SystemDictionary::WKID, SystemDictionary::WKID&, Thread*)+0x25
V [libjvm.so+0x5eb493] SystemDictionary::initialize_preloaded_classes(Thread*)+0x73
V [libjvm.so+0x5eb7b1] SystemDictionary::initialize(Thread*)+0x131
V [libjvm.so+0x62dea7] Universe::genesis(Thread*)+0x117
V [libjvm.so+0x62e7cc] universe2_init()+0x2c
V [libjvm.so+0x358368] init_globals()+0x98
V [libjvm.so+0x6188ac] Threads::create_vm(JavaVMInitArgs*, bool*)+0x1bc
V [libjvm.so+0x3a6d0c] JNI_CreateJavaVM+0x5c
C [java+0x1788] JavaMain+0x88
C [libpthread.so.0+0x5e99] start_thread+0xd9
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
Other Threads:
=>0x08c3b400 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=22051, stack(0xb76f1000,0xb7742000)]
VM state:not at safepoint (not fully initialized)
VM Mutex/Monitor currently owned by a thread: None
Dynamic libraries:
00110000-001ef000 r-xp 00000000 08:01 1049261 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
001ef000-001f3000 r--p 000de000 08:01 1049261 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
001f3000-001f4000 rw-p 000e2000 08:01 1049261 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
001f4000-001fb000 rw-p 00000000 00:00 0
001fb000-00206000 r-xp 00000000 08:01 1054008 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libverify.so
00206000-00207000 ---p 0000b000 08:01 1054008 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libverify.so
00207000-00208000 r--p 0000b000 08:01 1054008 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libverify.so
00208000-00209000 rw-p 0000c000 08:01 1054008 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libverify.so
0020a000-00224000 r-xp 00000000 08:01 4592076 /lib/i386-linux-gnu/libgcc_s.so.1
00224000-00225000 r--p 00019000 08:01 4592076 /lib/i386-linux-gnu/libgcc_s.so.1
00225000-00226000 rw-p 0001a000 08:01 4592076 /lib/i386-linux-gnu/libgcc_s.so.1
00226000-00249000 r-xp 00000000 08:01 1051747 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libjava.so
00249000-0024a000 r--p 00022000 08:01 1051747 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libjava.so
0024a000-0024c000 rw-p 00023000 08:01 1051747 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libjava.so
0024c000-0025f000 r-xp 00000000 08:01 4592023 /lib/i386-linux-gnu/libnsl-2.13.so
0025f000-00260000 r--p 00012000 08:01 4592023 /lib/i386-linux-gnu/libnsl-2.13.so
00260000-00261000 rw-p 00013000 08:01 4592023 /lib/i386-linux-gnu/libnsl-2.13.so
00261000-00263000 rw-p 00000000 00:00 0
00263000-00269000 r-xp 00000000 08:01 4592027 /lib/i386-linux-gnu/libnss_compat-2.13.so
00269000-0026a000 r--p 00005000 08:01 4592027 /lib/i386-linux-gnu/libnss_compat-2.13.so
0026a000-0026b000 rw-p 00006000 08:01 4592027 /lib/i386-linux-gnu/libnss_compat-2.13.so
0026b000-00274000 r-xp 00000000 08:01 4592026 /lib/i386-linux-gnu/libnss_nis-2.13.so
00274000-00275000 r--p 00008000 08:01 4592026 /lib/i386-linux-gnu/libnss_nis-2.13.so
00275000-00276000 rw-p 00009000 08:01 4592026 /lib/i386-linux-gnu/libnss_nis-2.13.so
0027c000-0027d000 r-xp 00000000 00:00 0 [vdso]
0027d000-00287000 r-xp 00000000 08:01 4592039 /lib/i386-linux-gnu/libnss_files-2.13.so
00287000-00288000 r--p 00009000 08:01 4592039 /lib/i386-linux-gnu/libnss_files-2.13.so
00288000-00289000 rw-p 0000a000 08:01 4592039 /lib/i386-linux-gnu/libnss_files-2.13.so
00377000-0037a000 r-xp 00000000 08:01 1053990 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/jli/libjli.so
0037a000-0037b000 r--p 00002000 08:01 1053990 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/jli/libjli.so
0037b000-0037c000 rw-p 00003000 08:01 1053990 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/jli/libjli.so
00498000-004bc000 r-xp 00000000 08:01 4592036 /lib/i386-linux-gnu/libm-2.13.so
004bc000-004bd000 r--p 00023000 08:01 4592036 /lib/i386-linux-gnu/libm-2.13.so
004bd000-004be000 rw-p 00024000 08:01 4592036 /lib/i386-linux-gnu/libm-2.13.so
004f9000-00653000 r-xp 00000000 08:01 4591532 /lib/i386-linux-gnu/libc-2.13.so
00653000-00654000 ---p 0015a000 08:01 4591532 /lib/i386-linux-gnu/libc-2.13.so
00654000-00656000 r--p 0015a000 08:01 4591532 /lib/i386-linux-gnu/libc-2.13.so
00656000-00657000 rw-p 0015c000 08:01 4591532 /lib/i386-linux-gnu/libc-2.13.so
00657000-0065a000 rw-p 00000000 00:00 0
00679000-00680000 r-xp 00000000 08:01 4591603 /lib/i386-linux-gnu/librt-2.13.so
00680000-00681000 r--p 00006000 08:01 4591603 /lib/i386-linux-gnu/librt-2.13.so
00681000-00682000 rw-p 00007000 08:01 4591603 /lib/i386-linux-gnu/librt-2.13.so
00740000-00746000 r-xp 00000000 08:01 1053987 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libzip.so
00746000-00747000 r--p 00005000 08:01 1053987 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libzip.so
00747000-00748000 rw-p 00006000 08:01 1053987 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libzip.so
00785000-00787000 r-xp 00000000 08:01 4592034 /lib/i386-linux-gnu/libdl-2.13.so
00787000-00788000 r--p 00001000 08:01 4592034 /lib/i386-linux-gnu/libdl-2.13.so
00788000-00789000 rw-p 00002000 08:01 4592034 /lib/i386-linux-gnu/libdl-2.13.so
00854000-00869000 r-xp 00000000 08:01 4592032 /lib/i386-linux-gnu/libpthread-2.13.so
00869000-0086a000 r--p 00015000 08:01 4592032 /lib/i386-linux-gnu/libpthread-2.13.so
0086a000-0086b000 rw-p 00016000 08:01 4592032 /lib/i386-linux-gnu/libpthread-2.13.so
0086b000-0086d000 rw-p 00000000 00:00 0
009c9000-009dc000 r-xp 00000000 08:01 4592072 /lib/i386-linux-gnu/libz.so.1.2.3.4
009dc000-009dd000 r--p 00012000 08:01 4592072 /lib/i386-linux-gnu/libz.so.1.2.3.4
009dd000-009de000 rw-p 00013000 08:01 4592072 /lib/i386-linux-gnu/libz.so.1.2.3.4
00bd6000-00bf2000 r-xp 00000000 08:01 4592037 /lib/i386-linux-gnu/ld-2.13.so
00bf2000-00bf3000 r--p 0001b000 08:01 4592037 /lib/i386-linux-gnu/ld-2.13.so
00bf3000-00bf4000 rw-p 0001c000 08:01 4592037 /lib/i386-linux-gnu/ld-2.13.so
00bf4000-012ba000 r-xp 00000000 08:01 1053998 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server/libjvm.so
012ba000-012bb000 ---p 006c6000 08:01 1053998 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server/libjvm.so
012bb000-01300000 r--p 006c6000 08:01 1053998 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server/libjvm.so
01300000-0130f000 rw-p 0070b000 08:01 1053998 /usr/lib/jvm/java-6-openjdk/jre/lib/i386/server/libjvm.so
0130f000-01729000 rw-p 00000000 00:00 0
08048000-08051000 r-xp 00000000 08:01 1180687 /usr/lib/jvm/java-6-openjdk/jre/bin/java
08051000-08052000 r--p 00008000 08:01 1180687 /usr/lib/jvm/java-6-openjdk/jre/bin/java
08052000-08053000 rw-p 00009000 08:01 1180687 /usr/lib/jvm/java-6-openjdk/jre/bin/java
08c34000-08ca9000 rw-p 00000000 00:00 0 [heap]
7eeec000-7ef51000 r--s 004cb000 08:01 5505534 /home/victor/projects/android-sdk-linux_86/platforms/android-8/android.jar
7ef51000-7ef52000 ---p 00000000 00:00 0
7ef52000-7efd2000 rw-p 00000000 00:00 0
7efd2000-7efd3000 ---p 00000000 00:00 0
7efd3000-7f053000 rw-p 00000000 00:00 0
7f053000-7f054000 ---p 00000000 00:00 0
7f054000-7f0d4000 rw-p 00000000 00:00 0
7f0d4000-7f0d5000 ---p 00000000 00:00 0
7f0d5000-7f15d000 rw-p 00000000 00:00 0
7f15d000-7f195000 rw-p 00000000 00:00 0
7f195000-7f1a5000 rw-p 00000000 00:00 0
7f1a5000-7f286000 rw-p 00000000 00:00 0
7f286000-7f28e000 rw-p 00000000 00:00 0
7f28e000-7f2c6000 rw-p 00000000 00:00 0
7f2c6000-7f2d6000 rw-p 00000000 00:00 0
7f2d6000-7f3b6000 rw-p 00000000 00:00 0
7f3b6000-7f3bf000 rw-p 00000000 00:00 0
7f3bf000-7f42f000 rw-p 00000000 00:00 0
7f42f000-80430000 rw-p 00000000 00:00 0
80430000-87430000 rw-p 00000000 00:00 0
87430000-89250000 rw-p 00000000 00:00 0
89250000-a5590000 rw-p 00000000 00:00 0
a5590000-a6490000 rw-p 00000000 00:00 0
a6490000-b4630000 rw-p 00000000 00:00 0
b4631000-b463a000 rw-p 00000000 00:00 0
b463a000-b46f1000 rw-p 00000000 00:00 0
b46f1000-b4931000 rwxp 00000000 00:00 0
b4931000-b76f1000 rw-p 00000000 00:00 0
b76f1000-b76f4000 ---p 00000000 00:00 0
b76f4000-b7745000 rw-p 00000000 00:00 0
b7753000-b775b000 rw-s 00000000 08:01 4590758 /tmp/hsperfdata_victor/22046
b775b000-b775c000 rw-p 00000000 00:00 0
b775c000-b775d000 r--p 00000000 00:00 0
b775d000-b775f000 rw-p 00000000 00:00 0
bf9d7000-bf9f8000 rw-p 00000000 00:00 0 [stack]
VM Arguments:
jvm_args: -Dfile.encoding=UTF-8 -Xbootclasspath:/home/victor/projects/android-sdk-linux_86/platforms/android-8/android.jar
java_command: net.osmand.data.MapAlgorithms
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
USERNAME=victor
LD_LIBRARY_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-6-openjdk/jre/../lib/i386:/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/xulrunner-1.9.2.17:/usr/lib/xulrunner-1.9.2.17
SHELL=/bin/bash
DISPLAY=:0
Signal Handlers:
SIGSEGV: [libjvm.so+0x656ef0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x656ef0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGFPE: [libjvm.so+0x51d410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGPIPE: [libjvm.so+0x51d410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGXFSZ: [libjvm.so+0x51d410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGILL: [libjvm.so+0x51d410], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x51d280], sa_mask[0]=0x00000004, sa_flags=0x10000004
SIGHUP: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGINT: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGTERM: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGQUIT: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
--------------- S Y S T E M ---------------
OS:Ubuntu 11.04 (natty)
uname:Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686
libc:glibc 2.13 NPTL 2.13
rlimit: STACK 8192k, CORE 0k, NPROC infinity, NOFILE 4096, AS infinity
load average:1.35 1.13 1.07
/proc/meminfo:
MemTotal: 2954168 kB
MemFree: 85856 kB
Buffers: 28824 kB
Cached: 736420 kB
SwapCached: 3540 kB
Active: 1814884 kB
Inactive: 943644 kB
Active(anon): 1551576 kB
Inactive(anon): 709456 kB
Active(file): 263308 kB
Inactive(file): 234188 kB
Unevictable: 112 kB
Mlocked: 112 kB
HighTotal: 2093212 kB
HighFree: 2612 kB
LowTotal: 860956 kB
LowFree: 83244 kB
SwapTotal: 8656892 kB
SwapFree: 8602364 kB
Dirty: 6956 kB
Writeback: 0 kB
AnonPages: 1990068 kB
Mapped: 130596 kB
Shmem: 267672 kB
Slab: 54620 kB
SReclaimable: 32068 kB
SUnreclaim: 22552 kB
KernelStack: 3728 kB
PageTables: 11316 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 10133976 kB
Committed_AS: 4343804 kB
VmallocTotal: 122880 kB
VmallocUsed: 37532 kB
VmallocChunk: 35284 kB
HardwareCorrupted: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 4096 kB
DirectMap4k: 36856 kB
DirectMap4M: 872448 kB
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 37 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
Memory: 4k page, physical 2954168k(85856k free), swap 8656892k(8602364k free)
vm_info: OpenJDK Server VM (20.0-b11) for linux-x86 JRE (1.6.0_22-b22), built on Jun 11 2011 05:56:20 by "buildd" with gcc 4.5.2
time: Fri Jun 24 16:09:38 2011
elapsed time: 0 seconds

View file

@ -601,7 +601,98 @@ public class MapRenderRepositories {
return pl;
}
// Copied from MapAlgorithms
private boolean isClockwiseWay(TLongList c){
if(c.size() == 0){
return true;
}
// calculate middle Y
int mask = 0xffffffff;
long middleY = 0;
for(int i=0; i< c.size(); i++) {
middleY += (c.get(i) & mask);
}
middleY /= (long) c.size();
double clockwiseSum = 0;
boolean firstDirectionUp = false;
int previousX = Integer.MIN_VALUE;
int firstX = Integer.MIN_VALUE;
int prevX = (int) (c.get(0) >> 32);
int prevY = (int) (c.get(0) & mask);
for (int i = 1; i < c.size(); i++) {
int x = (int) (c.get(i) >> 32);
int y = (int) (c.get(i) & mask);
int rX = ray_intersect_x(prevX, prevY, x, y, (int) middleY);
if (rX != Integer.MIN_VALUE) {
boolean skipSameSide = (y <= middleY) == (prevY <= middleY);
if (skipSameSide) {
continue;
}
boolean directionUp = prevY >= middleY;
if (firstX == -Integer.MIN_VALUE) {
firstDirectionUp = directionUp;
firstX = rX;
} else {
boolean clockwise = (!directionUp) == (previousX < rX);
if (clockwise) {
clockwiseSum += Math.abs(previousX - rX);
} else {
clockwiseSum -= Math.abs(previousX - rX);
}
}
previousX = rX;
prevX = x;
prevY = y;
}
}
if(firstX != -360){
boolean clockwise = (!firstDirectionUp) == (previousX < firstX);
if(clockwise){
clockwiseSum += Math.abs(previousX - firstX);
} else {
clockwiseSum -= Math.abs(previousX - firstX);
}
}
return clockwiseSum >= 0;
}
// Copied from MapAlgorithms
private int ray_intersect_x(int prevX, int prevY, int x, int y, int middleY) {
// prev node above line
// x,y node below line
if(prevY > y){
int tx = prevX;
int ty = prevY;
x = prevX;
y = prevY;
prevX = tx;
prevY = ty;
}
if (y == middleY || prevY == middleY) {
middleY -= 1;
}
if (prevY > middleY || y < middleY) {
return Integer.MIN_VALUE;
} else {
if (y == prevY) {
// the node on the boundary !!!
return x;
}
// that tested on all cases (left/right)
double rx = x + ((double) middleY - y) * ((double) x - prevX) / (((double) y - prevY));
return (int) rx;
}
}
// NOT WORKING GOOD !
private boolean isClockwiseWayOld(TLongList c){
double angle = 0;
double prevAng = 0;
int px = 0;

View file

@ -685,8 +685,8 @@ public class OsmandRenderer {
rc.main.updatePaint(paint);
canvas.drawPath(path, paint);
// for test purpose
// rc.second.strokeWidth = 1.5f;
// rc.second.color = Color.BLACK;
// rc.second.strokeWidth = 1.5f;
// rc.second.color = Color.BLACK;
if (rc.second.strokeWidth != 0) {
rc.second.updatePaint(paint);