let TileLoaderHook stop further processing
- return false when no other loader hook should process the current element
This commit is contained in:
parent
c234507edb
commit
402e4c3cd6
@ -91,11 +91,11 @@ public class BuildingLayer extends Layer implements TileLoaderHook {
|
||||
private final static int MIN_ZOOM = 17;
|
||||
|
||||
@Override
|
||||
public void render(MapTile tile, ElementLayers layers, MapElement element,
|
||||
public boolean render(MapTile tile, ElementLayers layers, MapElement element,
|
||||
RenderStyle style, int level) {
|
||||
|
||||
if (!(style instanceof ExtrusionStyle))
|
||||
return;
|
||||
return false;
|
||||
|
||||
ExtrusionStyle extrusion = (ExtrusionStyle) style;
|
||||
|
||||
@ -125,6 +125,8 @@ public class BuildingLayer extends Layer implements TileLoaderHook {
|
||||
height = 12 * 100;
|
||||
|
||||
l.add(element, height, minHeight);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//@Override
|
||||
|
||||
@ -124,7 +124,7 @@ public class VectorTileLayer extends TileLayer {
|
||||
}
|
||||
|
||||
public interface TileLoaderHook {
|
||||
public void render(MapTile tile, ElementLayers layers,
|
||||
public boolean render(MapTile tile, ElementLayers layers,
|
||||
MapElement element, RenderStyle style, int level);
|
||||
}
|
||||
|
||||
@ -137,8 +137,8 @@ public class VectorTileLayer extends TileLayer {
|
||||
public void addHook(TileLoaderHook h) {
|
||||
int length = mLoaderHooks.length;
|
||||
TileLoaderHook[] tmp = new TileLoaderHook[length + 1];
|
||||
System.arraycopy(mLoaderHooks, 0, tmp, 1, length);
|
||||
tmp[0] = h;
|
||||
System.arraycopy(mLoaderHooks, 0, tmp, 0, length);
|
||||
tmp[length] = h;
|
||||
mLoaderHooks = tmp;
|
||||
}
|
||||
|
||||
|
||||
@ -294,12 +294,14 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
|
||||
public void renderSymbol(SymbolStyle symbol) {
|
||||
for (TileLoaderHook h : mTileLayer.getLoaderHooks())
|
||||
h.render(mTile, mLayers, mElement, symbol, 0);
|
||||
if (h.render(mTile, mLayers, mElement, symbol, 0))
|
||||
break;
|
||||
}
|
||||
|
||||
public void renderExtrusion(ExtrusionStyle extrusion, int level) {
|
||||
for (TileLoaderHook h : mTileLayer.getLoaderHooks())
|
||||
h.render(mTile, mLayers, mElement, extrusion, level);
|
||||
if (h.render(mTile, mLayers, mElement, extrusion, level))
|
||||
break;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -309,6 +311,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
@Override
|
||||
public void renderText(TextStyle text) {
|
||||
for (TileLoaderHook h : mTileLayer.getLoaderHooks())
|
||||
h.render(mTile, mLayers, mElement, text, 0);
|
||||
if (h.render(mTile, mLayers, mElement, text, 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MapTile tile, ElementLayers layers, MapElement element,
|
||||
public boolean render(MapTile tile, ElementLayers layers, MapElement element,
|
||||
RenderStyle style, int level) {
|
||||
|
||||
if (style instanceof TextStyle) {
|
||||
@ -41,7 +41,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
if (element.type == LINE) {
|
||||
String value = element.tags.getValue(text.textKey);
|
||||
if (value == null || value.length() == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
int offset = 0;
|
||||
for (int i = 0, n = element.index.length; i < n; i++) {
|
||||
@ -58,7 +58,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
// TODO place somewhere on polygon
|
||||
String value = element.tags.getValue(text.textKey);
|
||||
if (value == null || value.length() == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
@ -76,7 +76,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
else if (element.type == POINT) {
|
||||
String value = element.tags.getValue(text.textKey);
|
||||
if (value == null || value.length() == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
for (int i = 0, n = element.getNumPoints(); i < n; i++) {
|
||||
PointF p = element.getPoint(i);
|
||||
@ -88,7 +88,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
SymbolStyle symbol = (SymbolStyle) style;
|
||||
|
||||
if (symbol.texture == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
LabelTileData ld = get(tile);
|
||||
|
||||
@ -100,6 +100,7 @@ public class LabelTileLoaderHook implements TileLoaderHook {
|
||||
ld.symbols.push(it);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user