Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
text: string,
technique: TextTechnique,
geojsonProperties?: {}
) {
const priority =
technique.priority === undefined ? DEFAULT_LABELED_ICON.priority : technique.priority;
const xOffset =
technique.xOffset === undefined ? DEFAULT_LABELED_ICON.xOffset : technique.xOffset;
const yOffset =
technique.yOffset === undefined ? DEFAULT_LABELED_ICON.yOffset : technique.yOffset;
const featureId = DEFAULT_LABELED_ICON.featureId;
const styleCache = this.mapView.textElementsRenderer.styleCache;
const textElement = new TextElement(
ContextualArabicConverter.instance.convert(text),
path,
styleCache.getRenderStyle(this, technique),
styleCache.getLayoutStyle(this, technique),
getPropertyValue(priority, this.mapView.zoomLevel),
xOffset,
yOffset,
featureId
);
// Set the userData of the TextElement to the geojsonProperties, then it will be available
// for picking.
if (geojsonProperties !== undefined) {
textElement.userData = geojsonProperties;
}
private addPoi(
position: THREE.Vector3,
technique: PoiTechnique,
zoomLevel: number,
geojsonProperties?: {}
) {
const label = DEFAULT_LABELED_ICON.label;
const priority =
technique.priority === undefined ? DEFAULT_LABELED_ICON.priority : technique.priority;
const xOffset = getPropertyValue(technique.xOffset, zoomLevel);
const yOffset = getPropertyValue(technique.yOffset, zoomLevel);
const featureId = DEFAULT_LABELED_ICON.featureId;
const styleCache = this.mapView.textElementsRenderer.styleCache;
const textElement = new TextElement(
ContextualArabicConverter.instance.convert(label),
position,
styleCache.getRenderStyle(this, technique),
styleCache.getLayoutStyle(this, technique),
getPropertyValue(priority, this.mapView.zoomLevel),
xOffset === undefined ? DEFAULT_LABELED_ICON.xOffset : xOffset,
yOffset === undefined ? DEFAULT_LABELED_ICON.yOffset : yOffset,
featureId
);
// Set the userData of the TextElement to the geojsonProperties, then it will be available
// for picking.
if (geojsonProperties !== undefined) {
textElement.userData = geojsonProperties;
}
const pointIndex = positions.length / 3;
indices.push(pointIndex - 4);
indices.push(pointIndex - 3);
indices.push(pointIndex - 2);
indices.push(pointIndex - 4);
indices.push(pointIndex - 2);
indices.push(pointIndex - 1);
if (debugTextPathsFull) {
// give point index a label
const label: string =
pathIndex % 5 === 0
? text + ":" + pathIndex
: Number(pathIndex).toString();
const labelElement = new TextElement(
ContextualArabicConverter.instance.convert(label),
new THREE.Vector3(x + worldOffsetX, y, z),
textRenderStyle,
textLayoutStyle,
getPropertyValue(technique.priority || 0, zoomLevel),
technique.xOffset || 0.0,
technique.yOffset || 0.0
);
labelElement.minZoomLevel = technique.minZoomLevel;
labelElement.mayOverlap = true;
labelElement.reserveSpace = false;
labelElement.alwaysOnTop = true;
labelElement.ignoreDistance = true;
this.addUserTextElement(labelElement);
}
}
position: THREE.Vector3,
text: string,
technique: TextTechnique,
geojsonProperties?: {}
) {
const priority =
technique.priority === undefined ? DEFAULT_LABELED_ICON.priority : technique.priority;
const xOffset =
technique.xOffset === undefined ? DEFAULT_LABELED_ICON.xOffset : technique.xOffset;
const yOffset =
technique.yOffset === undefined ? DEFAULT_LABELED_ICON.yOffset : technique.yOffset;
const featureId = DEFAULT_LABELED_ICON.featureId;
const styleCache = this.mapView.textElementsRenderer.styleCache;
const textElement = new TextElement(
ContextualArabicConverter.instance.convert(text),
position,
styleCache.getRenderStyle(this, technique),
styleCache.getLayoutStyle(this, technique),
getPropertyValue(priority, this.mapView.zoomLevel),
xOffset,
yOffset,
featureId
);
// Set the userData of the TextElement to the geojsonProperties, then it will be available
// for picking.
if (geojsonProperties !== undefined) {
textElement.userData = geojsonProperties;
}
});
} else {
textPosition.copy(middlePoint);
this.m_textLayoutStyle = new TextLayoutStyle({
verticalAlignment: VerticalAlignment.Center,
horizontalAlignment: HorizontalAlignment.Center
});
}
const text = `${tileKey.mortonCode()} (${tileKey.row}, ${tileKey.column}, ${
tileKey.level
})`;
textPosition.add(this.center);
const textElement = new TextElement(
text,
textPosition,
this.m_textRenderStyle,
this.m_textLayoutStyle,
PRIORITY_ALWAYS,
TEXT_SCALE
);
textElement.mayOverlap = true;
textElement.reserveSpace = false;
textElement.alwaysOnTop = true;
textElement.ignoreDistance = true;
this.addTextElement(textElement);
}
}