more work on building layer

This commit is contained in:
Hannes Janetzek
2013-01-03 18:29:13 +01:00
parent 74ca621de0
commit eb278585fa
22 changed files with 1105 additions and 79 deletions

View File

@@ -53,9 +53,10 @@ public interface IMapDatabaseCallback {
* length of way data in wayNodes
* @param closed
* way is closed (means need to add endpoint == startpoint)
* @param prio TODO
*/
void renderWay(byte layer, Tag[] tags, float[] wayNodes, short[] wayLength,
boolean closed);
boolean closed, int prio);
/**
* TBD: check if way will be rendered before decoding

View File

@@ -961,7 +961,7 @@ public class MapDatabase implements IMapDatabase {
&& mWayNodes[1] == mWayNodes[l - 1];
mapDatabaseCallback
.renderWay(layer, tags, mWayNodes, wayLengths, closed);
.renderWay(layer, tags, mWayNodes, wayLengths, closed, 0);
}
}

View File

@@ -298,7 +298,7 @@ public class MapDatabase implements IMapDatabase {
private static final int TAG_ELEM_INDEX = 12;
private static final int TAG_ELEM_COORDS = 13;
private static final int TAG_ELEM_LAYER = 21;
// private static final int TAG_ELEM_PRIORITY = 31;
private static final int TAG_ELEM_PRIORITY = 31;
private short[] mTmpKeys = new short[100];
private short[] mIndices = new short[10];
@@ -376,6 +376,8 @@ public class MapDatabase implements IMapDatabase {
int indexCnt = 1;
int coordCnt = 0;
int layer = 5;
int prio = 0;
Tag[] tags = null;
short[] index = null;
@@ -441,6 +443,10 @@ public class MapDatabase implements IMapDatabase {
layer = decodeVarint32();
break;
case TAG_ELEM_PRIORITY:
prio = decodeVarint32();
break;
default:
Log.d(TAG, "X invalid type for way: " + tag);
}
@@ -457,9 +463,9 @@ public class MapDatabase implements IMapDatabase {
float[] coords = mTmpCoords;
if (type == TAG_TILE_LINE)
mMapGenerator.renderWay((byte) layer, tags, coords, index, false);
mMapGenerator.renderWay((byte) layer, tags, coords, index, false, prio);
else if (type == TAG_TILE_POLY)
mMapGenerator.renderWay((byte) layer, tags, coords, index, true);
mMapGenerator.renderWay((byte) layer, tags, coords, index, true, prio);
else {
if (debug)
Log.d(TAG, "add poi " + coords[1] + " " + coords[0] + " " + tags[0]);

View File

@@ -556,7 +556,7 @@ public class MapDatabase implements IMapDatabase {
if (layer == 0)
layer = 5;
mMapGenerator.renderWay((byte) layer, tags, coords, index, polygon);
mMapGenerator.renderWay((byte) layer, tags, coords, index, polygon, 0);
return true;
}

View File

@@ -182,7 +182,7 @@ public class MapDatabase implements IMapDatabase {
short[] idx = new short[mIndexPos];
System.arraycopy(mIndex, 0, idx, 0, mIndexPos);
mapDatabaseCallback.renderWay((byte) 0, mTags, mCoords, idx, polygon);
mapDatabaseCallback.renderWay((byte) 0, mTags, mCoords, idx, polygon, 0);
}
}
} catch (SQLException e) {

View File

@@ -100,7 +100,7 @@ public class MapDatabase implements IMapDatabase {
mIndex[2] = 10;
mIndex[3] = 0;
mapDatabaseCallback.renderWay((byte) 0, mTags, mCoords, mIndex, true);
mapDatabaseCallback.renderWay((byte) 0, mTags, mCoords, mIndex, true, 0);
mIndex[0] = 4;
mIndex[1] = -1;
@@ -113,7 +113,7 @@ public class MapDatabase implements IMapDatabase {
Tag[] tags = new Tag[2];
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 0, tags, mCoords, mIndex, false);
mapDatabaseCallback.renderWay((byte) 0, tags, mCoords, mIndex, false, 0);
// center up
mCoords[0] = size / 2;
@@ -124,7 +124,7 @@ public class MapDatabase implements IMapDatabase {
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 0, tags, mCoords, mIndex,
false);
false, 0);
// center down
mCoords[0] = size / 2;
@@ -134,7 +134,7 @@ public class MapDatabase implements IMapDatabase {
tags = new Tag[2];
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 0, tags, mCoords, mIndex, false);
mapDatabaseCallback.renderWay((byte) 0, tags, mCoords, mIndex, false, 0);
// left-top to center
mCoords[0] = size / 2;
@@ -144,7 +144,7 @@ public class MapDatabase implements IMapDatabase {
tags = new Tag[2];
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false);
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false, 0);
// middle horizontal
mCoords[0] = 0;
@@ -154,7 +154,7 @@ public class MapDatabase implements IMapDatabase {
tags = new Tag[2];
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false);
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false, 0);
// middle horizontal
mCoords[0] = 10;
@@ -164,7 +164,7 @@ public class MapDatabase implements IMapDatabase {
tags = new Tag[2];
tags[0] = mTagsWay[0];
tags[1] = mTagsWay[1];
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false);
mapDatabaseCallback.renderWay((byte) 1, tags, mCoords, mIndex, false, 0);
// lon1 = size / 2;
// lat1 = size / 2;