使用具有标注的牵引线

尝试一下在线预览

字体线条的标注 可以设置在 标签 上或 符号 上。标注只能在标签或符号上设置,但不能同时在两者上设置。

labels-callout

在标签上设置标注有助于将标签与其对应的符号连接起来。通过这种方式,用户可以清楚地识别每个标签属于哪个要素。

要在符号上设置标注,请检查 城市示例的点样式

在这个样本中,我们想展示欧洲瑞士的最高山峰。峰值用黑色圆圈表示,标签用标注线连接到符号上:

                             
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const symbol = {
  type: "label-3d", // autocasts as new LabelSymbol3D()
  symbolLayers: [
    {
      type: "text", // autocasts as new TextSymbol3DLayer()
      material: {
        color: "black"
      },
      halo: {
        color: [255, 255, 255, 0.7],
        size: 2
      },
      size: 10
    }
  ],
  verticalOffset: {
    screenLength: 150,
    maxWorldLength: 2000,
    minWorldLength: 30
  },
  callout: {
    type: "line", // autocasts as new LineCallout3D()
    size: 0.5,
    color: [0, 0, 0],
    border: {
      color: [255, 255, 255]
    }
  }
};

这个示例还使用了 screenSizePerspective 来提供更好的深度感知。请参阅 标签指南页面 了解更多信息和已知的限制。

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.