描述位于包含位置的二维图标 Describes a two dimensional icon located at the position of the containing

广告牌示例 Example billboards
Entity.

广告牌示例 Example billboards
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
options |
BillboardGraphics.ConstructorOptions | 可选 optional 描述初始化选项的对象 Object describing initialization options |
演示: Demo:
成员 Members
alignedAxis : Property|undefined
获取或设置 Gets or sets the
Cartesian3 属性指定固定框架中旋转的单位矢量轴。当设置为 Cartesian3.ZERO 时,旋转从屏幕顶部开始。 Property specifying the unit vector axis of rotation in the fixed frame. When set to Cartesian3.ZERO the rotation is from the top of the screen.
-
默认值: Default Value:
Cartesian3.ZERO
color : Property|undefined
获取或设置指定的属性 Gets or sets the Property specifying the
Color 乘以 that is multiplied with the image。这有两个常见的用例。首先,相同的白色纹理可以被许多不同的广告牌使用,每个广告牌具有不同的颜色,以创建彩色广告牌。其次,颜色的 Alpha 分量可用于使广告牌半透明,如下所示。阿尔法 . This has two common use cases. First, the same white texture may be used by many different billboards, each with a different color, to create colored billboards. Second, the color's alpha component can be used to make the billboard translucent as shown below. An alpha of 0.0 使广告牌透明,并且 makes the billboard transparent, and 1.0 使广告牌不透明。 makes the billboard opaque.
default![]() |
alpha : 0.5![]() |
-
默认值: Default Value:
Color.WHITE
readonly definitionChanged : Event
获取每当更改或修改属性或子属性时引发的事件。 Gets the event that is raised whenever a property or sub-property is changed or modified.
disableDepthTestDistance : Property|undefined
获取或设置禁用深度测试的距相机的距离,例如,防止对地形进行裁剪。当设置为零时,始终应用深度测试。当设置为 Number.POSITIVE_INFINITY 时,永远不会应用深度测试。 Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain. When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.
distanceDisplayCondition : Property|undefined
获取或设置 Gets or sets the
DistanceDisplayCondition 属性指定此广告牌将在距相机的距离处显示。 Property specifying at what distance from the camera that this billboard will be displayed.
eyeOffset : Property|undefined
获取或设置 Gets or sets the
Cartesian3 指定广告牌在眼睛坐标中的偏移量的属性。眼坐标是左手坐标系,其中 Property specifying the billboard's offset in eye coordinates. Eye coordinates is a left-handed coordinate system, where x 指向观看者的右侧, points towards the viewer's right, y 点向上,并且 points up, and z 点到屏幕上。 points into the screen.
眼睛偏移通常用于将多个广告牌或对象布置在同一位置,例如,将广告牌布置在其相应的 3D 模型之上。 An eye offset is commonly used to arrange multiple billboards or objects at the same position, e.g., to arrange a billboard above its corresponding 3D model.
下面,广告牌位于地球中心,但眼睛偏移使其始终显示在地球顶部,无论观看者或地球的方向如何。 Below, the billboard is positioned at the center of the Earth but an eye offset makes it always appear on top of the Earth regardless of the viewer's or Earth's orientation.
![]() |
![]() |
b.eyeOffset = new Cartesian3(0.0, 8000000.0, 0.0);
-
默认值: Default Value:
Cartesian3.ZERO
height : Property|undefined
获取或设置指定广告牌高度(以像素为单位)的数字属性。如果未定义,则使用本机高度。 Gets or sets the numeric Property specifying the height of the billboard in pixels. When undefined, the native height is used.
heightReference : Property|undefined
获取或设置指定的属性 Gets or sets the Property specifying the
HeightReference.
-
默认值: Default Value:
HeightReference.NONE
horizontalOrigin : Property|undefined
获取或设置指定的属性 Gets or sets the Property specifying the
HorizontalOrigin.
-
默认值: Default Value:
HorizontalOrigin.CENTER
image : Property|undefined
获取或设置指定用于广告牌的图像、URI 或画布的属性。 Gets or sets the Property specifying the Image, URI, or Canvas to use for the billboard.
imageSubRegion : Property|undefined
获取或设置指定一个的属性 Gets or sets the Property specifying a
BoundingRectangle 定义了一个子区域 that defines a sub-region of the image 用于广告牌,而不是整个图像,从左下角开始以像素为单位测量。 to use for the billboard, rather than the entire image, measured in pixels from the bottom-left.
pixelOffset : Property|undefined
获取或设置 Gets or sets the
广告牌的原点由黄点表示。 The billboard's origin is indicated by the yellow point.
Cartesian2 属性指定屏幕空间中广告牌相对于该广告牌原点的像素偏移量。这通常用于在同一位置对齐多个广告牌和标签,例如图像和文本。屏幕空间原点是画布的左上角; Property specifying the billboard's pixel offset in screen space from the origin of this billboard. This is commonly used to align multiple billboards and labels at the same position, e.g., an image and text. The screen space origin is the top, left corner of the canvas; x 从左到右增加,并且 increases from left to right, and y 从上到下增加。 increases from top to bottom.
default |
b.pixeloffset = new Cartesian2(50, 25); |
-
默认值: Default Value:
Cartesian2.ZERO
pixelOffsetScaleByDistance : Property|undefined
获取或设置 Gets or sets
NearFarScalar 属性根据距相机的距离指定广告牌的像素偏移。广告牌的像素偏移将在 Property specifying the pixel offset of the billboard based on the distance from the camera. A billboard's pixel offset will interpolate between the NearFarScalar#nearValue and
NearFarScalar#farValue 当相机距离落在指定的下限和上限内时 while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far。在这些范围之外,广告牌的像素偏移仍然被限制在最近的范围内。 . Outside of these ranges the billboard's pixel offset remains clamped to the nearest bound.
rotation : Property|undefined
获取或设置数字属性,指定图像从 Gets or sets the numeric Property specifying the rotation of the image counter clockwise from the
alignedAxis.
-
默认值: Default Value:
0
scale : Property|undefined
获取或设置指定要应用于图像的统一比例的数字属性。规模大于 Gets or sets the numeric Property specifying the uniform scale to apply to the image. A scale greater than

上图中从左到右,比例尺分别是 From left to right in the above image, the scales are
1.0 放大广告牌,而比例小于 enlarges the billboard while a scale less than 1.0 缩小它。 shrinks it.

上图中从左到右,比例尺分别是 From left to right in the above image, the scales are
0.5, 1.0, 和 , and 2.0.
-
默认值: Default Value:
1.0
scaleByDistance : Property|undefined
获取或设置 Gets or sets
NearFarScalar 属性根据距相机的距离指定广告牌的比例。广告牌的比例将在 Property specifying the scale of the billboard based on the distance from the camera. A billboard's scale will interpolate between the NearFarScalar#nearValue and
NearFarScalar#farValue 当相机距离落在指定的下限和上限内时 while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far。在这些范围之外,广告牌的比例仍然限制在最近的范围内。 . Outside of these ranges the billboard's scale remains clamped to the nearest bound.
show : Property|undefined
获取或设置指定广告牌可见性的布尔属性。 Gets or sets the boolean Property specifying the visibility of the billboard.
-
默认值: Default Value:
true
sizeInMeters : Property|undefined
获取或设置布尔属性,指定此广告牌的大小是否以米为单位。 Gets or sets the boolean Property specifying if this billboard's size will be measured in meters.
-
默认值: Default Value:
false
splitDirection : Property|undefined
-
默认值: Default Value:
SplitDirection.NONE
translucencyByDistance : Property|undefined
获取或设置 Gets or sets
NearFarScalar 属性根据距相机的距离指定广告牌的半透明度。广告牌的半透明度将在 Property specifying the translucency of the billboard based on the distance from the camera. A billboard's translucency will interpolate between the NearFarScalar#nearValue and
NearFarScalar#farValue 当相机距离落在指定的下限和上限内时 while the camera distance falls within the lower and upper bounds of the specified NearFarScalar#near and NearFarScalar#far。在这些范围之外,广告牌的半透明度仍然被限制在最近的范围内。 . Outside of these ranges the billboard's translucency remains clamped to the nearest bound.
verticalOrigin : Property|undefined
获取或设置指定的属性 Gets or sets the Property specifying the
VerticalOrigin.
-
默认值: Default Value:
VerticalOrigin.CENTER
width : Property|undefined
获取或设置指定广告牌宽度(以像素为单位)的数字属性。如果未定义,则使用本机宽度。 Gets or sets the numeric Property specifying the width of the billboard in pixels. When undefined, the native width is used.
方法 Methods
clone(result) → BillboardGraphics
复制此实例。 Duplicates this instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
result |
BillboardGraphics | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if one was not provided.
将此对象上每个未分配的属性分配给所提供的源对象上相同属性的值。 Assigns each unassigned property on this object to the value of the same property on the provided source object.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
source |
BillboardGraphics | 要合并到此对象中的对象。 The object to be merged into this object. |
类型定义 Type Definitions
BillboardGraphics 构造函数的初始化选项 Initialization options for the BillboardGraphics constructor
属性: Properties:
| 名称 Name | 类型 Type | Attributes | 默认值 Default | 说明 Description |
|---|---|---|---|---|
show |
Property | boolean |
<可选> <optional> |
true | 指定广告牌可见性的布尔属性。 A boolean Property specifying the visibility of the billboard. |
image |
Property | string | HTMLImageElement | HTMLCanvasElement |
<可选> <optional> |
指定用于广告牌的图像、URI 或画布的属性。 A Property specifying the Image, URI, or Canvas to use for the billboard. | |
scale |
Property | number |
<可选> <optional> |
1.0 | 一个数字属性,指定应用于图像大小的比例。 A numeric Property specifying the scale to apply to the image size. |
pixelOffset |
Property | Cartesian2 |
<可选> <optional> |
Cartesian2.ZERO | A Cartesian2 指定像素偏移的属性。 Property specifying the pixel offset. |
eyeOffset |
Property | Cartesian3 |
<可选> <optional> |
Cartesian3.ZERO | A Cartesian3 指定眼睛偏移的属性。 Property specifying the eye offset. |
horizontalOrigin |
Property | HorizontalOrigin |
<可选> <optional> |
HorizontalOrigin.CENTER | 指定的属性 A Property specifying the HorizontalOrigin. |
verticalOrigin |
Property | VerticalOrigin |
<可选> <optional> |
VerticalOrigin.CENTER | 指定的属性 A Property specifying the VerticalOrigin. |
heightReference |
Property | HeightReference |
<可选> <optional> |
HeightReference.NONE | 指定高度相对值的属性。 A Property specifying what the height is relative to. |
color |
Property | Color |
<可选> <optional> |
Color.WHITE | 指定色调的属性 A Property specifying the tint Color 的图像。 of the image. |
rotation |
Property | number |
<可选> <optional> |
0 | 一个数字属性,指定绕alignedAxis 的旋转。 A numeric Property specifying the rotation about the alignedAxis. |
alignedAxis |
Property | Cartesian3 |
<可选> <optional> |
Cartesian3.ZERO | A Cartesian3 指定单位矢量旋转轴的属性。 Property specifying the unit vector axis of rotation. |
sizeInMeters |
Property | boolean |
<可选> <optional> |
一个布尔属性,指定此广告牌的大小是否应以米为单位进行测量。 A boolean Property specifying whether this billboard's size should be measured in meters. | |
width |
Property | number |
<可选> <optional> |
一个数字属性,指定广告牌的宽度(以像素为单位),覆盖原始大小。 A numeric Property specifying the width of the billboard in pixels, overriding the native size. | |
height |
Property | number |
<可选> <optional> |
一个数字属性,指定广告牌的高度(以像素为单位),覆盖原始大小。 A numeric Property specifying the height of the billboard in pixels, overriding the native size. | |
scaleByDistance |
Property | NearFarScalar |
<可选> <optional> |
A NearFarScalar 用于根据距相机的距离缩放点的属性。 Property used to scale the point based on distance from the camera. |
|
translucencyByDistance |
Property | NearFarScalar |
<可选> <optional> |
A NearFarScalar 用于根据距相机的距离设置半透明度的属性。 Property used to set translucency based on distance from the camera. |
|
pixelOffsetScaleByDistance |
Property | NearFarScalar |
<可选> <optional> |
A NearFarScalar 用于根据距相机的距离设置 PixelOffset 的属性。 Property used to set pixelOffset based on distance from the camera. |
|
imageSubRegion |
Property | BoundingRectangle |
<可选> <optional> |
指定一个属性 A Property specifying a BoundingRectangle 它定义了用于广告牌的图像子区域,而不是整个图像,从左下角开始以像素为单位进行测量。 that defines a sub-region of the image to use for the billboard, rather than the entire image, measured in pixels from the bottom-left. |
|
distanceDisplayCondition |
Property | DistanceDisplayCondition |
<可选> <optional> |
一个属性,指定此广告牌将在距相机的距离处显示。 A Property specifying at what distance from the camera that this billboard will be displayed. | |
disableDepthTestDistance |
Property | number |
<可选> <optional> |
指定禁用深度测试的距相机距离的属性。 A Property specifying the distance from the camera at which to disable the depth test to. | |
splitDirection |
Property | SplitDirection |
<可选> <optional> |
指定的属性 A Property specifying the SplitDirection 广告牌的。 of the billboard. |




