react-native-mobilex 开发文档
    Preparing search index...

    Type Alias IBaseLayers

    底图模块。

    提供底图的查询、添加、排序、删除、重命名和显隐控制能力。

    type IBaseLayers = {
        add: (param: AddBaseLayerParam, beforeId?: string) => Promise<string>;
        getBaseLayers: () => IBaseLayer[];
        getRasterCapabilities: (id: string) => IRasterCapabilities | undefined;
        getRasterRenderInfo: (id: string) => IRasterRenderInfo | undefined;
        getRasterStyle: (id: string) => IRasterStyle | undefined;
        move: (id: string, beforeId?: string) => void;
        remove: (id: string) => void;
        rename: (id: string, name: string) => void;
        setRasterStyle: (
            id: string,
            style: IRasterStyle | null,
        ) => Promise<IRasterStyle>;
        setVisible: (id: string, visible: boolean) => void;
        updateRasterStyle: (
            id: string,
            patch: Partial<IRasterStyle>,
        ) => Promise<IRasterStyle>;
    }
    Index

    Properties

    add: (param: AddBaseLayerParam, beforeId?: string) => Promise<string>

    添加底图。

    当添加 MVT 底图时,会复用地图整体应用流程,因此需要异步等待完成。 影像底图等待读取、统计和原生安装完成;准备或应用失败会 reject 并撤销此次新增。 返回 id 不表示视口内全部瓦片已绘制。

    Type declaration

      • (param: AddBaseLayerParam, beforeId?: string): Promise<string>
      • Parameters

        • param: AddBaseLayerParam

          底图参数

        • OptionalbeforeId: string

          指定添加到某个底图前面,不指定则添加到最后

        Returns Promise<string>

        底图 id

    getBaseLayers: () => IBaseLayer[]

    获取当前地图的底图列表。

    返回值同时支持影像底图和 MVT 底图。

    getRasterCapabilities: (id: string) => IRasterCapabilities | undefined

    查询图层数据与环境能力;unknown 表示尚未准备,不代表不支持。

    Type declaration

      • (id: string): IRasterCapabilities | undefined
      • Parameters

        • id: string

          影像图层 id。

        Returns IRasterCapabilities | undefined

        renderer/采样支持范围及原因;不存在或非影像返回 undefined。

    getRasterRenderInfo: (id: string) => IRasterRenderInfo | undefined

    查询准备/就绪/失败状态及实际 renderer、波段、物理范围和统计依据。 ready 表示实例准备完成;这些状态不会写入保存的地图。

    Type declaration

      • (id: string): IRasterRenderInfo | undefined
      • Parameters

        • id: string

          影像图层 id。

        Returns IRasterRenderInfo | undefined

        实际结果;不存在或非影像返回 undefined。

    getRasterStyle: (id: string) => IRasterStyle | undefined

    获取最后成功提交的完整配置副本;准备期间仍返回旧值。

    Type declaration

      • (id: string): IRasterStyle | undefined
      • Parameters

        • id: string

          影像图层 id,需已添加到地图。

        Returns IRasterStyle | undefined

        配置副本;不存在或非影像返回 undefined。RN client 需 await。

    move: (id: string, beforeId?: string) => void

    调整底图顺序。

    Type declaration

      • (id: string, beforeId?: string): void
      • Parameters

        • id: string

          要移动的底图 id

        • OptionalbeforeId: string

          移动到此底图前面;不指定时移动到当前底图列表最后

        Returns void

    remove: (id: string) => void

    删除底图。

    Type declaration

      • (id: string): void
      • Parameters

        • id: string

          底图 id

        Returns void

    rename: (id: string, name: string) => void

    重命名底图。

    Type declaration

      • (id: string, name: string): void
      • Parameters

        • id: string

          底图 id

        • name: string

          新名称

        Returns void

    setRasterStyle: (
        id: string,
        style: IRasterStyle | null,
    ) => Promise<IRasterStyle>

    完整替换配置,省略字段恢复默认;null 重置全部参数。失败保留最后成功配置。

    Type declaration

      • (id: string, style: IRasterStyle | null): Promise<IRasterStyle>
      • Parameters

        • id: string

          影像图层 id。

        • style: IRasterStyle | null

          新配置,或 null。

        Returns Promise<IRasterStyle>

        已提交的完整配置。成功表示实例已准备,不表示视口全部瓦片完成。

    code/message:LAYER_NOT_FOUND、INVALID_LAYER_TYPE、INVALID_ARGUMENT、 UNSUPPORTED_RASTER_STYLE、TIFF_READ_FAILED、TIFF_STATISTICS_FAILED、RASTER_STYLE_APPLY_FAILED。

    await client.baseLayers.setRasterStyle(id, { renderer: { type: 'grayscale', band: 1,
    stretch: { type: 'manual', range: [0, 6000] } } })
    setVisible: (id: string, visible: boolean) => void

    设置底图显隐。

    Type declaration

      • (id: string, visible: boolean): void
      • Parameters

        • id: string

          底图 id

        • visible: boolean

          是否可见

        Returns void

    updateRasterStyle: (
        id: string,
        patch: Partial<IRasterStyle>,
    ) => Promise<IRasterStyle>

    顶层原子更新;缺省字段保留,renderer/noData 整体替换,不深度合并。 请求轮到提交时再与已提交配置合并,避免并发 patch 覆盖;失败保留旧配置。

    Type declaration

      • (id: string, patch: Partial<IRasterStyle>): Promise<IRasterStyle>
      • Parameters

        • id: string

          影像图层 id。

        • patch: Partial<IRasterStyle>

          要更新的顶层字段,例如 { opacity: 0.5 }。

        Returns Promise<IRasterStyle>

        已提交完整配置;错误码与 setRasterStyle 相同。