multimodalsim-viewer 0.0.3__py3-none-any.whl → 0.1.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- multimodalsim_viewer/common/environments/.env +2 -0
- multimodalsim_viewer/common/utils.py +11 -48
- multimodalsim_viewer/models/__init__.py +0 -0
- multimodalsim_viewer/models/environment.py +70 -0
- multimodalsim_viewer/models/leg.py +194 -0
- multimodalsim_viewer/models/passenger.py +148 -0
- multimodalsim_viewer/models/serializable.py +43 -0
- multimodalsim_viewer/models/simulation_information.py +84 -0
- multimodalsim_viewer/models/state.py +44 -0
- multimodalsim_viewer/models/stop.py +114 -0
- multimodalsim_viewer/models/update.py +616 -0
- multimodalsim_viewer/models/vehicle.py +151 -0
- multimodalsim_viewer/server/{simulation_visualization_data_collector.py → data_collector.py} +185 -198
- multimodalsim_viewer/server/data_manager.py +572 -0
- multimodalsim_viewer/server/http_routes.py +4 -7
- multimodalsim_viewer/server/log_manager.py +2 -2
- multimodalsim_viewer/server/server.py +8 -10
- multimodalsim_viewer/server/simulation.py +4 -5
- multimodalsim_viewer/server/simulation_manager.py +22 -23
- multimodalsim_viewer/ui/static/environment.json +2 -0
- multimodalsim_viewer/ui/static/index.html +2 -2
- multimodalsim_viewer/ui/static/{main-LUPJCMAF.js → main-7DV4COXP.js} +173 -173
- multimodalsim_viewer/ui/static/scripts/load-environment.script.js +1 -1
- multimodalsim_viewer/ui/static/styles-257KETL3.css +1 -0
- {multimodalsim_viewer-0.0.3.dist-info → multimodalsim_viewer-0.1.0.1.dist-info}/METADATA +6 -12
- multimodalsim_viewer-0.1.0.1.dist-info/RECORD +53 -0
- multimodalsim_viewer/server/simulation_visualization_data_model.py +0 -1570
- multimodalsim_viewer/ui/static/styles-KU7LTPET.css +0 -1
- multimodalsim_viewer-0.0.3.dist-info/RECORD +0 -43
- {multimodalsim_viewer-0.0.3.dist-info → multimodalsim_viewer-0.1.0.1.dist-info}/WHEEL +0 -0
- {multimodalsim_viewer-0.0.3.dist-info → multimodalsim_viewer-0.1.0.1.dist-info}/entry_points.txt +0 -0
- {multimodalsim_viewer-0.0.3.dist-info → multimodalsim_viewer-0.1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
from math import inf
|
3
|
+
|
4
|
+
from multimodalsim.simulator.stop import Stop
|
5
|
+
|
6
|
+
from multimodalsim_viewer.models.serializable import Serializable
|
7
|
+
|
8
|
+
|
9
|
+
# MARK: StopType
|
10
|
+
class StopType(Enum):
|
11
|
+
PREVIOUS = "previous"
|
12
|
+
CURRENT = "current"
|
13
|
+
NEXT = "next"
|
14
|
+
|
15
|
+
|
16
|
+
# MARK: Stop
|
17
|
+
class VisualizedStop(Serializable): # pylint: disable=too-many-instance-attributes
|
18
|
+
|
19
|
+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
|
20
|
+
self,
|
21
|
+
arrival_time: float,
|
22
|
+
departure_time: float | None,
|
23
|
+
latitude: float | None,
|
24
|
+
longitude: float | None,
|
25
|
+
capacity: int | None,
|
26
|
+
label: str,
|
27
|
+
tags: list[str],
|
28
|
+
stop_type: StopType,
|
29
|
+
) -> None:
|
30
|
+
self.arrival_time: float = arrival_time
|
31
|
+
self.departure_time: float | None = departure_time
|
32
|
+
self.latitude: float | None = latitude
|
33
|
+
self.longitude: float | None = longitude
|
34
|
+
self.capacity: int | None = capacity
|
35
|
+
self.label: str = label
|
36
|
+
self.tags: list[str] = tags
|
37
|
+
self.stop_type: StopType = stop_type
|
38
|
+
|
39
|
+
@classmethod
|
40
|
+
def from_stop(cls, stop: Stop, stop_type: StopType) -> "VisualizedStop":
|
41
|
+
return cls(
|
42
|
+
stop.arrival_time,
|
43
|
+
stop.departure_time if stop.departure_time != inf else None,
|
44
|
+
stop.location.lat,
|
45
|
+
stop.location.lon,
|
46
|
+
stop.capacity,
|
47
|
+
stop.location.label,
|
48
|
+
stop.tags,
|
49
|
+
stop_type,
|
50
|
+
)
|
51
|
+
|
52
|
+
def serialize(self) -> dict:
|
53
|
+
serialized = {"arrivalTime": self.arrival_time, "stopType": self.stop_type.value}
|
54
|
+
|
55
|
+
if self.departure_time is not None:
|
56
|
+
serialized["departureTime"] = self.departure_time
|
57
|
+
|
58
|
+
if self.latitude is not None and self.longitude is not None:
|
59
|
+
serialized["position"] = {
|
60
|
+
"latitude": self.latitude,
|
61
|
+
"longitude": self.longitude,
|
62
|
+
}
|
63
|
+
|
64
|
+
if self.capacity is not None:
|
65
|
+
serialized["capacity"] = self.capacity
|
66
|
+
|
67
|
+
serialized["label"] = self.label
|
68
|
+
|
69
|
+
if len(self.tags) > 0:
|
70
|
+
serialized["tags"] = self.tags
|
71
|
+
|
72
|
+
return serialized
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def deserialize(cls, serialized_data: dict | str) -> "VisualizedStop":
|
76
|
+
serialized_data = cls.serialized_data_to_dict(serialized_data)
|
77
|
+
|
78
|
+
required_keys = ["arrivalTime", "label", "stopType"]
|
79
|
+
|
80
|
+
cls.verify_required_fields(serialized_data, required_keys, "VisualizedStop")
|
81
|
+
|
82
|
+
arrival_time = float(serialized_data["arrivalTime"])
|
83
|
+
departure_time = serialized_data.get("departureTime", None)
|
84
|
+
if departure_time is not None:
|
85
|
+
departure_time = float(departure_time)
|
86
|
+
|
87
|
+
latitude = None
|
88
|
+
longitude = None
|
89
|
+
|
90
|
+
position = serialized_data.get("position", None)
|
91
|
+
|
92
|
+
if position is not None:
|
93
|
+
latitude = position.get("latitude", None)
|
94
|
+
if latitude is not None:
|
95
|
+
latitude = float(latitude)
|
96
|
+
|
97
|
+
longitude = position.get("longitude", None)
|
98
|
+
if longitude is not None:
|
99
|
+
longitude = float(longitude)
|
100
|
+
|
101
|
+
capacity = serialized_data.get("capacity", None)
|
102
|
+
|
103
|
+
if capacity is not None:
|
104
|
+
capacity = int(capacity)
|
105
|
+
|
106
|
+
label = serialized_data["label"]
|
107
|
+
|
108
|
+
tags = serialized_data.get("tags", [])
|
109
|
+
|
110
|
+
stop_type = serialized_data.get("stopType")
|
111
|
+
|
112
|
+
return VisualizedStop(
|
113
|
+
arrival_time, departure_time, latitude, longitude, capacity, label, tags, StopType(stop_type)
|
114
|
+
)
|