Methods
-
_getClassBreakStyle(styleOptions){Object}
document/support/support/Utils.js, line 798 -
获取分段对应的mapbox样式对象
Name Type Description styleOptionsObject 构造样式需要的参数
Name Type Description infoObject 可选 单个分段参数对象
visibleBoolean 可选 样式是否可以显示
opacityNumber 可选 样式透明度
convertSymbolOptionsObject 可选 convertSymbol方法需要的参数
isLastBoolean 可选 是否是最后一个分段
expressionString 可选 样式表达式
rendererClassBreakRenderer 可选 渲染器对象
classBreakSpaceArray.<Object> 可选 分段信息外的分段
sourceIdString 可选 sourceId
Returns:
Type Description Object MapboxGL的样式对象 -
addStyleToMapboxglMap(style, mapboxglMap, beforeId){Boolean}
engineExtensions/index.js, line 87 -
将
initializeOptions生成的样式片段批量添加到 MapboxGL 地图对象。该方法会依次调用
addSource和addLayer,适用于在原生 MapboxGL 地图上挂载 WebClient 图层转换结果。Name Type Description styleObject 待添加的样式片段。
mapboxglMapObject MapboxGL 原生地图对象。
beforeIdString 可选 将图层插入到指定图层之前;不传时默认追加到当前样式图层栈顶部。
Returns:
Type Description Boolean 添加完成后返回 true。Example
const { initializeOptions, addStyleToMapboxglMap } = zondy.mapboxgl.util const style = initializeOptions(layer, { mapboxglMap }) addStyleToMapboxglMap(style, mapboxglMap, 'label-layer') -
applyStyleViewLevelRange(style, view)
view/utils/support/rasterLayerUtil.js, line 275 -
将视图层级范围写入动态 raster source 配置。
Name Type Description styleObject source / layer 结果对象。
viewView 当前视图对象。
-
covertSimpleLineSymbol()
document/support/support/Utils.js, line 123 -
****************************** 符号转换 ************************************
-
createClassBreakRendererStyleLayers(){*}
document/support/support/Utils.js, line 850 -
创建ClassBreakRenderer转换
Returns:
Type Description * -
createClusterRendererStyleLayers(){*}
document/support/support/Utils.js, line 459 -
创建聚类Renderer转换
Returns:
Type Description * -
createRandomRendererStyleLayers(){*}
document/support/support/Utils.js, line 941 -
创建RandomRenderer转换
Returns:
Type Description * -
createRankRendererStyleLayers(){*}
document/support/support/Utils.js, line 956 -
创建RankRenderer转换
Returns:
Type Description * -
createSimpleRendererStyleLayers(){*}
document/support/support/Utils.js, line 672 -
创建SimpleRenderer转换
Returns:
Type Description * -
createUniqueValueRendererStyleLayers(){*}
document/support/support/Utils.js, line 695 -
创建UniqueValueRenderer转换
Returns:
Type Description * -
getBeforeId(layer, map){String|undefined}
view/utils/support/rasterLayerUtil.js, line 229 -
获取当前图层在 MapboxGL 图层栈中的后一位图层 ID。
返回值通常可作为
addLayer(..., beforeId)的beforeId使用。Name Type Description layerObject MapboxGL style layer 对象。
mapObject MapboxGL 原生地图对象。
Returns:
Type Description String | undefined 当前图层之后的图层 ID。 -
getCustomRasterSourcesAndStyleLayers(layer, options){Object}
view/utils/support/rasterLayerUtil.js, line 186 -
构建自定义
rasterTileLayer对应的 source 和 layer 结果。当前主要用于百度 / 高德等自定义投影 raster 底图兼容场景。
Name Type Description layerLayer common 模块中的图层对象。
optionsObject 构建附加参数。
Name Type Description layerViewLayerView 可选 图层视图对象。
minZoomNumber 最小层级。
maxZoomNumber 最大层级。
Returns:
Type Description Object source 与 style layer 结果对象。 -
getLevelRangeByView(view){Array.<Number>}
view/utils/support/rasterLayerUtil.js, line 250 -
获取当前视图支持的最小 / 最大层级范围。
Name Type Description viewView 当前视图对象。
Returns:
Type Description Array.<Number> [minLevel, maxLevel]层级范围数组。 -
getRasterLayer(layerID, sourceID, layer, layerView){Object}
view/utils/support/rasterLayerUtil.js, line 160 -
构建 raster style layer 初始化参数。
Name Type Description layerIDString 图层 ID。
sourceIDString 图层关联的数据源 ID。
layerLayer common 模块中的图层对象。
layerViewLayerView 可选 图层视图对象。
Returns:
Type Description Object style layer 构造参数对象。 -
getRasterSource(url, tileSize, renderMode, subDomains, requestParams, clippingArea, decryptOptions, bounds){Object}
view/utils/support/rasterLayerUtil.js, line 69 -
构建 raster source 初始化参数。
当
renderMode === 'image'时返回单张动态出图 source 配置; 否则返回标准 raster tiles source 配置。Name Type Description urlString 完整的出图链接地址。
tileSizeNumber 瓦片大小。
renderModeString 渲染模式。
subDomainsArray.<String> 子域名占位符数组。
requestParamsObject 网络请求参数。
clippingAreaObject 裁剪几何。
decryptOptionsObject 解密信息。
boundsArray.<Number> 可选 source 数据范围。
Returns:
Type Description Object source 构造参数对象。 -
getSymbolsByRenderer(renderer){*}
document/support/support/Utils.js, line 1161 -
获取renderer所有符号
Name Type Description renderer* Returns:
Type Description * -
getUniqueRendererFromRandomRenderer(randomRenderer, featureSet){UniqueValueRenderer}
document/support/support/Utils.js, line 385 -
通过随机准提图和要素集合,构造一个单值专题图,注意随机专题图必须指定字段名,不指定则寻找字段名为oid的字段,没找到,则默认用属性里面的第一个字段名
Name Type Description randomRendererRandomRenderer 随即专题图
featureSetFeatureSet 要素集合
Returns:
Type Description UniqueValueRenderer 单值专题图 -
initializeCRS(layer){CRS}
engineExtensions/index.js, line 115 -
根据 common 层图层对象构建 MapboxGL 自定义坐标系对象。
当前主要用于瓦片类图层、矢量瓦片图层和 WMTS 图层的坐标系初始化场景。
Name Type Description layerLayer common 层定义的图层对象。
Returns:
Type Description CRS 可直接用于 MapboxGL 地图初始化或图层适配的 CRS 对象。 Example
const { initializeCRS } = zondy.mapboxgl.util const crs = initializeCRS(layer) -
initializeOptions(layer, options){Object}
engineExtensions/index.js, line 14 -
将 WebClient 图层对象转换为 MapboxGL 可消费的
sources和layers配置。适用于在直接操作 MapboxGL 原生地图对象时,根据 common 层图层定义快速生成样式片段。
Name Type Description layerLayer common 层定义的图层对象。
optionsObject 可选 转换附加参数。
Name Type Description featureSetFeatureSet 可选 要素数据集对象。仅在使用
IGSFeatureLayer、GeoJSONLayer、WFSLayer等矢量图层时有效。mapboxglMapObject 可选 MapboxGL 原生地图对象。矢量图层和
GraphicsLayer需要传入该对象,以便构建图片资源管理器并保证符号正常加载。Returns:
Type Description Object 供 mapboxgl.Map#addSource与mapboxgl.Map#addLayer使用的样式配置片段。Example
const { initializeOptions } = zondy.mapboxgl.util const style = initializeOptions(layer, { featureSet, mapboxglMap }) -
mapboxCustomCRS(mapboxgl, projectObject){function}
view/utils/support/mapboxCustomUtil.js, line 1 -
创建可注册到 MapboxGL 的自定义 CRS 构造器。
适用于使用自定义坐标系加载瓦片、矢量瓦片或其他依赖 MapboxGL
CRS/Projection扩展点的场景。projectObject可以传入proj4对象,也可以传入@mapgis/webclient-common提供的Projection对象。Name Type Description mapboxglObject MapboxGL 命名空间对象。
projectObjectObject | Projection proj4 对象,或
@mapgis/webclient-common提供的Projection对象。Returns:
Type Description function 可用于 new mapboxgl.Proj.CRS(...)的自定义 CRS 构造器。Example
import mapboxgl from 'mapbox-gl' import proj4 from 'proj4' import { mapboxCustomCRS } from '@mapgis/webclient-mapboxgl-plugin' const CustomCRS = mapboxCustomCRS(mapboxgl, proj4) -
parseExpressionToMapboxglExpress(expression){*}
document/support/support/Utils.js, line 63 -
解析表达式为mapboxgl表达式
Name Type Description expression* Returns:
Type Description * -
parseFieldAndExpression(field, expression){*}
document/support/support/Utils.js, line 113 -
解析字段表达式
Name Type Description field* expression* Returns:
Type Description * -
removeLayer(layerView)
view/utils/support/rasterLayerUtil.js, line 29 -
从底层地图对象中移除当前 raster 图层及其关联 source。
Name Type Description layerViewLayerView 图层视图对象。
-
setFeatureAttributeMap(map, calcArr, calcFlag, currentInfo){*}
document/support/support/Utils.js, line 42 -
运算符计算
Name Type Description map* 取值映射,取值表示的mapboxgl表达式
calcArr* 计算组
calcFlag* 运算符
currentInfo* Returns:
Type Description * -
setOpacity(layerView)
view/utils/support/rasterLayerUtil.js, line 44 -
同步当前图层视图的透明度状态。
对普通 raster layer 直接更新 MapboxGL
raster-opacity, 对自定义rasterTileLayer则转调底层实现的setOpacity。Name Type Description layerViewLayerView 图层视图对象。
-
setVisible(layerView)
view/utils/support/rasterLayerUtil.js, line 4 -
同步当前图层视图的可见状态。
对普通 raster layer 直接更新 MapboxGL
visibility, 对自定义rasterTileLayer则转调底层实现的setVisible。Name Type Description layerViewLayerView 图层视图对象。