这里SDK-栅格层不透明

发布于 2025-01-28 14:07:57 字数 1712 浏览 1 评论 0原文

我正在使用此处的SDK的导航版进行Android。我正在添加自定义的栅格层,我的两个层是透明的(Lite Edition正确显示了这些图层),但是MapView显示了这些图层具有白色背景而不是透明的。这很糟糕,因为白色背景隐藏了基础地图。我是否缺少拥有透明层的东西?

这是我的代码:

    private RasterDataSource createRasterDataSource() {
    List<Integer> storageLevels = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
    RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
            mTemplateUrl,
            TilingScheme.QUAD_TREE_MERCATOR,
            storageLevels);
    String path = "cache/raster/toner";
    long maxDiskSizeInBytes = 1024 * 1024 * 32;
    RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes);
    return new RasterDataSource(mMapView.getMapContext(),
            new RasterDataSourceConfiguration(mName, rasterProviderConfig, cacheConfig));
}

private MapLayer createMapLayer() {
    MapLayerPriority priority = new MapLayerPriorityBuilder()
            .renderedAfterLayer("ocm_cartography")
            .build();
    MapLayerVisibilityRange range = new MapLayerVisibilityRange(0, 22 + 1);
    try {
        MapLayer mapLayer = new MapLayerBuilder()
                .forMap(mMapView.getHereMap()) // mandatory parameter
                .withName(mName + "Layer") // mandatory parameter
                .withDataSource(mName, mMapContentType)
                .withPriority(priority)
                .withVisibilityRange(range)
                .build();
        return mapLayer;
    } catch (MapLayerBuilder.InstantiationException e) {
        throw new RuntimeException(e.getMessage());
    }
}

mmapContentType是mapconttype.raster_image

I am using the Navigate Edition of HERE SDK for Android. I am adding custom raster layers and two of my layers are transparent (Lite Edition showed the layers correctly), but the MapView shows these layers with a white background instead of transparent. This is bad as the white background hides the underlying map. Am I missing something to have the transparent layer?

Here's my code:

    private RasterDataSource createRasterDataSource() {
    List<Integer> storageLevels = Arrays.asList(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
    RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
            mTemplateUrl,
            TilingScheme.QUAD_TREE_MERCATOR,
            storageLevels);
    String path = "cache/raster/toner";
    long maxDiskSizeInBytes = 1024 * 1024 * 32;
    RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes);
    return new RasterDataSource(mMapView.getMapContext(),
            new RasterDataSourceConfiguration(mName, rasterProviderConfig, cacheConfig));
}

private MapLayer createMapLayer() {
    MapLayerPriority priority = new MapLayerPriorityBuilder()
            .renderedAfterLayer("ocm_cartography")
            .build();
    MapLayerVisibilityRange range = new MapLayerVisibilityRange(0, 22 + 1);
    try {
        MapLayer mapLayer = new MapLayerBuilder()
                .forMap(mMapView.getHereMap()) // mandatory parameter
                .withName(mName + "Layer") // mandatory parameter
                .withDataSource(mName, mMapContentType)
                .withPriority(priority)
                .withVisibilityRange(range)
                .build();
        return mapLayer;
    } catch (MapLayerBuilder.InstantiationException e) {
        throw new RuntimeException(e.getMessage());
    }
}

The mMapContentType is MapContentType.RASTER_IMAGE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

林空鹿饮溪 2025-02-04 14:07:57

得到这里的支持(谢谢!),对于透明的层,我不得不为rasterdatasourceconfiguration.provider设置Hasalphachannel:

RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
            url,
            TilingScheme.QUAD_TREE_MERCATOR,
            storageLevels);
rasterProviderConfig.hasAlphaChannel = true;

Got support from HERE team (thanks!) and for transparent layers I had to set the hasAlphaChannel for the RasterDataSourceConfiguration.Provider:

RasterDataSourceConfiguration.Provider rasterProviderConfig = new RasterDataSourceConfiguration.Provider(
            url,
            TilingScheme.QUAD_TREE_MERCATOR,
            storageLevels);
rasterProviderConfig.hasAlphaChannel = true;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文