Skip to main content

格点样式

格点填色样式

格点填色样式IPixelLayerStyleOptions主要是LPixelLayerLCanvasPixelLayer图层的样式配置。

两种色标的配置方式

fillColor和colorScale是色标的两种不同配置方式。

fillColor

通过设置fillColor配置格点颜色,可以是固定颜色值,也可以是分级规则。

const style: IPixelLayerStyleOptions = {
  fillColor: "color-precp#res",
  ...
}
colorScale

colorScale是另一种色标形式,也就是一个颜色条。是bitmap形式的色例配置,优先级高于fillColor。

指定颜色条的最小值和最大值,然后将数据线性的对应到色条的颜色

const maxMin = provider.getGrid().maxMin;           //先获取数据的最大最小值
const colorScale = await getPredefinedBitmapScale(  //调用内置函数,获取内置的色标
  predefinedLegendNames.BkBlAqGrYeOrReViWh200,
  maxMin.min,
  maxMin.max,
  true
);
const style: IPixelLayerStyleOptions = {
  colorScale: colorScale,
  ...
};

框架中也提供了根据颜色分段规则直接创建colorScale的方法

const colorScale = BitmapColorScaleGL.createFromStopRules(resourceService.getResource("color-temp").instance, 256, false, 0, -2, 50);     //根据颜色分段规则创建colorScale
const style: IPixelLayerStyleOptions = {          //绘制样式配置
  colorScale: colorScale,                         //格点颜色使用colorScale的方式
  ...
}
当在手机端进行渲染时,建议使用colorScale的方式。
fillMode

通过配置fillMode可以设置不同的显示方式,有如下几种方式:

  • bitmap 格点填色
  • none 不填色
  • pixel1 双线性插值渲染
  • pixel2 样条插值渲染
  • shaded1 双线性插值色斑
  • shaded2 样条插值色斑
  • 更多可配置参数请查看IPixelLayerStyleOptions

    格点标签样式

    格点标签样式IGridLabelStyleOptions主要是LGridLabelLayer图层的样式配置。可配置参数为绘制间隔,格点文本样式和格点图片样式。

    格点文本样式

    IGridTextStyleOptions

    格点图片样式

    IGridImageStyleOptions