mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-29 15:49:49 +01:00
feature: implemented polyline casting
This commit is contained in:
@@ -302,7 +302,21 @@ def _cast_polygon(raw_tiled_object: RawTiledObject) -> Polygon:
|
||||
|
||||
|
||||
def _cast_polyline(raw_tiled_object: RawTiledObject) -> Polyline:
|
||||
raise NotImplementedError
|
||||
""" Cast the raw_tiled_object to a Polyline object.
|
||||
|
||||
Args:
|
||||
raw_tiled_object: Raw Tiled Object to be casted to a Polyline
|
||||
|
||||
Returns:
|
||||
Polyline: The Polyline object created from the raw_tiled_object
|
||||
"""
|
||||
polyline = []
|
||||
for point in raw_tiled_object["polyline"]:
|
||||
polyline.append(OrderedPair(point["x"], point["y"]))
|
||||
|
||||
return Polyline(
|
||||
points=polyline, **_get_common_attributes(raw_tiled_object).__dict__
|
||||
)
|
||||
|
||||
|
||||
def _cast_text(raw_tiled_object: RawTiledObject) -> Text:
|
||||
|
||||
Reference in New Issue
Block a user