diff --git a/src/czml3/core.py b/src/czml3/core.py index 5bbe16f..6ebf5b6 100644 --- a/src/czml3/core.py +++ b/src/czml3/core.py @@ -36,7 +36,13 @@ class Packet(BaseCZMLObject): properties = attr.ib(default=None) position = attr.ib(default=None) orientation = attr.ib(default=None) + viewFrom = attr.ib(default=None) billboard = attr.ib(default=None) + box = attr.ib(default=None) + corridor = attr.ib(default=None) + cylinder = attr.ib(default=None) + ellipse = attr.ib(default=None) + ellipsoid = attr.ib(default=None) label = attr.ib(default=None) model = attr.ib(default=None) path = attr.ib(default=None) @@ -44,6 +50,8 @@ class Packet(BaseCZMLObject): polygon = attr.ib(default=None) polyline = attr.ib(default=None) rectangle = attr.ib(default=None) + tileset = attr.ib(default=None) + wall = attr.ib(default=None) @attr.s(repr=False, frozen=True) diff --git a/src/czml3/properties.py b/src/czml3/properties.py index 4ccb73c..4da564f 100644 --- a/src/czml3/properties.py +++ b/src/czml3/properties.py @@ -138,6 +138,8 @@ class Position(BaseCZMLObject, Interpolatable, Deletable): cartesian = attr.ib(default=None) cartographicRadians = attr.ib(default=None) cartographicDegrees = attr.ib(default=None) + cartesianVelocity = attr.ib(default=None) + reference = attr.ib(default=None) def __attrs_post_init__(self,): if all( @@ -146,6 +148,8 @@ def __attrs_post_init__(self,): self.cartesian, self.cartographicDegrees, self.cartographicRadians, + self.cartesianVelocity, + self.reference, ) ): raise ValueError( @@ -175,6 +179,77 @@ class EllipsoidRadii(BaseCZMLObject, Interpolatable, Deletable): reference = attr.ib(default=None) +@attr.s(repr=False, frozen=True, kw_only=True) +class Corridor(BaseCZMLObject): + """A corridor , which is a shape defined by a centerline and width that conforms to the + curvature of the body shape. It can can optionally be extruded into a volume.""" + + positions = attr.ib() + show = attr.ib(default=None) + width = attr.ib() + height = attr.ib(default=None) + heightReference = attr.ib(default=None) + extrudedHeight = attr.ib(default=None) + extrudedHeightReference = attr.ib(default=None) + cornerType = attr.ib(default=None) + granularity = attr.ib(default=None) + fill = attr.ib(default=None) + material = attr.ib(default=None) + outline = attr.ib(default=None) + outlineColor = attr.ib(default=None) + outlineWidth = attr.ib(default=None) + shadows = attr.ib(default=None) + distanceDisplayCondition = attr.ib(default=None) + classificationType = attr.ib(default=None) + zIndex = attr.ib(default=None) + + +@attr.s(repr=False, frozen=True, kw_only=True) +class Cylinder(BaseCZMLObject): + """A cylinder, which is a special cone defined by length, top and bottom radius.""" + + length = attr.ib() + show = attr.ib(default=None) + topRadius = attr.ib() + bottomRadius = attr.ib() + heightReference = attr.ib(default=None) + fill = attr.ib(default=None) + material = attr.ib(default=None) + outline = attr.ib(default=None) + outlineColor = attr.ib(default=None) + outlineWidth = attr.ib(default=None) + numberOfVerticalLines = attr.ib(default=None) + slices = attr.ib(default=None) + shadows = attr.ib(default=None) + distanceDisplayCondition = attr.ib(default=None) + + +@attr.s(repr=False, frozen=True, kw_only=True) +class Ellipse(BaseCZMLObject): + """An ellipse, which is a close curve, on or above Earth's surface.""" + + semiMajorAxis = attr.ib() + semiMinorAxis = attr.ib() + show = attr.ib(default=None) + height = attr.ib(default=None) + heightReference = attr.ib(default=None) + extrudedHeight = attr.ib(default=None) + extrudedHeightReference = attr.ib(default=None) + rotation = attr.ib(default=None) + stRotation = attr.ib(default=None) + granularity = attr.ib(default=None) + fill = attr.ib(default=None) + material = attr.ib(default=None) + outline = attr.ib(default=None) + outlineColor = attr.ib(default=None) + outlineWidth = attr.ib(default=None) + numberOfVerticalLines = attr.ib(default=None) + shadows = attr.ib(default=None) + distanceDisplayCondition = attr.ib(default=None) + classificationType = attr.ib(default=None) + zIndex = attr.ib(default=None) + + @attr.s(repr=False, frozen=True, kw_only=True) class Polygon(BaseCZMLObject): """A polygon, which is a closed figure on the surface of the Earth.""" @@ -396,6 +471,34 @@ class Point(BaseCZMLObject): disableDepthTestDistance = attr.ib(default=None) +@attr.s(repr=False, frozen=True, kw_only=True) +class TileSet(BaseCZMLObject): + """A 3D Tiles tileset.""" + + show = attr.ib(default=None) + uri = attr.ib() + maximumScreenSpaceError = attr.ib(default=None) + + +@attr.s(repr=False, frozen=True, kw_only=True) +class Wall(BaseCZMLObject): + """A two-dimensional wall defined as a line strip and optional maximum and minimum heights. + It conforms to the curvature of the globe and can be placed along the surface or at altitude.""" + + show = attr.ib(default=None) + positions = attr.ib() + minimumHeights = attr.ib(default=None) + maximumHeights = attr.ib(default=None) + granularity = attr.ib(default=None) + fill = attr.ib(default=None) + material = attr.ib(default=None) + outline = attr.ib(default=None) + outlineColor = attr.ib(default=None) + outlineWidth = attr.ib(default=None) + shadows = attr.ib(default=None) + distanceDisplayCondition = attr.ib(default=None) + + @attr.s(repr=False, frozen=True, kw_only=True) class NearFarScalar(BaseCZMLObject, Interpolatable, Deletable): """ A numeric value which will be linearly interpolated between two values based on an object's distance from the diff --git a/tests/test_properties.py b/tests/test_properties.py index 2bc6902..ee80f9e 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -11,6 +11,8 @@ ClassificationType, Color, DistanceDisplayCondition, + Ellipsoid, + EllipsoidRadii, EyeOffset, GridMaterial, ImageMaterial, @@ -364,6 +366,15 @@ def test_position_cartographic_degrees(): assert repr(pos) == expected_result +def test_position_reference(): + expected_result = """{ + "reference": "satellite" +}""" + pos = Position(reference="satellite") + + assert repr(pos) == expected_result + + def test_single_interval_value(): expected_result = """{ "interval": "2019-01-01T00:00:00Z/2019-01-02T00:00:00Z", @@ -436,3 +447,22 @@ def test_bad_uri_raises_error(): Uri(uri="a") assert "uri must be a URL or a data URI" in excinfo.exconly() + + +def test_ellisoid(): + expected_result = """{ + "radii": { + "cartesian": [ + 20.0, + 30.0, + 40.0 + ] + }, + "fill": false, + "outline": true +}""" + + ell = Ellipsoid( + radii=EllipsoidRadii(cartesian=[20.0, 30.0, 40.0]), fill=False, outline=True + ) + assert repr(ell) == expected_result