Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const geometryType = isExtruded ? GeometryType.ExtrudedPolygon : GeometryType.Polygon;
const meshBuffers = this.findOrCreateMeshBuffers(techniqueIndex, geometryType);
if (meshBuffers === undefined) {
return;
}
const extrudedPolygonTechnique = technique as ExtrudedPolygonTechnique;
const fillTechnique = technique as FillTechnique;
const boundaryWalls = extrudedPolygonTechnique.boundaryWalls !== false;
const isFilled = isFillTechnique(technique);
const texCoordType = this.getTextureCoordinateType(technique);
let height = evaluateTechniqueAttr(context, extrudedPolygonTechnique.height);
let floorHeight = evaluateTechniqueAttr(
context,
extrudedPolygonTechnique.floorHeight
);
if (height === undefined) {
// Get the height values for the footprint and extrusion.
const featureHeight = context.env.lookup("height") as number;
const styleSetDefaultHeight = evaluateTechniqueAttr(
context,
extrudedPolygonTechnique.defaultHeight
);
height =
featureHeight !== undefined
? featureHeight
if (meshBuffers === undefined) {
continue;
}
const { positions, texts, imageTextures, objInfos } = meshBuffers;
const shouldCreateTextGeometries =
isTextTechnique(technique) || isPoiTechnique(technique);
let imageTexture: string | undefined;
const wantsPoi = isPoiTechnique(technique);
if (wantsPoi) {
const poiTechnique = technique as PoiTechnique;
imageTexture = evaluateTechniqueAttr(context, poiTechnique.imageTexture);
// TODO: Move to decoder independent parts of code.
if (poiTechnique.poiName !== undefined) {
imageTexture = evaluateTechniqueAttr(context, poiTechnique.poiName);
} else if (typeof poiTechnique.poiNameField === "string") {
const poiNameFieldValue = env.lookup(poiTechnique.poiNameField) as string;
imageTexture = poiNameFieldValue;
} else if (typeof poiTechnique.imageTextureField === "string") {
const imageTextureValue = env.lookup(poiTechnique.imageTextureField) as string;
imageTexture = composeTechniqueTextureName(imageTextureValue, poiTechnique);
}
}
for (const pos of geometry) {
if (shouldCreateTextGeometries) {
const textTechnique = technique as TextTechnique;
const meshBuffers = this.findOrCreateMeshBuffers(techniqueIndex, geometryType);
if (meshBuffers === undefined) {
return;
}
const extrudedPolygonTechnique = technique as ExtrudedPolygonTechnique;
const fillTechnique = technique as FillTechnique;
const boundaryWalls = extrudedPolygonTechnique.boundaryWalls !== false;
const isFilled = isFillTechnique(technique);
const texCoordType = this.getTextureCoordinateType(technique);
let height = evaluateTechniqueAttr(context, extrudedPolygonTechnique.height);
let floorHeight = evaluateTechniqueAttr(
context,
extrudedPolygonTechnique.floorHeight
);
if (height === undefined) {
// Get the height values for the footprint and extrusion.
const featureHeight = context.env.lookup("height") as number;
const styleSetDefaultHeight = evaluateTechniqueAttr(
context,
extrudedPolygonTechnique.defaultHeight
);
height =
featureHeight !== undefined
? featureHeight
: styleSetDefaultHeight !== undefined
? styleSetDefaultHeight
return (
aLine.technique === techniqueIndex && aLine.renderOrderOffset === renderOrderOffset
);
});
const hasNormalsAndUvs = uvs !== undefined;
if (lineGroupGeometries === undefined) {
lineGroup = new LineGroup(hasNormalsAndUvs, undefined, lineType === LineType.Simple);
const aLine: LinesGeometry = {
type: lineType === LineType.Complex ? GeometryType.SolidLine : GeometryType.Line,
technique: techniqueIndex,
renderOrderOffset:
renderOrderOffset !== undefined ? Number(renderOrderOffset) : undefined,
lines: lineGroup
};
const techniqueTransient = evaluateTechniqueAttr(
context,
technique.transient,
false
);
if (!techniqueTransient && this.m_gatherFeatureAttributes) {
// if this technique is transient, do not save the featureIds with the geometry
aLine.objInfos = [featureAttributes];
aLine.featureStarts = [0];
}
linesGeometry.push(aLine);
} else {
lineGroup = lineGroupGeometries.lines;
if (
this.m_gatherFeatureAttributes &&
const featureStride = texCoordType !== undefined ? 4 : 2;
const vertexStride = featureStride + 2;
const isSpherical = this.m_decodeInfo.targetProjection.type === ProjectionType.Spherical;
const edgeWidth = isExtruded
? extrudedPolygonTechnique.lineWidth || 0.0
: isFilled
? fillTechnique.lineWidth || 0.0
: 0.0;
const hasEdges = edgeWidth > 0.0;
let color: THREE.Color | undefined;
if (isExtrudedPolygonTechnique(technique)) {
if (getOptionValue(technique.vertexColors, false)) {
let colorValue = evaluateTechniqueAttr(context, technique.color);
if (colorValue === undefined) {
const featureColor = context.env.lookup("color");
if (this.isColorStringValid(featureColor)) {
colorValue = String(featureColor);
}
}
if (colorValue === undefined) {
colorValue = evaluateTechniqueAttr(
context,
technique.defaultColor,
0x000000
);
}
if (colorValue === undefined) {
colorValue = 0x000000;
private applyLineTechnique(
linesGeometry: LinesGeometry[],
technique: IndexedTechnique,
techniqueIndex: number,
lineType = LineType.Complex,
featureAttributes: AttributeMap,
lines: number[][],
context: AttrEvaluationContext,
uvs?: number[][],
offsets?: number[][]
): void {
const renderOrderOffset = evaluateTechniqueAttr(
context,
technique.renderOrderOffset,
0
);
let lineGroup: LineGroup;
const lineGroupGeometries = linesGeometry.find(aLine => {
return (
aLine.technique === techniqueIndex && aLine.renderOrderOffset === renderOrderOffset
);
});
const hasNormalsAndUvs = uvs !== undefined;
if (lineGroupGeometries === undefined) {
lineGroup = new LineGroup(hasNormalsAndUvs, undefined, lineType === LineType.Simple);
const aLine: LinesGeometry = {
type: lineType === LineType.Complex ? GeometryType.SolidLine : GeometryType.Line,
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;
}
const techniqueCaps = evaluateTechniqueAttr(
context,
technique.caps,
"Circle"
);
const addCircle = wantCircle && techniqueCaps === "Circle";
localLines.forEach(aLine => {
triangulateLine(aLine, lineWidth, positions, indices, addCircle);
featureStarts.push(start);
objInfos.push(
this.m_gatherFeatureAttributes ? env.entries : getFeatureId(env.entries)
);
});
const count = indices.length - start;
? fillTechnique.lineWidth || 0.0
: 0.0;
const hasEdges = edgeWidth > 0.0;
let color: THREE.Color | undefined;
if (isExtrudedPolygonTechnique(technique)) {
if (getOptionValue(technique.vertexColors, false)) {
let colorValue = evaluateTechniqueAttr(context, technique.color);
if (colorValue === undefined) {
const featureColor = context.env.lookup("color");
if (this.isColorStringValid(featureColor)) {
colorValue = String(featureColor);
}
}
if (colorValue === undefined) {
colorValue = evaluateTechniqueAttr(
context,
technique.defaultColor,
0x000000
);
}
if (colorValue === undefined) {
colorValue = 0x000000;
}
tmpColor.set(colorValue as any);
color = tmpColor;
}
}
for (const polygon of polygons) {