How to use the @here/harp-datasource-protocol.isFillTechnique 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 / TileGeometryCreator.ts View on Github external
| MapMeshStandardMaterial
                                          | MapMeshBasicMaterial;

                                      extrudedMaterial.color.set(
                                          getPropertyValue(technique.color!, mapView.zoomLevel)
                                      );
                                  }
                                : undefined
                        );
                    }
                }

                this.addFeatureData(srcGeometry, technique, object);
                this.addGeometryObjInfos(tile, srcGeometry, technique, object);

                if (isExtrudedPolygonTechnique(technique) || isFillTechnique(technique)) {
                    // filled polygons are normal meshes, and need transparency only when fading or
                    // dynamic properties is defined.
                    const hasDynamicColor =
                        (technique.color !== undefined && Expr.isExpr(technique.color)) ||
                        (isExtrudedPolygonTechnique(technique) && Expr.isExpr(technique.emissive));
                    if (technique.fadeFar !== undefined || hasDynamicColor) {
                        const fadingParams = this.getFadingParams(displayZoomLevel, technique);
                        FadingFeature.addRenderHelper(
                            object,
                            viewRanges,
                            fadingParams.fadeNear,
                            fadingParams.fadeFar,
                            true,
                            hasDynamicColor
                                ? (renderer, mat) => {
                                      const polygonMaterial = mat as
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
extents: number
    ): void {
        const isExtruded = isExtrudedPolygonTechnique(technique);

        const geometryType = isExtruded ? GeometryType.ExtrudedPolygon : GeometryType.Polygon;
        const meshBuffers = this.findOrCreateMeshBuffers(techniqueIndex, geometryType);

        if (meshBuffers === undefined) {
            return;
        }

        const extrudedPolygonTechnique = technique as ExtrudedPolygonTechnique;
        const fillTechnique = technique as FillTechnique;
        const boundaryWalls = extrudedPolygonTechnique.boundaryWalls !== false;

        const isFilled = isFillTechnique(technique);
        const texCoordType = this.getTextureCoordinateType(technique);

        let height = evaluateTechniqueAttr(context, extrudedPolygonTechnique.height);

        let floorHeight = evaluateTechniqueAttr(
            context,
            extrudedPolygonTechnique.floorHeight
        );

        if (height === undefined) {
            // Get the height values for the footprint and extrusion.
            const featureHeight = context.env.lookup("height") as number;
            const styleSetDefaultHeight = evaluateTechniqueAttr(
                context,
                extrudedPolygonTechnique.defaultHeight
            );
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryCreator.ts View on Github external
technique.animateExtrusionDuration !== undefined &&
                        animatedExtrusionHandler.forceEnabled === false
                            ? technique.animateExtrusionDuration
                            : animatedExtrusionHandler.duration;

                    tile.animatedExtrusionTileHandler = new AnimatedExtrusionTileHandler(
                        tile,
                        extrudedObjects,
                        extrusionAnimationDuration
                    );
                    mapView.animatedExtrusionHandler.add(tile.animatedExtrusionTileHandler);
                }

                // Add the fill area edges as a separate geometry.

                if (isFillTechnique(technique) && srcGeometry.edgeIndex !== undefined) {
                    const outlineGeometry = new THREE.BufferGeometry();
                    outlineGeometry.setAttribute(
                        "position",
                        bufferGeometry.getAttribute("position")
                    );
                    outlineGeometry.setIndex(getBufferAttribute(srcGeometry.edgeIndex!));

                    const fillTechnique = technique as FillTechnique;

                    const fadingParams = this.getPolygonFadingParams(
                        displayZoomLevel,
                        fillTechnique
                    );

                    // Configure the edge material based on the theme values.
                    const materialParams: EdgeMaterialParameters = {
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryCreator.ts View on Github external
const hasSolidLinesOutlines: boolean =
                    isSolidLineTechnique(technique) && technique.secondaryWidth !== undefined;

                const object = new ObjectCtor(bufferGeometry, material);
                object.renderOrder = technique.renderOrder!;

                if (group.renderOrderOffset !== undefined) {
                    object.renderOrder += group.renderOrderOffset;
                }

                if (srcGeometry.uuid !== undefined) {
                    object.userData.geometryId = srcGeometry.uuid;
                }

                if (
                    isFillTechnique(technique) &&
                    mapView.projection.type === ProjectionType.Planar
                ) {
                    object.onBeforeRender = chainCallbacks(
                        object.onBeforeRender,
                        (_renderer, _scene, _camera, _geometry, _material) => {
                            if (_material.clippingPlanes === null) {
                                _material.clippingPlanes = this.clippingPlanes;
                                // TODO: Add clipping for Spherical projection.
                            }
                            const worldOffsetX =
                                mapView.projection.worldExtent(0, 0).max.x * tile.offset;
                            // This prevents aliasing issues in the pixel shader, there are artifacts
                            // at low zoom levels, so we increase the factor by 10 to 1%.
                            const expandFactor = mapView.zoomLevel <= 2 ? 1.01 : 1.001;
                            const planes = _material.clippingPlanes;
                            const rightConstant =
github heremaps / harp.gl / @here / harp-mapview / lib / geometry / TileGeometryLoader.ts View on Github external
export function setDefaultGeometryKind(technique: Technique): GeometryKind | GeometryKindSet {
        let geometryKind = technique.kind;

        // 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;
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
center,
                            projection,
                            techniqueIndex,
                            technique.label!,
                            buffers.textGeometryBuffer,
                            feature.properties
                        );
                    }
                }
                break;

            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!,
github heremaps / harp.gl / @here / harp-omv-datasource / lib / OmvDecodedTileEmitter.ts View on Github external
return;
            }

            const techniqueIndex = technique._index;

            if (techniqueIndex === undefined) {
                throw new Error(
                    "OmvDecodedTileEmitter#processPolygonFeature: " +
                        "Internal error - No technique index"
                );
            }

            const polygons: Ring[][] = [];

            const isExtruded = isExtrudedPolygonTechnique(technique);
            const isFilled = isFillTechnique(technique);

            const isPolygon = isExtruded || isFilled || isStandardTechnique(technique);
            const computeTexCoords = this.getComputeTexCoordsFunc(technique);
            const vertexStride = computeTexCoords !== undefined ? 4 : 2;

            for (const polygon of geometry) {
                const rings: Ring[] = [];

                for (const outline of polygon.rings) {
                    const ringContour: number[] = [];

                    for (const coord of outline) {
                        ringContour.push(coord.x, coord.y);
                        if (computeTexCoords !== undefined) {
                            const { u, v } = computeTexCoords(coord, extents);
                            ringContour.push(u, v);
github heremaps / harp.gl / @here / harp-geojson-datasource / lib / GeoJsonParser.ts View on Github external
center,
                            projection,
                            techniqueIndex,
                            technique.label!,
                            buffers.textPathGeometryBuffer,
                            feature.properties
                        );
                    }
                }
                break;

            case "Polygon":
                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!,