PinBuilder

new Cesium.PinBuilder()

用于生成自定义地图图钉作为画布元素的实用工具类。


使用Cesium自带的maki图标集和单字符文本生成的示例图钉。
Demo:

Methods

fromColor(color, size)HTMLCanvasElement

创建指定颜色和大小的空图钉。
Name Type Description
color Color 图钉的颜色。
size number 图钉的大小,以像素为单位。
Returns:
表示生成的图钉的画布元素。

fromMakiIconId(id, color, size)HTMLCanvasElement|Promise.<HTMLCanvasElement>

使用指定的maki图标标识符、颜色和大小创建图钉。
Name Type Description
id string 要印在图钉上的maki图标ID。
color Color 图钉的颜色。
size number 图钉的大小,以像素为单位。
Returns:
表示生成的图钉的画布元素或指向该画布元素的Promise。

fromText(text, color, size)HTMLCanvasElement

创建具有指定文本、颜色和大小的图钉。文本将尽可能放大, 同时仍完全包含在图钉内。
Name Type Description
text string 要印在图钉上的文本。
color Color 图钉的颜色。
size number 图钉的大小,以像素为单位。
Returns:
表示生成的图钉的画布元素。

fromUrl(url, color, size)HTMLCanvasElement|Promise.<HTMLCanvasElement>

创建具有指定图标、颜色和大小的图钉。
Name Type Description
url Resource | string 要印在图钉上的图像的URL。
color Color 图钉的颜色。
size number 图钉的大小,以像素为单位。
Returns:
表示生成的图钉的画布元素或指向该画布元素的Promise。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.