cleanup: VectorTileLoader
This commit is contained in:
parent
29189c77ff
commit
b6cbc960f3
@ -285,48 +285,42 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LineLayer lineLayer = mTile.layers.getLineLayer(numLayer);
|
LineLayer l = mTile.layers.getLineLayer(numLayer);
|
||||||
|
|
||||||
if (lineLayer == null)
|
if (l.line == null) {
|
||||||
return;
|
l.line = line;
|
||||||
|
|
||||||
if (lineLayer.line == null) {
|
|
||||||
lineLayer.line = line;
|
|
||||||
|
|
||||||
float w = line.width;
|
float w = line.width;
|
||||||
if (!line.fixed)
|
if (!line.fixed)
|
||||||
w *= mLineScale;
|
w *= mLineScale;
|
||||||
|
|
||||||
lineLayer.width = w;
|
l.width = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.outline) {
|
if (line.outline) {
|
||||||
lineLayer.addOutline(mCurLineLayer);
|
l.addOutline(mCurLineLayer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineLayer.addLine(mElement);
|
l.addLine(mElement);
|
||||||
|
|
||||||
// keep reference for outline layer
|
// NB: keep reference for outline layer(s)
|
||||||
mCurLineLayer = lineLayer;
|
mCurLineLayer = l;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LineTexLayer lineLayer = mTile.layers.getLineTexLayer(numLayer);
|
LineTexLayer l = mTile.layers.getLineTexLayer(numLayer);
|
||||||
|
|
||||||
if (lineLayer == null)
|
if (l.line == null) {
|
||||||
return;
|
l.line = line;
|
||||||
|
|
||||||
if (lineLayer.line == null) {
|
|
||||||
lineLayer.line = line;
|
|
||||||
|
|
||||||
float w = line.width;
|
float w = line.width;
|
||||||
if (!line.fixed)
|
if (!line.fixed)
|
||||||
w *= mLineScale;
|
w *= mLineScale;
|
||||||
|
|
||||||
lineLayer.width = w;
|
l.width = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineLayer.addLine(mElement);
|
l.addLine(mElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,13 +328,10 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
public void renderArea(Area area, int level) {
|
public void renderArea(Area area, int level) {
|
||||||
int numLayer = mCurLayer + level;
|
int numLayer = mCurLayer + level;
|
||||||
|
|
||||||
PolygonLayer layer = mTile.layers.getPolygonLayer(numLayer);
|
PolygonLayer l = mTile.layers.getPolygonLayer(numLayer);
|
||||||
|
|
||||||
if (layer == null)
|
l.area = area;
|
||||||
return;
|
l.addPolygon(mElement.points, mElement.index);
|
||||||
|
|
||||||
layer.area = area;
|
|
||||||
layer.addPolygon(mElement.points, mElement.index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -434,7 +425,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
if (v != null)
|
if (v != null)
|
||||||
minHeight = Integer.parseInt(v);
|
minHeight = Integer.parseInt(v);
|
||||||
|
|
||||||
ExtrusionLayer l = (ExtrusionLayer) mTile.layers.extrusionLayers;
|
ExtrusionLayer l = mTile.layers.getExtrusionLayers();
|
||||||
|
|
||||||
if (l == null) {
|
if (l == null) {
|
||||||
double lat = MercatorProjection.toLatitude(mTile.y);
|
double lat = MercatorProjection.toLatitude(mTile.y);
|
||||||
@ -442,7 +433,8 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
* MercatorProjection.EARTH_CIRCUMFERENCE
|
* MercatorProjection.EARTH_CIRCUMFERENCE
|
||||||
/ ((long) Tile.SIZE << mTile.zoomLevel));
|
/ ((long) Tile.SIZE << mTile.zoomLevel));
|
||||||
|
|
||||||
mTile.layers.extrusionLayers = l = new ExtrusionLayer(0, groundScale, extrusion.colors);
|
l = new ExtrusionLayer(0, groundScale, extrusion.colors);
|
||||||
|
mTile.layers.add(l);
|
||||||
}
|
}
|
||||||
l.add(mElement, height, minHeight);
|
l.add(mElement, height, minHeight);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import java.nio.ShortBuffer;
|
|||||||
import org.oscim.backend.GL20;
|
import org.oscim.backend.GL20;
|
||||||
import org.oscim.renderer.BufferObject;
|
import org.oscim.renderer.BufferObject;
|
||||||
import org.oscim.theme.renderinstruction.Line;
|
import org.oscim.theme.renderinstruction.Line;
|
||||||
|
import org.oscim.utils.pool.Inlist;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -344,4 +345,12 @@ public class ElementLayers {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(ExtrusionLayer l) {
|
||||||
|
extrusionLayers = Inlist.appendItem(extrusionLayers, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExtrusionLayer getExtrusionLayers() {
|
||||||
|
return (ExtrusionLayer) extrusionLayers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user