Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setDefaultGeometryKind(technique: Technique): GeometryKind | GeometryKindSet {
let geometryKind = technique.kind;
// Set default kind based on technique.
if (geometryKind === undefined) {
if (isFillTechnique(technique)) {
geometryKind = GeometryKind.Area;
} else if (
isLineTechnique(technique) ||
isSolidLineTechnique(technique) ||
isSegmentsTechnique(technique) ||
isExtrudedLineTechnique(technique)
) {
geometryKind = GeometryKind.Line;
} else if (isExtrudedPolygonTechnique(technique)) {
geometryKind = GeometryKind.Building;
} else if (
isPoiTechnique(technique) ||
isLineMarkerTechnique(technique) ||
isTextTechnique(technique)
) {
geometryKind = GeometryKind.Label;
} else {
geometryKind = GeometryKind.All;
}
if (bufferGeometry.getAttribute("color")) {
lineMaterial.defines.USE_COLOR = 1;
}
if (
technique.caps !== undefined &&
LineCapsDefinitions.hasOwnProperty(technique.caps)
) {
lineMaterial.defines[LineCapsDefinitions[technique.caps]] = 1;
}
}
// Add the solid line outlines as a separate object.
const hasSolidLinesOutlines: boolean =
isSolidLineTechnique(technique) && technique.secondaryWidth !== undefined;
const object = new ObjectCtor(bufferGeometry, material);
object.renderOrder = technique.renderOrder!;
if (group.renderOrderOffset !== undefined) {
object.renderOrder += group.renderOrderOffset;
}
if (srcGeometry.uuid !== undefined) {
object.userData.geometryId = srcGeometry.uuid;
}
if (
isFillTechnique(technique) &&
mapView.projection.type === ProjectionType.Planar
) {
);
}
);
}
if (srcGeometry.index) {
bufferGeometry.setIndex(getBufferAttribute(srcGeometry.index));
}
if (!bufferGeometry.getAttribute("normal") && needsVertexNormals(technique)) {
bufferGeometry.computeVertexNormals();
}
bufferGeometry.addGroup(start, count);
if (isSolidLineTechnique(technique)) {
const lineMaterial = material as THREE.RawShaderMaterial;
lineMaterial.uniforms.opacity.value = material.opacity;
if (
technique.clipping !== false &&
tile.projection.type === ProjectionType.Planar
) {
const tileSize = lineMaterial.uniforms.tileSize;
const size = new THREE.Vector3();
tile.boundingBox.getSize(size);
tileSize.value.x = size.x;
tileSize.value.y = size.y;
lineMaterial.defines.TILE_CLIP = 1;
}
if (bufferGeometry.getAttribute("color")) {
}
}
break;
case "Polygon":
techniqueIndices = this.findTechniqueIndices(feature, "polygon", styleSetEvaluator);
for (const techniqueIndex of techniqueIndices) {
const technique = styleSetEvaluator.techniques[techniqueIndex];
if (isFillTechnique(technique) || isSolidLineTechnique(technique)) {
this.processPolygons(
[feature.geometry.coordinates],
center,
projection,
techniqueIndex,
buffers.geometryBuffer,
isSolidLineTechnique(technique),
feature.properties
);
} else if (isTextTechnique(technique)) {
this.processMultiPolygonLabels(
[feature.geometry.coordinates],
center,
projection,
techniqueIndex,
technique.label!,
buffers.textGeometryBuffer,
feature.properties
);
}
}
break;
feature.geometry.coordinates,
center,
projection,
techniqueIndex,
buffers.geometryBuffer,
feature.properties
);
}
}
break;
case "LineString":
techniqueIndices = this.findTechniqueIndices(feature, "line", styleSetEvaluator);
for (const techniqueIndex of techniqueIndices) {
const technique = styleSetEvaluator.techniques[techniqueIndex];
if (isSolidLineTechnique(technique)) {
this.processLines(
extendedTile,
[feature.geometry.coordinates],
center,
projection,
techniqueIndex,
styleSetEvaluator,
buffers.geometryBuffer,
feature.id,
feature.properties
);
} else if (isTextTechnique(technique)) {
this.processLineLabels(
[feature.geometry.coordinates],
center,
projection,
private addFeatureData(srcGeometry: Geometry, technique: Technique, object: THREE.Object3D) {
if (
((srcGeometry.objInfos !== undefined && srcGeometry.objInfos.length > 0) ||
isCirclesTechnique(technique) ||
isSquaresTechnique(technique)) &&
!isSolidLineTechnique(technique)
) {
const featureData: TileFeatureData = {
geometryType: srcGeometry.type,
starts: srcGeometry.featureStarts,
objInfos: srcGeometry.objInfos
};
object.userData.feature = featureData;
}
}