How to use the @here/harp-datasource-protocol.isTextTechnique function in @here/harp-datasource-protocol

To help you get started, we’ve selected a few @here/harp-datasource-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
for (const technique of techniques) {
            if (technique === undefined) {
                continue;
            }

            const techniqueIndex = technique._index;
            const meshBuffers = this.findOrCreateMeshBuffers(techniqueIndex, GeometryType.Point);

            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;
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
break;

            case "MultiPoint":
                techniqueIndices = this.findTechniqueIndices(feature, "point", styleSetEvaluator);
                for (const techniqueIndex of techniqueIndices) {
                    const technique = styleSetEvaluator.techniques[techniqueIndex];
                    if (isPoiTechnique(technique)) {
                        this.processPois(
                            feature.geometry.coordinates,
                            center,
                            projection,
                            techniqueIndex,
                            buffers.poiGeometryBuffer,
                            feature.properties
                        );
                    } else if (isTextTechnique(technique)) {
                        this.processPointLabels(
                            feature.geometry.coordinates,
                            center,
                            projection,
                            techniqueIndex,
                            technique.label!,
                            buffers.textGeometryBuffer,
                            feature.properties
                        );
                    } else if (isCirclesTechnique(technique) || isSquaresTechnique(technique)) {
                        this.processPoints(
                            feature.geometry.coordinates,
                            center,
                            projection,
                            techniqueIndex,
                            buffers.geometryBuffer,
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
if (
                !this.m_styleSetEvaluator.techniques ||
                this.m_styleSetEvaluator.techniques.length <= techniqueIdx
            ) {
                throw new Error("Invalid technique index");
            }

            const technique = this.m_styleSetEvaluator.techniques[techniqueIdx];
            if (technique === undefined) {
                return;
            }

            const positionElements = new Float32Array(meshBuffers.positions);

            if (meshBuffers.texts.length > 0 && isTextTechnique(technique)) {
                this.m_textGeometries.push({
                    positions: {
                        name: "position",
                        type: "float",
                        buffer: positionElements.buffer as ArrayBuffer,
                        itemCount: 3
                    },
                    texts: meshBuffers.texts,
                    technique: techniqueIdx,
                    stringCatalog: meshBuffers.stringCatalog,
                    objInfos: meshBuffers.objInfos
                });
                return;
            }

            if (meshBuffers.texts.length > 0 && isPoiTechnique(technique)) {
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryCreator.ts View on Github external
const textFilter = (technique: Technique): boolean => {
            if (
                !isPoiTechnique(technique) &&
                !isLineMarkerTechnique(technique) &&
                !isTextTechnique(technique)
            ) {
                return false;
            }
            return filter(technique);
        };
        this.createTextElements(tile, decodedTile, textFilter);
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
const lineType = isLineTechnique(technique) ? LineType.Simple : LineType.Complex;

                this.applyLineTechnique(
                    lineGeometry,
                    technique,
                    techniqueIndex,
                    lineType,
                    env.entries,
                    localLines,
                    context,
                    this.getTextureCoordinateType(technique) ? uvs : undefined,
                    hasUntiledLines ? offsets : undefined
                );
            } else if (
                isTextTechnique(technique) ||
                isPoiTechnique(technique) ||
                isLineMarkerTechnique(technique)
            ) {
                const textTechnique = technique as TextTechnique;
                const text = ExtendedTileInfo.getFeatureText(
                    context,
                    textTechnique,
                    this.m_languages
                );

                if (text === undefined || text.length === 0) {
                    continue;
                }
                let validLines: number[][] = [];

                if (this.m_skipShortLabels) {
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDebugLabelsTile.ts View on Github external
const redPointGeometry = new THREE.BufferGeometry();
            const redPointIndices = new Array();
            const redPointPositions = new Array();

            const blackPointGeometry = new THREE.BufferGeometry();
            const blackPointIndices = new Array();
            const blackPointPositions = new Array();

            let baseVertex = 0;
            const pointScale = this.mapView.pixelToWorld;
            const worldOffsetX = this.computeWorldOffsetX();

            for (const textPath of this.preparedTextPaths) {
                const technique = decodedTile.techniques[textPath.technique];
                if (!isTextTechnique(technique)) {
                    continue;
                }
                if (technique.color !== undefined) {
                    colorMap.set(
                        textPath.technique,
                        new THREE.Color(getPropertyValue(technique.color, zoomLevel))
                    );
                }

                baseVertex = linePositions.length / 3;

                const text = textPath.text;

                const elementIndex = this.preparedTextPaths.indexOf(textPath);

                const createDebugInfo =
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryLoader.ts View on Github external
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;
        }

        return geometryKind;
    }
}
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
case "MultiPolygon":
                techniqueIndices = this.findTechniqueIndices(feature, "polygon", styleSetEvaluator);
                for (const techniqueIndex of techniqueIndices) {
                    const technique = styleSetEvaluator.techniques[techniqueIndex];
                    if (isFillTechnique(technique) || isSolidLineTechnique(technique)) {
                        this.processPolygons(
                            feature.geometry.coordinates,
                            center,
                            projection,
                            techniqueIndex,
                            buffers.geometryBuffer,
                            isSolidLineTechnique(technique),
                            feature.properties
                        );
                    } else if (isTextTechnique(technique)) {
                        this.processMultiPolygonLabels(
                            feature.geometry.coordinates,
                            center,
                            projection,
                            techniqueIndex,
                            technique.label!,
                            buffers.textGeometryBuffer,
                            feature.properties
                        );
                    }
                }
                break;

            case "GeometryCollection":
                feature.geometry.geometries.forEach(geometry => {
                    const collectionFeature: Feature = {
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryCreator.ts View on Github external
for (const textPath of textPathGeometries) {
                const technique = decodedTile.techniques[textPath.technique];
                if (technique.enabled === false || !isTextTechnique(technique)) {
                    continue;
                }
                if (textPath.pathLengthSqr > maxPathLengthSqr) {
                    maxPathLengthSqr = textPath.pathLengthSqr;
                }
            }

            for (const textPath of textPathGeometries) {
                const technique = decodedTile.techniques[textPath.technique];

                if (
                    technique.enabled === false ||
                    !isTextTechnique(technique) ||
                    (textFilter !== undefined && !textFilter(technique))
                ) {
                    continue;
                }

                const path: THREE.Vector3[] = [];
                for (let i = 0; i < textPath.path.length; i += 3) {
                    path.push(
                        new THREE.Vector3(
                            textPath.path[i] + worldOffsetX,
                            textPath.path[i + 1],
                            textPath.path[i + 2]
                        )
                    );
                }