diff --git a/src/czml3/__init__.py b/src/czml3/__init__.py index 6ea2121..d3c1336 100644 --- a/src/czml3/__init__.py +++ b/src/czml3/__init__.py @@ -1,5 +1,5 @@ from .core import CZML_VERSION, Document, Packet -__version__ = "2.3.0" +__version__ = "2.3.1" __all__ = ["Document", "Packet", "CZML_VERSION"] diff --git a/src/czml3/properties.py b/src/czml3/properties.py index 2c5055f..5a7779e 100644 --- a/src/czml3/properties.py +++ b/src/czml3/properties.py @@ -448,10 +448,10 @@ class Billboard(BaseCZMLObject): See `here `__ 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 `__ 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 `__ 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) @@ -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 `__ 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 `__ for it's definition.""" horizontalOrigin: None | HorizontalOrigins | TimeIntervalCollection = Field( default=None ) - """ See `here `__ for it's definition.""" + """See `here `__ for it's definition.""" verticalOrigin: None | VerticalOrigins | TimeIntervalCollection = Field( default=None ) - """ See `here `__ for it's definition.""" + """See `here `__ 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 `__ 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 `__ 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 `__ 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 `__ 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 `__ 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 @@ -1484,11 +1514,11 @@ class Label(BaseCZMLObject): horizontalOrigin: None | HorizontalOrigins | TimeIntervalCollection = Field( default=None ) - """ See `here `__ for it's definition.""" + """See `here `__ for it's definition.""" verticalOrigin: None | VerticalOrigins | TimeIntervalCollection = Field( default=None ) - """ See `here `__ for it's definition.""" + """See `here `__ for it's definition.""" class Orientation(BaseCZMLObject, Interpolatable, Deletable): diff --git a/tests/test_properties.py b/tests/test_properties.py index 8e2f222..2c65d23 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -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