PinBuilder

new Cesium.PinBuilder()

一个实用程序类,用于将自定义地图图钉生成为 canvas 元素。


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

Methods

fromColor(color, size)HTMLCanvasElement

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

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

创建具有指定 maki 图标标识符、颜色和大小的图钉。
Name Type Description
id string 要压印到图钉上的 maki 图标的 ID。
color Color 图钉的颜色。
size number 引脚的大小(以像素为单位)。
Returns:
表示生成的图钉的 canvas 元素的 canvas 元素的 Promise。

fromText(text, color, size)HTMLCanvasElement

创建具有指定文本、颜色和大小的图钉。 文本的大小将尽可能大 同时仍完全包含在 pin 中。
Name Type Description
text string 要盖章到图钉上的文本。
color Color 图钉的颜色。
size number 引脚的大小(以像素为单位)。
Returns:
表示生成的图钉的 canvas 元素。

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

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