Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private processLineFeatures(
data: ArrayBufferLike | {},
tileKey: TileKey,
styleSetEvaluator: StyleSetEvaluator,
projection: Projection,
geometries: Geometry[]
) {
// Setup an environment for this "layer". This does normaly come from the data and should
// contain all the attributes of a specific feature, so that it can be styled properly.
const env = new MapEnv({ layer: "line-layer" });
const techniques = styleSetEvaluator.getMatchingTechniques(env);
const geoCenter = webMercatorTilingScheme.getGeoBox(tileKey).center;
const worldCenter = projection.projectPoint(geoCenter, new Vector3());
// Convert the input coordinates to local world coord coordinates (i.e. projected world
// coordinates relative to the tile center in world coordinates)
const worldPoints = this.convertToLocalWorldCoordinates(
data,
geoCenter,
projection,
worldCenter
);
// Create actual line-geometry out of the data.
const lineGroup = new LineGroup();
lineGroup.add(worldCenter, worldPoints);
for (const technique of techniques) {
extendedTile,
center,
projection,
styleSetEvaluator,
buffers
);
const geometries: GeoJsonTileGeometries = {
geometries: [],
poiGeometries: [],
textGeometries: [],
textPathGeometries: []
};
const tileWorldBounds = new THREE.Box3();
const geoBox = webMercatorTilingScheme.getGeoBox(extendedTile.info.tileKey);
const tileBounds = projection.projectBox(geoBox, tileWorldBounds);
const tileCenter = new THREE.Vector3();
tileBounds.getCenter(tileCenter);
const tileWorldExtents = tileWorldBounds.max.sub(tileCenter).x;
buffers.geometryBuffer.forEach((geometryData, techniqueIndex) => {
switch (geometryData.type) {
case "point":
geometries.geometries.push(
this.createPointGeometry(geometryData, techniqueIndex)
);
break;
case "solid-line":
case "dashed-line":
geometries.geometries.push(
this.createSolidLineGeometry(geometryData, techniqueIndex)
private getTileCenter(tileKey: TileKey) {
const geoBox = webMercatorTilingScheme.getGeoBox(tileKey);
const tileBounds = this.m_projection.projectBox(geoBox, new OrientedBox3());
return tileBounds.position;
}