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
88 changes: 14 additions & 74 deletions src/czml3/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,10 @@ class Material(BaseCZMLObject):
default=None
)
"""A material that fills the surface with a checkerboard pattern. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CheckerboardMaterial>`__ for it's definition."""
polylineOutline: (
None | PolylineMaterial | PolylineOutline | TimeIntervalCollection
) = Field(default=None) # NOTE: Not in documentation
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineOutline>`__ for it's definition."""


class PolylineOutline(BaseCZMLObject):
"""A definition of how a surface is colored or shaded.
class PolylineOutlineMaterial(BaseCZMLObject):
"""A material that fills the surface of a line with an outlined color.

See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineOutlineMaterial>`__ for it's definition.
"""
Expand All @@ -95,20 +91,8 @@ class PolylineOutline(BaseCZMLObject):
"""The width of the outline."""


class PolylineOutlineMaterial(BaseCZMLObject):
"""A definition of the material wrapper for a polyline outline.

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

polylineOutline: None | PolylineOutline | TimeIntervalCollection = Field(
default=None
)
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineOutline>`__ for it's definition."""


class PolylineGlow(BaseCZMLObject):
"""A definition of how a glowing polyline appears.
class PolylineGlowMaterial(BaseCZMLObject):
"""A material that fills the surface of a line with a glowing color.

See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineGlowMaterial>`__ for it's definition.
"""
Expand All @@ -121,38 +105,18 @@ class PolylineGlow(BaseCZMLObject):
"""The strength of the tapering effect. 1.0 and higher means no tapering."""


class PolylineGlowMaterial(BaseCZMLObject):
"""A material that fills the surface of a line with a glowing color.

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

polylineGlow: None | PolylineGlow | TimeIntervalCollection = Field(default=None)
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineGlow>`__ for it's definition."""


class PolylineArrow(BaseCZMLObject):
"""A definition of how a polyline arrow appears.

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

color: None | Color | str | TimeIntervalCollection = Field(default=None)
"""The color of the surface. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Color>`__ for it's definition."""


class PolylineArrowMaterial(BaseCZMLObject):
"""A material that fills the surface of a line with an arrow.

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

polylineArrow: None | PolylineArrow | TimeIntervalCollection = Field(default=None)
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineArrow>`__ for it's definition."""
color: None | Color | str | TimeIntervalCollection = Field(default=None)
"""The color of the surface. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Color>`__ for it's definition."""


class PolylineDash(BaseCZMLObject):
"""A definition of how a polyline should be dashed with two colors.
class PolylineDashMaterial(BaseCZMLObject):
"""A material that provides a how a polyline should be dashed.

See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineDashMaterial>`__ for it's definition.
"""
Expand All @@ -167,16 +131,6 @@ class PolylineDash(BaseCZMLObject):
"""A 16-bit bitfield representing which portions along a single dashLength are the dash (1) and which are the gap (0). The default value, 255 (0000000011111111), indicates 50% gap followed by 50% dash."""


class PolylineDashMaterial(BaseCZMLObject):
"""A material that provides a how a polyline should be dashed.

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

polylineDash: None | PolylineDash | TimeIntervalCollection = Field(default=None)
"""See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/PolylineDash>`__ for it's definition."""


