Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (technique.gapSize !== undefined) {
lineMaterial.gapSize =
getPropertyValue(
technique.gapSize,
mapView.zoomLevel,
mapView.pixelToWorld
) *
unitFactor *
0.5;
}
}
);
}
if (isExtrudedLineTechnique(technique)) {
// extruded lines are normal meshes, and need transparency only when fading or
// dynamic properties is defined.
if (technique.fadeFar !== undefined || Expr.isExpr(technique.color)) {
const fadingParams = this.getFadingParams(
displayZoomLevel,
technique as StandardExtrudedLineTechnique
);
FadingFeature.addRenderHelper(
object,
viewRanges,
fadingParams.fadeNear,
fadingParams.fadeFar,
true,
technique.color !== undefined && Expr.isExpr(technique.color)
? (renderer, mat) => {
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;
}
technique.kind = geometryKind;
}
export function getMaterialConstructor(technique: Technique): MaterialConstructor | undefined {
if (technique.name === undefined) {
return undefined;
}
switch (technique.name) {
case "extruded-line":
if (!isExtrudedLineTechnique(technique)) {
throw new Error("Invalid extruded-line technique");
}
return technique.shading === "standard"
? MapMeshStandardMaterial
: MapMeshBasicMaterial;
case "standard":
case "terrain":
case "extruded-polygon":
return MapMeshStandardMaterial;
case "dashed-line":
case "solid-line":
return SolidLineMaterial;
case "fill":
? [env.entries]
: [getFeatureId(env.entries)]
});
}
}
} else if (isLabelRejectionLineTechnique(technique)) {
for (const path of worldLines) {
const worldPath: Vector3Like[] = [];
for (let i = 0; i < path.length; i += 3) {
worldPath.push(new THREE.Vector3().fromArray(path, i) as Vector3Like);
}
this.m_pathGeometries.push({
path: worldPath
});
}
} else if (isExtrudedLineTechnique(technique)) {
const meshBuffers = this.findOrCreateMeshBuffers(
techniqueIndex,
GeometryType.ExtrudedLine
);
if (meshBuffers === undefined) {
continue;
}
const { positions, indices, groups, featureStarts, objInfos } = meshBuffers;
const start = indices.length;
const lineWidth = evaluateTechniqueAttr(context, technique.lineWidth);
if (lineWidth === undefined) {
continue;
}