English中文

PinBuilder

new Cesium.PinBuilder()

用于生成自定义地图图钉作为画布元素的实用程序类。 A utility class for generating custom map pins as canvas elements.


使用 Cesium 附带的 maki 图标集和单字符文本生成的示例图钉。 Example pins generated using both the maki icon set, which ships with Cesium, and single character text.
演示: Demo:

方法 Methods

fromColor(color, size)HTMLCanvasElement

创建指定颜色和大小的空图钉。 Creates an empty pin of the specified color and size.
名称 Name 类型 Type 说明 Description
color Color 图钉的颜色。 The color of the pin.
size number 引脚的大小(以像素为单位)。 The size of the pin, in pixels.
返回: Returns:
表示生成的引脚的画布元素。 The canvas element that represents the generated pin.

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

创建具有指定的引脚 Creates a pin with the specified maki 图标标识符、颜色和大小。 icon identifier, color, and size.
名称 Name 类型 Type 说明 Description
id string 要印在图钉上的 Maki 图标的 ID。 The id of the maki icon to be stamped onto the pin.
color Color 图钉的颜色。 The color of the pin.
size number 引脚的大小(以像素为单位)。 The size of the pin, in pixels.
返回: Returns:
canvas 元素或代表生成 pin 的 canvas 元素的 Promise。 The canvas element or a Promise to the canvas element that represents the generated pin.

fromText(text, color, size)HTMLCanvasElement

创建具有指定文本、颜色和大小的图钉。文本的大小将尽可能大,同时仍完全包含在图钉内。 Creates a pin with the specified text, color, and size. The text will be sized to be as large as possible while still being contained completely within the pin.
名称 Name 类型 Type 说明 Description
text string 要印在图钉上的文本。 The text to be stamped onto the pin.
color Color 图钉的颜色。 The color of the pin.
size number 引脚的大小(以像素为单位)。 The size of the pin, in pixels.
返回: Returns:
表示生成的引脚的画布元素。 The canvas element that represents the generated pin.

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

创建具有指定图标、颜色和大小的图钉。 Creates a pin with the specified icon, color, and size.
名称 Name 类型 Type 说明 Description
url Resource | string 要标记到 pin 上的图像的 URL。 The url of the image to be stamped onto the pin.
color Color 图钉的颜色。 The color of the pin.
size number 引脚的大小(以像素为单位)。 The size of the pin, in pixels.
返回: Returns:
canvas 元素或代表生成 pin 的 canvas 元素的 Promise。 The canvas element or a Promise to the canvas element that represents the generated pin.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.