fix issue 268

git-svn-id: https://osmand.googlecode.com/svn/trunk@819 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-12-14 14:48:21 +00:00
parent 7540e20564
commit 73e789d0f2
3 changed files with 54 additions and 46 deletions

View file

@ -12,10 +12,10 @@
<ImageView android:src="@drawable/headline_osmand_icon"
android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginLeft="5dp"/>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="0dp" android:layout_weight="1" android:layout_marginTop="5dp"
android:layout_marginLeft="0dp" android:layout_weight="1" android:layout_marginTop="5px"
android:text="OsmAnd" android:textColor="#000000" android:typeface="serif" android:textSize="20sp"/>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="5px"
android:text="0.5.1 beta(b6)" android:textColor="#000000" android:typeface="serif" android:id="@+id/TextVersion"
android:textSize="13sp"/>
<ImageView android:layout_marginRight="10dp" android:clickable="true" android:id="@+id/CloseButton"

View file

@ -256,9 +256,8 @@ public class MapRenderRepositories {
for(int i=0; i < r.getTypes().length; i++){
if ((r.getTypes()[i] & 0x3) == MapRenderingTypes.MULTY_POLYGON_TYPE) {
// multy polygon
int type = MapRenderingTypes.getMainObjectType(r.getTypes()[i]);
int subtype = MapRenderingTypes.getObjectSubType(r.getTypes()[i]);
TagValuePair pair = r.getMapIndex().decodeType(type, subtype);
TagValuePair pair = r.getMapIndex().decodeType(MapRenderingTypes.getMainObjectType(r.getTypes()[i]),
MapRenderingTypes.getObjectSubType(r.getTypes()[i]));
if(pair != null){
pair = new TagValuePair(pair.tag, pair.value, r.getTypes()[i]);
if (!multiPolygons.containsKey(pair)) {
@ -449,7 +448,8 @@ public class MapRenderRepositories {
incompletedRings.clear();
completedRingNames.clear();
incompletedRingNames.clear();
log.debug("Process multypolygon " + type.tag + " " + type.value + //$NON-NLS-1$ //$NON-NLS-2$
" direct list : " +directList + " rev : " + inverselist); //$NON-NLS-1$ //$NON-NLS-2$
MultyPolygon pl = processMultiPolygon(leftX, rightX, bottomY, topY, listPolygons, completedRings, incompletedRings,
completedRingNames, incompletedRingNames, type, directList, inverselist, zoom);
if(pl != null){
@ -463,11 +463,10 @@ public class MapRenderRepositories {
List<List<Long>> completedRings, List<List<Long>> incompletedRings, List<String> completedRingNames, List<String> incompletedRingNames,
TagValuePair type, List<BinaryMapDataObject> directList, List<BinaryMapDataObject> inverselist, int zoom) {
MultyPolygon pl = new MultyPolygon();
// TODO delete setType at all!!!
// delete direction last bit (to not show point)
pl.setType(type.additionalAttribute);
pl.setTag(type.tag);
pl.setValue(type.value);
pl.setLayer(MapRenderingTypes.getNegativeWayLayer(type.additionalAttribute));
long dbId = 0;
for (int km = 0; km < 2; km++) {
List<BinaryMapDataObject> list = km == 0 ? directList : inverselist;

View file

@ -293,25 +293,28 @@ public class OsmandRenderer {
BinaryMapDataObject o = objects.get(i);
int sh = i << 8;
for (int j = 0; j < o.getTypes().length; j++) {
// put(orderMap, BinaryMapDataObject.getOrder(o.getTypes()[j]), sh + j, init);
int wholeType = o.getTypes()[j];
int mask = wholeType & 3;
int layer = 0;
if(mask != 1){
layer = MapRenderingTypes.getNegativeWayLayer(wholeType);
}
if (o instanceof MultyPolygon) {
put(orderMap, render.getObjectOrder(((MultyPolygon) o).getTag(), ((MultyPolygon) o).getValue(),
mask, layer), sh + j, init);
} else {
if (o instanceof MultyPolygon) {
int mask = MapRenderingTypes.MULTY_POLYGON_TYPE;
int layer = ((MultyPolygon) o).getLayer();
put(orderMap, render.getObjectOrder(((MultyPolygon) o).getTag(), ((MultyPolygon) o).getValue(),
mask, layer), sh, init);
} else {
for (int j = 0; j < o.getTypes().length; j++) {
// put(orderMap, BinaryMapDataObject.getOrder(o.getTypes()[j]), sh + j, init);
int wholeType = o.getTypes()[j];
int mask = wholeType & 3;
int layer = 0;
if (mask != 1) {
layer = MapRenderingTypes.getNegativeWayLayer(wholeType);
}
TagValuePair pair = o.getMapIndex().decodeType(MapRenderingTypes.getMainObjectType(wholeType),
MapRenderingTypes.getObjectSubType(wholeType));
if (pair != null) {
put(orderMap, render.getObjectOrder(pair.tag, pair.value, mask, layer), sh + j, init);
}
}
}
}
if (rc.interrupted) {
@ -339,7 +342,7 @@ public class OsmandRenderer {
BinaryMapDataObject obj = objects.get(ind);
// show text only for main type
drawObj(obj, cv, rc, obj.getTypes()[l], l == 0);
drawObj(obj, cv, rc, l, l == 0);
objCount++;
}
@ -524,7 +527,9 @@ public class OsmandRenderer {
}
Bitmap ico = cachedIcons.get(text.shieldRes);
if (ico != null) {
cv.drawBitmap(ico, text.centerX - ico.getWidth() / 2 - 0.5f * dm.density, text.centerY - text.textSize - 2 * dm.density, paintIcon);
cv.drawBitmap(ico, text.centerX - ico.getWidth() / 2 - 0.5f * dm.density,
text.centerY - text.textSize / 2 - 6.5f * dm.density,
paintIcon);
}
}
if(text.text.length() > text.textWrap){
@ -566,22 +571,29 @@ public class OsmandRenderer {
}
protected void drawObj(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int mainType, boolean renderText) {
int t = mainType & 3;
int type = MapRenderingTypes.getMainObjectType(mainType);
int subtype = MapRenderingTypes.getObjectSubType(mainType);
rc.allObjects ++;
if(t == MapRenderingTypes.POINT_TYPE){
drawPoint(obj, canvas, rc, type, subtype, renderText);
} else if(t == MapRenderingTypes.POLYLINE_TYPE){
drawPolyline(obj, canvas, rc, type, subtype, mainType);
} else if(t == MapRenderingTypes.POLYGON_TYPE){
drawPolygon(obj, canvas, rc, type, subtype);
protected void drawObj(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int l, boolean renderText) {
rc.allObjects++;
if (obj instanceof MultyPolygon) {
drawMultiPolygon(obj, canvas, rc);
} else {
if(t == MapRenderingTypes.MULTY_POLYGON_TYPE && !(obj instanceof MultyPolygon)){
return;
int mainType = obj.getTypes()[l];
int t = mainType & 3;
int type = MapRenderingTypes.getMainObjectType(mainType);
int subtype = MapRenderingTypes.getObjectSubType(mainType);
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
if (t == MapRenderingTypes.POINT_TYPE) {
drawPoint(obj, canvas, rc, pair, renderText);
} else if (t == MapRenderingTypes.POLYLINE_TYPE) {
int layer = MapRenderingTypes.getNegativeWayLayer(mainType);
drawPolyline(obj, canvas, rc, pair, layer);
} else if (t == MapRenderingTypes.POLYGON_TYPE) {
drawPolygon(obj, canvas, rc, pair);
} else {
if (t == MapRenderingTypes.MULTY_POLYGON_TYPE && !(obj instanceof MultyPolygon)) {
// log this situation
return;
}
}
drawMultiPolygon(obj, canvas, rc, type, subtype);
}
}
@ -635,7 +647,7 @@ public class OsmandRenderer {
shaders.clear();
}
private void drawMultiPolygon(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype) {
private void drawMultiPolygon(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc) {
String tag = ((MultyPolygon)obj).getTag();
String value = ((MultyPolygon)obj).getValue();
if(render == null || tag == null){
@ -690,8 +702,8 @@ public class OsmandRenderer {
}
private void drawPolygon(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype) {
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
private void drawPolygon(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, TagValuePair pair) {
if(render == null || pair == null){
return;
}
@ -746,8 +758,7 @@ public class OsmandRenderer {
return;
}
private void drawPoint(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype, boolean renderText) {
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
private void drawPoint(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, TagValuePair pair, boolean renderText) {
if(render == null || pair == null){
return;
}
@ -794,8 +805,7 @@ public class OsmandRenderer {
private void drawPolyline(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, int type, int subtype, int wholeType) {
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
private void drawPolyline(BinaryMapDataObject obj, Canvas canvas, RenderingContext rc, TagValuePair pair, int layer) {
if(render == null || pair == null){
return;
}
@ -803,7 +813,6 @@ public class OsmandRenderer {
if(length < 2){
return;
}
int layer = MapRenderingTypes.getNegativeWayLayer(wholeType);
rc.main.emptyLine();
rc.second.emptyLine();
rc.third.emptyLine();