Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/czml3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .core import CZML_VERSION, Document, Packet

__version__ = "2.3.0"
__version__ = "2.3.1"

__all__ = ["Document", "Packet", "CZML_VERSION"]
46 changes: 38 additions & 8 deletions src/czml3/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ class Billboard(BaseCZMLObject):

See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Billboard>`__ for it's definition."""

image: str | Uri | TimeIntervalCollection = Field()
"""The URI of the image displayed on the billboard. For broadest client compatibility, the URI should be accessible via Cross-Origin Resource Sharing (CORS). The URI may also be a data URI. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Uri>`__ for it's definition."""
show: None | bool | TimeIntervalCollection = Field(default=None)
"""Whether or not the billboard is shown."""
image: str | Uri | TimeIntervalCollection = Field()
"""The URI of the image displayed on the billboard. For broadest client compatibility, the URI should be accessible via Cross-Origin Resource Sharing (CORS). The URI may also be a data URI. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Uri>`__ for it's definition."""
scale: None | float | TimeIntervalCollection = Field(default=None)
"""The scale of the billboard. The scale is multiplied with the pixel size of the billboard's image. For example, if the scale is 2.0, the billboard will be rendered with twice the number of pixels, in each direction, of the image."""
pixelOffset: None | list[float] | TimeIntervalCollection = Field(default=None)
Expand All @@ -460,16 +460,46 @@ class Billboard(BaseCZMLObject):
default=None
)
"""The eye offset of the billboard, which is the offset in eye coordinates at which to place the billboard relative to the position property. Eye coordinates are a left-handed coordinate system where the X-axis points toward the viewer's right, the Y-axis points up, and the Z-axis points into the screen. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/EyeOffset>`__ for it's definition."""
color: None | Color | str | TimeIntervalCollection = Field(default=None)
"""The color of the billboard. This color value is multiplied with the values of the billboard's image to produce the final color. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Color>`__ for it's definition."""
horizontalOrigin: None | HorizontalOrigins | TimeIntervalCollection = Field(
default=None
)
""" See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HorizontalOrigin>`__ for it's definition."""
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HorizontalOrigin>`__ for it's definition."""
verticalOrigin: None | VerticalOrigins | TimeIntervalCollection = Field(
default=None
)
""" See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/VerticalOrigin>`__ for it's definition."""
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/VerticalOrigin>`__ for it's definition."""
heightReference: None | HeightReference | TimeIntervalCollection = Field(
default=None
)
"""The height reference of the billboard, which indicates if height is relative to terrain or not. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HeightReference>`__ for it's definition."""
color: None | Color | str | TimeIntervalCollection = Field(default=None)
"""The color of the billboard. This color value is multiplied with the values of the billboard's image to produce the final color. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Color>`__ for it's definition."""
rotation: None | float | TimeIntervalCollection = Field(default=None)
"""The rotation of the billboard, in radians, counter-clockwise from the alignedAxis."""
sizeInMeters: None | bool | TimeIntervalCollection = Field(default=None)
"""Whether this billboard's size (width and height) should be measured in meters, otherwise size is measured in pixels."""
width: None | float | TimeIntervalCollection = Field(default=None)
"""The width of the billboard, in pixels (or meters, if `sizeInMeters` is true). By default, the native width of the image is used."""
height: None | float | TimeIntervalCollection = Field(default=None)
"""The height of the billboard, in pixels (or meters, if `sizeInMeters` is true). By default, the native height of the image is used."""
scaleByDistance: None | NearFarScalar | TimeIntervalCollection = Field(default=None)
"""How the point's scale should change based on the point's distance from the camera. This scalar value will be multiplied by `pixelSize`. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/NearFarScalar>`__ for it's definition."""
translucencyByDistance: None | NearFarScalar | TimeIntervalCollection = Field(
default=None
)
"""How the billboard's translucency should change based on the billboard's distance from the camera. This scalar value should range from 0 to 1. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/NearFarScalar>`__ for it's definition."""
pixelOffsetScaleByDistance: None | NearFarScalar | TimeIntervalCollection = Field(
default=None
)
"""How the billboard's pixel offset should change based on the billboard's distance from the camera. This scalar value will be multiplied by `pixelOffset`. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/NearFarScalar>`__ for it's definition."""
distanceDisplayCondition: (
None | DistanceDisplayCondition | TimeIntervalCollection
) = Field(default=None)
"""How the billboard's scale should change based on the billboard's distance from the camera. This scalar value will be multiplied by scale."""
disableDepthTestDistance: None | float | TimeIntervalCollection = Field(
default=None
)
"""The distance from the camera at which to disable the depth test. This can be used to prevent clipping against terrain, for example. When set to zero, the depth test is always applied. When set to Infinity, the depth test is never applied."""

@field_validator("eyeOffset")
@classmethod
Expand Down Expand Up @@ -1484,11 +1514,11 @@ class Label(BaseCZMLObject):
horizontalOrigin: None | HorizontalOrigins | TimeIntervalCollection = Field(
default=None
)
""" See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HorizontalOrigin>`__ for it's definition."""
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HorizontalOrigin>`__ for it's definition."""
verticalOrigin: None | VerticalOrigins | TimeIntervalCollection = Field(
default=None
)
""" See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/VerticalOrigin>`__ for it's definition."""
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/VerticalOrigin>`__ for it's definition."""


class Orientation(BaseCZMLObject, Interpolatable, Deletable):
Expand Down
70 changes: 70 additions & 0 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,76 @@ def test_packet_billboard():
assert str(packet) == expected_result


def test_packet_billboard_further():
expected_result = """{
"image": "file://image.png",
"eyeOffset": {
"cartesian": [
1.0,
2.0,
3.0
]
},
"rotation": 0.1,
"sizeInMeters": true,
"width": 10.0,
"height": 10.0,
"scaleByDistance": {
"nearFarScalar": [
150.0,
2.0,
15000000.0,
0.5
]
},
"translucencyByDistance": {
"nearFarScalar": [
250.0,
2.0,
15000000.0,
0.5
]
},
"pixelOffsetScaleByDistance": {
"nearFarScalar": [
350.0,
2.0,
15000000.0,
0.5
]
},
"distanceDisplayCondition": {
"distanceDisplayCondition": [
14.0,
81.0
]
},
"disableDepthTestDistance": 2.0
}"""
packet = Billboard(
image="file://image.png",
eyeOffset=EyeOffset(cartesian=Cartesian3Value(values=[1, 2, 3])),
rotation=0.1,
sizeInMeters=True,
width=10,
height=10,
scaleByDistance=NearFarScalar(
nearFarScalar=NearFarScalarValue(values=[150, 2.0, 15000000, 0.5])
),
translucencyByDistance=NearFarScalar(
nearFarScalar=NearFarScalarValue(values=[250, 2.0, 15000000, 0.5])
),
pixelOffsetScaleByDistance=NearFarScalar(
nearFarScalar=NearFarScalarValue(values=[350, 2.0, 15000000, 0.5])
),
disableDepthTestDistance=2,
distanceDisplayCondition=DistanceDisplayCondition(
distanceDisplayCondition=DistanceDisplayConditionValue(values=[14, 81])
),
)
assert str(packet) == expected_result


def test_delete():
expected_result = """{
"delete": true
Expand Down
Loading