add static 'building' key to Tag

This commit is contained in:
Hannes Janetzek 2013-01-24 22:14:20 +01:00
parent de88c33701
commit 2f3ae3e7c0
2 changed files with 26 additions and 9 deletions

View File

@ -42,6 +42,11 @@ public class Tag {
*/ */
public static final String TAG_KEY_ELE = "ele".intern(); public static final String TAG_KEY_ELE = "ele".intern();
/**
* The key of the elevation OpenStreetMap tag.
*/
public static final String TAG_KEY_BUILDING = "building".intern();
/** /**
* The key of this tag. * The key of this tag.
*/ */

View File

@ -90,7 +90,6 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
private RenderInstruction[] mRenderInstructions = null; private RenderInstruction[] mRenderInstructions = null;
//private final String TAG_WATER = "water".intern(); //private final String TAG_WATER = "water".intern();
private final String TAG_BUILDING = "building".intern();
private final MapView mMapView; private final MapView mMapView;
@ -106,8 +105,11 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
private float mPoiX, mPoiY; private float mPoiX, mPoiY;
private int mPriority; private int mPriority;
private Tag mTagEmptyName = new Tag(Tag.TAG_KEY_NAME, null, false); private final static Tag mTagEmptyName = new Tag(Tag.TAG_KEY_NAME, null, false);
private final static Tag mTagEmptyHouseNr = new Tag(Tag.TAG_KEY_HOUSE_NUMBER, null, false);
private Tag mTagName; private Tag mTagName;
private Tag mTagHouseNr;
private boolean mDebugDrawPolygons; private boolean mDebugDrawPolygons;
boolean mDebugDrawUnmatched; boolean mDebugDrawUnmatched;
@ -255,8 +257,11 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
if (tags[i].key == Tag.TAG_KEY_NAME) { if (tags[i].key == Tag.TAG_KEY_NAME) {
mTagName = tags[i]; mTagName = tags[i];
tags[i] = mTagEmptyName; tags[i] = mTagEmptyName;
} else if (tags[i].key == Tag.TAG_KEY_HOUSE_NUMBER) {
mTagHouseNr = tags[i];
tags[i] = mTagEmptyHouseNr;
} else if (mCurrentTile.zoomLevel >= 17 && } else if (mCurrentTile.zoomLevel >= 17 &&
key == TAG_BUILDING) { key == Tag.TAG_KEY_BUILDING) {
mRenderBuildingModel = true; mRenderBuildingModel = true;
} }
} }
@ -270,6 +275,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
// reset state // reset state
mTagName = null; mTagName = null;
mTagHouseNr = null;
//if (mMapProjection != null) { //if (mMapProjection != null) {
// long x = mCurrentTile.pixelX; // long x = mCurrentTile.pixelX;
@ -318,6 +324,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
// reset state // reset state
mTagName = null; mTagName = null;
mTagHouseNr = null;
mCurLineLayer = null; mCurLineLayer = null;
mPriority = prio; mPriority = prio;
@ -448,17 +455,22 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
public void renderAreaCaption(Text text) { public void renderAreaCaption(Text text) {
// Log.d(TAG, "renderAreaCaption: " + mTagName); // Log.d(TAG, "renderAreaCaption: " + mTagName);
if (text.textKey == Tag.TAG_KEY_NAME) {
if (mTagName == null) if (mTagName == null)
return; return;
if (text.textKey == mTagEmptyName.key) {
// TextItem t = new TextItem(mCoords[0], mCoords[1], mTagName.value,
// text);
TextItem t = TextItem.get().set(mCoords[0], mCoords[1], mTagName.value, text); TextItem t = TextItem.get().set(mCoords[0], mCoords[1], mTagName.value, text);
t.next = mLabels; t.next = mLabels;
mLabels = t; mLabels = t;
} }
else if (text.textKey == Tag.TAG_KEY_HOUSE_NUMBER) {
if (mTagHouseNr == null)
return;
TextItem t = TextItem.get().set(mCoords[0], mCoords[1], mTagHouseNr.value, text);
t.next = mLabels;
mLabels = t;
}
} }
@Override @Override