How to use the @here/harp-datasource-protocol.isPoiTechnique 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-mapview / lib / geometry / TileGeometryLoader.ts View on Github external
// Set default kind based on technique.
        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
projection: Projection,
        styleSetEvaluator: StyleSetEvaluator,
        buffers: GeometryDataBuffers
    ): void {
        // Skip features without geometries.
        if (feature.geometry === null) {
            return;
        }

        let techniqueIndices: number[] = [];
        switch (feature.geometry.type) {
            case "Point":
                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,
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) {
                    // Filter the lines, keep only those that are long enough for labelling. Also,
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
}

            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;
                    imageTexture = composeTechniqueTextureName(imageTextureValue, poiTechnique);
                }
            }
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
[feature.geometry.coordinates],
                            center,
                            projection,
                            techniqueIndex,
                            buffers.geometryBuffer,
                            feature.properties
                        );
                    }
                }
                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,
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / PhasedTileGeometryLoader.ts View on Github external
const textFilter = (technique: Technique): boolean => {
                if (
                    !isPoiTechnique(technique) &&
                    !isLineMarkerTechnique(technique) &&
                    !isTextTechnique(technique)
                ) {
                    return false;
                }
                return filter(technique);
            };
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonTile.ts View on Github external
createTextElements(decodedTile: DecodedTile, zoomLevel: number) {
        const tileGeometryCreator = TileGeometryCreator.instance;
        const worldOffsetX = this.computeWorldOffsetX();

        if (decodedTile.poiGeometries !== undefined) {
            for (const geometry of decodedTile.poiGeometries) {
                const techniqueIndex = geometry.technique!;
                const technique = decodedTile.techniques[techniqueIndex];
                if (isPoiTechnique(technique)) {
                    this.addPois(geometry, technique, zoomLevel, worldOffsetX);
                }
            }
        }
        if (decodedTile.textGeometries !== undefined) {
            for (const geometry of decodedTile.textGeometries) {
                const techniqueIndex = geometry.technique!;
                const technique = decodedTile.techniques[techniqueIndex];
                if (isTextTechnique(technique)) {
                    this.addTexts(geometry, technique, worldOffsetX);
                }
            }
        }

        if (decodedTile.textPathGeometries !== undefined) {
            this.preparedTextPaths = tileGeometryCreator.prepareTextPaths(
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);