fix issue 205

try to fix issue 200

git-svn-id: https://osmand.googlecode.com/svn/trunk@700 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-11-23 23:09:27 +00:00
parent 9070abe50f
commit 791340424b

View file

@ -1285,27 +1285,39 @@ public class IndexCreator {
} }
// skip incompleted rings and do not add whole relation ? // skip incompleted rings and do not add whole relation ?
if(!incompletedRings.isEmpty()){ if(!incompletedRings.isEmpty()){
log.warn("In multipolygon " + e.getId() + " there are incompleted ways : " + incompletedRings);
return; return;
// completedRings.addAll(incompletedRings); // completedRings.addAll(incompletedRings);
} }
// skip completed rings that are not one type
for(List<Way> l : completedRings){
boolean innerType = "inner".equals(entities.get(l.get(0)));
for (Way way : l) {
boolean inner = "inner".equals(entities.get(way));
if (innerType != inner) {
log.warn("Probably map bug: Multipoligon contains outer and inner ways.\n" +
"Way:" + way.getId() + " is strange part of completed ring. InnerType:" + innerType + " way inner: " + inner + " way inner string:" + entities.get(way));
return;
}
}
}
for(List<Way> l : completedRings){ for(List<Way> l : completedRings){
boolean innerType = "inner".equals(entities.get(l.get(0))); boolean innerType = "inner".equals(entities.get(l.get(0)));
boolean clockwise = isClockwiseWay(l); boolean clockwise = isClockwiseWay(l);
// clockwise - outer (like coastline), anticlockwise - inner // clockwise - outer (like coastline), anticlockwise - inner
boolean inverse = clockwise != !innerType; boolean inverse = clockwise != !innerType;
for (Way es : l) { for (Way way : l) {
boolean inner = "inner".equals(entities.get(es)); boolean inner = "inner".equals(entities.get(way));
if (innerType != inner) {
throw new IllegalStateException("Way:" + es.getId() + " is strange part of completed ring. InnerType:" + innerType + " way inner: " + inner + " way inner string:" + entities.get(es));
}
if (!inner && name != null) { if (!inner && name != null) {
multiPolygonsNames.put(es.getId(), name); multiPolygonsNames.put(way.getId(), name);
} }
putMultipolygonType(multiPolygonsWays[0], es.getId(), mtType, inverse); putMultipolygonType(multiPolygonsWays[0], way.getId(), mtType, inverse);
for (int i = 1; i < multiPolygonsWays.length; i++) { for (int i = 1; i < multiPolygonsWays.length; i++) {
int type = findMultiPolygonType(e, i); int type = findMultiPolygonType(e, i);
if (type != 0) { if (type != 0) {
putMultipolygonType(multiPolygonsWays[i], es.getId(), type, inverse); putMultipolygonType(multiPolygonsWays[i], way.getId(), type, inverse);
} }
} }
} }
@ -1553,7 +1565,7 @@ public class IndexCreator {
int zoom; int zoom;
long id = (baseId << 3) | ((level & 3) << 1); long id = (baseId << 3) | ((level & 3) << 1);
rtree = mapTree[level]; rtree = mapTree[level];
zoom = MAP_ZOOMS[MAP_ZOOMS.length - level - 1] - 2; zoom = MAP_ZOOMS[MAP_ZOOMS.length - level - 1];
boolean skip = false; boolean skip = false;
if (e instanceof Way) { if (e instanceof Way) {
id |= 1; id |= 1;
@ -1594,7 +1606,8 @@ public class IndexCreator {
} }
e = way; e = way;
skip = way.getNodes().size() < 2; skip = way.getNodes().size() < 2;
if (/* !hasMulti && */(maxX - minX) <= 4 && (maxY - minY) <= 4) { if (/* !hasMulti && */
((maxX - minX) <= 3 && (maxY - minY) <= 5) && ((maxX - minX) <= 5 && (maxY - minY) <= 3)) {
skip = true; skip = true;
} }
if(!cycle && hasMulti){ if(!cycle && hasMulti){