Skip to content

KBE3D / KBCore / Cesium / PinBuilder

类: PinBuilder

A utility class for generating custom map pins as canvas elements. <br /><br /> <div align='center'> <img src='/Images/PinBuilder.png' width='500'/><br /> Example pins generated using both the maki icon set, which ships with Cesium, and single character text. </div>

方法

fromColor()

fromColor(color: Color, size: number): HTMLCanvasElement

Creates an empty pin of the specified color and size.

参数

color

Color

The color of the pin.

size

number

The size of the pin, in pixels.

返回

HTMLCanvasElement

The canvas element that represents the generated pin.


fromUrl()

fromUrl(url: string | Resource, color: Color, size: number): HTMLCanvasElement | Promise<HTMLCanvasElement>

Creates a pin with the specified icon, color, and size.

参数

url

The url of the image to be stamped onto the pin.

string | Resource

color

Color

The color of the pin.

size

number

The size of the pin, in pixels.

返回

HTMLCanvasElement | Promise<HTMLCanvasElement>

The canvas element or a Promise to the canvas element that represents the generated pin.


fromMakiIconId()

fromMakiIconId(id: string, color: Color, size: number): HTMLCanvasElement | Promise<HTMLCanvasElement>

Creates a pin with the specified maki

icon identifier, color, and size.

参数

id

string

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.

返回

HTMLCanvasElement | Promise<HTMLCanvasElement>

The canvas element or a Promise to the canvas element that represents the generated pin.


fromText()

fromText(text: string, color: Color, size: number): 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.

参数

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.

返回

HTMLCanvasElement

The canvas element that represents the generated pin.

构造函数

构造函数

new PinBuilder(): PinBuilder

返回

PinBuilder

KBE3D @3.0.0 Copyright © 2024-present KBE3D