Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// PoiTable not found or can not be loaded.
if (poiTable === undefined || !poiTable.loadedOk) {
PoiManager.notifyMissingPoiTable(poiTableName, poiTable);
return true;
}
// Try to acquire PoiTableEntry.
const poiName = poiInfo.poiName;
const poiTableEntry = poiTable.getEntry(poiName);
if (poiTableEntry === undefined) {
PoiManager.notifyMissingPoi(poiName, poiTableName);
return true;
}
if (poiTableEntry.iconName !== undefined && poiTableEntry.iconName.length > 0) {
poiInfo.imageTextureName = composeTechniqueTextureName(
poiTableEntry.iconName,
poiInfo.technique
);
}
pointLabel.visible =
poiTableEntry.visible !== undefined ? poiTableEntry.visible : pointLabel.visible;
pointLabel.priority =
poiTableEntry.priority !== undefined ? poiTableEntry.priority : pointLabel.priority;
poiInfo.iconMinZoomLevel =
poiTableEntry.iconMinLevel !== undefined
? poiTableEntry.iconMinLevel
: poiInfo.iconMinZoomLevel;
poiInfo.iconMaxZoomLevel =
poiTableEntry.iconMaxLevel !== undefined
? poiTableEntry.iconMaxLevel
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 text = ExtendedTileInfo.getFeatureText(
context,
textTechnique,
this.m_languages
);
if (text !== undefined && text.length > 0) {
texts.push(meshBuffers.addText(text));
} else {
texts.push(INVALID_ARRAY_INDEX);
private addPoi(
tile: Tile,
poiGeometry: PoiGeometry,
technique: PoiTechnique,
positions: THREE.BufferAttribute,
worldOffsetX: number
) {
if (poiGeometry.stringCatalog === undefined) {
return;
}
const techniqueTextureName: string | undefined =
technique.imageTexture !== undefined
? composeTechniqueTextureName(technique.imageTexture, technique)
: undefined;
const poiTechnique = technique as PoiTechnique;
const poiTableName = poiTechnique.poiTable;
let poiName = poiTechnique.poiName;
for (let i = 0; i < positions.count; ++i) {
const x = positions.getX(i) + worldOffsetX;
const y = positions.getY(i);
const z = positions.getZ(i);
assert(poiGeometry.texts.length > i);
let imageTextureName = techniqueTextureName;
const text: string = poiGeometry.stringCatalog[poiGeometry.texts[i]] || "";
const userData =
poiGeometry.objInfos !== undefined ? poiGeometry.objInfos[i] : undefined;
private addLineMarker(
tile: Tile,
poiGeometry: PoiGeometry,
technique: LineMarkerTechnique,
positions: THREE.BufferAttribute,
worldOffsetX: number
) {
let imageTextureName: string | undefined =
technique.imageTexture !== undefined
? composeTechniqueTextureName(technique.imageTexture, technique)
: undefined;
let text: string = "";
let userData: AttributeMap | undefined;
let featureId: number | undefined;
if (poiGeometry.stringCatalog !== undefined) {
assert(poiGeometry.texts.length > 0);
text = poiGeometry.stringCatalog[poiGeometry.texts[0]] || "";
if (poiGeometry.objInfos !== undefined) {
userData = poiGeometry.objInfos[0];
featureId = getFeatureId(userData);
}
if (poiGeometry.imageTextures !== undefined) {
assert(poiGeometry.imageTextures.length > 0);