How to use the @here/harp-datasource-protocol.ExtendedTileInfo.getFeatureText 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 / OmvTileInfoEmitter.ts View on Github external
webMercatorTile2TargetTile(extents, this.m_decodeInfo, pos, tmpV);
                    contour.push(tmpV.x, tmpV.y, tmpV.z);
                }
                rings.push(new Ring(extents, 3, contour));
            }
            polygons.push(rings);
        }

        for (const technique of techniques) {
            if (technique === undefined) {
                continue;
            }

            const infoTileTechniqueIndex = tileInfoWriter.addTechnique(technique);

            const featureText = ExtendedTileInfo.getFeatureText(
                context,
                technique,
                this.m_languages
            );
            tileInfoWriter.addFeature(
                this.m_tileInfo.polygonGroup,
                context.env,
                featureId,
                featureText,
                infoTileTechniqueIndex,
                FeatureGroupType.Polygon
            );
        }

        for (const rings of polygons) {
            // rings are shared between techniques
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
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) {
                    // Filter the lines, keep only those that are long enough for labelling. Also,
                    // split jagged label paths to keep processing and rendering only those that
                    // have no sharp corners, which would not be rendered anyway.

                    const metersPerPixel = tileSizeInMeters / this.m_decodeInfo.tileSizeOnScreen;
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
// 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);
                    }
                }

                // Always store the position, otherwise the following POIs will be
                // misplaced.
                if (shouldCreateTextGeometries) {
                    webMercatorTile2TargetWorld(extents, this.m_decodeInfo, pos, tmpV3);
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
const infoTileTechniqueIndex = tileInfoWriter.addTechnique(technique);

            let currentGeoJsonIndex = 0;
            for (const aLine of lines) {
                // add the geoJsonProperties for this line. undefined values are accepted as some
                // line may not have any data.
                const lineFeatureGroup = extendedTile.info.lineGroup as LineFeatureGroup;
                if (lineFeatureGroup.userData === undefined) {
                    lineFeatureGroup.userData = [geojsonProperties[currentGeoJsonIndex]];
                } else {
                    lineFeatureGroup.userData.push(geojsonProperties[currentGeoJsonIndex]);
                }

                currentGeoJsonIndex++;

                const featureText = ExtendedTileInfo.getFeatureText(env, technique);
                tileInfoWriter.addFeature(
                    extendedTile.info.lineGroup,
                    env,
                    featureId,
                    featureText,
                    infoTileTechniqueIndex,
                    FeatureGroupType.Line
                );

                tileInfoWriter.addFeaturePoints(extendedTile.info.lineGroup, aLine);
            }

            if (this.m_gatherRoadSegments) {
                const segmentId = env.lookup("segmentId") as number;
                if (segmentId !== undefined) {
                    const startOffset = env.lookup("startOffset");
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvTileInfoEmitter.ts View on Github external
for (const polyline of geometry) {
            const line: number[] = [];
            for (const pos of polyline.positions) {
                webMercatorTile2TargetTile(extents, this.m_decodeInfo, pos, tmpV);
                line.push(tmpV.x, tmpV.y);
            }
            lines.push(line);
        }

        for (const technique of techniques) {
            if (technique === undefined) {
                continue;
            }

            const infoTileTechniqueIndex = tileInfoWriter.addTechnique(technique);
            const featureText = ExtendedTileInfo.getFeatureText(
                context,
                technique,
                this.m_languages
            );
            for (const aLine of lines) {
                tileInfoWriter.addFeature(
                    this.m_tileInfo.lineGroup,
                    env,
                    featureId,
                    featureText,
                    infoTileTechniqueIndex,
                    FeatureGroupType.Line
                );

                tileInfoWriter.addFeaturePoints(this.m_tileInfo.lineGroup, aLine);
            }
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvTileInfoEmitter.ts View on Github external
extents: number,
        geometry: THREE.Vector2[],
        context: AttrEvaluationContext,
        techniques: IndexedTechnique[],
        featureId: number | undefined
    ): void {
        const tileInfoWriter = this.m_tileInfoWriter;
        const tmpV = new THREE.Vector3();

        for (const technique of techniques) {
            if (technique === undefined) {
                continue;
            }

            const infoTileTechniqueIndex = tileInfoWriter.addTechnique(technique);
            const featureText = ExtendedTileInfo.getFeatureText(
                context,
                technique,
                this.m_languages
            );
            for (const pos of geometry) {
                webMercatorTile2TargetTile(extents, this.m_decodeInfo, pos, tmpV);
                tileInfoWriter.addFeature(
                    this.m_tileInfo.pointGroup,
                    context.env,
                    featureId,
                    featureText,
                    infoTileTechniqueIndex,
                    FeatureGroupType.Point
                );
                tileInfoWriter.addFeaturePoint(this.m_tileInfo.pointGroup, tmpV.x, tmpV.y);
            }