How to use the @here/harp-utils.Math2D.computeSquaredLineLength function in @here/harp-utils

To help you get started, we’ve selected a few @here/harp-utils 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-geojson-datasource / lib / GeoJsonGeometryCreator.ts View on Github external
private static createTextPathGeometries(
        geometryData: GeometryData,
        techniqueIndex: number,
        geometries: GeoJsonTileGeometries
    ): void {
        for (let i = 0; i < geometryData.lines.vertices.length; i++) {
            const pathVertex = geometryData.lines.vertices[i];
            const path: number[] = [];
            path.push(...pathVertex);
            const pathLengthSqr = Math2D.computeSquaredLineLength(path);
            const properties = geometryData.lines.geojsonProperties[i];
            const text = (properties as any)[geometryData.labelProperty!].toString();
            const geometry: TextPathGeometry = {
                technique: techniqueIndex,
                path,
                pathLengthSqr,
                text,
                objInfos: properties
            };
            geometries.textPathGeometries.push(geometry);
        }
    }
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
MAX_CORNER_ANGLE
                    );
                } else {
                    validLines = worldLines;
                }

                if (validLines.length === 0) {
                    continue;
                }

                if (isTextTechnique(technique)) {
                    if (text === undefined) {
                        continue;
                    }
                    for (const path of validLines) {
                        const pathLengthSqr = Math2D.computeSquaredLineLength(path);
                        this.m_textPathGeometries.push({
                            technique: techniqueIndex,
                            path,
                            pathLengthSqr,
                            text: String(text),
                            objInfos: this.m_gatherFeatureAttributes
                                ? env.entries
                                : getFeatureId(env.entries)
                        });
                    }
                } else {
                    const lineMarkerTechnique = technique as LineMarkerTechnique;

                    let imageTexture = evaluateTechniqueAttr(
                        context,
                        lineMarkerTechnique.imageTexture