Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
rotation: getOptionValue(technique.rotation, defaultRenderParams.rotation),
color: getOptionValue(this.m_colorMap.get(cacheId), defaultRenderParams.color),
backgroundColor: getOptionValue(
this.m_colorMap.get(cacheId + "_bg"),
defaultRenderParams.backgroundColor
),
opacity:
technique.opacity !== undefined
? getPropertyValue(technique.opacity, Math.floor(zoomLevel))
: defaultRenderParams.opacity,
backgroundOpacity:
technique.backgroundOpacity !== undefined
? getPropertyValue(technique.backgroundOpacity, Math.floor(zoomLevel))
: technique.backgroundColor !== undefined &&
technique.backgroundSize !== undefined &&
getPropertyValue(technique.backgroundSize, Math.floor(zoomLevel)) > 0
? 1.0 // make label opaque when backgroundColor and backgroundSize are set
: defaultRenderParams.backgroundOpacity
};
const themeRenderParams = this.getTextElementStyle(technique.style).renderParams;
renderStyle = new TextRenderStyle({
...themeRenderParams,
...renderParams
});
this.m_textRenderStyleCache.set(cacheId, renderStyle);
}
return renderStyle;
}
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);
}
}
}
// the lines of a path share a common geometry
const N = textPath.path.length / 3;
for (let i = 0; i < N; ++i) {
) {
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 mayOverlap =
technique.iconMayOverlap === undefined
? DEFAULT_LABELED_ICON.iconMayOverlap
: technique.iconMayOverlap;
const reserveSpace =
): TextElement {
const textElementsRenderer = this.mapView.textElementsRenderer;
const priority = technique.priority !== undefined ? technique.priority : 0;
const positions = Array.isArray(x) ? (x as THREE.Vector3[]) : new THREE.Vector3(x, y, z);
// The current zoomlevel of mapview. Since this method is called for all tiles in the
// VisibleTileSet we can be sure that the current zoomlevel matches the zoomlevel where
// the tile should be shown.
const displayZoomLevel = this.mapView.zoomLevel;
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: technique.fadeNear;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: technique.fadeFar;
const xOffset = getPropertyValue(technique.xOffset, displayZoomLevel);
const yOffset = getPropertyValue(technique.yOffset, displayZoomLevel);
const textElement: TextElement = new TextElement(
ContextualArabicConverter.instance.convert(text),
positions,
textElementsRenderer.styleCache.getRenderStyle(tile, technique),
textElementsRenderer.styleCache.getLayoutStyle(tile, technique),
getPropertyValue(priority, displayZoomLevel),
xOffset !== undefined ? xOffset : 0.0,
yOffset !== undefined ? yOffset : 0.0,
featureId,
technique.style,
fadeNear,
fadeFar
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;
}
const mayOverlap =
technique.mayOverlap === undefined
? DEFAULT_LABELED_ICON.iconMayOverlap
: technique.mayOverlap;
const distanceScale = DEFAULT_TEXT_DISTANCE_SCALE;
)
);
}
if (outlineTechnique.secondaryWidth !== undefined) {
const techniqueLineWidth = getPropertyValue(
outlineTechnique.lineWidth!,
mapView.zoomLevel,
mapView.pixelToWorld
);
const techniqueSecondaryWidth = getPropertyValue(
outlineTechnique.secondaryWidth!,
mapView.zoomLevel,
mapView.pixelToWorld
);
const techniqueOpacity = getPropertyValue(
outlineTechnique.opacity,
mapView.zoomLevel
);
// hide outline when it's equal or smaller then line to avoid subpixel contour
const lineWidth =
techniqueSecondaryWidth <= techniqueLineWidth &&
(techniqueOpacity === undefined || techniqueOpacity === 1)
? 0
: techniqueSecondaryWidth;
lineMaterial.lineWidth = lineWidth * unitFactor * 0.5;
}
}
);
: EdgeMaterial.DEFAULT_COLOR_MIX;
}
}
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_NEAR;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_FAR;
const lineFadeNear =
technique.lineFadeNear !== undefined
? getPropertyValue(technique.lineFadeNear, displayZoomLevel)
: fadeNear;
const lineFadeFar =
technique.lineFadeFar !== undefined
? getPropertyValue(technique.lineFadeFar, displayZoomLevel)
: fadeFar;
if (color === undefined) {
color = EdgeMaterial.DEFAULT_COLOR;
}
return {
color,
colorMix,
fadeNear,
fadeFar,
lineFadeNear,
let colorMix = EdgeMaterial.DEFAULT_COLOR_MIX;
if (technique.lineColor !== undefined) {
color = getPropertyValue(technique.lineColor, displayZoomLevel);
if (isExtrudedPolygonTechnique(technique)) {
const extrudedPolygonTechnique = technique as ExtrudedPolygonTechnique;
colorMix =
extrudedPolygonTechnique.lineColorMix !== undefined
? extrudedPolygonTechnique.lineColorMix
: EdgeMaterial.DEFAULT_COLOR_MIX;
}
}
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_NEAR;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_FAR;
const lineFadeNear =
technique.lineFadeNear !== undefined
? getPropertyValue(technique.lineFadeNear, displayZoomLevel)
: fadeNear;
const lineFadeFar =
technique.lineFadeFar !== undefined
? getPropertyValue(technique.lineFadeFar, displayZoomLevel)
: fadeFar;
if (color === undefined) {
private getFadingParams(
displayZoomLevel: number,
technique: MakeTechniqueAttrs
): FadingParameters {
const fadeNear =
technique.fadeNear !== undefined
? getPropertyValue(technique.fadeNear, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_NEAR;
const fadeFar =
technique.fadeFar !== undefined
? getPropertyValue(technique.fadeFar, displayZoomLevel)
: FadingFeature.DEFAULT_FADE_FAR;
return {
fadeNear,
fadeFar
};
}