How to use @here/harp-lines - 6 common examples

To help you get started, we’ve selected a few @here/harp-lines 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
): void {
        const renderOrderOffset = evaluateTechniqueAttr(
            context,
            technique.renderOrderOffset,
            0
        );

        let lineGroup: LineGroup;
        const lineGroupGeometries = linesGeometry.find(aLine => {
            return (
                aLine.technique === techniqueIndex && aLine.renderOrderOffset === renderOrderOffset
            );
        });
        const hasNormalsAndUvs = uvs !== undefined;
        if (lineGroupGeometries === undefined) {
            lineGroup = new LineGroup(hasNormalsAndUvs, undefined, lineType === LineType.Simple);
            const aLine: LinesGeometry = {
                type: lineType === LineType.Complex ? GeometryType.SolidLine : GeometryType.Line,
                technique: techniqueIndex,
                renderOrderOffset:
                    renderOrderOffset !== undefined ? Number(renderOrderOffset) : undefined,
                lines: lineGroup
            };

            const techniqueTransient = evaluateTechniqueAttr(
                context,
                technique.transient,
                false
            );
            if (!techniqueTransient && this.m_gatherFeatureAttributes) {
                // if this technique is transient, do not save the featureIds with the geometry
                aLine.objInfos = [featureAttributes];
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonGeometryCreator.ts View on Github external
private static createPolygonOutlineGeometry(
        geometryData: GeometryData,
        techniqueIndex: number,
        tileWorldExtents: number
    ): Geometry {
        const meshBuffer = new MeshBuffer();
        const { indices, featureStarts, geojsonProperties } = meshBuffer;

        let contour: number[];
        const holesVertices: number[][] = [];

        const solidOutline = new LineGroup();
        const position = new Array();

        for (const polygon of geometryData.polygons) {
            contour = polygon.holes.length
                ? polygon.vertices.slice(0, polygon.holes[0] * 3)
                : polygon.vertices;

            // External ring.
            this.addOutlineVertices(contour, tileWorldExtents, solidOutline, position);

            // Holes, if any.
            if (polygon.holes.length) {
                for (let i = 0; i < polygon.holes.length; i++) {
                    if (i === polygon.holes.length - 1) {
                        holesVertices[i] = polygon.vertices.slice(polygon.holes[i] * 3);
                    } else {
github heremaps / harp.gl / @here / harp-examples / decoder / custom_decoder.ts View on Github external
const techniques = styleSetEvaluator.getMatchingTechniques(env);

        const geoCenter = webMercatorTilingScheme.getGeoBox(tileKey).center;
        const worldCenter = projection.projectPoint(geoCenter, new Vector3());

        // Convert the input coordinates to local world coord coordinates (i.e. projected world
        // coordinates relative to the tile center in world coordinates)
        const worldPoints = this.convertToLocalWorldCoordinates(
            data,
            geoCenter,
            projection,
            worldCenter
        );

        // Create actual line-geometry out of the data.
        const lineGroup = new LineGroup();
        lineGroup.add(worldCenter, worldPoints);

        for (const technique of techniques) {
            geometries.push(this.createLineGeometry(lineGroup, technique._index));
        }
    }
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonGeometryCreator.ts View on Github external
private static createSolidLineGeometry(
        geometryData: GeometryData,
        techniqueIndex: number
    ): Geometry {
        const lineCenter = new THREE.Vector3();
        const lines = new LineGroup();
        const positions = new Array();

        for (const line of geometryData.lines.vertices) {
            lines.add(lineCenter, line);
            positions.push(...line);
        }

        return {
            type: GeometryType.SolidLine,
            index: {
                buffer: new Uint32Array(lines.indices).buffer,
                itemCount: 1,
                type: "uint32",
                name: "index"
            },
            interleavedVertexAttributes: [
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometry.ts View on Github external
get width(): number | undefined {
        assert(this.checkSetUp(), "RoIndexedBufferedGeometryLineAccessor not setup");

        if (this.geometryType === GeometryType.ExtrudedLine) {
            const start = this.start + this.startCapSize;
            const positionArray = this.position.array as Float32Array;
            return reconstructLineWidth(positionArray, start);
        }

        return undefined;
    }
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
localLines.forEach(aLine => {
                    triangulateLine(aLine, lineWidth, positions, indices, addCircle);
                    featureStarts.push(start);
                    objInfos.push(
                        this.m_gatherFeatureAttributes ? env.entries : getFeatureId(env.entries)
                    );
                });

@here/harp-lines

Create three.js geometries for wide lines

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages