@JsType(isNative=true, namespace="Cesium", name="Billboard") public class Billboard extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Billboard.CreateImagePromiseCallback<T>
A function that creates an image.
|
Modifier and Type | Field and Description |
---|---|
Cartesian3 |
alignedAxis
Gets or sets the aligned axis in world space.
|
Color |
color
Gets or sets the color that is multiplied with the billboard's texture.
|
double |
disableDepthTestDistance
Gets or sets the distance from the camera at which to disable the depth test to, for example,
prevent clipping against terrain.
|
DistanceDisplayCondition |
distanceDisplayCondition
Gets or sets the condition specifying at what distance from the camera that this billboard will be displayed.
|
Cartesian3 |
eyeOffset
Gets or sets the 3D Cartesian offset applied to this billboard in eye coordinates.
|
double |
height
Gets or sets a height for the billboard.
|
Number |
heightReference
Gets or sets the height reference of this billboard.
|
Number |
horizontalOrigin
Gets or sets the horizontal origin of this billboard, which determines if the billboard is to the left, center, or right of its position.
|
Object |
id
Gets or sets the user-defined object returned when the billboard is picked.
|
String |
image
Gets or sets the image to be used for this billboard.
|
com.google.gwt.dom.client.CanvasElement |
imageCanvas |
Cartesian2 |
pixelOffset
Gets or sets the pixel offset in screen space from the origin of this billboard.
|
NearFarScalar |
pixelOffsetScaleByDistance
Gets or sets near and far pixel offset scaling properties of a Billboard based on the billboard's distance from the camera.
|
Cartesian3 |
position
Gets or sets the Cartesian position of this billboard.
|
double |
rotation
Gets or sets the rotation angle in radians.
|
double |
scale
Gets or sets the uniform scale that is multiplied with the billboard's image size in pixels.
|
NearFarScalar |
scaleByDistance
Gets or sets near and far scaling properties of a Billboard based on the billboard's distance from the camera.
|
boolean |
show
Determines if this billboard will be shown.
|
boolean |
sizeInMeters
Gets or sets if the billboard size is in meters or pixels. true to size the billboard in meters; otherwise, the size is in pixels.
|
NearFarScalar |
translucencyByDistance
Gets or sets near and far translucency properties of a Billboard based on the billboard's distance from the camera.
|
Number |
verticalOrigin
Gets or sets the vertical origin of this billboard, which determines if the billboard is to the above, below,
or at the center of its position.
|
int |
width
Gets or sets a width for the billboard.
|
Constructor and Description |
---|
Billboard()
A viewport-aligned image positioned in the 3D scene, that is created and rendered using a
BillboardCollection . |
Modifier and Type | Method and Description |
---|---|
Cartesian2 |
computeScreenSpacePosition(Scene scene)
Computes the screen-space position of the billboard's origin, taking into account eye and pixel offsets.
|
Cartesian2 |
computeScreenSpacePosition(Scene scene,
Cartesian2 result)
Computes the screen-space position of the billboard's origin, taking into account eye and pixel offsets.
|
boolean |
equals(Billboard other)
Determines if this billboard equals another billboard.
|
boolean |
ready()
When true, this billboard is ready to render, i.e., the image has been downloaded and the WebGL resources are created.
|
void |
setImage(String id,
Billboard.CreateImagePromiseCallback image)
Sets the image to be used for this billboard.
|
void |
setImage(String id,
com.google.gwt.dom.client.CanvasElement image)
Sets the image to be used for this billboard.
|
void |
setImage(String id,
JsImage image)
Sets the image to be used for this billboard.
|
void |
setImage(String id,
String image)
Sets the image to be used for this billboard.
|
void |
setImageSubRegion(String id,
BoundingRectangle subRegion)
Uses a sub-region of the image with the given id as the image for this billboard, measured in pixels from the bottom-left.
|
@JsProperty public Cartesian3 alignedAxis
@JsProperty public Color color
@JsProperty public double disableDepthTestDistance
@JsProperty public DistanceDisplayCondition distanceDisplayCondition
@JsProperty public Cartesian3 eyeOffset
@JsProperty public double height
@JsProperty public Number heightReference
HeightReference.NONE()
@JsProperty public Number horizontalOrigin
@JsProperty public Object id
@JsProperty public String image
@JsProperty(name="image") public com.google.gwt.dom.client.CanvasElement imageCanvas
@JsProperty public Cartesian2 pixelOffset
@JsProperty public NearFarScalar pixelOffsetScaleByDistance
NearFarScalar.nearValue
and NearFarScalar.farValue
while
the camera distance falls within the upper and lower bounds of the specified NearFarScalar.near
and NearFarScalar.far
.
Outside of these ranges the billboard's pixel offset scale remains clamped to the nearest bound. If undefined,
pixelOffsetScaleByDistance will be disabled.@JsProperty public Cartesian3 position
@JsProperty public double rotation
@JsProperty public double scale
@JsProperty public NearFarScalar scaleByDistance
NearFarScalar.nearValue
and NearFarScalar.farValue
while
the camera distance falls within the upper and lower bounds of the specified NearFarScalar.near
and NearFarScalar.far
.
Outside of these ranges the billboard's scale remains clamped to the nearest bound. If undefined, scaleByDistance will be disabled.@JsProperty public boolean show
@JsProperty public boolean sizeInMeters
@JsProperty public NearFarScalar translucencyByDistance
NearFarScalar.nearValue
and NearFarScalar.farValue
while the camera distance falls within the upper and lower bounds of the specified NearFarScalar.near
and
NearFarScalar.far
. Outside of these ranges the billboard's translucency remains clamped to the nearest bound.
If undefined, translucencyByDistance will be disabled.@JsProperty public Number verticalOrigin
@JsProperty public int width
@JsConstructor public Billboard()
BillboardCollection
.
A billboard is created and its initial properties are set by calling BillboardCollection.add(org.cesiumjs.cs.scene.options.BillboardOptions)
.
Performance:
Reading a property, e.g., Billboard#show, is constant time. Assigning to a property is constant
time but results in CPU to GPU traffic when Collection.update()
is called.
The per-billboard traffic is the same regardless of how many properties were updated.
If most billboards in a collection need to be updated, it may be more efficient to clear the collection
with BillboardCollection#removeAll and add new billboards instead of modifying each one.@JsProperty(name="ready") public boolean ready()
public Cartesian2 computeScreenSpacePosition(Scene scene)
scene
- The scene.eyeOffset
,
pixelOffset
public Cartesian2 computeScreenSpacePosition(Scene scene, Cartesian2 result)
scene
- The scene.result
- The object onto which to store the result.eyeOffset
,
pixelOffset
public boolean equals(Billboard other)
other
- The billboard to compare for equality.public void setImage(String id, JsImage image)
image
property is more convenient.id
- The id of the image. This can be any string that uniquely identifies the image.image
- The image to load. This parameter can either be a loaded Image or Canvas, a URL which will be
loaded as an Image automatically, or a function which will be called to create the image if it hasn't been loaded already.public void setImage(String id, com.google.gwt.dom.client.CanvasElement image)
image
property is more convenient.id
- The id of the image. This can be any string that uniquely identifies the image.image
- The image to load. This parameter can either be a loaded Image or Canvas, a URL which will be
loaded as an Image automatically, or a function which will be called to create the image if it hasn't been loaded already.public void setImage(String id, String image)
image
property is more convenient.id
- The id of the image. This can be any string that uniquely identifies the image.image
- The image to load. This parameter can either be a loaded Image or Canvas, a URL which will be
loaded as an Image automatically, or a function which will be called to create the image if it hasn't been loaded already.public void setImage(String id, Billboard.CreateImagePromiseCallback image)
image
property is more convenient.id
- The id of the image. This can be any string that uniquely identifies the image.image
- The image to load. This parameter can either be a loaded Image or Canvas, a URL which will be
loaded as an Image automatically, or a function which will be called to create the image if it hasn't been loaded already.public void setImageSubRegion(String id, BoundingRectangle subRegion)
id
- The id of the image to use.subRegion
- The sub-region of the image.Copyright © 2019. All rights reserved.