class PolylineMaterial(BaseCZMLObject):
"""A definition of how a surface is colored or shaded.

Expand Down Expand Up @@ -809,31 +763,17 @@ class Polyline(BaseCZMLObject):
"""The width of the polyline."""
granularity: None | float | TimeIntervalCollection = Field(default=None)
"""The sampling distance, in radians."""
material: (
None
| PolylineMaterial
| PolylineDashMaterial
| PolylineArrowMaterial
| PolylineGlowMaterial
| PolylineOutlineMaterial
| str
| TimeIntervalCollection
) = Field(default=None)
material: None | PolylineMaterial | str | TimeIntervalCollection = Field(
default=None
)
"""The material to use to draw the polyline. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Field>`__ for it's definition."""
followSurface: None | bool | TimeIntervalCollection = Field(default=None)
"""Whether or not the positions are connected as great arcs (the default) or as straight lines. This property has been superseded by `arcType`, which should be used instead."""
shadows: None | ShadowMode | TimeIntervalCollection = Field(default=None)
"""Whether or not the polyline casts or receives shadows. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/ShadowMode>`__ for it's definition."""
depthFailMaterial: (
None
| PolylineMaterial
| PolylineDashMaterial
| PolylineArrowMaterial
| PolylineGlowMaterial
| PolylineOutlineMaterial
| str
| TimeIntervalCollection
) = Field(default=None)
depthFailMaterial: None | PolylineMaterial | str | TimeIntervalCollection = Field(
default=None
)
"""The material to use to draw the polyline when it is below the terrain. See `here <https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Field>`__ for it's definition."""
distanceDisplayCondition: (
None | DistanceDisplayCondition | TimeIntervalCollection
Expand Down
20 changes: 8 additions & 12 deletions tests/test_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@
Point,
Polygon,
Polyline,
PolylineArrow,
PolylineArrowMaterial,
PolylineDash,
PolylineDashMaterial,
PolylineGlow,
PolylineGlowMaterial,
PolylineMaterial,
PolylineOutline,
PolylineOutlineMaterial,
Position,
PositionList,
Expand Down Expand Up @@ -406,8 +402,8 @@ def test_packet_polyline_outline():
positions=PositionList(
cartographicDegrees=[-75, 43, 500000, -125, 43, 500000]
),
material=PolylineOutlineMaterial(
polylineOutline=PolylineOutline(
material=PolylineMaterial(
polylineOutline=PolylineOutlineMaterial(
color=Color(rgba=[255, 0, 0, 255]),
outlineColor=Color(rgba=[255, 0, 0, 255]),
outlineWidth=2,
Expand Down Expand Up @@ -456,8 +452,8 @@ def test_packet_polyline_glow():
positions=PositionList(
cartographicDegrees=[-75, 43, 500000, -125, 43, 500000]
),
material=PolylineGlowMaterial(
polylineGlow=PolylineGlow(
material=PolylineMaterial(
polylineGlow=PolylineGlowMaterial(
color=Color(rgba=[255, 0, 0, 255]),
glowPower=0.2,
taperPower=0.5,
Expand Down Expand Up @@ -503,8 +499,8 @@ def test_packet_polyline_arrow():
positions=PositionList(
cartographicDegrees=[-75, 43, 500000, -125, 43, 500000]
),
material=PolylineArrowMaterial(
polylineArrow=PolylineArrow(color=Color(rgba=[255, 0, 0, 255]))
material=PolylineMaterial(
polylineArrow=PolylineArrowMaterial(color=Color(rgba=[255, 0, 0, 255]))
),
),
)
Expand Down Expand Up @@ -546,8 +542,8 @@ def test_packet_polyline_dashed():
positions=PositionList(
cartographicDegrees=[-75, 43, 500000, -125, 43, 500000]
),
material=PolylineDashMaterial(
polylineDash=PolylineDash(color=Color(rgba=[255, 0, 0, 255]))
material=PolylineMaterial(
polylineDash=PolylineDashMaterial(color=Color(rgba=[255, 0, 0, 255]))
),
),
)
Expand Down
20 changes: 8 additions & 12 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@
Point,
Polygon,
Polyline,
PolylineArrow,
PolylineArrowMaterial,
PolylineDash,
PolylineDashMaterial,
PolylineGlow,
PolylineGlowMaterial,
PolylineMaterial,
PolylineOutline,
PolylineOutlineMaterial,
Position,
PositionList,
Expand Down Expand Up @@ -266,8 +262,8 @@ def test_arrowmaterial_color():
}
}
}"""
pamat = PolylineArrowMaterial(
polylineArrow=PolylineArrow(color=Color(rgba=[200, 100, 30, 255])),
pamat = PolylineMaterial(
polylineArrow=PolylineArrowMaterial(color=Color(rgba=[200, 100, 30, 255])),
)

assert str(pamat) == expected_result
Expand Down Expand Up @@ -296,8 +292,8 @@ def test_dashmaterial_colors():
"dashPattern": 255
}
}"""
dashmat = PolylineDashMaterial(
polylineDash=PolylineDash(
dashmat = PolylineMaterial(
polylineDash=PolylineDashMaterial(
color=Color(rgba=[200, 100, 30, 255]),
gapColor=Color(rgba=[100, 200, 0, 255]),
dashLength=16,
Expand All @@ -323,8 +319,8 @@ def test_glowmaterial_color():
"taperPower": 0.3
}
}"""
glowmat = PolylineGlowMaterial(
polylineGlow=PolylineGlow(
glowmat = PolylineMaterial(
polylineGlow=PolylineGlowMaterial(
color=Color(rgba=[200, 100, 30, 255]), glowPower=0.7, taperPower=0.3
)
)
Expand Down Expand Up @@ -353,8 +349,8 @@ def test_outline_material_colors():
"outlineWidth": 3.0
}
}"""
omat = PolylineOutlineMaterial(
polylineOutline=PolylineOutline(
omat = PolylineMaterial(
polylineOutline=PolylineOutlineMaterial(
color=Color(rgba=[200, 100, 30, 255]),
outlineColor=Color(rgba=[100, 200, 0, 255]),
outlineWidth=3,
Expand Down